39#ifndef SNTP_CLIENT_SUPPORT
40 #define SNTP_CLIENT_SUPPORT ENABLED
41#elif (SNTP_CLIENT_SUPPORT != ENABLED && SNTP_CLIENT_SUPPORT != DISABLED)
42 #error SNTP_CLIENT_SUPPORT parameter is not valid
46#ifndef SNTP_CLIENT_DEFAULT_TIMEOUT
47 #define SNTP_CLIENT_DEFAULT_TIMEOUT 30000
48#elif (SNTP_CLIENT_DEFAULT_TIMEOUT < 1000)
49 #error SNTP_CLIENT_DEFAULT_TIMEOUT parameter is not valid
53#ifndef SNTP_CLIENT_INIT_RETRANSMIT_TIMEOUT
54 #define SNTP_CLIENT_INIT_RETRANSMIT_TIMEOUT 2000
55#elif (SNTP_CLIENT_INIT_RETRANSMIT_TIMEOUT < 1000)
56 #error SNTP_CLIENT_INIT_RETRANSMIT_TIMEOUT parameter is not valid
60#ifndef SNTP_CLIENT_MAX_RETRANSMIT_TIMEOUT
61 #define SNTP_CLIENT_MAX_RETRANSMIT_TIMEOUT 15000
62#elif (SNTP_CLIENT_MAX_RETRANSMIT_TIMEOUT < 1000)
63 #error SNTP_CLIENT_MAX_RETRANSMIT_TIMEOUT parameter is not valid
67#ifndef SNTP_CLIENT_PRIVATE_CONTEXT
68 #define SNTP_CLIENT_PRIVATE_CONTEXT
83 SNTP_CLIENT_STATE_INIT = 0,
84 SNTP_CLIENT_STATE_SENDING = 2,
85 SNTP_CLIENT_STATE_RECEIVING = 3,
86 SNTP_CLIENT_STATE_COMPLETE = 4
105 uint8_t message[NTP_MAX_MSG_SIZE];
108 SNTP_CLIENT_PRIVATE_CONTEXT
118 NetInterface *interface);
121 const IpAddr *serverIpAddr, uint16_t serverPort);
124 NtpTimestamp *timestamp);
error_t
Error codes.
Definition error.h:43
Definitions common to NTP client and server.
uint32_t systime_t
System time.
Definition os_port_none.h:90
SntpClientState
SNTP client states.
Definition sntp_client.h:82
IP network address.
Definition ip.h:72
SNTP client context.
Definition sntp_client.h:95
systime_t retransmitTimeout
Retransmission timeout.
Definition sntp_client.h:104
systime_t retransmitStartTime
Time at which the last request was sent.
Definition sntp_client.h:103
NetInterface * interface
Underlying network interface.
Definition sntp_client.h:97
IpAddr serverIpAddr
NTP server address.
Definition sntp_client.h:98
size_t messageLen
Length of the NTP message, in bytes.
Definition sntp_client.h:106
Socket * socket
Underlying socket.
Definition sntp_client.h:101
systime_t startTime
Request start time.
Definition sntp_client.h:102
uint16_t serverPort
NTP server port.
Definition sntp_client.h:99
systime_t timeout
Timeout value.
Definition sntp_client.h:100
SntpClientState state
SNTP client state.
Definition sntp_client.h:96
uint32_t kissCode
Kiss code.
Definition sntp_client.h:107