Border Router

This module includes functions to manage local network data with the OpenThread Border Router.

Functions

otError otBorderRoutingInit ( otInstance *aInstance, uint32_t aInfraIfIndex, bool aInfraIfIsRunning)
This method initializes the Border Routing Manager on given infrastructure interface.
otError otBorderRoutingSetEnabled ( otInstance *aInstance, bool aEnabled)
Enables or disables the Border Routing Manager.
otRoutePreference otBorderRoutingGetRouteInfoOptionPreference ( otInstance *aInstance)
This function gets the preference used when advertising Route Info Options (e.g., for discovered OMR prefixes) in Router Advertisement messages sent over the infrastructure link.
void otBorderRoutingSetRouteInfoOptionPreference ( otInstance *aInstance, otRoutePreference aPreference)
This function sets the preference to use when advertising Route Info Options (e.g., for discovered OMR prefixes) in Router Advertisement messages sent over the infrastructure link.
otError otBorderRoutingGetOmrPrefix ( otInstance *aInstance, otIp6Prefix *aPrefix)
Gets the Off-Mesh-Routable (OMR) Prefix, for example fdfc:1ff5:1512:5622::/64 .
otError otBorderRoutingGetOnLinkPrefix ( otInstance *aInstance, otIp6Prefix *aPrefix)
Gets the On-Link Prefix for the adjacent infrastructure link, for example fd41:2650:a6f5:0::/64 .
otError otBorderRoutingGetNat64Prefix ( otInstance *aInstance, otIp6Prefix *aPrefix)
Gets the local NAT64 Prefix of the Border Router.
otError otBorderRouterGetNetData ( otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
This method provides a full or stable copy of the local Thread Network Data.
otError otBorderRouterAddOnMeshPrefix ( otInstance *aInstance, const otBorderRouterConfig *aConfig)
Add a border router configuration to the local network data.
otError otBorderRouterRemoveOnMeshPrefix ( otInstance *aInstance, const otIp6Prefix *aPrefix)
Remove a border router configuration from the local network data.
otError otBorderRouterGetNextOnMeshPrefix ( otInstance *aInstance, otNetworkDataIterator *aIterator, otBorderRouterConfig *aConfig)
This function gets the next On Mesh Prefix in the local Network Data.
otError otBorderRouterAddRoute ( otInstance *aInstance, const otExternalRouteConfig *aConfig)
Add an external route configuration to the local network data.
otError otBorderRouterRemoveRoute ( otInstance *aInstance, const otIp6Prefix *aPrefix)
Remove an external route configuration from the local network data.
otError otBorderRouterGetNextRoute ( otInstance *aInstance, otNetworkDataIterator *aIterator, otExternalRouteConfig *aConfig)
This function gets the next external route in the local Network Data.
otError otBorderRouterRegister ( otInstance *aInstance)
Immediately register the local network data with the Leader.

Detailed Description

This module includes functions to manage local network data with the OpenThread Border Router.

Function Documentation

otBorderRouterAddOnMeshPrefix()

otError otBorderRouterAddOnMeshPrefix ( otInstance * aInstance,
const otBorderRouterConfig * aConfig
)

Add a border router configuration to the local network data.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aConfig A pointer to the border router configuration.
Return values
OT_ERROR_NONE Successfully added the configuration to the local network data.
OT_ERROR_INVALID_ARGS One or more configuration parameters were invalid.
OT_ERROR_NO_BUFS Not enough room is available to add the configuration to the local network data.
See also
otBorderRouterRemoveOnMeshPrefix
otBorderRouterRegister

otBorderRouterAddRoute()

otError otBorderRouterAddRoute ( otInstance * aInstance,
const otExternalRouteConfig * aConfig
)

Add an external route configuration to the local network data.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aConfig A pointer to the external route configuration.
Return values
OT_ERROR_NONE Successfully added the configuration to the local network data.
OT_ERROR_INVALID_ARGS One or more configuration parameters were invalid.
OT_ERROR_NO_BUFS Not enough room is available to add the configuration to the local network data.
See also
otBorderRouterRemoveRoute
otBorderRouterRegister

otBorderRouterGetNetData()

otError otBorderRouterGetNetData ( otInstance * aInstance,
bool aStable,
uint8_t * aData,
uint8_t * aDataLength
)

This method provides a full or stable copy of the local Thread Network Data.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aStable TRUE when copying the stable version, FALSE when copying the full version.
[out] aData A pointer to the data buffer.
[in,out] aDataLength On entry, size of the data buffer pointed to by aData . On exit, number of copied bytes.

otBorderRouterGetNextOnMeshPrefix()

otError otBorderRouterGetNextOnMeshPrefix ( otInstance * aInstance,
otNetworkDataIterator * aIterator,
otBorderRouterConfig * aConfig
)

This function gets the next On Mesh Prefix in the local Network Data.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in,out] aIterator A pointer to the Network Data iterator context. To get the first on-mesh entry it should be set to OT_NETWORK_DATA_ITERATOR_INIT.
[out] aConfig A pointer to the On Mesh Prefix information.
Return values
OT_ERROR_NONE Successfully found the next On Mesh prefix.
OT_ERROR_NOT_FOUND No subsequent On Mesh prefix exists in the Thread Network Data.

otBorderRouterGetNextRoute()

otError otBorderRouterGetNextRoute ( otInstance * aInstance,
otNetworkDataIterator * aIterator,
otExternalRouteConfig * aConfig
)

