coreSNTP v1.3.1
Client library for synchronizing device time with internet time using Simple Network Time Protocol (SNTP)
 
Loading...
Searching...
No Matches
SntpContext_t Struct Reference

Structure for a context that stores state for managing a long-running SNTP client that periodically polls time and synchronizes system clock. More...

#include <core_sntp_client.h>

Data Fields

const SntpServerInfo_tpTimeServers
 List of time servers in decreasing priority order configured for the SNTP client. Only a single server is configured for use at a time across polling attempts until the server rejects a time request or there is a response timeout, after which, the next server in the list is used for subsequent polling requests.
 
size_t numOfServers
 Number of servers configured for use.
 
size_t currentServerIndex
 The index for the currently configured time server for time querying from the list of time servers in pTimeServers.
 
uint8_t * pNetworkBuffer
 The user-supplied buffer for storing network data of both SNTP requests and SNTP response.
 
size_t bufferSize
 The size of the network buffer.
 
SntpResolveDns_t resolveDnsFunc
 The user-supplied function for resolving DNS name of time servers.
 
SntpGetTime_t getTimeFunc
 The user-supplied function for obtaining the current system time.
 
SntpSetTime_t setTimeFunc
 The user-supplied function for correcting system time after receiving time from a server.
 
UdpTransportInterface_t networkIntf
 The user-defined interface for performing User Datagram Protocol (UDP) send and receive network operations.
 
SntpAuthenticationInterface_t authIntf
 The user-defined interface for incorporating security mechanism of adding client authentication in SNTP request as well as authenticating server from SNTP response.
 
uint32_t currentServerAddr
 Cache of the resolved Ipv4 address of the current server being used for time synchronization. As a Best Practice functionality, the client library attempts to resolve the DNS of the time-server every time the Sntp_SendTimeRequest API is called.
 
SntpTimestamp_t lastRequestTime
 Cache of the timestamp of sending the last time request to a server for replay attack protection by checking that the server response contains the same timestamp in its "originate timestamp" field.
 
uint16_t sntpPacketSize
 State member for storing the size of the SNTP packet that includes both SNTP_PACKET_BASE_SIZE bytes plus any authentication data, if a security mechanism is used. This value is used for expecting the same size for an SNTP response from the server.
 
uint32_t responseTimeoutMs
 The timeout duration (in milliseconds) for receiving a response, through Sntp_ReceiveTimeResponse API, from a server after the request for time is sent to it through Sntp_SendTimeRequest API.
 

Detailed Description

Structure for a context that stores state for managing a long-running SNTP client that periodically polls time and synchronizes system clock.

Field Documentation

◆ authIntf

SntpAuthenticationInterface_t SntpContext_t::authIntf

The user-defined interface for incorporating security mechanism of adding client authentication in SNTP request as well as authenticating server from SNTP response.

Note
If the application will not use security mechanism for any of the configured servers, then this interface can be undefined.

The documentation for this struct was generated from the following file: