Border Router API#

Wi-SUN Border Router API contains functions for Border Router specific functionality.

This API is an extension, not a replacement of Wi-SUN Stack API. An application implementing Border Router capability may utilize functions from both APIs. See Wi-SUN API availability for further information.

Functions#

sl_status_t
sl_wisun_br_get_gak(uint8_t index, uint8_t *gak)

Get Group AES Key.

sl_status_t
sl_wisun_br_get_ip_addresses(uint8_t *addr_ll, uint8_t *addr_gua, uint8_t *addr_dodagid)

Get the unicast IPv6 addresses configured in the Border Router.

sl_status_t
sl_wisun_br_get_state(sl_wisun_br_state_t *state)

Get the Border Router state.

sl_status_t
sl_wisun_br_ipv6_down(const uint8_t *data, size_t data_length)

Forward an IPv6 packet to Wi-SUN network.

sl_status_t
sl_wisun_br_ipv6_route_exists(const uint8_t *ipv6_address, bool *exists)

Check if the IPv6 destination address is routable in the Wi-SUN network.

sl_status_t
sl_wisun_br_pan_defect_advertise(bool defect_advertise, uint32_t min_scan_duration_s, uint32_t max_scan_duration_s)

Start or stop PAN Defect advertisement.

sl_status_t
sl_wisun_br_set_broadcast_settings(uint32_t interval_ms, uint8_t dwell_interval_ms)

Set broadcast settings.

sl_status_t
sl_wisun_br_set_connection_parameters(const sl_wisun_br_connection_params_t *params)

Configure the Border Router parameter set.

sl_status_t
sl_wisun_br_set_device_certificate(uint16_t certificate_options, uint16_t certificate_length, const uint8_t *certificate)

Set the Border Router device certificate.

sl_status_t
sl_wisun_br_set_dhcp_vendor_data(uint32_t enterprise_number, uint16_t data_length, const uint8_t *data)

Set DHCPv6 Vendor Data.

sl_status_t
sl_wisun_br_set_gtk(const uint8_t *gtk, uint8_t index)

Set Group Transient Key.

sl_status_t
sl_wisun_br_set_ipv6_prefix(const uint8_t *ipv6_prefix, uint8_t prefix_length)

Set IPv6 prefix for DODAG.

sl_status_t
sl_wisun_br_set_ipv6_up_handler(sl_wisun_ipv6_up_handler_t handler)

Register a function to handle IPv6 packets received from Wi-SUN network.

sl_status_t
sl_wisun_br_set_lfn_parameters(const sl_wisun_br_lfn_params_t *params)

Configure LFN parenting parameter set.

sl_status_t
sl_wisun_br_set_lfn_support(uint8_t lfn_limit, bool lfn_support_pan)

Configure LFN parenting support.

sl_status_t
sl_wisun_br_set_network_size(sl_wisun_network_size_t size)

Set the size of the Wi-SUN network.

sl_status_t
sl_wisun_br_start(const uint8_t *name, const sl_wisun_phy_config_t *phy_config)

Start the Border Router.

sl_status_t

Stop the Border Router.

Macros#

#define
sl_wisun_set_br_device_certificate sl_wisun_br_set_device_certificate

Define sl_wisun_set_br_device_certificate for legacy.

Function Documentation#

sl_wisun_br_get_gak#

sl_status_t sl_wisun_br_get_gak (uint8_t index, uint8_t * gak)

Get Group AES Key.

Parameters
[in]index

Index of the key from 0 to 3 for GAKs and 4 to 6 for LFN GAKs

[out]gak

Pointer to Group AES Key

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function exports (L)GAK as a plaintext key.

Note

  • This functionality is only available when using the debug library.


Definition at line 110 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_get_ip_addresses#

sl_status_t sl_wisun_br_get_ip_addresses (uint8_t * addr_ll, uint8_t * addr_gua, uint8_t * addr_dodagid)

Get the unicast IPv6 addresses configured in the Border Router.

Parameters
[out]addr_ll

Pointer to Link-Local address

[out]addr_gua

Pointer to Unique Local Address or Global Unicast Address

[out]addr_dodagid

Pointer to DODAG ID

Returns

  • SL_STATUS_OK if successful, an error code otherwise


Definition at line 97 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_get_state#

sl_status_t sl_wisun_br_get_state (sl_wisun_br_state_t * state)

Get the Border Router state.

Parameters
[out]state

Pointer to state

Returns

  • SL_STATUS_OK if successful, an error code otherwise


Definition at line 120 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_ipv6_down#

sl_status_t sl_wisun_br_ipv6_down (const uint8_t * data, size_t data_length)

