Google is committed to advancing racial equity for Black communities. See how.

General

This module includes functions for all Thread roles.

Summary

The Network Data Publisher provides mechanisms to limit the number of similar Service and/or Prefix (on-mesh prefix or external route) entries in the Thread Network Data by monitoring the Network Data and managing if or when to add or remove entries.

All the functions in this module require OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE to be enabled.

Enumerations

anonymous enum{
  OT_NETWORK_DIAGNOSTIC_TLV_EXT_ADDRESS = 0,
  OT_NETWORK_DIAGNOSTIC_TLV_SHORT_ADDRESS = 1,
  OT_NETWORK_DIAGNOSTIC_TLV_MODE = 2,
  OT_NETWORK_DIAGNOSTIC_TLV_TIMEOUT = 3,
  OT_NETWORK_DIAGNOSTIC_TLV_CONNECTIVITY = 4,
  OT_NETWORK_DIAGNOSTIC_TLV_ROUTE = 5,
  OT_NETWORK_DIAGNOSTIC_TLV_LEADER_DATA = 6,
  OT_NETWORK_DIAGNOSTIC_TLV_NETWORK_DATA = 7,
  OT_NETWORK_DIAGNOSTIC_TLV_IP6_ADDR_LIST = 8,
  OT_NETWORK_DIAGNOSTIC_TLV_MAC_COUNTERS = 9,
  OT_NETWORK_DIAGNOSTIC_TLV_BATTERY_LEVEL = 14,
  OT_NETWORK_DIAGNOSTIC_TLV_SUPPLY_VOLTAGE = 15,
  OT_NETWORK_DIAGNOSTIC_TLV_CHILD_TABLE = 16,
  OT_NETWORK_DIAGNOSTIC_TLV_CHANNEL_PAGES = 17,
  OT_NETWORK_DIAGNOSTIC_TLV_TYPE_LIST = 18,
  OT_NETWORK_DIAGNOSTIC_TLV_MAX_CHILD_TIMEOUT = 19
}
enum
otDeviceRole{
  OT_DEVICE_ROLE_DISABLED = 0,
  OT_DEVICE_ROLE_DETACHED = 1,
  OT_DEVICE_ROLE_CHILD = 2,
  OT_DEVICE_ROLE_ROUTER = 3,
  OT_DEVICE_ROLE_LEADER = 4
}
enum
Represents a Thread device role.
otNetDataPublisherEvent{
  OT_NETDATA_PUBLISHER_EVENT_ENTRY_ADDED = 0,
  OT_NETDATA_PUBLISHER_EVENT_ENTRY_REMOVED = 1
}
enum
This enumeration represents the events reported from the Publisher callbacks.
otRoutePreference{
  OT_ROUTE_PREFERENCE_LOW = -1,
  OT_ROUTE_PREFERENCE_MED = 0,
  OT_ROUTE_PREFERENCE_HIGH = 1
}
enum
Defines valid values for mPreference in otExternalRouteConfig and otBorderRouterConfig.

Typedefs

