Router/Leader

This module includes functions for Thread Routers and Leaders.

Classes

struct otChildInfo
This structure holds diagnostic information for a Thread Child.
struct otCacheEntryInfo
This structure represents an EID cache entry.
struct otCacheEntryIterator
This type represents an iterator used for iterating through the EID cache table entries.
struct otNeighborTableEntryInfo
This type represent a neighbor table entry info (child or router) and is used as a parameter in the neighbor table callback otNeighborTableCallback .

Macros

#define OT_CHILD_IP6_ADDRESS_ITERATOR_INIT 0
Initializer for otChildIP6AddressIterator.

Typedefs

typedef uint16_t otChildIp6AddressIterator
Used to iterate through IPv6 addresses of a Thread Child entry.
typedef enum otCacheEntryState otCacheEntryState
This enumeration defines the EID cache entry state.
typedef struct otCacheEntryInfo otCacheEntryInfo
This structure represents an EID cache entry.
typedef struct otCacheEntryIterator otCacheEntryIterator
This type represents an iterator used for iterating through the EID cache table entries.
typedef void(* otNeighborTableCallback ) ( otNeighborTableEvent aEvent, const otNeighborTableEntryInfo *aEntryInfo)
This function pointer is called to notify that there is a change in the neighbor table.

Enumerations

enum otCacheEntryState {
OT_CACHE_ENTRY_STATE_CACHED = 0,
OT_CACHE_ENTRY_STATE_SNOOPED = 1,
OT_CACHE_ENTRY_STATE_QUERY = 2,
OT_CACHE_ENTRY_STATE_RETRY_QUERY = 3
}
This enumeration defines the EID cache entry state.
enum otNeighborTableEvent {
OT_NEIGHBOR_TABLE_EVENT_CHILD_ADDED ,
OT_NEIGHBOR_TABLE_EVENT_CHILD_REMOVED ,
OT_NEIGHBOR_TABLE_EVENT_CHILD_MODE_CHANGED ,
OT_NEIGHBOR_TABLE_EVENT_ROUTER_ADDED ,
OT_NEIGHBOR_TABLE_EVENT_ROUTER_REMOVED
}
This enumeration defines the constants used in otNeighborTableCallback to indicate changes in neighbor table.

Functions

