Operational Dataset

Includes functions for the Operational Dataset API.

Summary

For FTD builds only, Dataset Updater includes functions to manage dataset updates.

For FTD and MTD builds, the Operational Dataset API includes functions to manage Active and Pending datasets and dataset TLVs.

Enumerations

otMeshcopTlvType{
  OT_MESHCOP_TLV_CHANNEL = 0,
  OT_MESHCOP_TLV_PANID = 1,
  OT_MESHCOP_TLV_EXTPANID = 2,
  OT_MESHCOP_TLV_NETWORKNAME = 3,
  OT_MESHCOP_TLV_PSKC = 4,
  OT_MESHCOP_TLV_NETWORKKEY = 5,
  OT_MESHCOP_TLV_NETWORK_KEY_SEQUENCE = 6,
  OT_MESHCOP_TLV_MESHLOCALPREFIX = 7,
  OT_MESHCOP_TLV_STEERING_DATA = 8,
  OT_MESHCOP_TLV_BORDER_AGENT_RLOC = 9,
  OT_MESHCOP_TLV_COMMISSIONER_ID = 10,
  OT_MESHCOP_TLV_COMM_SESSION_ID = 11,
  OT_MESHCOP_TLV_SECURITYPOLICY = 12,
  OT_MESHCOP_TLV_GET = 13,
  OT_MESHCOP_TLV_ACTIVETIMESTAMP = 14,
  OT_MESHCOP_TLV_COMMISSIONER_UDP_PORT = 15,
  OT_MESHCOP_TLV_STATE = 16,
  OT_MESHCOP_TLV_JOINER_DTLS = 17,
  OT_MESHCOP_TLV_JOINER_UDP_PORT = 18,
  OT_MESHCOP_TLV_JOINER_IID = 19,
  OT_MESHCOP_TLV_JOINER_RLOC = 20,
  OT_MESHCOP_TLV_JOINER_ROUTER_KEK = 21,
  OT_MESHCOP_TLV_PROVISIONING_URL = 32,
  OT_MESHCOP_TLV_VENDOR_NAME_TLV = 33,
  OT_MESHCOP_TLV_VENDOR_MODEL_TLV = 34,
  OT_MESHCOP_TLV_VENDOR_SW_VERSION_TLV = 35,
  OT_MESHCOP_TLV_VENDOR_DATA_TLV = 36,
  OT_MESHCOP_TLV_VENDOR_STACK_VERSION_TLV = 37,
  OT_MESHCOP_TLV_UDP_ENCAPSULATION_TLV = 48,
  OT_MESHCOP_TLV_IPV6_ADDRESS_TLV = 49,
  OT_MESHCOP_TLV_PENDINGTIMESTAMP = 51,
  OT_MESHCOP_TLV_DELAYTIMER = 52,
  OT_MESHCOP_TLV_CHANNELMASK = 53,
  OT_MESHCOP_TLV_COUNT = 54,
  OT_MESHCOP_TLV_PERIOD = 55,
  OT_MESHCOP_TLV_SCAN_DURATION = 56,
  OT_MESHCOP_TLV_ENERGY_LIST = 57,
  OT_MESHCOP_TLV_THREAD_DOMAIN_NAME = 59,
  OT_MESHCOP_TLV_WAKEUP_CHANNEL = 74,
  OT_MESHCOP_TLV_DISCOVERYREQUEST = 128,
  OT_MESHCOP_TLV_DISCOVERYRESPONSE = 129,
  OT_MESHCOP_TLV_JOINERADVERTISEMENT = 241
}
enum
Represents meshcop TLV types.

Typedefs

