Modules#

otChildInfo

otCacheEntryInfo

otCacheEntryIterator

otDeviceProperties

otNeighborTableEntryInfo

Router/Leader#

This module includes functions for Thread Routers and Leaders.

Enumerations#

enum
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
OT_POWER_SUPPLY_BATTERY = 0
OT_POWER_SUPPLY_EXTERNAL = 1
OT_POWER_SUPPLY_EXTERNAL_STABLE = 2
OT_POWER_SUPPLY_EXTERNAL_UNSTABLE = 3
}

This enumeration represents the power supply property on a device.

enum
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.

Typedefs#

typedef uint16_t

Used to iterate through IPv6 addresses of a Thread Child entry.

typedef enum otCacheEntryState

This enumeration defines the EID cache entry state.

typedef struct otCacheEntryInfo

This structure represents an EID cache entry.

typedef struct otCacheEntryIterator

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

typedef struct otDeviceProperties

This structure represents the device properties which are used for calculating the local leader weight on a device.

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

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

Functions#

uint16_t
otThreadGetMaxAllowedChildren(otInstance *aInstance)

Gets the maximum number of children currently allowed.

otThreadSetMaxAllowedChildren(otInstance *aInstance, uint16_t aMaxChildren)

Sets the maximum number of children currently allowed.

bool
otThreadIsRouterEligible(otInstance *aInstance)

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

otThreadSetRouterEligible(otInstance *aInstance, bool aEligible)

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

otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId)

Set the preferred Router Id.

otThreadGetDeviceProperties(otInstance *aInstance)

Get the current device properties.

void
otThreadSetDeviceProperties(otInstance *aInstance, const otDeviceProperties *aDeviceProperties)

Set the device properties which are then used to determine and set the Leader Weight.

uint8_t
otThreadGetLocalLeaderWeight(otInstance *aInstance)

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

void
otThreadSetLocalLeaderWeight(otInstance *aInstance, uint8_t aWeight)

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

uint32_t

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)

Gets the Joiner UDP Port.

otThreadSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoinerUdpPort)

Sets 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.

uint8_t
otThreadGetChildRouterLinks(otInstance *aInstance)

Get the MLE_CHILD_ROUTER_LINKS parameter used in the REED role.

otThreadSetChildRouterLinks(otInstance *aInstance, uint8_t aChildRouterLinks)

Set the MLE_CHILD_ROUTER_LINKS parameter used in the REED role.

otThreadReleaseRouterId(otInstance *aInstance, uint8_t aRouterId)

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

otThreadBecomeRouter(otInstance *aInstance)

Attempt to become a router.

otThreadBecomeLeader(otInstance *aInstance)

Become a leader and start a new partition.

uint8_t

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.

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

Gets diagnostic information for an attached Child by its Child ID or RLOC16.

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

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

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.

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

The function retains diagnostic information for a given Thread Router.

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.

otThreadGetPskcRef(otInstance *aInstance)

Get Key Reference to Thread PSKc stored.

otThreadSetPskc(otInstance *aInstance, const otPskc *aPskc)

Set the Thread PSKc.

otThreadSetPskcRef(otInstance *aInstance, otPskcRef aKeyRef)

Set the Thread PSKc.

int8_t
otThreadGetParentPriority(otInstance *aInstance)

Get the assigned parent priority.

otThreadSetParentPriority(otInstance *aInstance, int8_t aParentPriority)

Set the parent priority.

uint8_t
otThreadGetMaxChildIpAddresses(otInstance *aInstance)

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

otThreadSetMaxChildIpAddresses(otInstance *aInstance, uint8_t aMaxIpAddresses)

Sets or 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.

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.

bool
otThreadIsRouterIdAllocated(otInstance *aInstance, uint8_t aRouterId)

This function indicates whether or not a Router ID is currently allocated.

void
otThreadGetNextHopAndPathCost(otInstance *aInstance, uint16_t aDestRloc16, uint16_t *aNextHopRloc16, uint8_t *aPathCost)

This function gets the next hop and path cost towards a given RLOC16 destination.

Macros#

#define

Initializer for otChildIP6AddressIterator.

Enumeration Documentation#

otCacheEntryState#

otCacheEntryState

This enumeration defines the EID cache entry state.

Enumerator
OT_CACHE_ENTRY_STATE_CACHED
OT_CACHE_ENTRY_STATE_SNOOPED
OT_CACHE_ENTRY_STATE_QUERY
OT_CACHE_ENTRY_STATE_RETRY_QUERY

Definition at line 89 of file include/openthread/thread_ftd.h

otPowerSupply#

otPowerSupply

This enumeration represents the power supply property on a device.

This is used as a property in otDeviceProperties to calculate the leader weight.

Enumerator
OT_POWER_SUPPLY_BATTERY

Battery powered.

OT_POWER_SUPPLY_EXTERNAL

Externally powered (mains-powered).

OT_POWER_SUPPLY_EXTERNAL_STABLE

Stable external power with a battery backup or UPS.

OT_POWER_SUPPLY_EXTERNAL_UNSTABLE

Potentially unstable ext power (e.g. light bulb powered via a switch).


Definition at line 206 of file include/openthread/thread_ftd.h

otNeighborTableEvent#

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.


Definition at line 774 of file include/openthread/thread_ftd.h