uint16_t otThreadGetMaxAllowedChildren ( otInstance *aInstance)
Get the maximum number of children currently allowed.
otError otThreadSetMaxAllowedChildren ( otInstance *aInstance, uint16_t aMaxChildren)
Set the maximum number of children currently allowed.
bool otThreadIsRouterEligible ( otInstance *aInstance)
This method indicates whether or not the device is router-eligible.
otError otThreadSetRouterEligible ( otInstance *aInstance, bool aEligible)
This function sets whether or not the device is router-eligible.
otError otThreadSetPreferredRouterId ( otInstance *aInstance, uint8_t aRouterId)
Set the preferred Router Id.
uint8_t otThreadGetLocalLeaderWeight ( otInstance *aInstance)
Get the Thread Leader Weight used when operating in the Leader role.
void otThreadSetLocalLeaderWeight ( otInstance *aInstance, uint8_t aWeight)
Set the Thread Leader Weight used when operating in the Leader role.
uint32_t otThreadGetPreferredLeaderPartitionId ( otInstance *aInstance)
Get the preferred Thread Leader Partition Id used when operating in the Leader role.
void otThreadSetPreferredLeaderPartitionId ( otInstance *aInstance, uint32_t aPartitionId)
Set the preferred Thread Leader Partition Id used when operating in the Leader role.
uint16_t otThreadGetJoinerUdpPort ( otInstance *aInstance)
Get the Joiner UDP Port.
otError otThreadSetJoinerUdpPort ( otInstance *aInstance, uint16_t aJoinerUdpPort)
Set the Joiner UDP Port.
void otThreadSetSteeringData ( otInstance *aInstance, const otExtAddress *aExtAddress)
Set Steering data out of band.
uint32_t otThreadGetContextIdReuseDelay ( otInstance *aInstance)
Get the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.
void otThreadSetContextIdReuseDelay ( otInstance *aInstance, uint32_t aDelay)
Set the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.
uint8_t otThreadGetNetworkIdTimeout ( otInstance *aInstance)
Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
void otThreadSetNetworkIdTimeout ( otInstance *aInstance, uint8_t aTimeout)
Set the NETWORK_ID_TIMEOUT parameter used in the Leader role.
uint8_t otThreadGetRouterUpgradeThreshold ( otInstance *aInstance)
Get the ROUTER_UPGRADE_THRESHOLD parameter used in the REED role.
void otThreadSetRouterUpgradeThreshold ( otInstance *aInstance, uint8_t aThreshold)
Set the ROUTER_UPGRADE_THRESHOLD parameter used in the Leader role.
otError otThreadReleaseRouterId ( otInstance *aInstance, uint8_t aRouterId)
Release a Router ID that has been allocated by the device in the Leader role.
otError otThreadBecomeRouter ( otInstance *aInstance)
Attempt to become a router.
otError otThreadBecomeLeader ( otInstance *aInstance)
Become a leader and start a new partition.
uint8_t otThreadGetRouterDowngradeThreshold ( otInstance *aInstance)
Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role.
void otThreadSetRouterDowngradeThreshold ( otInstance *aInstance, uint8_t aThreshold)
Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role.
uint8_t otThreadGetRouterSelectionJitter ( otInstance *aInstance)
Get the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.
void otThreadSetRouterSelectionJitter ( otInstance *aInstance, uint8_t aRouterJitter)
Set the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.
otError otThreadGetChildInfoById ( otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo)
The function retains diagnostic information for an attached Child by its Child ID or RLOC16.
otError otThreadGetChildInfoByIndex ( otInstance *aInstance, uint16_t aChildIndex, otChildInfo *aChildInfo)
The function retains diagnostic information for an attached Child by the internal table index.
otError otThreadGetChildNextIp6Address ( otInstance *aInstance, uint16_t aChildIndex, otChildIp6AddressIterator *aIterator, otIp6Address *aAddress)
This function gets the next IPv6 address (using an iterator) for a given child.
uint8_t otThreadGetRouterIdSequence ( otInstance *aInstance)
Get the current Router ID Sequence.
uint8_t otThreadGetMaxRouterId ( otInstance *aInstance)
The function returns the maximum allowed router ID.
otError otThreadGetRouterInfo ( otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo)
The function retains diagnostic information for a given Thread Router.
otError otThreadGetNextCacheEntry ( otInstance *aInstance, otCacheEntryInfo *aEntryInfo, otCacheEntryIterator *aIterator)
This function gets the next EID cache entry (using an iterator).
void otThreadGetPskc ( otInstance *aInstance, otPskc *aPskc)
Get the Thread PSKc.
otPskcRef otThreadGetPskcRef ( otInstance *aInstance)
Get Key Reference to Thread PSKc stored.
otError otThreadSetPskc ( otInstance *aInstance, const otPskc *aPskc)
Set the Thread PSKc.
otError otThreadSetPskcRef ( otInstance *aInstance, otPskcRef aKeyRef)
Set the Thread PSKc.
int8_t otThreadGetParentPriority ( otInstance *aInstance)
Get the assigned parent priority.
otError otThreadSetParentPriority ( otInstance *aInstance, int8_t aParentPriority)
Set the parent priority.
uint8_t otThreadGetMaxChildIpAddresses ( otInstance *aInstance)
This function gets the maximum number of IP addresses that each MTD child may register with this device as parent.
otError otThreadSetMaxChildIpAddresses ( otInstance *aInstance, uint8_t aMaxIpAddresses)
This function sets/restores the maximum number of IP addresses that each MTD child may register with this device as parent.
void otThreadRegisterNeighborTableCallback ( otInstance *aInstance, otNeighborTableCallback aCallback)
This function registers a neighbor table callback function.
void otThreadSetCcmEnabled ( otInstance *aInstance, bool aEnabled)
This function sets whether the device was commissioned using CCM.
void otThreadSetThreadVersionCheckEnabled ( otInstance *aInstance, bool aEnabled)
This function sets whether the Security Policy TLV version-threshold for routing (VR field) is enabled.
void otThreadGetRouterIdRange ( otInstance *aInstance, uint8_t *aMinRouterId, uint8_t *aMaxRouterId)
This function gets the range of router IDs that are allowed to assign to nodes within the thread network.
otError otThreadSetRouterIdRange ( otInstance *aInstance, uint8_t aMinRouterId, uint8_t aMaxRouterId)
This function sets the range of router IDs that are allowed to assign to nodes within the thread network.