Forward an IPv6 packet to Wi-SUN network.

Parameters
[in]data

Pointer to IPv6 header

[out]data_length

Length of IPv6 packet data in bytes

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function forwards an IPv6 packet to Wi-SUN network. The destination address must belong to the DODAG prefix. This function is used for handling downlink packets from the backhaul interface, see sl_wisun_br_set_ipv6_up_handler() for uplink. It's recommended to use sl_wisun_br_ipv6_route_exists() before forwarding a packet.


Definition at line 287 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_ipv6_route_exists#

sl_status_t sl_wisun_br_ipv6_route_exists (const uint8_t * ipv6_address, bool * exists)

Check if the IPv6 destination address is routable in the Wi-SUN network.

Parameters
[in]ipv6_address

Pointer to IPv6 destination address

[out]exists

Whether the address is routable

  • true: address is routable

  • false: address is not routable

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function checks if the given IPv6 address is a valid destination in the Wi-SUN network. The destination address must belong to the Border Router or one of the connected nodes.


Definition at line 302 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_pan_defect_advertise#

sl_status_t sl_wisun_br_pan_defect_advertise (bool defect_advertise, uint32_t min_scan_duration_s, uint32_t max_scan_duration_s)

Start or stop PAN Defect advertisement.

Parameters
[in]defect_advertise

True to start PAN Defect procedure, false to stop it.

[in]min_scan_duration_s

Minimum duration after which devices are allowed to switch their PAN if an alternative one is available.

[in]max_scan_duration_s

Duration after which devices should systemically switch to the alternative PAN if one is available.

Returns

  • SL_STATUS_OK if successful, an error code otherwise.

Note

  • The values for min_scan_duration_s and max_scan_duration_s should be chosen based on the estimated performance of the backup power source. Specifically, max_scan_duration_s should be set to a value smaller than the estimated lifetime of the backup power source to ensure a seamless transition to the alternative PAN without long connection interruptions.


Definition at line 241 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_broadcast_settings#

sl_status_t sl_wisun_br_set_broadcast_settings (uint32_t interval_ms, uint8_t dwell_interval_ms)

Set broadcast settings.

Parameters
[in]interval_ms

Broadcast Interval (BDI < BI <= 16777215 ms) (default: 1020 ms)

[in]dwell_interval_ms

Broadcast Dwell Interval (100-255 ms) (default: 255 ms)

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the broadcast channel hopping schedule. The Broadcast Interval is the duration, between Broadcast Dwell Intervals within the advertising node’s broadcast schedule. Its resolution is limited to 24 bits (16777215 ms). The Broadcast Dwell Interval specifies the duration during which the node may transmit a broadcast message. It is recommended a BI value of 4.0 times the maximum of (UDI, BDI). These values affect the whole PAN, since they are propagated from parent to children. This function must be called before starting the Border Router.


Definition at line 163 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_connection_parameters#

sl_status_t sl_wisun_br_set_connection_parameters (const sl_wisun_br_connection_params_t * params)

Configure the Border Router parameter set.

Parameters
[in]params

Parameter set to use

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This functions sets the Border Router parameter set. These parameters impact connection time, bandwidth usage, and latency. Use of a predefined parameter set is recommended (Predefined BR parameter sets). This function must be called before starting the Border Router.


Definition at line 177 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_device_certificate#

sl_status_t sl_wisun_br_set_device_certificate (uint16_t certificate_options, uint16_t certificate_length, const uint8_t * certificate)

Set the Border Router device certificate.

Parameters
[in]certificate_options

Options for the certificate.
SL_WISUN_CERTIFICATE_OPTION_APPEND: Append the certificate to the list of server certificates instead of replacing the previous entries
SL_WISUN_CERTIFICATE_OPTION_IS_REF: The application guarantees the certificate data will remain in scope and can therefore be referenced instead of copied
SL_WISUN_CERTIFICATE_OPTION_HAS_KEY: The certificate has a private key

[in]certificate_length

Size of the certificate data

[in]certificate

Pointer to the certificate data

Returns

  • SL_STATUS_OK if successful, an error code otherwise


Definition at line 135 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_dhcp_vendor_data#

sl_status_t sl_wisun_br_set_dhcp_vendor_data (uint32_t enterprise_number, uint16_t data_length, const uint8_t * data)

Set DHCPv6 Vendor Data.

Parameters
[in]enterprise_number

Vendor Specific Enterprise Number

[in]data_length

Length of Vendor specific data

[in]data

Vendor specific data

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the vendor-specific information transmitted during DHCPv6 exchange. This function must be called before starting the Border Router.


Definition at line 220 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_gtk#