otBorderRouterConfig typedef
This structure represents a Border Router configuration.
otExternalRouteConfig typedef
This structure represents an External Route configuration.
otIpCounters typedef
struct otIpCounters
This structure represents the IP level counters.
otLeaderData typedef
struct otLeaderData
This structure represents the Thread Leader Data.
otLinkModeConfig typedef
This structure represents an MLE Link Mode configuration.
otMleCounters typedef
struct otMleCounters
This structure represents the Thread MLE counters.
otNeighborInfoIterator typedef
int16_t
Used to iterate through neighbor table.
otNetDataDnsSrpServicePublisherCallback)(otNetDataPublisherEvent aEvent, void *aContext) typedef
void(*
This function pointer type defines the callback used to notify when a "DNS/SRP Service" entry is added to or removed from the Thread Network Data.
otNetDataPrefixPublisherCallback)(otNetDataPublisherEvent aEvent, const otIp6Prefix *aPrefix, void *aContext) typedef
void(*
This function pointer type defines the callback used to notify when a prefix (on-mesh or external route) entry is added to or removed from the Thread Network Data.
otNetDataPublisherEvent typedef
This enumeration represents the events reported from the Publisher callbacks.
otNetworkDataIterator typedef
uint32_t
Used to iterate through Network Data information.
otNetworkDiagChildEntry typedef
This structure represents a Network Diagnostic Child Table Entry.
otNetworkDiagConnectivity typedef
This structure represents a Network Diagnostic Connectivity value.
otNetworkDiagIterator typedef
uint16_t
Used to iterate through Network Diagnostic TLV.
otNetworkDiagMacCounters typedef
This structure represents a Network Diagnostic Mac Counters value.
otNetworkDiagRoute typedef
This structure represents a Network Diagnostic Route TLV value.
otNetworkDiagRouteData typedef
This structure represents a Network Diagnostic Route data.
otNetworkDiagTlv typedef
This structure represents a Network Diagnostic TLV.
otReceiveDiagnosticGetCallback)(otError aError, otMessage *aMessage, const otMessageInfo *aMessageInfo, void *aContext) typedef
void(*
This function pointer is called when Network Diagnostic Get response is received.
otRoutePreference typedef
Defines valid values for mPreference in otExternalRouteConfig and otBorderRouterConfig.
otServerConfig typedef
This structure represents a Server configuration.
otServiceConfig typedef
This structure represents a Service configuration.
otThreadAnycastLocatorCallback)(void *aContext, otError aError, const otIp6Address *aMeshLocalAddress, uint16_t aRloc16) typedef
void(*
This function pointer type defines the callback to notify the outcome of a otThreadLocateAnycastDestination() request.
otThreadDiscoveryRequestCallback)(const otThreadDiscoveryRequestInfo *aInfo, void *aContext) typedef
void(*
This function pointer is called every time an MLE Discovery Request message is received.
otThreadDiscoveryRequestInfo typedef
This structure represents the Thread Discovery Request data.
otThreadParentResponseCallback)(otThreadParentResponseInfo *aInfo, void *aContext) typedef
void(*
This function pointer is called every time an MLE Parent Response message is received.
otThreadParentResponseInfo typedef
This structure represents the MLE Parent Response data.

Functions

otNetDataGet(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
This method provides a full or stable copy of the Partition's Thread Network Data.
otNetDataGetNextOnMeshPrefix(otInstance *aInstance, otNetworkDataIterator *aIterator, otBorderRouterConfig *aConfig)
This function gets the next On Mesh Prefix in the partition's Network Data.
otNetDataGetNextRoute(otInstance *aInstance, otNetworkDataIterator *aIterator, otExternalRouteConfig *aConfig)
This function gets the next external route in the partition's Network Data.
otNetDataGetNextService(otInstance *aInstance, otNetworkDataIterator *aIterator, otServiceConfig *aConfig)
This function gets the next service in the partition's Network Data.
otNetDataGetStableVersion(otInstance *aInstance)
uint8_t
Get the Stable Network Data Version.
otNetDataGetVersion(otInstance *aInstance)
uint8_t
Get the Network Data Version.
otNetDataIsDnsSrpServiceAdded(otInstance *aInstance)
bool
This function indicates whether or not currently the "DNS/SRP Service" entry is added to the Thread Network Data.
otNetDataIsPrefixAdded(otInstance *aInstance, const otIp6Prefix *aPrefix)
bool
This function indicates whether or not currently a published prefix entry (on-mesh or external route) is added to the Thread Network Data.
otNetDataPublishDnsSrpServiceAnycast(otInstance *aInstance, uint8_t aSequenceNUmber)
void
This function requests "DNS/SRP Service Anycast Address" to be published in the Thread Network Data.
otNetDataPublishDnsSrpServiceUnicast(otInstance *aInstance, const otIp6Address *aAddress, uint16_t aPort)
void
This function requests "DNS/SRP Service Unicast Address" to be published in the Thread Network Data.
otNetDataPublishDnsSrpServiceUnicastMeshLocalEid(otInstance *aInstance, uint16_t aPort)
void
This function requests "DNS/SRP Service Unicast Address" to be published in the Thread Network Data.
otNetDataPublishExternalRoute(otInstance *aInstance, const otExternalRouteConfig *aConfig)
This function requests an external route prefix to be published in the Thread Network Data.
otNetDataPublishOnMeshPrefix(otInstance *aInstance, const otBorderRouterConfig *aConfig)
This function requests an on-mesh prefix to be published in the Thread Network Data.
otNetDataSetDnsSrpServicePublisherCallback(otInstance *aInstance, otNetDataDnsSrpServicePublisherCallback aCallback, void *aContext)
void
This function sets a callback for notifying when a published "DNS/SRP Service" is actually added to or removed from the Thread Network Data.
otNetDataSetPrefixPublisherCallback(otInstance *aInstance, otNetDataPrefixPublisherCallback aCallback, void *aContext)
void
This function sets a callback for notifying when a published prefix entry is actually added to or removed from the Thread Network Data.
otNetDataSteeringDataCheckJoiner(otInstance *aInstance, const otExtAddress *aEui64)
Check if the steering data includes a Joiner.
otNetDataSteeringDataCheckJoinerWithDiscerner(otInstance *aInstance, const struct otJoinerDiscerner *aDiscerner)
Check if the steering data includes a Joiner with a given discerner value.
otNetDataUnpublishDnsSrpService(otInstance *aInstance)
void
This function unpublishes any previously added "DNS/SRP (Anycast or Unicast) Service" entry from the Thread Network Data.
otNetDataUnpublishPrefix(otInstance *aInstance, const otIp6Prefix *aPrefix)
This function unpublishes a previously published prefix (on-mesh or external route).
otThreadBecomeChild(otInstance *aInstance)
Attempt to reattach as a child.
otThreadBecomeDetached(otInstance *aInstance)
Detach from the Thread network.
otThreadDeviceRoleToString(otDeviceRole aRole)
const char *
Convert the device role to human-readable string.
otThreadDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aPanId, bool aJoiner, bool aEnableEui64Filtering, otHandleActiveScanResult aCallback, void *aCallbackContext)
This function starts a Thread Discovery scan.
otThreadGetChildTimeout(otInstance *aInstance)
uint32_t
Get the Thread Child Timeout used when operating in the Child role.
otThreadGetDeviceRole(otInstance *aInstance)
Get the device role.
otThreadGetDomainName(otInstance *aInstance)
const char *
Get the Thread Domain Name.
otThreadGetExtendedPanId(otInstance *aInstance)
const otExtendedPanId *
Get the IEEE 802.15.4 Extended PAN ID.
otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance)
Get the Interface Identifier manually specified for the Thread Domain Unicast Address.
otThreadGetIp6Counters(otInstance *aInstance)
const otIpCounters *
Get the IPv6 counters.
otThreadGetKeySequenceCounter(otInstance *aInstance)
uint32_t
Get the thrKeySequenceCounter.
otThreadGetKeySwitchGuardTime(otInstance *aInstance)
uint32_t
Get the thrKeySwitchGuardTime.
otThreadGetLeaderData(otInstance *aInstance, otLeaderData *aLeaderData)
This function get the Thread Leader Data.
otThreadGetLeaderRloc(otInstance *aInstance, otIp6Address *aLeaderRloc)
This function returns a pointer to the Leader's RLOC.
otThreadGetLeaderRouterId(otInstance *aInstance)
uint8_t
Get the Leader's Router ID.
otThreadGetLeaderWeight(otInstance *aInstance)
uint8_t
Get the Leader's Weight.
otThreadGetLinkLocalAllThreadNodesMulticastAddress(otInstance *aInstance)
const otIp6Address *
This function returns the Thread Link-Local All Thread Nodes multicast address.
otThreadGetLinkLocalIp6Address(otInstance *aInstance)
const otIp6Address *
This function returns the Thread link-local IPv6 address.
otThreadGetLinkMode(otInstance *aInstance)
Get the MLE Link Mode configuration.
otThreadGetMeshLocalEid(otInstance *aInstance)
const otIp6Address *
This function returns a pointer to the Mesh Local EID address.
otThreadGetMeshLocalPrefix(otInstance *aInstance)
This function returns a pointer to the Mesh Local Prefix.
otThreadGetMleCounters(otInstance *aInstance)
const otMleCounters *
Get the Thread MLE counters.
otThreadGetNetworkKey(otInstance *aInstance, otNetworkKey *aNetworkKey)
void
Get the Thread Network Key.
otThreadGetNetworkKeyRef(otInstance *aInstance)
Get the otNetworkKeyRef for Thread Network Key.
otThreadGetNetworkName(otInstance *aInstance)
const char *
Get the Thread Network Name.
otThreadGetNextDiagnosticTlv(const otMessage *aMessage, otNetworkDiagIterator *aIterator, otNetworkDiagTlv *aNetworkDiagTlv)
This function gets the next Network Diagnostic TLV in the message.
otThreadGetNextNeighborInfo(otInstance *aInstance, otNeighborInfoIterator *aIterator, otNeighborInfo *aInfo)
This function gets the next neighbor information.
otThreadGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi)
The function retrieves the average RSSI for the Thread Parent.
otThreadGetParentInfo(otInstance *aInstance, otRouterInfo *aParentInfo)
The function retrieves diagnostic information for a Thread Router as parent.
otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi)
The function retrieves the RSSI of the last packet from the Thread Parent.
otThreadGetPartitionId(otInstance *aInstance)
uint32_t
Get the Partition ID.
otThreadGetRealmLocalAllThreadNodesMulticastAddress(otInstance *aInstance)
const otIp6Address *
This function returns the Thread Realm-Local All Thread Nodes multicast address.
otThreadGetRloc(otInstance *aInstance)
const otIp6Address *
This function returns a pointer to the Thread Routing Locator (RLOC) address.
otThreadGetRloc16(otInstance *aInstance)
uint16_t
Get the RLOC16.
otThreadGetServiceAloc(otInstance *aInstance, uint8_t aServiceId, otIp6Address *aServiceAloc)
This function retrieves the Service ALOC for given Service ID.
otThreadGetVersion(void)
uint16_t
This function gets the Thread protocol version.
otThreadIsAnycastLocateInProgress(otInstance *aInstance)
bool
This function indicates whether an anycast locate request is currently in progress.
otThreadIsDiscoverInProgress(otInstance *aInstance)
bool
This function determines if an MLE Thread Discovery is currently in progress.
otThreadIsSingleton(otInstance *aInstance)
bool
This function indicates whether a node is the only router on the network.
otThreadLocateAnycastDestination(otInstance *aInstance, const otIp6Address *aAnycastAddress, otThreadAnycastLocatorCallback aCallback, void *aContext)
This function requests the closest destination of a given anycast address to be located.
otThreadRegisterParentResponseCallback(otInstance *aInstance, otThreadParentResponseCallback aCallback, void *aContext)
void
This function registers a callback to receive MLE Parent Response data.
otThreadResetIp6Counters(otInstance *aInstance)
void
Reset the IPv6 counters.
otThreadResetMleCounters(otInstance *aInstance)
void
Reset the Thread MLE counters.
otThreadSendAddressNotification(otInstance *aInstance, otIp6Address *aDestination, otIp6Address *aTarget, otIp6InterfaceIdentifier *aMlIid)
void
This function sends a Proactive Address Notification (ADDR_NTF.ntf) message.
otThreadSendDiagnosticGet(otInstance *aInstance, const otIp6Address *aDestination, const uint8_t aTlvTypes[], uint8_t aCount, otReceiveDiagnosticGetCallback aCallback, void *aCallbackContext)
Send a Network Diagnostic Get request.
otThreadSendDiagnosticReset(otInstance *aInstance, const otIp6Address *aDestination, const uint8_t aTlvTypes[], uint8_t aCount)
Send a Network Diagnostic Reset request.
otThreadSendProactiveBackboneNotification(otInstance *aInstance, otIp6Address *aTarget, otIp6InterfaceIdentifier *aMlIid, uint32_t aTimeSinceLastTransaction)
This function sends a Proactive Backbone Notification (PRO_BB.ntf) message on the Backbone link.
otThreadSetChildTimeout(otInstance *aInstance, uint32_t aTimeout)
void
Set the Thread Child Timeout used when operating in the Child role.
otThreadSetDiscoveryRequestCallback(otInstance *aInstance, otThreadDiscoveryRequestCallback aCallback, void *aContext)
void
This function sets a callback to receive MLE Discovery Request data.
otThreadSetDomainName(otInstance *aInstance, const char *aDomainName)
Set the Thread Domain Name.
otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
This function starts Thread protocol operation.
otThreadSetExtendedPanId(otInstance *aInstance, const otExtendedPanId *aExtendedPanId)
Set the IEEE 802.15.4 Extended PAN ID.
otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp6InterfaceIdentifier *aIid)
Set/Clear the Interface Identifier manually specified for the Thread Domain Unicast Address.
otThreadSetJoinerAdvertisement(otInstance *aInstance, uint32_t aOui, const uint8_t *aAdvData, uint8_t aAdvDataLength)
This method sets the Thread Joiner Advertisement when discovering Thread network.
otThreadSetKeySequenceCounter(otInstance *aInstance, uint32_t aKeySequenceCounter)
void
Set the thrKeySequenceCounter.
otThreadSetKeySwitchGuardTime(otInstance *aInstance, uint32_t aKeySwitchGuardTime)
void
Set the thrKeySwitchGuardTime.
otThreadSetLinkMode(otInstance *aInstance, otLinkModeConfig aConfig)
Set the MLE Link Mode configuration.
otThreadSetMeshLocalPrefix(otInstance *aInstance, const otMeshLocalPrefix *aMeshLocalPrefix)
This function sets the Mesh Local Prefix.
otThreadSetNetworkKey(otInstance *aInstance, const otNetworkKey *aKey)
Set the Thread Network Key.
otThreadSetNetworkKeyRef(otInstance *aInstance, otNetworkKeyRef aKeyRef)
Set the Thread Network Key as a otNetworkKeyRef.
otThreadSetNetworkName(otInstance *aInstance, const char *aNetworkName)
Set the Thread Network Name.