Detailed Description

This module includes functions for Thread Routers and Leaders.

Typedef Documentation

otCacheEntryIterator

This type represents an iterator used for iterating through the EID cache table entries.

To initialize the iterator and start from the first entry in the cache table, set all its fields in the structure to zero (e.g., memset the iterator to zero).

otNeighborTableCallback

typedef void(* otNeighborTableCallback) ( otNeighborTableEvent aEvent, const otNeighborTableEntryInfo *aEntryInfo)

This function pointer is called to notify that there is a change in the neighbor table.

Parameters
[in] aEvent A event flag.
[in] aEntryInfo A pointer to table entry info.

Enumeration Type Documentation

otNeighborTableEvent

This enumeration defines the constants used in otNeighborTableCallback to indicate changes in neighbor table.

Enumerator
OT_NEIGHBOR_TABLE_EVENT_CHILD_ADDED

A child is being added.

OT_NEIGHBOR_TABLE_EVENT_CHILD_REMOVED

A child is being removed.

OT_NEIGHBOR_TABLE_EVENT_CHILD_MODE_CHANGED

An existing child's mode is changed.

OT_NEIGHBOR_TABLE_EVENT_ROUTER_ADDED

A router is being added.

OT_NEIGHBOR_TABLE_EVENT_ROUTER_REMOVED

A router is being removed.

Function Documentation

otThreadBecomeLeader()

otError otThreadBecomeLeader ( otInstance * aInstance )

Become a leader and start a new partition.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
Return values
OT_ERROR_NONE Successfully became a leader and started a new partition.
OT_ERROR_INVALID_STATE Thread is disabled.

otThreadBecomeRouter()

otError otThreadBecomeRouter ( otInstance * aInstance )

Attempt to become a router.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
Return values
OT_ERROR_NONE Successfully begin attempt to become a router.
OT_ERROR_INVALID_STATE Thread is disabled.

otThreadGetChildInfoById()

otError otThreadGetChildInfoById ( otInstance * aInstance,
uint16_t aChildId,
otChildInfo * aChildInfo
)

The function retains diagnostic information for an attached Child by its Child ID or RLOC16.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aChildId The Child ID or RLOC16 for the attached child.
[out] aChildInfo A pointer to where the child information is placed.
Return values
OT_ERROR_NONE aChildInfo was successfully updated with the info for the given ID.
OT_ERROR_NOT_FOUND No valid child with this Child ID.
OT_ERROR_INVALID_ARGS If aChildInfo is NULL.

otThreadGetChildInfoByIndex()

otError otThreadGetChildInfoByIndex ( otInstance * aInstance,
uint16_t aChildIndex,
otChildInfo * aChildInfo
)

The function retains diagnostic information for an attached Child by the internal table index.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aChildIndex The table index.
[out] aChildInfo A pointer to where the child information is placed.
Return values
OT_ERROR_NONE aChildInfo was successfully updated with the info for the given index.
OT_ERROR_NOT_FOUND No valid child at this index.
OT_ERROR_INVALID_ARGS Either aChildInfo is NULL, or aChildIndex is out of range (higher than max table index).
See also
otGetMaxAllowedChildren

otThreadGetChildNextIp6Address()

otError otThreadGetChildNextIp6Address ( otInstance * aInstance,
uint16_t aChildIndex,
otChildIp6AddressIterator * aIterator,
otIp6Address * aAddress
)

