Rtos API example

Embed: (wiki syntax)

« Back to documentation index

net_rpl.h File Reference

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.

RECOMMEND API for router and border router:

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_idNetwork 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_idInterface ID
dodag_idA pointer to unique DODAGID. This must be the node's GP address in the ZigBeeIP network.
configA pointer to the DODAG configure structure.
instace_idInstance ID for RPL DODAG.
flagsDefines 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_idInterface 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_idInterface ID in which the RPL instance updates the DODAG preference.
preferenceDODAG 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_idRoot interface ID
prefix_ptrA pointer to IPv6 prefix (16-bytes).
prefix_lenPrefix length (should be 64).
flagsDefine R-flag (RPL_PREFIX_ROUTER_ADDRESS_FLAG), A-flag (RPL_PREFIX_AUTONOMOUS_ADDRESS_FLAG).
lifetimePrefix 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_idInterface 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_idRoot interface ID.
route_ptrA pointer to IPv6 prefix (16-bytes).
prefix_lenPrefix length (should be 64).
flagsDefine R-flag (RPL_PREFIX_ROUTER_ADDRESS_FLAG).
lifetimeRoute 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_idInterface 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_idRoot 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_limitWhen RPL reach this state at total allocation it start cleaning unused data.
hard_limitTotal 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_ptrA pointer to the location of the instance IDs.
buffer_sizeInstance 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_ptrA pointer to DODAG information structure.
instance_idRead instance ID.
Returns:
1, Read OK.
0, Read fail.