Structs

otBorderRouterConfig

This structure represents a Border Router configuration.

otExternalRouteConfig

This structure represents an External Route configuration.

otIpCounters

This structure represents the IP level counters.

otLeaderData

This structure represents the Thread Leader Data.

otLinkModeConfig

This structure represents an MLE Link Mode configuration.

otMleCounters

This structure represents the Thread MLE counters.

otNeighborInfo

This structure holds diagnostic information for a neighboring Thread node.

otNetworkDiagChildEntry

This structure represents a Network Diagnostic Child Table Entry.

otNetworkDiagConnectivity

This structure represents a Network Diagnostic Connectivity value.

otNetworkDiagMacCounters

This structure represents a Network Diagnostic Mac Counters value.

otNetworkDiagRoute

This structure represents a Network Diagnostic Route TLV value.

otNetworkDiagRouteData

This structure represents a Network Diagnostic Route data.

otNetworkDiagTlv

This structure represents a Network Diagnostic TLV.

otRouterInfo

This structure holds diagnostic information for a Thread Router.

otServerConfig

This structure represents a Server configuration.

otServiceConfig

This structure represents a Service configuration.

otThreadDiscoveryRequestInfo

This structure represents the Thread Discovery Request data.

otThreadParentResponseInfo

This structure represents the MLE Parent Response data.

Enumerations

otDeviceRole

 otDeviceRole

Represents a Thread device role.

Properties
OT_DEVICE_ROLE_CHILD

The Thread Child role.

OT_DEVICE_ROLE_DETACHED

Not currently participating in a Thread network/partition.

OT_DEVICE_ROLE_DISABLED

The Thread stack is disabled.

OT_DEVICE_ROLE_LEADER

The Thread Leader role.

OT_DEVICE_ROLE_ROUTER

The Thread Router role.

otNetDataPublisherEvent

 otNetDataPublisherEvent

This enumeration represents the events reported from the Publisher callbacks.

Properties
OT_NETDATA_PUBLISHER_EVENT_ENTRY_ADDED

Published entry is added to the Thread Network Data.

OT_NETDATA_PUBLISHER_EVENT_ENTRY_REMOVED

Published entry is removed from the Thread Network Data.

otRoutePreference

 otRoutePreference

Defines valid values for mPreference in otExternalRouteConfig and otBorderRouterConfig.

Properties
OT_ROUTE_PREFERENCE_HIGH

High route preference.

OT_ROUTE_PREFERENCE_LOW

Low route preference.

OT_ROUTE_PREFERENCE_MED

Medium route preference.

Typedefs

otBorderRouterConfig

struct otBorderRouterConfig otBorderRouterConfig

This structure represents a Border Router configuration.

otExternalRouteConfig

struct otExternalRouteConfig otExternalRouteConfig

This structure represents an External Route configuration.

otIpCounters

struct otIpCounters otIpCounters

This structure represents the IP level counters.

otLeaderData

struct otLeaderData otLeaderData

This structure represents the Thread Leader Data.

otLinkModeConfig

struct otLinkModeConfig otLinkModeConfig

This structure represents an MLE Link Mode configuration.

otMleCounters

struct otMleCounters otMleCounters

This structure represents the Thread MLE counters.

otNeighborInfoIterator

int16_t otNeighborInfoIterator

Used to iterate through neighbor table.

otNetDataDnsSrpServicePublisherCallback

void(* otNetDataDnsSrpServicePublisherCallback)(otNetDataPublisherEvent aEvent, void *aContext)

This function pointer type defines the callback used to notify when a "DNS/SRP Service" entry is added to or removed from the Thread Network Data.

On remove the callback is invoked independent of whether the entry is removed by Publisher (e.g., when there are too many similar entries already present in the Network Data) or through an explicit call to unpublish the entry (i.e., a call to otNetDataUnpublishDnsSrpService()).

Details
Parameters
[in] aEvent
Indicates the event (whether the entry was added or removed).
[in] aContext
A pointer to application-specific context.

otNetDataPrefixPublisherCallback

void(* otNetDataPrefixPublisherCallback)(otNetDataPublisherEvent aEvent, const otIp6Prefix *aPrefix, void *aContext)

This function pointer type defines the callback used to notify when a prefix (on-mesh or external route) entry is added to or removed from the Thread Network Data.

On remove the callback is invoked independent of whether the entry is removed by Publisher (e.g., when there are too many similar entries already present in the Network Data) or through an explicit call to unpublish the entry.

Details
Parameters
[in] aEvent
Indicates the event (whether the entry was added or removed).
[in] aPrefix
A pointer to the prefix entry.
[in] aContext
A pointer to application-specific context.

otNetDataPublisherEvent

enum otNetDataPublisherEvent otNetDataPublisherEvent

This enumeration represents the events reported from the Publisher callbacks.

otNetworkDataIterator

uint32_t otNetworkDataIterator

Used to iterate through Network Data information.

otNetworkDiagChildEntry

struct otNetworkDiagChildEntry otNetworkDiagChildEntry

This structure represents a Network Diagnostic Child Table Entry.

otNetworkDiagConnectivity

struct otNetworkDiagConnectivity otNetworkDiagConnectivity

This structure represents a Network Diagnostic Connectivity value.