This function gets the next IPv6 address (using an iterator) for a given child.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aChildIndex The child index.
[in,out] aIterator A pointer to the iterator. On success the iterator will be updated to point to next entry in the list. To get the first IPv6 address the iterator should be set to OT_CHILD_IP6_ADDRESS_ITERATOR_INIT.
[out] aAddress A pointer to an IPv6 address where the child's next address is placed (on success).
Return values
OT_ERROR_NONE Successfully found the next IPv6 address ( aAddress was successfully updated).
OT_ERROR_NOT_FOUND The child has no subsequent IPv6 address entry.
OT_ERROR_INVALID_ARGS aIterator or aAddress are NULL, or child at aChildIndex is not valid.
See also
otThreadGetChildInfoByIndex

otThreadGetContextIdReuseDelay()

uint32_t otThreadGetContextIdReuseDelay ( otInstance * aInstance )

Get the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The CONTEXT_ID_REUSE_DELAY value.
See also
otThreadSetContextIdReuseDelay

otThreadGetJoinerUdpPort()

uint16_t otThreadGetJoinerUdpPort ( otInstance * aInstance )

Get the Joiner UDP Port.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The Joiner UDP Port number.
See also
otThreadSetJoinerUdpPort

otThreadGetLocalLeaderWeight()

uint8_t otThreadGetLocalLeaderWeight ( otInstance * aInstance )

Get the Thread Leader Weight used when operating in the Leader role.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The Thread Leader Weight value.
See also
otThreadSetLeaderWeight

otThreadGetMaxAllowedChildren()

uint16_t otThreadGetMaxAllowedChildren ( otInstance * aInstance )

Get the maximum number of children currently allowed.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The maximum number of children currently allowed.
See also
otThreadSetMaxAllowedChildren

otThreadGetMaxChildIpAddresses()

uint8_t otThreadGetMaxChildIpAddresses ( otInstance * aInstance )

This function gets the maximum number of IP addresses that each MTD child may register with this device as parent.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The maximum number of IP addresses that each MTD child may register with this device as parent.
See also
otThreadSetMaxChildIpAddresses

otThreadGetMaxRouterId()

uint8_t otThreadGetMaxRouterId ( otInstance * aInstance )

The function returns the maximum allowed router ID.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The maximum allowed router ID.

otThreadGetNetworkIdTimeout()

uint8_t otThreadGetNetworkIdTimeout ( otInstance * aInstance )

Get the NETWORK_ID_TIMEOUT parameter used in the Router role.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The NETWORK_ID_TIMEOUT value.
See also
otThreadSetNetworkIdTimeout

otThreadGetNextCacheEntry()

otError otThreadGetNextCacheEntry ( otInstance * aInstance,
otCacheEntryInfo * aEntryInfo,
otCacheEntryIterator * aIterator
)

This function gets the next EID cache entry (using an iterator).

Parameters
[in] aInstance A pointer to an OpenThread instance.
[out] aEntryInfo A pointer to where the EID cache entry information is placed.
[in,out] aIterator A pointer to an iterator. It will be updated to point to next entry on success. To get the first entry, initialize the iterator by setting all its fields to zero (e.g., memset the iterator structure to zero).
Return values
OT_ERROR_NONE Successfully populated aEntryInfo for next EID cache entry.
OT_ERROR_NOT_FOUND No more entries in the address cache table.

otThreadGetParentPriority()

int8_t otThreadGetParentPriority ( otInstance * aInstance )

Get the assigned parent priority.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The assigned parent priority value, -2 means not assigned.
See also
otThreadSetParentPriority

otThreadGetPreferredLeaderPartitionId()

uint32_t otThreadGetPreferredLeaderPartitionId ( otInstance * aInstance )

Get the preferred Thread Leader Partition Id used when operating in the Leader role.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The Thread Leader Partition Id value.

otThreadGetPskc()

void otThreadGetPskc ( otInstance * aInstance,
otPskc * aPskc
)

Get the Thread PSKc.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[out] aPskc A pointer to an otPskc to return the retrieved Thread PSKc.
See also
otThreadSetPskc

otThreadGetPskcRef()

otPskcRef otThreadGetPskcRef ( otInstance * aInstance )

Get Key Reference to Thread PSKc stored.

This function requires the build-time feature OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE to be enabled.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
Key Reference to PSKc
See also
otThreadSetPskcRef