otChannelMask typedef
uint32_t
Represents Channel Mask.
otDatasetMgmtSetCallback)(otError aResult, void *aContext) typedef
void(*
Pointer is called when a response to a MGMT_SET request is received or times out.
otDatasetUpdaterCallback)(otError aError, void *aContext) typedef
void(*
This callback function pointer is called when a Dataset update request finishes, reporting success or failure status of the Dataset update request.
otExtendedPanId typedef
Represents an Extended PAN ID.
otMeshLocalPrefix typedef
Represents a Mesh Local Prefix.
otMeshcopTlvType typedef
Represents meshcop TLV types.
otNetworkKey typedef
struct otNetworkKey
Represents a Thread Network Key.
otNetworkKeyRef typedef
This datatype represents KeyRef to NetworkKey.
otNetworkName typedef
struct otNetworkName
Represents a Network Name.
otOperationalDataset typedef
Represents an Active or Pending Operational Dataset.
otOperationalDatasetComponents typedef
Represents presence of different components in Active or Pending Operational Dataset.
otOperationalDatasetTlvs typedef
Represents an Active or Pending Operational Dataset.
otPskc typedef
struct otPskc
Represents a PSKc.
otPskcRef typedef
This datatype represents KeyRef to PSKc.
otSecurityPolicy typedef
Represent Security Policy.
otTimestamp typedef
struct otTimestamp
Represents a Thread Dataset timestamp component.

Variables

OT_TOOL_PACKED_END

Functions

otDatasetConvertToTlvs(const otOperationalDataset *aDataset, otOperationalDatasetTlvs *aDatasetTlvs)
void
Converts a given Operational Dataset to otOperationalDatasetTlvs.
otDatasetCreateNewNetwork(otInstance *aInstance, otOperationalDataset *aDataset)
For FTD only, creates a new Operational Dataset to use when forming a new network.
otDatasetGeneratePskc(const char *aPassPhrase, const otNetworkName *aNetworkName, const otExtendedPanId *aExtPanId, otPskc *aPskc)
Generates PSKc from a given pass-phrase, network name, and extended PAN ID.
otDatasetGetActive(otInstance *aInstance, otOperationalDataset *aDataset)
Gets the Active Operational Dataset.
otDatasetGetActiveTlvs(otInstance *aInstance, otOperationalDatasetTlvs *aDataset)
Gets the Active Operational Dataset.
otDatasetGetDelayTimerMinimal(otInstance *aInstance)
uint32_t
For FTD only, gets a minimal delay timer.
otDatasetGetPending(otInstance *aInstance, otOperationalDataset *aDataset)
Gets the Pending Operational Dataset.
otDatasetGetPendingTlvs(otInstance *aInstance, otOperationalDatasetTlvs *aDataset)
Gets the Pending Operational Dataset.
otDatasetIsCommissioned(otInstance *aInstance)
bool
Indicates whether a valid network is present in the Active Operational Dataset or not.
otDatasetParseTlvs(const otOperationalDatasetTlvs *aDatasetTlvs, otOperationalDataset *aDataset)
Parses an Operational Dataset from a given otOperationalDatasetTlvs.
otDatasetSendMgmtActiveGet(otInstance *aInstance, const otOperationalDatasetComponents *aDatasetComponents, const uint8_t *aTlvTypes, uint8_t aLength, const otIp6Address *aAddress)
Sends MGMT_ACTIVE_GET.
otDatasetSendMgmtActiveSet(otInstance *aInstance, const otOperationalDataset *aDataset, const uint8_t *aTlvs, uint8_t aLength, otDatasetMgmtSetCallback aCallback, void *aContext)
Sends MGMT_ACTIVE_SET.
otDatasetSendMgmtPendingGet(otInstance *aInstance, const otOperationalDatasetComponents *aDatasetComponents, const uint8_t *aTlvTypes, uint8_t aLength, const otIp6Address *aAddress)
Sends MGMT_PENDING_GET.
otDatasetSendMgmtPendingSet(otInstance *aInstance, const otOperationalDataset *aDataset, const uint8_t *aTlvs, uint8_t aLength, otDatasetMgmtSetCallback aCallback, void *aContext)
Sends MGMT_PENDING_SET.
otDatasetSetActive(otInstance *aInstance, const otOperationalDataset *aDataset)
Sets the Active Operational Dataset.
otDatasetSetActiveTlvs(otInstance *aInstance, const otOperationalDatasetTlvs *aDataset)
Sets the Active Operational Dataset.
otDatasetSetDelayTimerMinimal(otInstance *aInstance, uint32_t aDelayTimerMinimal)
For FTD only, sets a minimal delay timer.
otDatasetSetPending(otInstance *aInstance, const otOperationalDataset *aDataset)
Sets the Pending Operational Dataset.
otDatasetSetPendingTlvs(otInstance *aInstance, const otOperationalDatasetTlvs *aDataset)
Sets the Pending Operational Dataset.
otDatasetUpdateTlvs(const otOperationalDataset *aDataset, otOperationalDatasetTlvs *aDatasetTlvs)
Updates a given Operational Dataset.
otDatasetUpdaterCancelUpdate(otInstance *aInstance)
void
Cancels an ongoing (if any) Operational Dataset update request.
otDatasetUpdaterIsUpdateOngoing(otInstance *aInstance)
bool
Indicates whether there is an ongoing Operation Dataset update request.
otDatasetUpdaterRequestUpdate(otInstance *aInstance, const otOperationalDataset *aDataset, otDatasetUpdaterCallback aCallback, void *aContext)
Requests an update to Operational Dataset.
otNetworkNameFromString(otNetworkName *aNetworkName, const char *aNameString)
Sets an otNetworkName instance from a given null terminated C string.

Macros

OT_CHANNEL_10_MASK (1 << 10)
Channel 10.
OT_CHANNEL_11_MASK (1 << 11)
Channel 11.
OT_CHANNEL_12_MASK (1 << 12)
Channel 12.
OT_CHANNEL_13_MASK (1 << 13)
Channel 13.
OT_CHANNEL_14_MASK (1 << 14)
Channel 14.
OT_CHANNEL_15_MASK (1 << 15)
Channel 15.
OT_CHANNEL_16_MASK (1 << 16)
Channel 16.
OT_CHANNEL_17_MASK (1 << 17)
Channel 17.
OT_CHANNEL_18_MASK (1 << 18)
Channel 18.
OT_CHANNEL_19_MASK (1 << 19)
Channel 19.
OT_CHANNEL_1_MASK (1 << 1)
Channel 1.
OT_CHANNEL_20_MASK (1 << 20)
Channel 20.
OT_CHANNEL_21_MASK (1 << 21)
Channel 21.
OT_CHANNEL_22_MASK (1 << 22)
Channel 22.
OT_CHANNEL_23_MASK (1 << 23)
Channel 23.
OT_CHANNEL_24_MASK (1 << 24)
Channel 24.
OT_CHANNEL_25_MASK (1 << 25)
Channel 25.
OT_CHANNEL_26_MASK (1 << 26)
Channel 26.
OT_CHANNEL_2_MASK (1 << 2)
Channel 2.
OT_CHANNEL_3_MASK (1 << 3)
Channel 3.
OT_CHANNEL_4_MASK (1 << 4)
Channel 4.
OT_CHANNEL_5_MASK (1 << 5)
Channel 5.
OT_CHANNEL_6_MASK (1 << 6)
Channel 6.
OT_CHANNEL_7_MASK (1 << 7)
Channel 7.
OT_CHANNEL_8_MASK (1 << 8)
Channel 8.
OT_CHANNEL_9_MASK (1 << 9)
Channel 9.
OT_EXT_PAN_ID_SIZE 8
Size of a Thread PAN ID (bytes)
OT_MESH_LOCAL_PREFIX_SIZE OT_IP6_PREFIX_SIZE
Size of the Mesh Local Prefix (bytes)
OT_NETWORK_KEY_SIZE 16
Size of the Thread Network Key (bytes)
OT_NETWORK_NAME_MAX_SIZE 16
Maximum size of the Thread Network Name field (bytes)
OT_OPERATIONAL_DATASET_MAX_LENGTH 254
Maximum length of Operational Dataset in bytes.
OT_PSKC_MAX_SIZE 16
Maximum size of the PSKc (bytes)

Structs

otExtendedPanId

Represents an Extended PAN ID.

otNetworkKey

Represents a Thread Network Key.

otNetworkName

Represents a Network Name.

otOperationalDataset

Represents an Active or Pending Operational Dataset.

otOperationalDatasetComponents

Represents presence of different components in Active or Pending Operational Dataset.

otOperationalDatasetTlvs

Represents an Active or Pending Operational Dataset.

otPskc

Represents PSKc.

otSecurityPolicy

Represent Security Policy.

otTimestamp

Represents a Thread Dataset timestamp component.

Enumerations

otMeshcopTlvType

 otMeshcopTlvType

Represents meshcop TLV types.

Properties
OT_MESHCOP_TLV_ACTIVETIMESTAMP

meshcop Active Timestamp TLV

OT_MESHCOP_TLV_BORDER_AGENT_RLOC

meshcop Border Agent Locator TLV

OT_MESHCOP_TLV_CHANNEL

meshcop Channel TLV

OT_MESHCOP_TLV_CHANNELMASK

meshcop Channel Mask TLV

OT_MESHCOP_TLV_COMMISSIONER_ID

meshcop Commissioner ID TLV

OT_MESHCOP_TLV_COMMISSIONER_UDP_PORT

meshcop Commissioner UDP Port TLV

OT_MESHCOP_TLV_COMM_SESSION_ID

meshcop Commissioner Session ID TLV

OT_MESHCOP_TLV_COUNT

meshcop Count TLV

OT_MESHCOP_TLV_DELAYTIMER

meshcop Delay Timer TLV

OT_MESHCOP_TLV_DISCOVERYREQUEST

meshcop Discovery Request TLV

OT_MESHCOP_TLV_DISCOVERYRESPONSE

meshcop Discovery Response TLV

OT_MESHCOP_TLV_ENERGY_LIST

meshcop Energy List TLV

OT_MESHCOP_TLV_EXTPANID

meshcop Extended Pan Id TLV

OT_MESHCOP_TLV_GET

meshcop Get TLV

OT_MESHCOP_TLV_IPV6_ADDRESS_TLV

meshcop IPv6 address TLV

OT_MESHCOP_TLV_JOINERADVERTISEMENT

meshcop Joiner Advertisement TLV

OT_MESHCOP_TLV_JOINER_DTLS

meshcop Joiner DTLS Encapsulation TLV

OT_MESHCOP_TLV_JOINER_IID

meshcop Joiner IID TLV

OT_MESHCOP_TLV_JOINER_RLOC

meshcop Joiner Router Locator TLV

OT_MESHCOP_TLV_JOINER_ROUTER_KEK

meshcop Joiner Router KEK TLV

OT_MESHCOP_TLV_JOINER_UDP_PORT

meshcop Joiner UDP Port TLV

OT_MESHCOP_TLV_MESHLOCALPREFIX

meshcop Mesh Local Prefix TLV

OT_MESHCOP_TLV_NETWORKKEY

meshcop Network Key TLV

OT_MESHCOP_TLV_NETWORKNAME

meshcop Network Name TLV

OT_MESHCOP_TLV_NETWORK_KEY_SEQUENCE

meshcop Network Key Sequence TLV

OT_MESHCOP_TLV_PANID

meshcop Pan Id TLV

OT_MESHCOP_TLV_PENDINGTIMESTAMP

meshcop Pending Timestamp TLV

OT_MESHCOP_TLV_PERIOD

meshcop Period TLV

OT_MESHCOP_TLV_PROVISIONING_URL

meshcop Provisioning URL TLV

OT_MESHCOP_TLV_PSKC

meshcop PSKc TLV

OT_MESHCOP_TLV_SCAN_DURATION

meshcop Scan Duration TLV

OT_MESHCOP_TLV_SECURITYPOLICY

meshcop Security Policy TLV

OT_MESHCOP_TLV_STATE

meshcop State TLV

OT_MESHCOP_TLV_STEERING_DATA

meshcop Steering Data TLV

OT_MESHCOP_TLV_THREAD_DOMAIN_NAME

meshcop Thread Domain Name TLV

OT_MESHCOP_TLV_UDP_ENCAPSULATION_TLV

meshcop UDP encapsulation TLV

OT_MESHCOP_TLV_VENDOR_DATA_TLV

meshcop Vendor Data TLV

OT_MESHCOP_TLV_VENDOR_MODEL_TLV

meshcop Vendor Model TLV

OT_MESHCOP_TLV_VENDOR_NAME_TLV

meshcop Vendor Name TLV

OT_MESHCOP_TLV_VENDOR_STACK_VERSION_TLV

meshcop Vendor Stack Version TLV

OT_MESHCOP_TLV_VENDOR_SW_VERSION_TLV

meshcop Vendor SW Version TLV

OT_MESHCOP_TLV_WAKEUP_CHANNEL

meshcop Wake-up Channel TLV

Typedefs

otChannelMask

uint32_t otChannelMask

Represents Channel Mask.

otDatasetMgmtSetCallback

void(* otDatasetMgmtSetCallback)(otError aResult, void *aContext)

Pointer is called when a response to a MGMT_SET request is received or times out.

Details
Parameters
[in] aResult
A result of the operation.
[in] aContext
A pointer to application-specific context.
Return Values
OT_ERROR_NONE
The request was accepted by the leader.
OT_ERROR_REJECTED
The request was rejected by the leader.
OT_ERROR_PARSE
An error occurred during parsing the response.
OT_ERROR_ABORT
The request was reset by peer.
OT_ERROR_RESPONSE_TIMEOUT
No response or acknowledgment received during timeout period.

otDatasetUpdaterCallback

void(* otDatasetUpdaterCallback)(otError aError, void *aContext)

This callback function pointer is called when a Dataset update request finishes, reporting success or failure status of the Dataset update request.

Available when OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE is enabled.

Details
Parameters
[in] aError
The error status. OT_ERROR_NONE indicates successful Dataset update. OT_ERROR_INVALID_STATE indicates failure due invalid state (MLE being disabled). OT_ERROR_ALREADY indicates failure due to another device within network requesting a conflicting Dataset update.
[in] aContext
A pointer to the arbitrary context (provided by user in otDatasetUpdaterRequestUpdate()).

otExtendedPanId

struct otExtendedPanId otExtendedPanId

Represents an Extended PAN ID.

otMeshLocalPrefix

otIp6NetworkPrefix otMeshLocalPrefix

Represents a Mesh Local Prefix.

otMeshcopTlvType

enum otMeshcopTlvType otMeshcopTlvType

Represents meshcop TLV types.

otNetworkKey

struct otNetworkKey otNetworkKey

Represents a Thread Network Key.

otNetworkKeyRef

otCryptoKeyRef otNetworkKeyRef

This datatype represents KeyRef to NetworkKey.

Reference to Key

otNetworkName

struct otNetworkName otNetworkName

Represents a Network Name.

The otNetworkName is a null terminated C string (i.e., m8 char array MUST end with null char \0).

otOperationalDataset

struct otOperationalDataset otOperationalDataset

Represents an Active or Pending Operational Dataset.

Components in Dataset are optional. mComponents structure specifies which components are present in the Dataset.

otOperationalDatasetComponents

struct otOperationalDatasetComponents otOperationalDatasetComponents

Represents presence of different components in Active or Pending Operational Dataset.

otOperationalDatasetTlvs

struct otOperationalDatasetTlvs otOperationalDatasetTlvs

Represents an Active or Pending Operational Dataset.

The Operational Dataset is TLV encoded as specified by Thread.

otPskc

struct otPskc otPskc

Represents a PSKc.

otPskcRef

otCryptoKeyRef otPskcRef

This datatype represents KeyRef to PSKc.

Reference to Key

otSecurityPolicy

struct otSecurityPolicy otSecurityPolicy

Represent Security Policy.

otTimestamp

struct otTimestamp otTimestamp

Represents a Thread Dataset timestamp component.

Variables

OT_TOOL_PACKED_END

OT_TOOL_PACKED_BEGIN struct otNetworkKey OT_TOOL_PACKED_END

Functions

otDatasetConvertToTlvs

void otDatasetConvertToTlvs(
  const otOperationalDataset *aDataset,
  otOperationalDatasetTlvs *aDatasetTlvs
)

Converts a given Operational Dataset to otOperationalDatasetTlvs.

Details
Parameters
[in] aDataset
An Operational dataset to convert to TLVs.
[out] aDatasetTlvs
A pointer to dataset TLVs to return the result.

otDatasetCreateNewNetwork

otError otDatasetCreateNewNetwork(
  otInstance *aInstance,
  otOperationalDataset *aDataset
)

For FTD only, creates a new Operational Dataset to use when forming a new network.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aDataset
The Operational Dataset.
Return Values
OT_ERROR_NONE
Successfully created a new Operational Dataset.
OT_ERROR_FAILED
Failed to generate random values for new parameters.

otDatasetGeneratePskc

otError otDatasetGeneratePskc(
  const char *aPassPhrase,
  const otNetworkName *aNetworkName,
  const otExtendedPanId *aExtPanId,
  otPskc *aPskc
)

Generates PSKc from a given pass-phrase, network name, and extended PAN ID.

PSKc is used to establish the Commissioner Session.

Details
Parameters
[in] aPassPhrase
The commissioning pass-phrase.
[in] aNetworkName
The network name for PSKc computation.
[in] aExtPanId
The extended PAN ID for PSKc computation.
[out] aPskc
A pointer to variable to output the generated PSKc.
Return Values
OT_ERROR_NONE
Successfully generate PSKc.
OT_ERROR_INVALID_ARGS
If any of the input arguments is invalid.

otDatasetGetActive

otError otDatasetGetActive(
  otInstance *aInstance,
  otOperationalDataset *aDataset
)

Gets the Active Operational Dataset.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aDataset
A pointer to where the Active Operational Dataset will be placed.
Return Values
OT_ERROR_NONE
Successfully retrieved the Active Operational Dataset.
OT_ERROR_NOT_FOUND
No corresponding value in the setting store.

otDatasetGetActiveTlvs

otError otDatasetGetActiveTlvs(
  otInstance *aInstance,
  otOperationalDatasetTlvs *aDataset
)

Gets the Active Operational Dataset.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aDataset
A pointer to where the Active Operational Dataset will be placed.
Return Values
OT_ERROR_NONE
Successfully retrieved the Active Operational Dataset.
OT_ERROR_NOT_FOUND
No corresponding value in the setting store.

otDatasetGetDelayTimerMinimal

uint32_t otDatasetGetDelayTimerMinimal(
  otInstance *aInstance
)

For FTD only, gets a minimal delay timer.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Return Values
the
value of minimal delay timer (in ms).

otDatasetGetPending

otError otDatasetGetPending(
  otInstance *aInstance,
  otOperationalDataset *aDataset
)

Gets the Pending Operational Dataset.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aDataset
A pointer to where the Pending Operational Dataset will be placed.
Return Values
OT_ERROR_NONE
Successfully retrieved the Pending Operational Dataset.
OT_ERROR_NOT_FOUND
No corresponding value in the setting store.

otDatasetGetPendingTlvs

otError otDatasetGetPendingTlvs(
  otInstance *aInstance,
  otOperationalDatasetTlvs *aDataset
)

Gets the Pending Operational Dataset.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aDataset
A pointer to where the Pending Operational Dataset will be placed.
Return Values
OT_ERROR_NONE
Successfully retrieved the Pending Operational Dataset.
OT_ERROR_NOT_FOUND
No corresponding value in the setting store.

otDatasetIsCommissioned

bool otDatasetIsCommissioned(
  otInstance *aInstance
)

Indicates whether a valid network is present in the Active Operational Dataset or not.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
TRUE if a valid network is present in the Active Operational Dataset, FALSE otherwise.

otDatasetParseTlvs

otError otDatasetParseTlvs(
  const otOperationalDatasetTlvs *aDatasetTlvs,
  otOperationalDataset *aDataset
)

Parses an Operational Dataset from a given otOperationalDatasetTlvs.

Details
Parameters
[in] aDatasetTlvs
A pointer to dataset TLVs.
[out] aDataset
A pointer to where the dataset will be placed.
Return Values
OT_ERROR_NONE
Successfully set aDataset from aDatasetTlvs.
OT_ERROR_INVALID_ARGS
aDatasetTlvs's length is longer than OT_OPERATIONAL_DATASET_MAX_LENGTH.

otDatasetSendMgmtActiveGet

otError otDatasetSendMgmtActiveGet(
  otInstance *aInstance,
  const otOperationalDatasetComponents *aDatasetComponents,
  const uint8_t *aTlvTypes,
  uint8_t aLength,
  const otIp6Address *aAddress
)

Sends MGMT_ACTIVE_GET.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDatasetComponents
A pointer to a Dataset Components structure specifying which components to request.
[in] aTlvTypes
A pointer to array containing additional raw TLV types to be requested.
[in] aLength
The length of aTlvTypes.
[in] aAddress
A pointer to the IPv6 destination, if it is NULL, will use Leader ALOC as default.
Return Values
OT_ERROR_NONE
Successfully send the meshcop dataset command.
OT_ERROR_NO_BUFS
Insufficient buffer space to send.

otDatasetSendMgmtActiveSet

otError otDatasetSendMgmtActiveSet(
  otInstance *aInstance,
  const otOperationalDataset *aDataset,
  const uint8_t *aTlvs,
  uint8_t aLength,
  otDatasetMgmtSetCallback aCallback,
  void *aContext
)

Sends MGMT_ACTIVE_SET.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDataset
A pointer to operational dataset.
[in] aTlvs
A pointer to TLVs.
[in] aLength
The length of TLVs.
[in] aCallback
A pointer to a function that is called on response reception or timeout.
[in] aContext
A pointer to application-specific context for aCallback.
Return Values
OT_ERROR_NONE
Successfully send the meshcop dataset command.
OT_ERROR_NO_BUFS
Insufficient buffer space to send.
OT_ERROR_BUSY
A previous request is ongoing.

otDatasetSendMgmtPendingGet

otError otDatasetSendMgmtPendingGet(
  otInstance *aInstance,
  const otOperationalDatasetComponents *aDatasetComponents,
  const uint8_t *aTlvTypes,
  uint8_t aLength,
  const otIp6Address *aAddress
)

Sends MGMT_PENDING_GET.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDatasetComponents
A pointer to a Dataset Components structure specifying which components to request.
[in] aTlvTypes
A pointer to array containing additional raw TLV types to be requested.
[in] aLength
The length of aTlvTypes.
[in] aAddress
A pointer to the IPv6 destination, if it is NULL, will use Leader ALOC as default.
Return Values
OT_ERROR_NONE
Successfully send the meshcop dataset command.
OT_ERROR_NO_BUFS
Insufficient buffer space to send.

otDatasetSendMgmtPendingSet

otError otDatasetSendMgmtPendingSet(
  otInstance *aInstance,
  const otOperationalDataset *aDataset,
  const uint8_t *aTlvs,
  uint8_t aLength,
  otDatasetMgmtSetCallback aCallback,
  void *aContext
)

Sends MGMT_PENDING_SET.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDataset
A pointer to operational dataset.
[in] aTlvs
A pointer to TLVs.
[in] aLength
The length of TLVs.
[in] aCallback
A pointer to a function that is called on response reception or timeout.
[in] aContext
A pointer to application-specific context for aCallback.
Return Values
OT_ERROR_NONE
Successfully send the meshcop dataset command.
OT_ERROR_NO_BUFS
Insufficient buffer space to send.
OT_ERROR_BUSY
A previous request is ongoing.

otDatasetSetActive

otError otDatasetSetActive(
  otInstance *aInstance,
  const otOperationalDataset *aDataset
)

Sets the Active Operational Dataset.

If the dataset does not include an Active Timestamp, the dataset is only partially complete.

If Thread is enabled on a device that has a partially complete Active Dataset, the device will attempt to attach to an existing Thread network using any existing information in the dataset. Only the Thread Network Key is needed to attach to a network.

If channel is not included in the dataset, the device will send MLE Announce messages across different channels to find neighbors on other channels.

If the device successfully attaches to a Thread network, the device will then retrieve the full Active Dataset from its Parent. Note that a router-capable device will not transition to the Router or Leader roles until it has a complete Active Dataset.

This function consistently returns OT_ERROR_NONE and can effectively be treated as having a void return type. Previously, other errors (e.g., OT_ERROR_NOT_IMPLEMENTED) were allowed for legacy reasons. However, as non-volatile storage is now mandatory for Thread operation, any failure to save the dataset will trigger an assertion. The otError return type is retained for backward compatibility.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDataset
A pointer to the Active Operational Dataset.
Return Values
OT_ERROR_NONE
Successfully set the Active Operational Dataset.

otDatasetSetActiveTlvs

otError otDatasetSetActiveTlvs(
  otInstance *aInstance,
  const otOperationalDatasetTlvs *aDataset
)

Sets the Active Operational Dataset.

If the dataset does not include an Active Timestamp, the dataset is only partially complete.

If Thread is enabled on a device that has a partially complete Active Dataset, the device will attempt to attach to an existing Thread network using any existing information in the dataset. Only the Thread Network Key is needed to attach to a network.

If channel is not included in the dataset, the device will send MLE Announce messages across different channels to find neighbors on other channels.

If the device successfully attaches to a Thread network, the device will then retrieve the full Active Dataset from its Parent. Note that a router-capable device will not transition to the Router or Leader roles until it has a complete Active Dataset.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDataset
A pointer to the Active Operational Dataset.
Return Values
OT_ERROR_NONE
Successfully set the Active Operational Dataset.
OT_ERROR_INVALID_ARGS
The aDataset is invalid. It is too long or contains incorrect TLV formatting.

otDatasetSetDelayTimerMinimal

otError otDatasetSetDelayTimerMinimal(
  otInstance *aInstance,
  uint32_t aDelayTimerMinimal
)

For FTD only, sets a minimal delay timer.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDelayTimerMinimal
The value of minimal delay timer (in ms).
Return Values
OT_ERROR_NONE
Successfully set minimal delay timer.
OT_ERROR_INVALID_ARGS
If aDelayTimerMinimal is not valid.

otDatasetSetPending

otError otDatasetSetPending(
  otInstance *aInstance,
  const otOperationalDataset *aDataset
)

Sets the Pending Operational Dataset.

This function consistently returns OT_ERROR_NONE and can effectively be treated as having a void return type. Previously, other errors (e.g., OT_ERROR_NOT_IMPLEMENTED) were allowed for legacy reasons. However, as non-volatile storage is now mandatory for Thread operation, any failure to save the dataset will trigger an assertion. The otError return type is retained for backward compatibility.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDataset
A pointer to the Pending Operational Dataset.
Return Values
OT_ERROR_NONE
Successfully set the Pending Operational Dataset.

otDatasetSetPendingTlvs

otError otDatasetSetPendingTlvs(
  otInstance *aInstance,
  const otOperationalDatasetTlvs *aDataset
)

Sets the Pending Operational Dataset.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDataset
A pointer to the Pending Operational Dataset.
Return Values
OT_ERROR_NONE
Successfully set the Pending Operational Dataset.
OT_ERROR_INVALID_ARGS
The aDataset is invalid. It is too long or contains incorrect TLV formatting.

otDatasetUpdateTlvs

otError otDatasetUpdateTlvs(
  const otOperationalDataset *aDataset,
  otOperationalDatasetTlvs *aDatasetTlvs
)

Updates a given Operational Dataset.

aDataset contains the fields to be updated and their new value.

Details
Parameters
[in] aDataset
Specifies the set of types and values to update.
[in,out] aDatasetTlvs
A pointer to dataset TLVs to update.
Return Values
OT_ERROR_NONE
Successfully updated aDatasetTlvs.
OT_ERROR_INVALID_ARGS
aDataset contains invalid values.
OT_ERROR_NO_BUFS
Not enough space space in aDatasetTlvs to apply the update.

otDatasetUpdaterCancelUpdate

void otDatasetUpdaterCancelUpdate(
  otInstance *aInstance
)

Cancels an ongoing (if any) Operational Dataset update request.

Available when OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE is enabled.

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

otDatasetUpdaterIsUpdateOngoing

bool otDatasetUpdaterIsUpdateOngoing(
  otInstance *aInstance
)

Indicates whether there is an ongoing Operation Dataset update request.

Available when OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE is enabled.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Return Values
TRUE
There is an ongoing update.
FALSE
There is no ongoing update.

otDatasetUpdaterRequestUpdate

otError otDatasetUpdaterRequestUpdate(
  otInstance *aInstance,
  const otOperationalDataset *aDataset,
  otDatasetUpdaterCallback aCallback,
  void *aContext
)

Requests an update to Operational Dataset.

Available when OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE is enabled.

aDataset should contain the fields to be updated and their new value. It must not contain Active or Pending Timestamp fields. The Delay field is optional, if not provided a default value (1000 ms) would be used.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aDataset
A pointer to the Dataset containing the fields to change.
[in] aCallback
A callback to indicate when Dataset update request finishes.
[in] aContext
An arbitrary context passed to callback.
Return Values
OT_ERROR_NONE
Dataset update started successfully (aCallback will be invoked on completion).
OT_ERROR_INVALID_STATE
Device is disabled or not fully configured (missing or incomplete Active Dataset).
OT_ERROR_ALREADY
The aDataset fields already match the existing Active Dataset.
OT_ERROR_INVALID_ARGS
The aDataset is not valid (contains Active or Pending Timestamp).
OT_ERROR_BUSY
Cannot start update, a previous one is ongoing.
OT_ERROR_NO_BUFS
Could not allocated buffer to save Dataset.

otNetworkNameFromString

otError otNetworkNameFromString(
  otNetworkName *aNetworkName,
  const char *aNameString
)

Sets an otNetworkName instance from a given null terminated C string.

aNameString must follow UTF-8 encoding and the Network Name length must not be longer than OT_NETWORK_NAME_MAX_SIZE.

Details
Parameters
[out] aNetworkName
A pointer to the otNetworkName to set.
[in] aNameString
A name C string.
Return Values
OT_ERROR_NONE
Successfully set aNetworkName from aNameString.
OT_ERROR_INVALID_ARGS
aNameStrng is invalid (too long or does not follow UTF-8 encoding).

Macros

OT_CHANNEL_10_MASK

 OT_CHANNEL_10_MASK (1 << 10)

Channel 10.

OT_CHANNEL_11_MASK

 OT_CHANNEL_11_MASK (1 << 11)

Channel 11.

OT_CHANNEL_12_MASK

 OT_CHANNEL_12_MASK (1 << 12)

Channel 12.

OT_CHANNEL_13_MASK

 OT_CHANNEL_13_MASK (1 << 13)

Channel 13.

OT_CHANNEL_14_MASK

 OT_CHANNEL_14_MASK (1 << 14)

Channel 14.

OT_CHANNEL_15_MASK

 OT_CHANNEL_15_MASK (1 << 15)

Channel 15.

OT_CHANNEL_16_MASK

 OT_CHANNEL_16_MASK (1 << 16)

Channel 16.

OT_CHANNEL_17_MASK

 OT_CHANNEL_17_MASK (1 << 17)

Channel 17.

OT_CHANNEL_18_MASK

 OT_CHANNEL_18_MASK (1 << 18)

Channel 18.

OT_CHANNEL_19_MASK

 OT_CHANNEL_19_MASK (1 << 19)

Channel 19.

OT_CHANNEL_1_MASK

 OT_CHANNEL_1_MASK (1 << 1)

Channel 1.

OT_CHANNEL_20_MASK

 OT_CHANNEL_20_MASK (1 << 20)

Channel 20.

OT_CHANNEL_21_MASK

 OT_CHANNEL_21_MASK (1 << 21)

Channel 21.

OT_CHANNEL_22_MASK

 OT_CHANNEL_22_MASK (1 << 22)

Channel 22.

OT_CHANNEL_23_MASK

 OT_CHANNEL_23_MASK (1 << 23)

Channel 23.

OT_CHANNEL_24_MASK

 OT_CHANNEL_24_MASK (1 << 24)

Channel 24.

OT_CHANNEL_25_MASK

 OT_CHANNEL_25_MASK (1 << 25)

Channel 25.

OT_CHANNEL_26_MASK

 OT_CHANNEL_26_MASK (1 << 26)

Channel 26.

OT_CHANNEL_2_MASK

 OT_CHANNEL_2_MASK (1 << 2)

Channel 2.

OT_CHANNEL_3_MASK

 OT_CHANNEL_3_MASK (1 << 3)

Channel 3.

OT_CHANNEL_4_MASK

 OT_CHANNEL_4_MASK (1 << 4)

Channel 4.

OT_CHANNEL_5_MASK

 OT_CHANNEL_5_MASK (1 << 5)

Channel 5.

OT_CHANNEL_6_MASK

 OT_CHANNEL_6_MASK (1 << 6)

Channel 6.

OT_CHANNEL_7_MASK

 OT_CHANNEL_7_MASK (1 << 7)

Channel 7.

OT_CHANNEL_8_MASK

 OT_CHANNEL_8_MASK (1 << 8)

Channel 8.

OT_CHANNEL_9_MASK

 OT_CHANNEL_9_MASK (1 << 9)

Channel 9.

OT_EXT_PAN_ID_SIZE

 OT_EXT_PAN_ID_SIZE 8

Size of a Thread PAN ID (bytes)

OT_MESH_LOCAL_PREFIX_SIZE

 OT_MESH_LOCAL_PREFIX_SIZE OT_IP6_PREFIX_SIZE

Size of the Mesh Local Prefix (bytes)

OT_NETWORK_KEY_SIZE

 OT_NETWORK_KEY_SIZE 16

Size of the Thread Network Key (bytes)

OT_NETWORK_NAME_MAX_SIZE

 OT_NETWORK_NAME_MAX_SIZE 16

Maximum size of the Thread Network Name field (bytes)

OT_OPERATIONAL_DATASET_MAX_LENGTH

 OT_OPERATIONAL_DATASET_MAX_LENGTH 254

Maximum length of Operational Dataset in bytes.

OT_PSKC_MAX_SIZE

 OT_PSKC_MAX_SIZE 16

Maximum size of the PSKc (bytes)

Resources

OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.