otNetworkDiagIterator

uint16_t otNetworkDiagIterator

Used to iterate through Network Diagnostic TLV.

otNetworkDiagMacCounters

struct otNetworkDiagMacCounters otNetworkDiagMacCounters

This structure represents a Network Diagnostic Mac Counters value.

See RFC 2863 for definitions of member fields.

otNetworkDiagRoute

struct otNetworkDiagRoute otNetworkDiagRoute

This structure represents a Network Diagnostic Route TLV value.

otNetworkDiagRouteData

struct otNetworkDiagRouteData otNetworkDiagRouteData

This structure represents a Network Diagnostic Route data.

otNetworkDiagTlv

struct otNetworkDiagTlv otNetworkDiagTlv

This structure represents a Network Diagnostic TLV.

otReceiveDiagnosticGetCallback

void(* otReceiveDiagnosticGetCallback)(otError aError, otMessage *aMessage, const otMessageInfo *aMessageInfo, void *aContext)

This function pointer is called when Network Diagnostic Get response is received.

Details
Parameters
[in] aError
The error when failed to get the response.
[in] aMessage
A pointer to the message buffer containing the received Network Diagnostic Get response payload. Available only when aError is OT_ERROR_NONE.
[in] aMessageInfo
A pointer to the message info for aMessage. Available only when aError is OT_ERROR_NONE.
[in] aContext
A pointer to application-specific context.

otRoutePreference

enum otRoutePreference otRoutePreference

Defines valid values for mPreference in otExternalRouteConfig and otBorderRouterConfig.

otServerConfig

struct otServerConfig otServerConfig

This structure represents a Server configuration.

otServiceConfig

struct otServiceConfig otServiceConfig

This structure represents a Service configuration.

otThreadAnycastLocatorCallback

void(* otThreadAnycastLocatorCallback)(void *aContext, otError aError, const otIp6Address *aMeshLocalAddress, uint16_t aRloc16)

This function pointer type defines the callback to notify the outcome of a otThreadLocateAnycastDestination() request.

Details
Parameters
[in] aContext
A pointer to an arbitrary context (provided when callback is registered).
[in] aError
The error when handling the request. OT_ERROR_NONE indicates success. OT_ERROR_RESPONSE_TIMEOUT indicates a destination could not be found. OT_ERROR_ABORT indicates the request was aborted.
[in] aMeshLocalAddress
A pointer to the mesh-local EID of the closest destination of the anycast address when aError is OT_ERROR_NONE, NULL otherwise.
[in] aRloc16
The RLOC16 of the destination if found, otherwise invalid RLOC16 (0xfffe).

otThreadDiscoveryRequestCallback

void(* otThreadDiscoveryRequestCallback)(const otThreadDiscoveryRequestInfo *aInfo, void *aContext)

This function pointer is called every time an MLE Discovery Request message is received.

Details
Parameters
[in] aInfo
A pointer to the Discovery Request info data.
[in] aContext
A pointer to callback application-specific context.

otThreadDiscoveryRequestInfo

struct otThreadDiscoveryRequestInfo otThreadDiscoveryRequestInfo

This structure represents the Thread Discovery Request data.

otThreadParentResponseCallback

void(* otThreadParentResponseCallback)(otThreadParentResponseInfo *aInfo, void *aContext)

This function pointer is called every time an MLE Parent Response message is received.

Details
Parameters
[in] aStats
pointer to a location on stack holding the stats data.
[in] aContext
A pointer to callback client-specific context.

otThreadParentResponseInfo

struct otThreadParentResponseInfo otThreadParentResponseInfo

This structure represents the MLE Parent Response data.

Functions

otNetDataGet

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

This method provides a full or stable copy of the Partition's Thread Network Data.

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

otNetDataGetNextOnMeshPrefix

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

This function gets the next On Mesh Prefix in the partition's Network Data.

Details
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 where the On Mesh Prefix information will be placed.
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.

otNetDataGetNextRoute

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

This function gets the next external route in the partition's Network Data.

Details
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 where the External Route information will be placed.
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.

otNetDataGetNextService

otError otNetDataGetNextService(
  otInstance *aInstance,
  otNetworkDataIterator *aIterator,
  otServiceConfig *aConfig
)

This function gets the next service in the partition's Network Data.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in,out] aIterator
A pointer to the Network Data iterator context. To get the first service entry it should be set to OT_NETWORK_DATA_ITERATOR_INIT.
[out] aConfig
A pointer to where the service information will be placed.
Return Values
OT_ERROR_NONE
Successfully found the next service.
OT_ERROR_NOT_FOUND
No subsequent service exists in the partition's Network Data.

otNetDataGetStableVersion

uint8_t otNetDataGetStableVersion(
  otInstance *aInstance
)

Get the Stable Network Data Version.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The Stable Network Data Version.

otNetDataGetVersion

uint8_t otNetDataGetVersion(
  otInstance *aInstance
)

Get the Network Data Version.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The Network Data Version.

otNetDataIsDnsSrpServiceAdded

bool otNetDataIsDnsSrpServiceAdded(
  otInstance *aInstance
)

This function indicates whether or not currently the "DNS/SRP Service" entry is added to the Thread Network Data.

This function requires the feature OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE to be enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Return Values
TRUE
The published DNS/SRP Service entry is added to the Thread Network Data.
FALSE
The entry is not added to Thread Network Data or there is no entry to publish.

otNetDataIsPrefixAdded

bool otNetDataIsPrefixAdded(
  otInstance *aInstance,
  const otIp6Prefix *aPrefix
)

This function indicates whether or not currently a published prefix entry (on-mesh or external route) is added to the Thread Network Data.

This function requires the feature OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE to be enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aPrefix
A pointer to the prefix (MUST NOT be NULL).
Return Values
TRUE
The published prefix entry is added to the Thread Network Data.
FALSE
The entry is not added to Thread Network Data or there is no entry to publish.

otNetDataPublishDnsSrpServiceAnycast

void otNetDataPublishDnsSrpServiceAnycast(
  otInstance *aInstance,
  uint8_t aSequenceNUmber
)

This function requests "DNS/SRP Service Anycast Address" to be published in the Thread Network Data.

This function requires the feature OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE to be enabled.

A call to this function will remove and replace any previous "DNS/SRP Service" entry that was being published (from earlier call to any of otNetDataPublishDnsSrpService{Type}() functions).

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aSequenceNUmber
The sequence number of DNS/SRP Anycast Service.

otNetDataPublishDnsSrpServiceUnicast

void otNetDataPublishDnsSrpServiceUnicast(
  otInstance *aInstance,
  const otIp6Address *aAddress,
  uint16_t aPort
)

This function requests "DNS/SRP Service Unicast Address" to be published in the Thread Network Data.

This function requires the feature OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE to be enabled.

A call to this function will remove and replace any previous "DNS/SRP Service" entry that was being published (from earlier call to any of otNetDataPublishDnsSrpService{Type}() functions).

This function publishes the "DNS/SRP Service Unicast Address" by including the address and port info in the Service TLV data.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aAddress
The DNS/SRP server address to publish (MUST NOT be NULL).
[in] aPort
The SRP server port number to publish.

otNetDataPublishDnsSrpServiceUnicastMeshLocalEid

void otNetDataPublishDnsSrpServiceUnicastMeshLocalEid(
  otInstance *aInstance,
  uint16_t aPort
)

This function requests "DNS/SRP Service Unicast Address" to be published in the Thread Network Data.

This function requires the feature OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE to be enabled.

A call to this function will remove and replace any previous "DNS/SRP Service" entry that was being published (from earlier call to any of otNetDataPublishDnsSrpService{Type}() functions).

Unlike otNetDataPublishDnsSrpServiceUnicast() which requires the published address to be given and includes the info in the Service TLV data, this function uses the device's mesh-local EID and includes the info in the Server TLV data.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aPort
The SRP server port number to publish.

