SNTP#

This module includes functions that control SNTP communication.

Modules#

otSntpQuery

Typedefs#

typedef struct otSntpQuery

Implements SNTP Query parameters.

typedef void(*
otSntpResponseHandler)(void *aContext, uint64_t aTime, otError aResult)

Pointer is called when a SNTP response is received.

Functions#

otSntpClientQuery(otInstance *aInstance, const otSntpQuery *aQuery, otSntpResponseHandler aHandler, void *aContext)

Sends a SNTP query.

void
otSntpClientSetUnixEra(otInstance *aInstance, uint32_t aUnixEra)

Sets the unix era number.

Macros#

#define
OT_SNTP_DEFAULT_SERVER_IP "2001:4860:4806:8::"

Defines default SNTP Server address - Google NTP Server.

#define
OT_SNTP_DEFAULT_SERVER_PORT 123

Defines default SNTP Server port.

Typedef Documentation#

otSntpQuery#

typedef struct otSntpQuery otSntpQuery

Implements SNTP Query parameters.


otSntpResponseHandler#

typedef void(* otSntpResponseHandler) (void *aContext, uint64_t aTime, otError aResult) )(void *aContext, uint64_t aTime, otError aResult)

Pointer is called when a SNTP response is received.

Parameters
TypeDirectionArgument NameDescription
[in]aContext

A pointer to application-specific context.

[in]aTime

Specifies the time at the server when the response left for the client, in UNIX time.

[in]aResult

A result of the SNTP transaction.


Function Documentation#

otSntpClientQuery#

otError otSntpClientQuery (otInstance * aInstance, const otSntpQuery * aQuery, otSntpResponseHandler aHandler, void * aContext)

Sends a SNTP query.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

A pointer to an OpenThread instance.

const otSntpQuery *[in]aQuery

A pointer to specify SNTP query parameters.

otSntpResponseHandler[in]aHandler

A function pointer that shall be called on response reception or time-out.

void *[in]aContext

A pointer to arbitrary context information.

Is available only if feature OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE is enabled.


otSntpClientSetUnixEra#

void otSntpClientSetUnixEra (otInstance * aInstance, uint32_t aUnixEra)

Sets the unix era number.

Parameters
TypeDirectionArgument NameDescription
otInstance *[in]aInstance

A pointer to an OpenThread instance.

uint32_t[in]aUnixEra

Unix era number.

The default value of unix era is set to 0. The subsequent eras start after year 2106.