Typedef Documentation#

otChildIp6AddressIterator#

typedef uint16_t otChildIp6AddressIterator

Used to iterate through IPv6 addresses of a Thread Child entry.


Definition at line 83 of file include/openthread/thread_ftd.h

otCacheEntryState#

typedef enum otCacheEntryState otCacheEntryState

This enumeration defines the EID cache entry state.


Definition at line 95 of file include/openthread/thread_ftd.h

otCacheEntryInfo#

typedef struct otCacheEntryInfo otCacheEntryInfo

This structure represents an EID cache entry.


Definition at line 112 of file include/openthread/thread_ftd.h

otCacheEntryIterator#

typedef struct otCacheEntryIterator 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).


Definition at line 124 of file include/openthread/thread_ftd.h

otDeviceProperties#

typedef struct otDeviceProperties otDeviceProperties

This structure represents the device properties which are used for calculating the local leader weight on a device.

The parameters are set based on device's capability, whether acting as border router, its power supply config, etc.

mIsUnstable indicates operational stability of device and is determined via a vendor specific mechanism. It can include the following cases:

  • Device internally detects that it loses external power supply more often than usual. What is usual is determined by the vendor.

  • Device internally detects that it reboots more often than usual. What is usual is determined by the vendor.


Definition at line 234 of file include/openthread/thread_ftd.h

otNeighborTableCallback#

typedef void(* otNeighborTableCallback) (otNeighborTableEvent aEvent, const otNeighborTableEntryInfo *aEntryInfo) )(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.


Definition at line 805 of file include/openthread/thread_ftd.h

Function Documentation#

otThreadGetMaxAllowedChildren#

uint16_t otThreadGetMaxAllowedChildren (otInstance * aInstance)

Gets 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


Definition at line 136 of file include/openthread/thread_ftd.h

otThreadSetMaxAllowedChildren#

otError otThreadSetMaxAllowedChildren (otInstance * aInstance, uint16_t aMaxChildren)

Sets the maximum number of children currently allowed.

Parameters
[in]aInstance

A pointer to an OpenThread instance.

[in]aMaxChildren

The maximum allowed children.

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

See Also


Definition at line 153 of file include/openthread/thread_ftd.h

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.


Definition at line 164 of file include/openthread/thread_ftd.h

otThreadSetRouterEligible#

otError otThreadSetRouterEligible (otInstance * aInstance, bool aEligible)

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

Parameters
[in]aInstance

A pointer to an OpenThread instance.

[in]aEligible

TRUE to configure the device as router-eligible, FALSE otherwise.

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.


Definition at line 179 of file include/openthread/thread_ftd.h

otThreadSetPreferredRouterId#

otError otThreadSetPreferredRouterId (otInstance * aInstance, uint8_t aRouterId)

Set the preferred Router Id.

Parameters
[in]aInstance

A pointer to an OpenThread instance.

[in]aRouterId

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.


Definition at line 198 of file include/openthread/thread_ftd.h

otThreadGetDeviceProperties#

const otDeviceProperties * otThreadGetDeviceProperties (otInstance * aInstance)

Get the current device properties.

Parameters
N/AaInstance

Returns

  • The device properties otDeviceProperties.


Definition at line 242 of file include/openthread/thread_ftd.h

otThreadSetDeviceProperties#

void otThreadSetDeviceProperties (otInstance * aInstance, const otDeviceProperties * aDeviceProperties)

Set the device properties which are then used to determine and set the Leader Weight.

Parameters
[in]aInstance

A pointer to an OpenThread instance.

[in]aDeviceProperties

The device properties.


Definition at line 251 of file include/openthread/thread_ftd.h

otThreadGetLocalLeaderWeight#

uint8_t otThreadGetLocalLeaderWeight (otInstance * aInstance)

Gets 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


Definition at line 264 of file include/openthread/thread_ftd.h

otThreadSetLocalLeaderWeight#

void otThreadSetLocalLeaderWeight (otInstance * aInstance, uint8_t aWeight)

Sets 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.

This function directly sets the Leader Weight to the new value, replacing its previous value (which may have been determined from the current otDeviceProperties).

See Also


Definition at line 278 of file include/openthread/thread_ftd.h

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.


Definition at line 288 of file include/openthread/thread_ftd.h

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.


Definition at line 297 of file include/openthread/thread_ftd.h

otThreadGetJoinerUdpPort#

uint16_t otThreadGetJoinerUdpPort (otInstance * aInstance)

Gets the Joiner UDP Port.

Parameters
[in]aInstance

A pointer to an OpenThread instance.

Returns

  • The Joiner UDP Port number.

See Also


Definition at line 309 of file include/openthread/thread_ftd.h

otThreadSetJoinerUdpPort#

otError otThreadSetJoinerUdpPort (otInstance * aInstance, uint16_t aJoinerUdpPort)

Sets the Joiner UDP Port.

Parameters
[in]aInstance

A pointer to an OpenThread instance.

[in]aJoinerUdpPort

The Joiner UDP Port number.

See Also


Definition at line 322 of file include/openthread/thread_ftd.h

otThreadSetSteeringData#

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

Set 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.

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


Definition at line 337 of file include/openthread/thread_ftd.h

otThreadGetContextIdReuseDelay