policy: only send preferred candidate with transition request
[project/usteer.git] / usteer.h
index 0ad9499c9c0a995e090d2c8e9a575ac96e1c036e..1c3c28f5c8b02144c36fc17f1bc279b86728c195 100644 (file)
--- a/usteer.h
+++ b/usteer.h
@@ -73,6 +73,7 @@ struct usteer_remote_host;
 struct usteer_node {
        struct avl_node avl;
        struct list_head sta_info;
+       struct list_head measurements;
 
        enum usteer_node_type type;
 
@@ -148,6 +149,7 @@ struct usteer_config {
        uint32_t debug_level;
 
        bool ipv6;
+       bool local_mode;
 
        uint32_t sta_block_timeout;
        uint32_t local_sta_timeout;
@@ -155,6 +157,7 @@ struct usteer_config {
 
        uint32_t max_retry_band;
        uint32_t seen_policy_timeout;
+       uint32_t measurement_report_timeout;
 
        bool assoc_steering;
 
@@ -171,6 +174,8 @@ struct usteer_config {
        int32_t min_connect_snr;
        uint32_t signal_diff_threshold;
 
+       uint32_t steer_reject_timeout;
+
        int32_t roam_scan_snr;
        uint32_t roam_process_timeout;
 
@@ -183,6 +188,11 @@ struct usteer_config {
 
        uint32_t roam_kick_delay;
 
+       uint32_t band_steering_interval;
+       int32_t band_steering_min_snr; 
+
+       uint32_t link_measurement_interval;
+
        uint32_t initial_connect_delay;
 
        bool load_kick_enabled;
@@ -216,9 +226,6 @@ enum roam_trigger_state {
        ROAM_TRIGGER_IDLE,
        ROAM_TRIGGER_SCAN,
        ROAM_TRIGGER_SCAN_DONE,
-       ROAM_TRIGGER_WAIT_KICK,
-       ROAM_TRIGGER_NOTIFY_KICK,
-       ROAM_TRIGGER_KICK,
 };
 
 struct sta_info {
@@ -236,6 +243,9 @@ struct sta_info {
        uint64_t last_connected;
        int signal;
 
+       uint8_t rrm;
+       bool bss_transition;
+
        enum roam_trigger_state roam_state;
        uint8_t roam_tries;
        uint64_t roam_event;
@@ -243,6 +253,17 @@ struct sta_info {
        uint64_t roam_scan_start;
        uint64_t roam_scan_timeout_start;
 
+       struct {
+               uint8_t status_code;
+               uint64_t timestamp;
+       } bss_transition_response;
+
+       struct {
+               bool below_snr;
+       } band_steering;
+
+       uint64_t kick_time;
+
        int kick_count;
 
        uint32_t below_min_snr;
@@ -254,13 +275,29 @@ struct sta_info {
 struct sta {
        struct avl_node avl;
        struct list_head nodes;
+       struct list_head measurements;
 
        uint8_t seen_2ghz : 1;
        uint8_t seen_5ghz : 1;
 
        uint8_t addr[6];
+};
 
-       uint8_t rrm;
+struct usteer_measurement_report {
+       struct usteer_timeout timeout;
+
+       struct list_head list;
+
+       struct usteer_node *node;
+       struct list_head node_list;
+
+       struct sta *sta;
+       struct list_head sta_list;
+
+       uint64_t timestamp;
+
+       uint8_t rcpi;
+       uint8_t rsni;
 };
 
 extern struct ubus_context *ubus_ctx;
@@ -282,20 +319,31 @@ int usteer_snr_to_signal(struct usteer_node *node, int snr);
 void usteer_local_nodes_init(struct ubus_context *ctx);
 void usteer_local_node_kick(struct usteer_local_node *ln);
 
+int usteer_local_node_get_beacon_interval(struct usteer_local_node *ln);
+
+bool usteer_policy_node_below_max_assoc(struct usteer_node *node);
+
+void usteer_band_steering_perform_steer(struct usteer_local_node *ln);
+void usteer_band_steering_sta_update(struct sta_info *si);
+bool usteer_band_steering_is_target(struct usteer_local_node *ln, struct usteer_node *node);
+
 void usteer_ubus_init(struct ubus_context *ctx);
 void usteer_ubus_kick_client(struct sta_info *si);
 int usteer_ubus_trigger_client_scan(struct sta_info *si);
 int usteer_ubus_notify_client_disassoc(struct sta_info *si);
+int usteer_ubus_band_steering_request(struct sta_info *si);
 int usteer_ubus_bss_transition_request(struct sta_info *si,
                                       uint8_t dialog_token,
                                       bool disassoc_imminent,
                                       bool abridged,
-                                      uint8_t validity_period);
+                                      uint8_t validity_period,
+                                      struct usteer_node *target_node);
 
 struct sta *usteer_sta_get(const uint8_t *addr, bool create);
 struct sta_info *usteer_sta_info_get(struct sta *sta, struct usteer_node *node, bool *create);
 
-bool usteer_sta_supports_beacon_measurement_mode(struct sta *sta, enum usteer_beacon_measurement_mode mode);
+bool usteer_sta_supports_beacon_measurement_mode(struct sta_info *si, enum usteer_beacon_measurement_mode mode);
+bool usteer_sta_supports_link_measurement(struct sta_info *si);
 
 void usteer_sta_disconnected(struct sta_info *si);
 void usteer_sta_info_update_timeout(struct sta_info *si, int timeout);
@@ -335,4 +383,14 @@ void usteer_run_hook(const char *name, const char *arg);
 void usteer_dump_node(struct blob_buf *buf, struct usteer_node *node);
 void usteer_dump_host(struct blob_buf *buf, struct usteer_remote_host *host);
 
+struct usteer_measurement_report * usteer_measurement_report_get(struct sta *sta, struct usteer_node *node, bool create);
+void usteer_measurement_report_node_cleanup(struct usteer_node *node);
+void usteer_measurement_report_sta_cleanup(struct sta *sta);
+void usteer_measurement_report_del(struct usteer_measurement_report *mr);
+
+struct usteer_measurement_report *
+usteer_measurement_report_add(struct sta *sta, struct usteer_node *node, uint8_t rcpi, uint8_t rsni, uint64_t timestamp);
+
+
+int usteer_ubus_trigger_link_measurement(struct sta_info *si);
 #endif