sntp_client_misc.c
uint8_t message[NTP_MAX_MSG_SIZE]
Buffer that holds the NTP request/response.
Definition: sntp_client.h:105
void ntpDumpPacket(const NtpHeader *packet, size_t length)
Dump NTP packet for debugging purpose.
Definition: ntp_debug.c:108
void sntpClientCloseConnection(SntpClientContext *context)
Close UDP connection.
Definition: sntp_client_misc.c:81
error_t sntpClientOpenConnection(SntpClientContext *context)
Open UDP connection.
Definition: sntp_client_misc.c:52
Data logging functions for debugging purpose (NTP)
error_t sntpClientCheckResponse(SntpClientContext *context, const IpAddr *ipAddr, uint16_t port, const uint8_t *message, size_t length)
Check whether the NTP response is valid.
Definition: sntp_client_misc.c:245
error_t socketReceiveFrom(Socket *socket, IpAddr *srcIpAddr, uint16_t *srcPort, void *data, size_t size, size_t *received, uint_t flags)
Receive a datagram from a connectionless socket.
Definition: socket.c:1714
Socket * socketOpen(uint_t type, uint_t protocol)
Create a socket (UDP or TCP)
Definition: socket.c:125
error_t sntpClientReceiveResponse(SntpClientContext *context)
Wait for NTP server's response.
Definition: sntp_client_misc.c:158
error_t sntpClientParseResponse(SntpClientContext *context, NtpTimestamp *timestamp)
Parse NTP server's response.
Definition: sntp_client_misc.c:301
error_t sntpClientCheckTimeout(SntpClientContext *context)
Determine whether a timeout error has occurred.
Definition: sntp_client_misc.c:343
error_t sntpClientSendRequest(SntpClientContext *context)
Send request to the NTP server.
Definition: sntp_client_misc.c:99
error_t socketSendTo(Socket *socket, const IpAddr *destIpAddr, uint16_t destPort, const void *data, size_t length, size_t *written, uint_t flags)
Send a datagram to a specific destination.
Definition: socket.c:1507
TCP/IP stack core.
SNTP client (Simple Network Time Protocol)
error_t socketSetTimeout(Socket *socket, systime_t timeout)
Set timeout value for blocking operations.
Definition: socket.c:148
Debugging facilities.
#define SNTP_CLIENT_MAX_RETRANSMIT_TIMEOUT
Definition: sntp_client.h:61
Helper functions for SNTP client.