otNetDataPublishExternalRoute

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

This function requests an external route prefix to be published in the Thread Network Data.

This function requires the feature OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE to be enabled.

Only stable entries can be published (i.e.,aConfig.mStable MUST be TRUE).

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aConfig
The external route config to publish (MUST NOT be NULL).
Return Values
OT_ERROR_NONE
The external route is published successfully.
OT_ERROR_INVALID_ARGS
The aConfig is not valid (bad prefix, invalid flag combinations, or not stable).
OT_ERROR_ALREADY
An entry with the same prefix is already in the published list.
OT_ERROR_NO_BUFS
Could not allocate an entry for the new request. Publisher supports a limited number of entries (shared between on-mesh prefix and external route) determined by config OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_PREFIX_ENTRIES.

otNetDataPublishOnMeshPrefix

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

This function requests an on-mesh prefix to be published in the Thread Network Data.

This function requires the feature OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE to be enabled.

Only stable entries can be published (i.e.,aConfig.mStable MUST be TRUE).

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aConfig
The on-mesh prefix config to publish (MUST NOT be NULL).
Return Values
OT_ERROR_NONE
The on-mesh prefix is published successfully.
OT_ERROR_INVALID_ARGS
The aConfig is not valid (bad prefix, invalid flag combinations, or not stable).
OT_ERROR_ALREADY
An entry with the same prefix is already in the published list.
OT_ERROR_NO_BUFS
Could not allocate an entry for the new request. Publisher supports a limited number of entries (shared between on-mesh prefix and external route) determined by config OPENTHREAD_CONFIG_NETDATA_PUBLISHER_MAX_PREFIX_ENTRIES.

otNetDataSetDnsSrpServicePublisherCallback

void otNetDataSetDnsSrpServicePublisherCallback(
  otInstance *aInstance,
  otNetDataDnsSrpServicePublisherCallback aCallback,
  void *aContext
)

This function sets a callback for notifying when a published "DNS/SRP Service" is actually added to or removed from the Thread Network Data.

A subsequent call to this function replaces any previously set callback function.

This function requires the feature OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE to be enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aCallback
The callback function pointer (can be NULL if not needed).
[in] aContext
A pointer to application-specific context (used when aCallback is invoked).

otNetDataSetPrefixPublisherCallback

void otNetDataSetPrefixPublisherCallback(
  otInstance *aInstance,
  otNetDataPrefixPublisherCallback aCallback,
  void *aContext
)

This function sets a callback for notifying when a published prefix entry is actually added to or removed from the Thread Network Data.

A subsequent call to this function replaces any previously set callback function.

This function requires the feature OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE to be enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aCallback
The callback function pointer (can be NULL if not needed).
[in] aContext
A pointer to application-specific context (used when aCallback is invoked).

otNetDataSteeringDataCheckJoiner

otError otNetDataSteeringDataCheckJoiner(
  otInstance *aInstance,
  const otExtAddress *aEui64
)

Check if the steering data includes a Joiner.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aEui64
A pointer to the Joiner's IEEE EUI-64.
Return Values
OT_ERROR_NONE
aEui64 is included in the steering data.
OT_ERROR_INVALID_STATE
No steering data present.
OT_ERROR_NOT_FOUND
aEui64 is not included in the steering data.

otNetDataSteeringDataCheckJoinerWithDiscerner

otError otNetDataSteeringDataCheckJoinerWithDiscerner(
  otInstance *aInstance,
  const struct otJoinerDiscerner *aDiscerner
)

Check if the steering data includes a Joiner with a given discerner value.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDiscerner
A pointer to the Joiner Discerner.
Return Values
OT_ERROR_NONE
aDiscerner is included in the steering data.
OT_ERROR_INVALID_STATE
No steering data present.
OT_ERROR_NOT_FOUND
aDiscerner is not included in the steering data.

otNetDataUnpublishDnsSrpService

void otNetDataUnpublishDnsSrpService(
  otInstance *aInstance
)

This function unpublishes any previously added "DNS/SRP (Anycast or Unicast) Service" entry from the Thread Network Data.

This function requires the feature OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE to be enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.

otNetDataUnpublishPrefix

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

This function unpublishes a previously published prefix (on-mesh or external route).

This function requires the feature OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE to be enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aPrefix
The prefix to unpublish (MUST NOT be NULL).
Return Values
OT_ERROR_NONE
The prefix was unpublished successfully.
OT_ERROR_NOT_FOUND
Could not find the prefix in the published list.

otThreadBecomeChild

otError otThreadBecomeChild(
  otInstance *aInstance
)

Attempt to reattach as a child.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Return Values
OT_ERROR_NONE
Successfully begin attempt to become a child.
OT_ERROR_INVALID_STATE
Thread is disabled.

otThreadBecomeDetached

otError otThreadBecomeDetached(
  otInstance *aInstance
)

Detach from the Thread network.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Return Values
OT_ERROR_NONE
Successfully detached from the Thread network.
OT_ERROR_INVALID_STATE
Thread is disabled.

otThreadDeviceRoleToString

const char * otThreadDeviceRoleToString(
  otDeviceRole aRole
)

Convert the device role to human-readable string.

Details
Parameters
[in] aRole
The device role to convert.
Returns
A string representing aRole.

otThreadDiscover

otError otThreadDiscover(
  otInstance *aInstance,
  uint32_t aScanChannels,
  uint16_t aPanId,
  bool aJoiner,
  bool aEnableEui64Filtering,
  otHandleActiveScanResult aCallback,
  void *aCallbackContext
)

This function starts a Thread Discovery scan.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aScanChannels
A bit vector indicating which channels to scan (e.g. OT_CHANNEL_11_MASK).
[in] aPanId
The PAN ID filter (set to Broadcast PAN to disable filter).
[in] aJoiner
Value of the Joiner Flag in the Discovery Request TLV.
[in] aEnableEui64Filtering
TRUE to filter responses on EUI-64, FALSE otherwise.
[in] aCallback
A pointer to a function called on receiving an MLE Discovery Response or scan completes.
[in] aCallbackContext
A pointer to application-specific context.
Return Values
OT_ERROR_NONE
Successfully started a Thread Discovery Scan.
OT_ERROR_INVALID_STATE
The IPv6 interface is not enabled (netif is not up).
OT_ERROR_NO_BUFS
Could not allocate message for Discovery Request.
OT_ERROR_BUSY
Thread Discovery Scan is already in progress.

otThreadGetChildTimeout

uint32_t otThreadGetChildTimeout(
  otInstance *aInstance
)

Get the Thread Child Timeout used when operating in the Child role.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The Thread Child Timeout value in seconds.
See also:
otThreadSetChildTimeout

otThreadGetDeviceRole

otDeviceRole otThreadGetDeviceRole(
  otInstance *aInstance
)

Get the device role.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Return Values
OT_DEVICE_ROLE_DISABLED
The Thread stack is disabled.
OT_DEVICE_ROLE_DETACHED
The device is not currently participating in a Thread network/partition.
OT_DEVICE_ROLE_CHILD
The device is currently operating as a Thread Child.
OT_DEVICE_ROLE_ROUTER
The device is currently operating as a Thread Router.
OT_DEVICE_ROLE_LEADER
The device is currently operating as a Thread Leader.

otThreadGetDomainName

const char * otThreadGetDomainName(
  otInstance *aInstance
)

Get the Thread Domain Name.

This function is only available since Thread 1.2.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the Thread Domain Name.
See also:
otThreadSetDomainName

otThreadGetExtendedPanId

const otExtendedPanId * otThreadGetExtendedPanId(
  otInstance *aInstance
)

Get the IEEE 802.15.4 Extended PAN ID.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the IEEE 802.15.4 Extended PAN ID.
See also:
otThreadSetExtendedPanId