otThreadGetRouterDowngradeThreshold()

uint8_t otThreadGetRouterDowngradeThreshold ( otInstance * aInstance )

Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The ROUTER_DOWNGRADE_THRESHOLD value.
See also
otThreadSetRouterDowngradeThreshold

otThreadGetRouterIdRange()

void otThreadGetRouterIdRange ( otInstance * aInstance,
uint8_t * aMinRouterId,
uint8_t * aMaxRouterId
)

This function gets the range of router IDs that are allowed to assign to nodes within the thread network.

Note
This API requires OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE , and is only used for test purpose. All the router IDs in the range [aMinRouterId, aMaxRouterId] are allowed.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[out] aMinRouterId The minimum router ID.
[out] aMaxRouterId The maximum router ID.
See also
otThreadSetRouterIdRange

otThreadGetRouterIdSequence()

uint8_t otThreadGetRouterIdSequence ( otInstance * aInstance )

Get the current Router ID Sequence.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The Router ID Sequence.

otThreadGetRouterInfo()

otError otThreadGetRouterInfo ( otInstance * aInstance,
uint16_t aRouterId,
otRouterInfo * aRouterInfo
)

The function retains diagnostic information for a given Thread Router.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aRouterId The router ID or RLOC16 for a given router.
[out] aRouterInfo A pointer to where the router information is placed.
Return values
OT_ERROR_NONE Successfully retrieved the router info for given id.
OT_ERROR_NOT_FOUND No router entry with the given id.
OT_ERROR_INVALID_ARGS aRouterInfo is NULL.

otThreadGetRouterSelectionJitter()

uint8_t otThreadGetRouterSelectionJitter ( otInstance * aInstance )

Get the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The ROUTER_SELECTION_JITTER value.
See also
otThreadSetRouterSelectionJitter

otThreadGetRouterUpgradeThreshold()

uint8_t otThreadGetRouterUpgradeThreshold ( otInstance * aInstance )

Get the ROUTER_UPGRADE_THRESHOLD parameter used in the REED role.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Returns
The ROUTER_UPGRADE_THRESHOLD value.
See also
otThreadSetRouterUpgradeThreshold

otThreadIsRouterEligible()

bool otThreadIsRouterEligible ( otInstance * aInstance )

This method indicates whether or not the device is router-eligible.

Parameters
[in] aInstance A pointer to an OpenThread instance.
Return values
TRUE If device is router-eligible.
FALSE If device is not router-eligible.

otThreadRegisterNeighborTableCallback()

void otThreadRegisterNeighborTableCallback ( otInstance * aInstance,
otNeighborTableCallback aCallback
)

This function registers a neighbor table callback function.

