Server

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

Summary

Typedefs

otServerConfig typedef
This structure represents a Server configuration.
otServiceConfig typedef
This structure represents a Service configuration.

Functions

otServerAddService(otInstance *aInstance, const otServiceConfig *aConfig)
Add a service configuration to the local network data.
otServerGetNetDataLocal(otInstance *aInstance, bool aStable, uint8_t *aData, uint8_t *aDataLength)
This method provides a full or stable copy of the local Thread Network Data.
otServerGetNextLeaderService(otInstance *aInstance, otNetworkDataIterator *aIterator, otServiceConfig *aConfig)
This function gets the next service in the leader Network Data.
otServerGetNextService(otInstance *aInstance, otNetworkDataIterator *aIterator, otServiceConfig *aConfig)
This function gets the next service in the local Network Data.
otServerRegister(otInstance *aInstance)
Immediately register the local network data with the Leader.
otServerRemoveService(otInstance *aInstance, uint32_t aEnterpriseNumber, uint8_t *aServiceData, uint8_t aServiceDataLength)
Remove a service configuration from the local network data.

Structs

otServerConfig

This structure represents a Server configuration.

otServiceConfig

This structure represents a Service configuration.

Typedefs

otServerConfig

struct otServerConfig otServerConfig

This structure represents a Server configuration.

otServiceConfig

struct otServiceConfig otServiceConfig

This structure represents a Service configuration.

Functions

otServerAddService

OTAPI otError OTCALL otServerAddService(
  otInstance *aInstance,
  const otServiceConfig *aConfig
)

Add a service configuration to the local network data.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aConfig
A pointer to the service configuration.
Return Values
OT_ERROR_NONE
Successfully added the configuration to the local network data.
OT_ERROR_INVALID_ARGS
One or more configuration parameters were invalid.
OT_ERROR_NO_BUFS
Not enough room is available to add the configuration to the local network data.
See also:
otServerRemoveService
otServerRegister

otServerGetNetDataLocal

OTAPI otError OTCALL otServerGetNetDataLocal(
  otInstance *aInstance,
  bool aStable,
  uint8_t *aData,
  uint8_t *aDataLength
)

This method provides a full or stable copy of the local 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.

otServerGetNextLeaderService

OTAPI otError OTCALL otServerGetNextLeaderService(
  otInstance *aInstance,
  otNetworkDataIterator *aIterator,
  otServiceConfig *aConfig
)

This function gets the next service in the leader 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 leader Network Data.

otServerGetNextService

OTAPI otError OTCALL otServerGetNextService(
  otInstance *aInstance,
  otNetworkDataIterator *aIterator,
  otServiceConfig *aConfig
)

This function gets the next service in the local 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 Thread Network Data.

otServerRegister

OTAPI otError OTCALL otServerRegister(
  otInstance *aInstance
)

Immediately register the local network data with the Leader.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Return Values
OT_ERROR_NONE
Successfully queued a Server Data Request message for delivery.
See also:
otServerAddService
otServerRemoveService

otServerRemoveService

OTAPI otError OTCALL otServerRemoveService(
  otInstance *aInstance,
  uint32_t aEnterpriseNumber,
  uint8_t *aServiceData,
  uint8_t aServiceDataLength
)

Remove a service configuration from the local network data.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[in] aEnterpriseNumber
Enterprise Number of the service entry to be deleted.
[in] aServiceData
A pointer to an Service Data to look for during deletion.
[in] aServiceDataLength
The length of aServiceData in bytes.
Return Values
OT_ERROR_NONE
Successfully removed the configuration from the local network data.
OT_ERROR_NOT_FOUND
Could not find the Border Router entry.
See also:
otServerAddService
otServerRegister

Macros

OT_SERVER_DATA_MAX_SIZE

 OT_SERVER_DATA_MAX_SIZE 248

Maximum size of Server Data in bytes. This is theoretical limit, practical one is much lower.

OT_SERVICE_DATA_MAX_SIZE

 OT_SERVICE_DATA_MAX_SIZE 252

Maximum size of Service Data in bytes.