otThreadGetFixedDuaInterfaceIdentifier

const otIp6InterfaceIdentifier * otThreadGetFixedDuaInterfaceIdentifier(
  otInstance *aInstance
)

Get the Interface Identifier manually specified for the Thread Domain Unicast Address.

This function is only available since Thread 1.2 when OPENTHREAD_CONFIG_DUA_ENABLE is enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the Interface Identifier which was set manually, or NULL if none was set.
See also:
otThreadSetFixedDuaInterfaceIdentifier

otThreadGetIp6Counters

const otIpCounters * otThreadGetIp6Counters(
  otInstance *aInstance
)

Get the IPv6 counters.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the IPv6 counters.

otThreadGetKeySequenceCounter

uint32_t otThreadGetKeySequenceCounter(
  otInstance *aInstance
)

Get the thrKeySequenceCounter.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The thrKeySequenceCounter value.
See also:
otThreadSetKeySequenceCounter

otThreadGetKeySwitchGuardTime

uint32_t otThreadGetKeySwitchGuardTime(
  otInstance *aInstance
)

Get the thrKeySwitchGuardTime.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The thrKeySwitchGuardTime value (in hours).
See also:
otThreadSetKeySwitchGuardTime

otThreadGetLeaderData

otError otThreadGetLeaderData(
  otInstance *aInstance,
  otLeaderData *aLeaderData
)

This function get the Thread Leader Data.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aLeaderData
A pointer to where the leader data is placed.
Return Values
OT_ERROR_NONE
Successfully retrieved the leader data.
OT_ERROR_DETACHED
Not currently attached.

otThreadGetLeaderRloc

otError otThreadGetLeaderRloc(
  otInstance *aInstance,
  otIp6Address *aLeaderRloc
)

This function returns a pointer to the Leader's RLOC.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aLeaderRloc
A pointer to the Leader's RLOC.
Return Values
OT_ERROR_NONE
The Leader's RLOC was successfully written to aLeaderRloc.
OT_ERROR_INVALID_ARGS
aLeaderRloc was NULL.
OT_ERROR_DETACHED
Not currently attached to a Thread Partition.

otThreadGetLeaderRouterId

uint8_t otThreadGetLeaderRouterId(
  otInstance *aInstance
)

Get the Leader's Router ID.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The Leader's Router ID.

otThreadGetLeaderWeight

uint8_t otThreadGetLeaderWeight(
  otInstance *aInstance
)

Get the Leader's Weight.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The Leader's Weight.

otThreadGetLinkLocalAllThreadNodesMulticastAddress

const otIp6Address * otThreadGetLinkLocalAllThreadNodesMulticastAddress(
  otInstance *aInstance
)

This function returns the Thread Link-Local All Thread Nodes multicast address.

The address is a link-local Unicast Prefix-Based Multcast Address [RFC 3306], with:

  • flgs set to 3 (P = 1 and T = 1)
  • scop set to 2
  • plen set to 64
  • network prefix set to the Mesh Local Prefix
  • group ID set to 1

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to Thread Link-Local All Thread Nodes multicast address.

otThreadGetLinkLocalIp6Address

const otIp6Address * otThreadGetLinkLocalIp6Address(
  otInstance *aInstance
)

This function returns the Thread link-local IPv6 address.

The Thread link local address is derived using IEEE802.15.4 Extended Address as Interface Identifier.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to Thread link-local IPv6 address.

otThreadGetLinkMode

otLinkModeConfig otThreadGetLinkMode(
  otInstance *aInstance
)

Get the MLE Link Mode configuration.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The MLE Link Mode configuration.
See also:
otThreadSetLinkMode

otThreadGetMeshLocalEid

const otIp6Address * otThreadGetMeshLocalEid(
  otInstance *aInstance
)

This function returns a pointer to the Mesh Local EID address.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the Mesh Local EID address.

otThreadGetMeshLocalPrefix

const otMeshLocalPrefix * otThreadGetMeshLocalPrefix(
  otInstance *aInstance
)

This function returns a pointer to the Mesh Local Prefix.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the Mesh Local Prefix.

otThreadGetMleCounters

const otMleCounters * otThreadGetMleCounters(
  otInstance *aInstance
)

Get the Thread MLE counters.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the Thread MLE counters.

otThreadGetNetworkKey

void otThreadGetNetworkKey(
  otInstance *aInstance,
  otNetworkKey *aNetworkKey
)

Get the Thread Network Key.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aNetworkKey
A pointer to an otNetworkkey to return the Thread Network Key.
See also:
otThreadSetNetworkKey

otThreadGetNetworkKeyRef

otNetworkKeyRef otThreadGetNetworkKeyRef(
  otInstance *aInstance
)

Get the otNetworkKeyRef for Thread Network Key.

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

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
Reference to the Thread Network Key stored in memory.
See also:
otThreadSetNetworkKeyRef

otThreadGetNetworkName

const char * otThreadGetNetworkName(
  otInstance *aInstance
)

Get the Thread Network Name.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the Thread Network Name.
See also:
otThreadSetNetworkName

otThreadGetNextDiagnosticTlv

otError otThreadGetNextDiagnosticTlv(
  const otMessage *aMessage,
  otNetworkDiagIterator *aIterator,
  otNetworkDiagTlv *aNetworkDiagTlv
)

This function gets the next Network Diagnostic TLV in the message.

A subsequent call to this function is allowed only when current return value is OT_ERROR_NONE.

Details
Parameters
[in] aMessage
A pointer to a message.
[in,out] aIterator
A pointer to the Network Diagnostic iterator context. To get the first Network Diagnostic TLV it should be set to OT_NETWORK_DIAGNOSTIC_ITERATOR_INIT.
[out] aNetworkDiagTlv
A pointer to where the Network Diagnostic TLV information will be placed.
Return Values
OT_ERROR_NONE
Successfully found the next Network Diagnostic TLV.
OT_ERROR_NOT_FOUND
No subsequent Network Diagnostic TLV exists in the message.
OT_ERROR_PARSE
Parsing the next Network Diagnostic failed.

otThreadGetNextNeighborInfo

otError otThreadGetNextNeighborInfo(
  otInstance *aInstance,
  otNeighborInfoIterator *aIterator,
  otNeighborInfo *aInfo
)

This function gets the next neighbor information.

It is used to go through the entries of the neighbor table.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in,out] aIterator
A pointer to the iterator context. To get the first neighbor entry it should be set to OT_NEIGHBOR_INFO_ITERATOR_INIT.
[out] aInfo
A pointer to the neighbor information.
Return Values
OT_ERROR_NONE
Successfully found the next neighbor entry in table.
OT_ERROR_NOT_FOUND
No subsequent neighbor entry exists in the table.
OT_ERROR_INVALID_ARGS
aIterator or aInfo was NULL.

otThreadGetParentAverageRssi

otError otThreadGetParentAverageRssi(
  otInstance *aInstance,
  int8_t *aParentRssi
)

The function retrieves the average RSSI for the Thread Parent.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aParentRssi
A pointer to where the parent RSSI should be placed.

otThreadGetParentInfo

otError otThreadGetParentInfo(
  otInstance *aInstance,
  otRouterInfo *aParentInfo
)

The function retrieves diagnostic information for a Thread Router as parent.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aParentInfo
A pointer to where the parent router information is placed.

otThreadGetParentLastRssi

otError otThreadGetParentLastRssi(
  otInstance *aInstance,
  int8_t *aLastRssi
)

The function retrieves the RSSI of the last packet from the Thread Parent.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aLastRssi
A pointer to where the last RSSI should be placed.
Return Values
OT_ERROR_NONE
Successfully retrieved the RSSI data.
OT_ERROR_FAILED
Unable to get RSSI data.
OT_ERROR_INVALID_ARGS
aLastRssi is NULL.