The provided callback (if non-NULL) will be invoked when there is a change in the neighbor table (e.g., a child or a router neighbor entry is being added/removed or an existing child's mode is changed).

Subsequent calls to this method will overwrite the previous callback. Note that this callback in invoked while the neighbor/child table is being updated and always before the otStateChangedCallback .

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aCallback A pointer to callback handler function.

otThreadReleaseRouterId()

otError otThreadReleaseRouterId ( otInstance * aInstance,
uint8_t aRouterId
)

Release a Router ID that has been allocated by the device in the Leader role.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aRouterId The Router ID to release. Valid range is [0, 62].
Return values
OT_ERROR_NONE Successfully released the router id.
OT_ERROR_INVALID_ARGS aRouterId is not in the range [0, 62].
OT_ERROR_INVALID_STATE The device is not currently operating as a leader.
OT_ERROR_NOT_FOUND The router id is not currently allocated.

otThreadSetCcmEnabled()

void otThreadSetCcmEnabled ( otInstance * aInstance,
bool aEnabled
)

This function sets whether the device was commissioned using CCM.

Note
This API requires OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE , and is only used by Thread Test Harness to indicate whether this device was commissioned using CCM.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aEnabled TRUE if the device was commissioned using CCM, FALSE otherwise.

otThreadSetContextIdReuseDelay()

void otThreadSetContextIdReuseDelay ( otInstance * aInstance,
uint32_t aDelay
)

Set the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aDelay The CONTEXT_ID_REUSE_DELAY value.
See also
otThreadGetContextIdReuseDelay

otThreadSetJoinerUdpPort()

otError otThreadSetJoinerUdpPort ( otInstance * aInstance,
uint16_t aJoinerUdpPort
)

Set the Joiner UDP Port.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aJoinerUdpPort The Joiner UDP Port number.
Return values
OT_ERROR_NONE Successfully set the Joiner UDP Port.
See also
otThreadGetJoinerUdpPort

otThreadSetLocalLeaderWeight()

void otThreadSetLocalLeaderWeight ( otInstance * aInstance,
uint8_t aWeight
)

Set the Thread Leader Weight used when operating in the Leader role.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aWeight The Thread Leader Weight value.
See also
otThreadGetLeaderWeight

otThreadSetMaxAllowedChildren()

otError otThreadSetMaxAllowedChildren ( otInstance * aInstance,
uint16_t aMaxChildren
)

Set the maximum number of children currently allowed.

This parameter can only be set when Thread protocol operation has been stopped.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aMaxChildren The maximum allowed children.
Return values
OT_ERROR_NONE Successfully set the max.
OT_ERROR_INVALID_ARGS If aMaxChildren is not in the range [1, OPENTHREAD_CONFIG_MLE_MAX_CHILDREN].
OT_ERROR_INVALID_STATE If Thread isn't stopped.
See also
otThreadGetMaxAllowedChildren

otThreadSetMaxChildIpAddresses()

otError otThreadSetMaxChildIpAddresses ( otInstance * aInstance,
uint8_t aMaxIpAddresses
)

This function sets/restores the maximum number of IP addresses that each MTD child may register with this device as parent.

Note
This API requires OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE , and is only used by Thread Test Harness to limit the address registrations of the reference parent in order to test the MTD DUT reaction.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aMaxIpAddresses The maximum number of IP addresses that each MTD child may register with this device as parent. 0 to clear the setting and restore the default.
Return values
OT_ERROR_NONE Successfully set/cleared the number.
OT_ERROR_INVALID_ARGS If exceeds the allowed maximum number.
See also
otThreadGetMaxChildIpAddresses

otThreadSetNetworkIdTimeout()

void otThreadSetNetworkIdTimeout ( otInstance * aInstance,
uint8_t aTimeout
)

Set the NETWORK_ID_TIMEOUT parameter used in the Leader role.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aTimeout The NETWORK_ID_TIMEOUT value.
See also
otThreadGetNetworkIdTimeout

otThreadSetParentPriority()

otError otThreadSetParentPriority ( otInstance * aInstance,
int8_t aParentPriority
)

Set the parent priority.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aParentPriority The parent priority value.
Return values
OT_ERROR_NONE Successfully set the parent priority.
OT_ERROR_INVALID_ARGS If the parent priority value is not among 1, 0, -1 and -2.
See also
otThreadGetParentPriority

otThreadSetPreferredLeaderPartitionId()

void otThreadSetPreferredLeaderPartitionId ( otInstance * aInstance,
uint32_t aPartitionId
)

Set the preferred Thread Leader Partition Id used when operating in the Leader role.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aPartitionId The Thread Leader Partition Id value.

otThreadSetPreferredRouterId()

otError otThreadSetPreferredRouterId ( otInstance * aInstance,
uint8_t aRouterId
)

Set the preferred Router Id.

Upon becoming a router/leader the node attempts to use this Router Id. If the preferred Router Id is not set or if it can not be used, a randomly generated router id is picked. This property can be set only when the device role is either detached or disabled.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aRouterId The preferred Router Id.
Return values
OT_ERROR_NONE Successfully set the preferred Router Id.
OT_ERROR_INVALID_STATE Could not set (role is not detached or disabled)

otThreadSetPskc()

otError otThreadSetPskc ( otInstance * aInstance,
const otPskc * aPskc
)

Set the Thread PSKc.

This function will only succeed when Thread protocols are disabled. A successful call to this function will also invalidate the Active and Pending Operational Datasets in non-volatile memory.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aPskc A pointer to the new Thread PSKc.
Return values
OT_ERROR_NONE Successfully set the Thread PSKc.
OT_ERROR_INVALID_STATE Thread protocols are enabled.
See also
otThreadGetPskc

otThreadSetPskcRef()

otError otThreadSetPskcRef ( otInstance * aInstance,
otPskcRef aKeyRef
)

Set the Thread PSKc.

This function requires the build-time feature OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE to be enabled.

This function will only succeed when Thread protocols are disabled. A successful call to this function will also invalidate the Active and Pending Operational Datasets in non-volatile memory.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aKeyRef Key Reference to the new Thread PSKc.
Return values
OT_ERROR_NONE Successfully set the Thread PSKc.
OT_ERROR_INVALID_STATE Thread protocols are enabled.
See also
otThreadGetPskcRef

otThreadSetRouterDowngradeThreshold()

void otThreadSetRouterDowngradeThreshold ( otInstance * aInstance,
uint8_t aThreshold
)

Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aThreshold The ROUTER_DOWNGRADE_THRESHOLD value.
See also
otThreadGetRouterDowngradeThreshold

otThreadSetRouterEligible()

otError otThreadSetRouterEligible ( otInstance * aInstance,
bool aEligible
)

This function sets whether or not the device is router-eligible.

If aEligible is false and the device is currently operating as a router, this call will cause the device to detach and attempt to reattach as a child.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aEligible TRUE to configure the device as router-eligible, FALSE otherwise.
Return values
OT_ERROR_NONE Successfully set the router-eligible configuration.
OT_ERROR_NOT_CAPABLE The device is not capable of becoming a router.

otThreadSetRouterIdRange()

otError otThreadSetRouterIdRange ( otInstance * aInstance,
uint8_t aMinRouterId,
uint8_t aMaxRouterId
)

This function sets the range of router IDs that are allowed to assign to nodes within the thread network.

Note
This API requires OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE , and is only used for test purpose. All the router IDs in the range [aMinRouterId, aMaxRouterId] are allowed.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aMinRouterId The minimum router ID.
[in] aMaxRouterId The maximum router ID.
Return values
OT_ERROR_NONE Successfully set the range.
OT_ERROR_INVALID_ARGS aMinRouterId > aMaxRouterId, or the range is not covered by [0, 62].
See also
otThreadGetRouterIdRange

otThreadSetRouterSelectionJitter()

void otThreadSetRouterSelectionJitter ( otInstance * aInstance,
uint8_t aRouterJitter
)

Set the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aRouterJitter The ROUTER_SELECTION_JITTER value.
See also
otThreadGetRouterSelectionJitter

otThreadSetRouterUpgradeThreshold()

void otThreadSetRouterUpgradeThreshold ( otInstance * aInstance,
uint8_t aThreshold
)

Set the ROUTER_UPGRADE_THRESHOLD parameter used in the Leader role.

Note
This API is reserved for testing and demo purposes only. Changing settings with this API will render a production application non-compliant with the Thread Specification.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aThreshold The ROUTER_UPGRADE_THRESHOLD value.
See also
otThreadGetRouterUpgradeThreshold

otThreadSetSteeringData()

void otThreadSetSteeringData ( otInstance * aInstance,
const otExtAddress * aExtAddress
)

Set Steering data out of band.

Configuration option OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE should be set to enable setting of steering data out of band.

Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aExtAddress Address used to update the steering data. All zeros to clear the steering data (no steering data). All 0xFFs to set steering data/bloom filter to accept/allow all. A specific EUI64 which is then added to current steering data/bloom filter.

otThreadSetThreadVersionCheckEnabled()

void otThreadSetThreadVersionCheckEnabled ( otInstance * aInstance,
bool aEnabled
)

This function sets whether the Security Policy TLV version-threshold for routing (VR field) is enabled.

Note
This API requires OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE , and is only used by Thread Test Harness to indicate that thread protocol version check VR should be skipped.
Parameters
[in] aInstance A pointer to an OpenThread instance.
[in] aEnabled TRUE to enable Security Policy TLV version-threshold for routing, FALSE otherwise.