Rtos API example
net_rpl.h File Reference
ZigBeeIP Router and Border Router RPL API. More...
Go to the source code of this file.
Data Structures | |
struct | rpl_dodag_info_t |
RPL Instance DODAG info structure for rpl_read_dodag_info. Read RFC 6550 for more information and to make sure you know what you are doing. More... | |
struct | dodag_config_t |
RPL DODAG config is used when allocating RPL base arm_nwk_6lowpan_rpl_dodag_init(). More... | |
Functions | |
int8_t | arm_nwk_6lowpan_rpl_dodag_init (int8_t interface_id, const uint8_t *dodag_id, const dodag_config_t *config, uint8_t instace_id, uint8_t flags) |
RPL DODAG root base allocate. | |
int8_t | arm_nwk_6lowpan_rpl_memory_limit_set (size_t soft_limit, size_t hard_limit) |
RPL Global memory size limits. | |
int8_t | arm_nwk_6lowpan_rpl_dodag_remove (int8_t interface_id) |
RPL DODAG remove by given interface ID. | |
int8_t | arm_nwk_6lowpan_rpl_dodag_start (int8_t interface_id) |
Activate RPL DODAG by given Interface ID. | |
int8_t | arm_nwk_6lowpan_rpl_dodag_prefix_update (int8_t interface_id, uint8_t *prefix_ptr, uint8_t prefix_len, uint8_t flags, uint32_t lifetime) |
RPL prefix information update. | |
int8_t | arm_nwk_6lowpan_rpl_dodag_route_update (int8_t interface_id, uint8_t *route_ptr, uint8_t prefix_len, uint8_t flags, uint32_t lifetime) |
RPL route information update. | |
int8_t | arm_nwk_6lowpan_rpl_dodag_poison (int8_t interface_id) |
RPL DODAG poison. | |
int8_t | arm_nwk_6lowpan_rpl_dodag_dao_trig (int8_t interface_id) |
Trigger RPL DODAG DAO by DTSN increment. | |
int8_t | arm_nwk_6lowpan_rpl_dodag_version_increment (int8_t interface_id) |
RPL DODAG version update. | |
uint8_t | rpl_instance_list_read (uint8_t *buffer_ptr, uint8_t buffer_size) |
Read RPL instance list of a node. | |
uint8_t | rpl_read_dodag_info (rpl_dodag_info_t *dodag_ptr, uint8_t instance_id) |
Read DODAG information by given RPL instance ID. | |
int8_t | arm_nwk_6lowpan_rpl_dodag_pref_set (int8_t interface_id, uint8_t preference) |
RPL DODAG preference set. |
Detailed Description
ZigBeeIP Router and Border Router RPL API.
This API is primarily used with a border router. You can also use it with a basic router.
- arm_nwk_6lowpan_rpl_memory_limit_set(), Set RPL global memory limit sizes. Call this only at boot ones.
- arm_nwk_6lowpan_rpl_dodag_init(), Allocate and init RPL DODAG root.
- arm_nwk_6lowpan_rpl_dodag_remove(), Remove DDAG root, specifically.
- arm_nwk_6lowpan_rpl_dodag_start(), Activate RPL DODAG instance.
- arm_nwk_6lowpan_rpl_dodag_poison(), Trigger some poison advertisements for the current instance, and then become a leaf (so no more adverts are sent). If a DODAG root, this remains allocated so arm_nwk_6lowpan_rpl_dodag_remove() still needs to be called to free it, after delaying some seconds to allow the poison advertisements to be sent().
- arm_nwk_6lowpan_rpl_dodag_prefix_update(), Update prefix info to the root.
- arm_nwk_6lowpan_rpl_dodag_route_update(), Update route info to the root.
- arm_nwk_6lowpan_rpl_dodag_dao_trig(), Increment the DAO Trigger Sequence Number (DTSN), to cause downstream nodes to refresh their Destination Advertisement Objects (DAOs).
- arm_nwk_6lowpan_rpl_dodag_version_increment(), Increment the DODAG version to trigger a global DODAG repair.
RECOMMEND API for router and border router:
- rpl_instance_list_read(), Read active RPL instance list.
- rpl_read_dodag_info(), Read RPL DODAG information to rpl_dodag_info_t structure by selected RPL instance ID.
Steps to define a new RPL DODAG instance:
1. Allocate RPL root base with arm_nwk_6lowpan_rpl_dodag_init(). 2. Set prefix 1 to root with arm_nwk_6lowpan_rpl_dodag_prefix_update(). 3. Set Route(s) to root with arm_nwk_6lowpan_rpl_dodag_route_update(). 4. Start Activate RPL DODAG: * arm_nwk_6lowpan_rpl_dodag_start() if RPL is generated after arm_nwk_interface().
Definition in file net_rpl.h.
Function Documentation
int8_t arm_nwk_6lowpan_rpl_dodag_dao_trig | ( | int8_t | interface_id ) |
Trigger RPL DODAG DAO by DTSN increment.
- Parameters:
-
interface_id Network interface ID.
- Returns:
- 0, DAO trig OK
- <0, DAO trig Fail
int8_t arm_nwk_6lowpan_rpl_dodag_init | ( | int8_t | interface_id, |
const uint8_t * | dodag_id, | ||
const dodag_config_t * | config, | ||
uint8_t | instace_id, | ||
uint8_t | flags | ||
) |
RPL DODAG root base allocate.
- Parameters:
-
interface_id Interface ID dodag_id A pointer to unique DODAGID. This must be the node's GP address in the ZigBeeIP network. config A pointer to the DODAG configure structure. instace_id Instance ID for RPL DODAG. flags Defines RPL MOP and DODAG pref. ZigBeeIP should use (BR_DODAG_MOP_NON_STORING | BR_DODAG_PREF_7).
- Returns:
- 0, Allocate OK.
- -1, Allocate fail (The node is already connected to the same instance or the memory allocate fails).
- -2, DODAG configuration parameter failure.
int8_t arm_nwk_6lowpan_rpl_dodag_poison | ( | int8_t | interface_id ) |
RPL DODAG poison.
This function poisons the current RPL instance. After a few seconds arm_nwk_6lowpan_rpl_dodag_remove() can also clean the root.
- Parameters:
-
interface_id Interface ID that defines the RPL instance to be poisoned.
- Returns:
- 0, Poison OK.
- <0, Poison fail.
int8_t arm_nwk_6lowpan_rpl_dodag_pref_set | ( | int8_t | interface_id, |
uint8_t | preference | ||
) |
RPL DODAG preference set.
- Parameters:
-
interface_id Interface ID in which the RPL instance updates the DODAG preference. preference DODAG preference. 0 to 7. 0 is least preferred.
- Returns:
- 0, Update OK
- <0, Update Fail
int8_t arm_nwk_6lowpan_rpl_dodag_prefix_update | ( | int8_t | interface_id, |
uint8_t * | prefix_ptr, | ||
uint8_t | prefix_len, | ||
uint8_t | flags, | ||
uint32_t | lifetime | ||
) |
RPL prefix information update.
- Parameters:
-
interface_id Root interface ID prefix_ptr A pointer to IPv6 prefix (16-bytes). prefix_len Prefix length (should be 64). flags Define R-flag (RPL_PREFIX_ROUTER_ADDRESS_FLAG), A-flag (RPL_PREFIX_AUTONOMOUS_ADDRESS_FLAG). lifetime Prefix lifetime.
- Returns:
- 0, Update OK.
- <0, Update fail.
int8_t arm_nwk_6lowpan_rpl_dodag_remove | ( | int8_t | interface_id ) |
RPL DODAG remove by given interface ID.
- Parameters:
-
interface_id Interface ID for removed DODAG.
- Returns:
- 0, Remove OK.
- -1, Remove fail.
int8_t arm_nwk_6lowpan_rpl_dodag_route_update | ( | int8_t | interface_id, |
uint8_t * | route_ptr, | ||
uint8_t | prefix_len, | ||
uint8_t | flags, | ||
uint32_t | lifetime | ||
) |
RPL route information update.
- Parameters:
-
interface_id Root interface ID. route_ptr A pointer to IPv6 prefix (16-bytes). prefix_len Prefix length (should be 64). flags Define R-flag (RPL_PREFIX_ROUTER_ADDRESS_FLAG). lifetime Route lifetime.
- Returns:
- 0, Update OK.
- <0, Update fail.
int8_t arm_nwk_6lowpan_rpl_dodag_start | ( | int8_t | interface_id ) |
Activate RPL DODAG by given Interface ID.
- Parameters:
-
interface_id Interface ID for start DODAG root.
- Returns:
- 0, Start OK.
- <0, Start fail.
int8_t arm_nwk_6lowpan_rpl_dodag_version_increment | ( | int8_t | interface_id ) |
RPL DODAG version update.
Network devices need to reset the current RPL instance and do unicast DIS/DIO and DAO/DAO ACK handshake.
- Parameters:
-
interface_id Root interface ID.
- Returns:
- 0, Version update OK.
- <0, Version update fail.
int8_t arm_nwk_6lowpan_rpl_memory_limit_set | ( | size_t | soft_limit, |
size_t | hard_limit | ||
) |
RPL Global memory size limits.
Calling this function you can update default memory limits. Soft default is 1024 and hard limit is 2048.
- Parameters:
-
soft_limit When RPL reach this state at total allocation it start cleaning unused data. hard_limit Total allocation limit. 0 means no limit and > 0 define hard limit. When hard limit > 0 soft_limit must be smaller than hard.
- Returns:
- 0, Set OK.
- -1, Unsupported parameter
uint8_t rpl_instance_list_read | ( | uint8_t * | buffer_ptr, |
uint8_t | buffer_size | ||
) |
Read RPL instance list of a node.
Global instances are output as a single byte containing the instance ID; local instances are output as the instance ID followed by the 16-byte DODAG ID.
- Parameters:
-
buffer_ptr A pointer to the location of the instance IDs. buffer_size Instance list buffer size.
- Returns:
- RPL instance count (not necessarily number of bytes, if local instances).
uint8_t rpl_read_dodag_info | ( | rpl_dodag_info_t * | dodag_ptr, |
uint8_t | instance_id | ||
) |
Read DODAG information by given RPL instance ID.
If it is a local instance ID, dodag_ptr must contain the DODAG ID on entry.
- Parameters:
-
dodag_ptr A pointer to DODAG information structure. instance_id Read instance ID.
- Returns:
- 1, Read OK.
- 0, Read fail.
Generated on Sun Jul 17 2022 08:25:35 by 1.7.2