otThreadGetPartitionId

uint32_t otThreadGetPartitionId(
  otInstance *aInstance
)

Get the Partition ID.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The Partition ID.

otThreadGetRealmLocalAllThreadNodesMulticastAddress

const otIp6Address * otThreadGetRealmLocalAllThreadNodesMulticastAddress(
  otInstance *aInstance
)

This function returns the Thread Realm-Local All Thread Nodes multicast address.

The address is a realm-local Unicast Prefix-Based Multcast Address [RFC 3306], with:

  • flgs set to 3 (P = 1 and T = 1)
  • scop set to 3
  • plen set to 64
  • network prefix set to the Mesh Local Prefix
  • group ID set to 1

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to Thread Realm-Local All Thread Nodes multicast address.

otThreadGetRloc

const otIp6Address * otThreadGetRloc(
  otInstance *aInstance
)

This function returns a pointer to the Thread Routing Locator (RLOC) address.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
A pointer to the Thread Routing Locator (RLOC) address.

otThreadGetRloc16

uint16_t otThreadGetRloc16(
  otInstance *aInstance
)

Get the RLOC16.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The RLOC16.

otThreadGetServiceAloc

otError otThreadGetServiceAloc(
  otInstance *aInstance,
  uint8_t aServiceId,
  otIp6Address *aServiceAloc
)

This function retrieves the Service ALOC for given Service ID.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aServiceId
Service ID to get ALOC for.
[out] aServiceAloc
A pointer to output the Service ALOC. MUST NOT BE NULL.
Return Values
OT_ERROR_NONE
Successfully retrieved the Service ALOC.
OT_ERROR_DETACHED
The Thread interface is not currently attached to a Thread Partition.

otThreadGetVersion

uint16_t otThreadGetVersion(
  void
)

This function gets the Thread protocol version.

Details
Returns
the Thread protocol version.

otThreadIsAnycastLocateInProgress

bool otThreadIsAnycastLocateInProgress(
  otInstance *aInstance
)

This function indicates whether an anycast locate request is currently in progress.

This function is only available when OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE is enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
TRUE if an anycast locate request is currently in progress, FALSE otherwise.

otThreadIsDiscoverInProgress

bool otThreadIsDiscoverInProgress(
  otInstance *aInstance
)

This function determines if an MLE Thread Discovery is currently in progress.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.

otThreadIsSingleton

bool otThreadIsSingleton(
  otInstance *aInstance
)

This function indicates whether a node is the only router on the network.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Return Values
TRUE
It is the only router in the network.
FALSE
It is a child or is not a single router in the network.

otThreadLocateAnycastDestination

otError otThreadLocateAnycastDestination(
  otInstance *aInstance,
  const otIp6Address *aAnycastAddress,
  otThreadAnycastLocatorCallback aCallback,
  void *aContext
)

This function requests the closest destination of a given anycast address to be located.

This function is only available when OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE is enabled.

If a previous request is ongoing, a subsequent call to this function will cancel and replace the earlier request.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aAnycastAddress
The anycast address to locate. MUST NOT be NULL.
[in] aCallback
The callback function to report the result.
[in] aContext
An arbitrary context used with aCallback.
Return Values
OT_ERROR_NONE
The request started successfully. aCallback will be invoked to report the result.
OT_ERROR_INVALID_ARGS
The aAnycastAddress is not a valid anycast address or aCallback is NULL.
OT_ERROR_NO_BUFS
Out of buffer to prepare and send the request message.

otThreadRegisterParentResponseCallback

void otThreadRegisterParentResponseCallback(
  otInstance *aInstance,
  otThreadParentResponseCallback aCallback,
  void *aContext
)

This function registers a callback to receive MLE Parent Response data.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aCallback
A pointer to a function that is called upon receiving an MLE Parent Response message.
[in] aContext
A pointer to callback client-specific context.

otThreadResetIp6Counters

void otThreadResetIp6Counters(
  otInstance *aInstance
)

Reset the IPv6 counters.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.

otThreadResetMleCounters

void otThreadResetMleCounters(
  otInstance *aInstance
)

Reset the Thread MLE counters.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.

otThreadSendAddressNotification

void otThreadSendAddressNotification(
  otInstance *aInstance,
  otIp6Address *aDestination,
  otIp6Address *aTarget,
  otIp6InterfaceIdentifier *aMlIid
)

This function sends a Proactive Address Notification (ADDR_NTF.ntf) message.

This function is only available when OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE is enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDestination
The destination to send the ADDR_NTF.ntf message.
[in] aTarget
The target address of the ADDR_NTF.ntf message.
[in] aMlIid
The ML-IID of the ADDR_NTF.ntf message.

otThreadSendDiagnosticGet

otError otThreadSendDiagnosticGet(
  otInstance *aInstance,
  const otIp6Address *aDestination,
  const uint8_t aTlvTypes[],
  uint8_t aCount,
  otReceiveDiagnosticGetCallback aCallback,
  void *aCallbackContext
)

Send a Network Diagnostic Get request.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDestination
A pointer to destination address.
[in] aTlvTypes
An array of Network Diagnostic TLV types.
[in] aCount
Number of types in aTlvTypes.
[in] aCallback
A pointer to a function that is called when Network Diagnostic Get response is received or NULL to disable the callback.
[in] aCallbackContext
A pointer to application-specific context.
Return Values
OT_ERROR_NONE
Successfully queued the DIAG_GET.req.
OT_ERROR_NO_BUFS
Insufficient message buffers available to send DIAG_GET.req.

otThreadSendDiagnosticReset

otError otThreadSendDiagnosticReset(
  otInstance *aInstance,
  const otIp6Address *aDestination,
  const uint8_t aTlvTypes[],
  uint8_t aCount
)

Send a Network Diagnostic Reset request.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDestination
A pointer to destination address.
[in] aTlvTypes
An array of Network Diagnostic TLV types. Currently only Type 9 is allowed.
[in] aCount
Number of types in aTlvTypes
Return Values
OT_ERROR_NONE
Successfully queued the DIAG_RST.ntf.
OT_ERROR_NO_BUFS
Insufficient message buffers available to send DIAG_RST.ntf.

otThreadSendProactiveBackboneNotification

otError otThreadSendProactiveBackboneNotification(
  otInstance *aInstance,
  otIp6Address *aTarget,
  otIp6InterfaceIdentifier *aMlIid,
  uint32_t aTimeSinceLastTransaction
)

This function sends a Proactive Backbone Notification (PRO_BB.ntf) message on the Backbone link.

This function is only available when OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE is enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aTarget
The target address of the PRO_BB.ntf message.
[in] aMlIid
The ML-IID of the PRO_BB.ntf message.
[in] aTimeSinceLastTransaction
Time since last transaction (in seconds).
Return Values
OT_ERROR_NONE
Successfully sent PRO_BB.ntf on backbone link.
OT_ERROR_NO_BUFS
If insufficient message buffers available.

otThreadSetChildTimeout

void otThreadSetChildTimeout(
  otInstance *aInstance,
  uint32_t aTimeout
)

Set the Thread Child Timeout used when operating in the Child role.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aTimeout
The timeout value in seconds.
See also:
otThreadGetChildTimeout

otThreadSetDiscoveryRequestCallback

void otThreadSetDiscoveryRequestCallback(
  otInstance *aInstance,
  otThreadDiscoveryRequestCallback aCallback,
  void *aContext
)

This function sets a callback to receive MLE Discovery Request data.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aCallback
A pointer to a function that is called upon receiving an MLE Discovery Request message.
[in] aContext
A pointer to callback application-specific context.

otThreadSetDomainName

otError otThreadSetDomainName(
  otInstance *aInstance,
  const char *aDomainName
)

Set the Thread Domain Name.

