Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
load_balance_api.h File Reference
A API class to support 6lowpan network load balance which based on RPL routing. More...
Go to the source code of this file.
Data Structures | |
struct | load_balance_api |
Struct load_balance_api_s defines functions for two-way communications between load balance and user. More... | |
Typedefs | |
typedef void | load_balance_beacon_notify (const load_balance_api_t *api, const struct mlme_beacon_ind_s *beacon_ind, uint8_t priority) |
Application which want enable load balance must first create load balance class, e.g 'load_balance_api_t* load_balance_create()' In the function external Nanostack needs to fill necessary function pointers so that Upper layer can use it. | |
typedef void | load_balance_second_ticks (const load_balance_api_t *api) |
load_balance_second_ticks update load balance state timer | |
typedef void | load_balance_enable (const load_balance_api_t *api, bool active_state, uint32_t network_triggle_max_period, uint32_t network_route_life_time) |
load_balance_enabled handler for enabled or disable beacon notify | |
typedef uint8_t | load_balance_priority_get (const void *load_balance_user) |
load_balance_priority_get function for load balance to get current advertisement priority | |
typedef void | load_balance_beacon_tx (const void *load_balance_user) |
load_balance_beacon_tx function for trig periodically beacon | |
typedef bool | load_balance_network_switch_notify (const void *load_balance_user, load_balance_nwk_switch_operation operation, uint16_t *timeout) |
load_balance_network_switch_notify this function will be called by load balance when it have detected better network to switch change state | |
typedef bool | load_balance_network_switch_req (void *load_balance_user, struct mlme_pan_descriptor_s *PANDescriptor, const uint8_t *beacon_payload, uint16_t beacon_payload_length) |
load_balance_network_switch_req this function will be called by load balance when it have detected better network to switch | |
typedef int8_t | load_balance_api_get_node_count (void *lb_user, uint16_t *node_count) |
load_balance_api_get_node_count Get border router registered node count | |
typedef int8_t | load_balance_api_set_load_level (void *lb_user, uint8_t load_level) |
load_balance_api_set_load_level Update new load level to network | |
typedef int8_t | load_balance_api_initialize (load_balance_api_t *api, load_balance_beacon_tx *lb_beacon_tx, load_balance_priority_get *priority_get_cb, load_balance_network_switch_req *lb_nwk_switch_cb, uint16_t beacon_max_payload_length, void *lb_user) |
load_balance_api_initialize Initialises load balancer needed callback. | |
Functions | |
load_balance_api_t * | load_balance_create (load_balance_network_switch_notify *lb_notify_cb, bool activate_periodic_beacon) |
Create load balance class. | |
int | load_balance_delete (load_balance_api_t *api) |
Delete load balance class and free memory. | |
int | load_balance_network_threshold_set (load_balance_api_t *api, uint8_t threshold_min, uint8_t threshold_max) |
Set load balance threshold min and max. | |
int | load_balance_network_load_monitor_enable (load_balance_api_t *api, uint16_t expected_node_count, uint8_t network_load_scaler, load_balance_api_get_node_count *get_count_cb, load_balance_api_set_load_level *set_new_load_cb) |
Enable load balance load monitor and update feature. | |
int | load_balance_network_load_monitor_disable (load_balance_api_t *api) |
Disable load balance load monitor and update feature. | |
int | load_balance_set_max_probability (load_balance_api_t *api, uint8_t max_p) |
Set network probability percent when new network is better than threshold max. | |
int | load_balance_network_switch_cb_set (load_balance_api_t *api, net_load_balance_network_switch_notify *network_switch_notify) |
Set user callback for accepting the network switch. |
Detailed Description
A API class to support 6lowpan network load balance which based on RPL routing.
Definition in file load_balance_api.h.
Typedef Documentation
typedef int8_t load_balance_api_get_node_count(void *lb_user, uint16_t *node_count) |
load_balance_api_get_node_count Get border router registered node count
- Parameters:
-
lb_user Load balancing user defined unique data. node_count Pointer where node count is stored
- Returns:
- -1 Get fail, 0 node_count include current node count
Definition at line 127 of file load_balance_api.h.
typedef int8_t load_balance_api_initialize(load_balance_api_t *api, load_balance_beacon_tx *lb_beacon_tx, load_balance_priority_get *priority_get_cb, load_balance_network_switch_req *lb_nwk_switch_cb, uint16_t beacon_max_payload_length, void *lb_user) |
load_balance_api_initialize Initialises load balancer needed callback.
- Parameters:
-
api load_balance_api_t pointer, which is created by application. lb_beacon_tx_period_set_cb Upper layer function to handle MCPS confirmations priority_get_cb Upper layer function to handle MCPS indications lb_nwk_switch_cb beacon_max_payload_length Set 0 if network switch is disabled otherwise give max supported beacon payload. lb_user Load balancing user defined unique data
- Returns:
- -1 if error, -2 if Out of Memory, 0 otherwise
Definition at line 147 of file load_balance_api.h.
typedef int8_t load_balance_api_set_load_level(void *lb_user, uint8_t load_level) |
load_balance_api_set_load_level Update new load level to network
- Parameters:
-
lb_user Load balancing user defined unique data. load_level load level which could be [0,CONFIGURED_SCALER -1]
- Returns:
- -1 Set fail, 0 New Network Load is updated
Definition at line 135 of file load_balance_api.h.
typedef void load_balance_beacon_notify(const load_balance_api_t *api, const struct mlme_beacon_ind_s *beacon_ind, uint8_t priority) |
Application which want enable load balance must first create load balance class, e.g 'load_balance_api_t* load_balance_create()' In the function external Nanostack needs to fill necessary function pointers so that Upper layer can use it.
For load balance user define:
- load_balance_beacon_notify: Beacon notify should call this api
- load_balance_api_initialize: Initialise load balance class with next function pointer
- load_balance_enable Load Balance requested function pointers
- load_balance_priority_get
- load_balance_network_switch_req
- load_balance_beacon_interval_set load_balance_beacon_notify
- Parameters:
-
api load_balance_api_t pointer beacon_ind standard beacon indication structure priority Beacon parsed network priority
Definition at line 63 of file load_balance_api.h.
typedef void load_balance_beacon_tx(const void *load_balance_user) |
load_balance_beacon_tx function for trig periodically beacon
- Parameters:
-
load_balance_user pointer to load balancer user initialised data
Definition at line 95 of file load_balance_api.h.
typedef void load_balance_enable(const load_balance_api_t *api, bool active_state, uint32_t network_triggle_max_period, uint32_t network_route_life_time) |
load_balance_enabled handler for enabled or disable beacon notify
- Parameters:
-
load_balance_api_t pointer active_state true enable load balancer and false disable network_triggle_max_period time that load balance will send periodic beacon network_route_life_time time for device route lifetime
Definition at line 78 of file load_balance_api.h.
typedef bool load_balance_network_switch_notify(const void *load_balance_user, load_balance_nwk_switch_operation operation, uint16_t *timeout) |
load_balance_network_switch_notify this function will be called by load balance when it have detected better network to switch change state
- Parameters:
-
load_balance_user pointer to load balancer user initialised data operation network switch operation timeout pointer where operation time must be define NULL when load balance not need time out or user set 0
- Returns:
- true Network switching can be performed immediately
- false Network switching will be performed later
Definition at line 106 of file load_balance_api.h.
typedef bool load_balance_network_switch_req(void *load_balance_user, struct mlme_pan_descriptor_s *PANDescriptor, const uint8_t *beacon_payload, uint16_t beacon_payload_length) |
load_balance_network_switch_req this function will be called by load balance when it have detected better network to switch
- Parameters:
-
load_balance_user pointer to load balancer user initialised data PANDescriptor pointer to link and coordinator info beacon_payload beacon payload pointer for new network beacon_payload_length payload length
- Returns:
- true network switch started
- false network switch fail
Definition at line 118 of file load_balance_api.h.
typedef uint8_t load_balance_priority_get(const void *load_balance_user) |
load_balance_priority_get function for load balance to get current advertisement priority
- Parameters:
-
load_balance_user pointer to load balancer user initialised data
- Returns:
- priority
Definition at line 88 of file load_balance_api.h.
typedef void load_balance_second_ticks(const load_balance_api_t *api) |
load_balance_second_ticks update load balance state timer
- Parameters:
-
load_balance_api_t pointer
Definition at line 69 of file load_balance_api.h.
Function Documentation
load_balance_api_t* load_balance_create | ( | load_balance_network_switch_notify * | lb_notify_cb, |
bool | activate_periodic_beacon | ||
) |
Create load balance class.
- Parameters:
-
lb_notify_cb user callback for accept network switch activate_periodic_beacon True define that load balance will generate periodic beacon based configured value at enable
- Returns:
- Pointer to load balance class
Definition at line 489 of file load_balance.c.
int load_balance_delete | ( | load_balance_api_t * | api ) |
Delete load balance class and free memory.
- Parameters:
-
api Class pointer to deleted class
- Returns:
- 0 process ok -1 Unknown class
Definition at line 508 of file load_balance.c.
int load_balance_network_load_monitor_disable | ( | load_balance_api_t * | api ) |
Disable load balance load monitor and update feature.
- Parameters:
-
api Class pointer to deleted class
- Returns:
- 0 process ok -1 Unknown class
Definition at line 558 of file load_balance.c.
int load_balance_network_load_monitor_enable | ( | load_balance_api_t * | api, |
uint16_t | expected_node_count, | ||
uint8_t | network_load_scaler, | ||
load_balance_api_get_node_count * | get_count_cb, | ||
load_balance_api_set_load_level * | set_new_load_cb | ||
) |
Enable load balance load monitor and update feature.
This feature is for border router's defined function for give network scale and load parameter what load balancer will follow automatically.
- Parameters:
-
api Class pointer to deleted class expected_node_count node which define max load to network network_load_scaler Define max load value get_count_cb function pointer for read current node count set_new_load_cb function pointer what is called when load level must be update
- Returns:
- 0 process ok -1 Unknown class or unsupported parameter
Definition at line 531 of file load_balance.c.
int load_balance_network_switch_cb_set | ( | load_balance_api_t * | api, |
net_load_balance_network_switch_notify * | network_switch_notify | ||
) |
Set user callback for accepting the network switch.
- Parameters:
-
api Class pointer to deleted class. network_switch_notify User callback.
- Returns:
- 0 Set OK.
- -1 unknown Interface.
Definition at line 583 of file load_balance.c.
int load_balance_network_threshold_set | ( | load_balance_api_t * | api, |
uint8_t | threshold_min, | ||
uint8_t | threshold_max | ||
) |
Set load balance threshold min and max.
Nework switch will work next diff_priority >= randLIB_get_random_in_range(threshold_min, threshold_max) --> switch network if true For border router Disable Network compare set threshold_min and threshold_max to 0.
- Parameters:
-
api Class pointer to deleted class threshold_min minimal threshold value for network switch threshold_max max threshold value for network switch
- Returns:
- 0 process ok -1 Unknown class or unsupported threshold
Definition at line 519 of file load_balance.c.
int load_balance_set_max_probability | ( | load_balance_api_t * | api, |
uint8_t | max_p | ||
) |
Set network probability percent when new network is better than threshold max.
- Parameters:
-
api Class pointer to deleted class max_p is percent probability to switch network. Default is 25%. Accepted values are [1,100] recommend values are 10-25.
- Returns:
- 0 process ok -1 Unknown class or unsupported parameter
Definition at line 567 of file load_balance.c.
Generated on Tue Jul 12 2022 18:18:57 by