This function gets the next external route in the local Network Data.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in,out] aIterator A pointer to the Network Data iterator context. To get the first external route entry it should be set to OT_NETWORK_DATA_ITERATOR_INIT.
[out] aConfig A pointer to the External Route information.
Return values
OT_ERROR_NONE Successfully found the next External Route.
OT_ERROR_NOT_FOUND No subsequent external route entry exists in the Thread Network Data.

otBorderRouterRegister()

otError otBorderRouterRegister ( otInstance * aInstance )

Immediately register the local network data with the Leader.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Return values
OT_ERROR_NONE Successfully queued a Server Data Request message for delivery.
See also
otBorderRouterAddOnMeshPrefix
otBorderRouterRemoveOnMeshPrefix
otBorderRouterAddRoute
otBorderRouterRemoveRoute

otBorderRouterRemoveOnMeshPrefix()

otError otBorderRouterRemoveOnMeshPrefix ( otInstance * aInstance,
const otIp6Prefix * aPrefix
)

Remove a border router configuration from the local network data.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aPrefix A pointer to an IPv6 prefix.
Return values
OT_ERROR_NONE Successfully removed the configuration from the local network data.
OT_ERROR_NOT_FOUND Could not find the Border Router entry.
See also
otBorderRouterAddOnMeshPrefix
otBorderRouterRegister

otBorderRouterRemoveRoute()

otError otBorderRouterRemoveRoute ( otInstance * aInstance,
const otIp6Prefix * aPrefix
)

Remove an external route configuration from the local network data.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aPrefix A pointer to an IPv6 prefix.
Return values
OT_ERROR_NONE Successfully removed the configuration from the local network data.
OT_ERROR_NOT_FOUND Could not find the Border Router entry.
See also
otBorderRouterAddRoute
otBorderRouterRegister

otBorderRoutingGetNat64Prefix()

otError otBorderRoutingGetNat64Prefix ( otInstance * aInstance,
otIp6Prefix * aPrefix
)

Gets the local NAT64 Prefix of the Border Router.

NAT64 Prefix might not be advertised in the Thread network.

OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE must be enabled.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[out] aPrefix A pointer to where the prefix will be output to.
Return values
OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
OT_ERROR_NONE Successfully retrieved the NAT64 prefix.

otBorderRoutingGetOmrPrefix()

otError otBorderRoutingGetOmrPrefix ( otInstance * aInstance,
otIp6Prefix * aPrefix
)

Gets the Off-Mesh-Routable (OMR) Prefix, for example fdfc:1ff5:1512:5622::/64 .

An OMR Prefix is a randomly generated 64-bit prefix that's published in the Thread network if there isn't already an OMR prefix. This prefix can be reached from the local Wi-Fi or Ethernet network.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[out] aPrefix A pointer to where the prefix will be output to.
Return values
OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
OT_ERROR_NONE Successfully retrieved the OMR prefix.

otBorderRoutingGetOnLinkPrefix()

otError otBorderRoutingGetOnLinkPrefix ( otInstance * aInstance,
otIp6Prefix * aPrefix
)

Gets the On-Link Prefix for the adjacent infrastructure link, for example fd41:2650:a6f5:0::/64 .

An On-Link Prefix is a randomly generated 64-bit prefix that's advertised on the infrastructure link if there isn't already a usable on-link prefix being advertised on the link.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[out] aPrefix A pointer to where the prefix will be output to.
Return values
OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
OT_ERROR_NONE Successfully retrieved the on-link prefix.

otBorderRoutingGetRouteInfoOptionPreference()

otRoutePreference otBorderRoutingGetRouteInfoOptionPreference ( otInstance * aInstance )

This function gets the preference used when advertising Route Info Options (e.g., for discovered OMR prefixes) in Router Advertisement messages sent over the infrastructure link.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The OMR prefix advertisement preference.

otBorderRoutingInit()

otError otBorderRoutingInit ( otInstance * aInstance,
uint32_t aInfraIfIndex,
bool aInfraIfIsRunning
)

This method initializes the Border Routing Manager on given infrastructure interface.

Note
This method MUST be called before any other otBorderRouting* APIs.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aInfraIfIndex The infrastructure interface index.
[in] aInfraIfIsRunning A boolean that indicates whether the infrastructure interface is running.
Return values
OT_ERROR_NONE Successfully started the Border Routing Manager on given infrastructure.
OT_ERROR_INVALID_STATE The Border Routing Manager has already been initialized.
OT_ERROR_INVALID_ARGS The index of the infrastructure interface is not valid.
OT_ERROR_FAILED Internal failure. Usually due to failure in generating random prefixes.
See also
otPlatInfraIfStateChanged .

otBorderRoutingSetEnabled()

otError otBorderRoutingSetEnabled ( otInstance * aInstance,
bool aEnabled
)

Enables or disables the Border Routing Manager.

Note
The Border Routing Manager is disabled by default.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aEnabled A boolean to enable/disable the routing manager.
Return values
OT_ERROR_INVALID_STATE The Border Routing Manager is not initialized yet.
OT_ERROR_NONE Successfully enabled/disabled the Border Routing Manager.

otBorderRoutingSetRouteInfoOptionPreference()

void otBorderRoutingSetRouteInfoOptionPreference ( otInstance * aInstance,
otRoutePreference aPreference
)

This function sets the preference to use when advertising Route Info Options (e.g., for discovered OMR prefixes) in Router Advertisement messages sent over the infrastructure link.

By default BR will use 'medium' preference level but this function allows the default value to be changed. As an example, it can be set to 'low' preference in the case where device is a temporary BR (a mobile BR or a battery-powered BR) to indicate that other BRs (if any) should be preferred over this BR on the infrastructure link.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aPreference The route preference to use.