This function is only available since Thread 1.2. This function succeeds only when Thread protocols are disabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDomainName
A pointer to the Thread Domain Name.
Return Values
OT_ERROR_NONE
Successfully set the Thread Domain Name.
OT_ERROR_INVALID_STATE
Thread protocols are enabled.
See also:
otThreadGetDomainName

otThreadSetEnabled

otError otThreadSetEnabled(
  otInstance *aInstance,
  bool aEnabled
)

This function starts Thread protocol operation.

The interface must be up when calling this function.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aEnabled
TRUE if Thread is enabled, FALSE otherwise.
Return Values
OT_ERROR_NONE
Successfully started Thread protocol operation.
OT_ERROR_INVALID_STATE
The network interface was not not up.

otThreadSetExtendedPanId

otError otThreadSetExtendedPanId(
  otInstance *aInstance,
  const otExtendedPanId *aExtendedPanId
)

Set the IEEE 802.15.4 Extended PAN ID.

This function can only be called while Thread protocols are disabled. A successful call to this function invalidates the Active and Pending Operational Datasets in non-volatile memory.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aExtendedPanId
A pointer to the IEEE 802.15.4 Extended PAN ID.
Return Values
OT_ERROR_NONE
Successfully set the Extended PAN ID.
OT_ERROR_INVALID_STATE
Thread protocols are enabled.
See also:
otThreadGetExtendedPanId

otThreadSetFixedDuaInterfaceIdentifier

otError otThreadSetFixedDuaInterfaceIdentifier(
  otInstance *aInstance,
  const otIp6InterfaceIdentifier *aIid
)

Set/Clear the Interface Identifier manually specified for the Thread Domain Unicast Address.

This function is only available since Thread 1.2 when OPENTHREAD_CONFIG_DUA_ENABLE is enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aIid
A pointer to the Interface Identifier to set or NULL to clear.
Return Values
OT_ERROR_NONE
Successfully set/cleared the Interface Identifier.
OT_ERROR_INVALID_ARGS
The specified Interface Identifier is reserved.
See also:
otThreadGetFixedDuaInterfaceIdentifier

otThreadSetJoinerAdvertisement

otError otThreadSetJoinerAdvertisement(
  otInstance *aInstance,
  uint32_t aOui,
  const uint8_t *aAdvData,
  uint8_t aAdvDataLength
)

This method sets the Thread Joiner Advertisement when discovering Thread network.

Thread Joiner Advertisement is used to allow a Joiner to advertise its own application-specific information (such as Vendor ID, Product ID, Discriminator, etc.) via a newly-proposed Joiner Advertisement TLV, and to make this information available to Commissioners or Commissioner Candidates without human interaction.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aOui
The Vendor IEEE OUI value that will be included in the Joiner Advertisement. Only the least significant 3 bytes will be used, and the most significant byte will be ignored.
[in] aAdvData
A pointer to the AdvData that will be included in the Joiner Advertisement.
[in] aAdvDataLength
The length of AdvData in bytes.
Return Values
OT_ERROR_NONE
Successfully set Joiner Advertisement.
OT_ERROR_INVALID_ARGS
Invalid AdvData.

otThreadSetKeySequenceCounter

void otThreadSetKeySequenceCounter(
  otInstance *aInstance,
  uint32_t aKeySequenceCounter
)

Set the thrKeySequenceCounter.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aKeySequenceCounter
The thrKeySequenceCounter value.
See also:
otThreadGetKeySequenceCounter

otThreadSetKeySwitchGuardTime

void otThreadSetKeySwitchGuardTime(
  otInstance *aInstance,
  uint32_t aKeySwitchGuardTime
)

Set the thrKeySwitchGuardTime.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aKeySwitchGuardTime
The thrKeySwitchGuardTime value (in hours).
See also:
otThreadGetKeySwitchGuardTime

otThreadSetLinkMode

otError otThreadSetLinkMode(
  otInstance *aInstance,
  otLinkModeConfig aConfig
)

Set the MLE Link Mode configuration.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aConfig
A pointer to the Link Mode configuration.
Return Values
OT_ERROR_NONE
Successfully set the MLE Link Mode configuration.
See also:
otThreadGetLinkMode

otThreadSetMeshLocalPrefix

otError otThreadSetMeshLocalPrefix(
  otInstance *aInstance,
  const otMeshLocalPrefix *aMeshLocalPrefix
)

This function sets the Mesh Local Prefix.

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

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aMeshLocalPrefix
A pointer to the Mesh Local Prefix.
Return Values
OT_ERROR_NONE
Successfully set the Mesh Local Prefix.
OT_ERROR_INVALID_STATE
Thread protocols are enabled.

otThreadSetNetworkKey

otError otThreadSetNetworkKey(
  otInstance *aInstance,
  const otNetworkKey *aKey
)

Set the Thread Network Key.

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

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aKey
A pointer to a buffer containing the Thread Network Key.
Return Values
OT_ERROR_NONE
Successfully set the Thread Network Key.
OT_ERROR_INVALID_STATE
Thread protocols are enabled.
See also:
otThreadGetNetworkKey

otThreadSetNetworkKeyRef

otError otThreadSetNetworkKeyRef(
  otInstance *aInstance,
  otNetworkKeyRef aKeyRef
)

Set the Thread Network Key as a otNetworkKeyRef.

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

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

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aKeyRef
Reference to the Thread Network Key.
Return Values
OT_ERROR_NONE
Successfully set the Thread Network Key.
OT_ERROR_INVALID_STATE
Thread protocols are enabled.
See also:
otThreadGetNetworkKeyRef

otThreadSetNetworkName

otError otThreadSetNetworkName(
  otInstance *aInstance,
  const char *aNetworkName
)

Set the Thread Network Name.

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

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aNetworkName
A pointer to the Thread Network Name.
Return Values
OT_ERROR_NONE
Successfully set the Thread Network Name.
OT_ERROR_INVALID_STATE
Thread protocols are enabled.
See also:
otThreadGetNetworkName

Macros

OT_JOINER_ADVDATA_MAX_LENGTH

 OT_JOINER_ADVDATA_MAX_LENGTH 64

Maximum AdvData Length of Joiner Advertisement.

OT_NEIGHBOR_INFO_ITERATOR_INIT

 OT_NEIGHBOR_INFO_ITERATOR_INIT 0

Initializer for otNeighborInfoIterator.

OT_NETWORK_BASE_TLV_MAX_LENGTH

 OT_NETWORK_BASE_TLV_MAX_LENGTH 254

Maximum value length of Thread Base TLV.

OT_NETWORK_DATA_ITERATOR_INIT

 OT_NETWORK_DATA_ITERATOR_INIT 0

Value to initialize otNetworkDataIterator.

OT_NETWORK_DIAGNOSTIC_CHILD_TABLE_ENTRY_SIZE

 OT_NETWORK_DIAGNOSTIC_CHILD_TABLE_ENTRY_SIZE 3

Size of Network Diagnostic Child Table entry.

OT_NETWORK_DIAGNOSTIC_ITERATOR_INIT

 OT_NETWORK_DIAGNOSTIC_ITERATOR_INIT 0

Initializer for otNetworkDiagIterator.

OT_NETWORK_DIAGNOSTIC_TYPELIST_MAX_ENTRIES

 OT_NETWORK_DIAGNOSTIC_TYPELIST_MAX_ENTRIES 19

Maximum Number of Network Diagnostic TLV Types to Request or Reset.

OT_NETWORK_MAX_ROUTER_ID

 OT_NETWORK_MAX_ROUTER_ID 62

Maximum Router ID.

OT_SERVER_DATA_MAX_SIZE

 OT_SERVER_DATA_MAX_SIZE 248

Max size of Server Data in bytes. Theoretical limit, practically much lower.

OT_SERVICE_DATA_MAX_SIZE

 OT_SERVICE_DATA_MAX_SIZE 252

Max size of Service Data in bytes.