sl_status_t sl_wisun_br_set_gtk (const uint8_t * gtk, uint8_t index)

Set Group Transient Key.

Parameters
[in]gtk

Group Transient Key

[in]index

Index of the key from 0 to 3 for GTKs and 4 to 6 for LGTKs

Note

  • This API is provided for test and debug purposes: setting a specific key in production is not recommended. Furthermore, using this API to set a GTK or LGTK disables the rotation of this key type so the application is responsible for setting new ones when suitable.

Returns

  • SL_STATUS_OK if successful, an error code otherwise


Definition at line 68 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_ipv6_prefix#

sl_status_t sl_wisun_br_set_ipv6_prefix (const uint8_t * ipv6_prefix, uint8_t prefix_length)

Set IPv6 prefix for DODAG.

Parameters
[in]ipv6_prefix

IPv6 prefix

[in]prefix_length

Prefix length. Currently, only 64 bit prefixes are supported.

Note

  • Must not be called after the border router is started

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the prefix used to generate IP addresses for RPL traffic (DODAGID will derive from it). This function must be called before starting the Border Router.


Definition at line 258 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_ipv6_up_handler#

sl_status_t sl_wisun_br_set_ipv6_up_handler (sl_wisun_ipv6_up_handler_t handler)

Register a function to handle IPv6 packets received from Wi-SUN network.

Parameters
[in]handler

Pointer to handler function

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function registers a handler function that will be called when the destination address of a received IPv6 packet is outside the DODAG prefix. Setting the handler function to NULL disables the forwarding. This function is used for handling uplink packets towards the backhaul interface, see sl_wisun_br_ipv6_down() for downlink.


Definition at line 272 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_lfn_parameters#

sl_status_t sl_wisun_br_set_lfn_parameters (const sl_wisun_br_lfn_params_t * params)

Configure LFN parenting parameter set.

Parameters
[in]params

Parameter set to use

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the LFN parenting parameter set. These parameters impact battery life of all LFNs in the PAN. Use of a predefined parameter set is recommended (Predefined BR LFN-parenting parameter sets). This function must be called before starting the Border Router.


Definition at line 190 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_lfn_support#

sl_status_t sl_wisun_br_set_lfn_support (uint8_t lfn_limit, bool lfn_support_pan)

Configure LFN parenting support.

Parameters
[in]lfn_limit

Maximum number of LFN children

  • 0: LFN parenting is disabled in the Border Router

  • 1 - 10: Maximum number of LFN children the Border Router can parent

[in]lfn_support_pan

LFN parenting support in the PAN

  • true: LFN parenting is enabled in the PAN

  • false: LFN parenting is disabled in the PAN

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function configures LFN parenting support in the Border Router and in the PAN.


Definition at line 206 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_set_network_size#

sl_status_t sl_wisun_br_set_network_size (sl_wisun_network_size_t size)

Set the size of the Wi-SUN network.

Parameters
[in]size

Size of the network
SL_WISUN_NETWORK_SIZE_AUTOMATIC: network size is managed automatically
SL_WISUN_NETWORK_SIZE_SMALL: less than 100 nodes
SL_WISUN_NETWORK_SIZE_MEDIUM: 100 to 800 nodes
SL_WISUN_NETWORK_SIZE_LARGE: 800 to 1500 nodes

Returns

  • SL_STATUS_OK if successful, an error code otherwise

This function sets the size of the network. The size is to used set various stack parameters, such as timing parameters to optimize device behavior in regards to node count. The device will function with any setting but may exhibit non-optimal behavior. Setting the size too large may cause slow connection speed and increased latency. Conversely, a value too small may cause increased network traffic.


Definition at line 87 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_start#

sl_status_t sl_wisun_br_start (const uint8_t * name, const sl_wisun_phy_config_t * phy_config)

Start the Border Router.

Parameters
[in]name

Name of the Wi-SUN network as a zero-terminated string

[in]phy_config

Pointer to PHY configuration

Returns

  • SL_STATUS_OK if successful, an error code otherwise


Definition at line 48 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

sl_wisun_br_stop#

sl_status_t sl_wisun_br_stop (void )

Stop the Border Router.

Parameters
N/A

Returns

  • SL_STATUS_OK if successful, an error code otherwise


Definition at line 55 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h

Macro Definition Documentation#

sl_wisun_set_br_device_certificate#

#define sl_wisun_set_br_device_certificate
Value:
sl_wisun_br_set_device_certificate

Define sl_wisun_set_br_device_certificate for legacy.


Definition at line 142 of file /mnt/raid/workspaces/ws.obQFDUprC/overlay/gsdk/protocol/wisun/stack/inc/border_router/sl_wisun_br_api.h