ReactOS 0.4.16-dev-334-g4d9f67c
Options
Collaboration diagram for Options:

Macros

#define SNTP_SET_SYSTEM_TIME(sec)   LWIP_UNUSED_ARG(sec)
 
#define SNTP_MAX_SERVERS   LWIP_DHCP_MAX_NTP_SERVERS
 
#define SNTP_GET_SERVERS_FROM_DHCP   LWIP_DHCP_GET_NTP_SRV
 
#define SNTP_GET_SERVERS_FROM_DHCPV6   LWIP_DHCP6_GET_NTP_SRV
 
#define SNTP_SERVER_DNS   0
 
#define SNTP_DEBUG   LWIP_DBG_OFF
 
#define SNTP_PORT   LWIP_IANA_PORT_SNTP
 
#define SNTP_CHECK_RESPONSE   0
 
#define SNTP_COMP_ROUNDTRIP   0
 
#define SNTP_STARTUP_DELAY   0
 
#define SNTP_STARTUP_DELAY_FUNC   (LWIP_RAND() % 5000)
 
#define SNTP_RECV_TIMEOUT   15000
 
#define SNTP_UPDATE_DELAY   3600000
 
#define SNTP_GET_SYSTEM_TIME(sec, us)   do { (sec) = 0; (us) = 0; } while(0)
 
#define SNTP_RETRY_TIMEOUT   SNTP_RECV_TIMEOUT
 
#define SNTP_RETRY_TIMEOUT_MAX   (SNTP_RETRY_TIMEOUT * 10)
 
#define SNTP_RETRY_TIMEOUT_EXP   1
 
#define SNTP_MONITOR_SERVER_REACHABILITY   1
 

Detailed Description

Macro Definition Documentation

◆ SNTP_CHECK_RESPONSE

#define SNTP_CHECK_RESPONSE   0

Sanity check: Define this to

  • 0 to turn off sanity checks (default; smaller code)
  • >= 1 to check address and port of the response packet to ensure the response comes from the server we sent the request to.
  • >= 2 to check returned Originate Timestamp against Transmit Timestamp sent to the server (to ensure response to older request).
  • >= 3
    Todo:
    : discard reply if any of the VN, Stratum, or Transmit Timestamp fields is 0 or the Mode field is not 4 (unicast) or 5 (broadcast).

Definition at line 111 of file sntp_opts.h.

◆ SNTP_COMP_ROUNDTRIP

#define SNTP_COMP_ROUNDTRIP   0

Enable round-trip delay compensation. Compensate for the round-trip delay by calculating the clock offset from the originate, receive, transmit and destination timestamps, as per RFC.

The calculation requires compiler support for 64-bit integers. Also, either SNTP_SET_SYSTEM_TIME_US or SNTP_SET_SYSTEM_TIME_NTP has to be implemented for setting the system clock with sub-second precision. Likewise, either SNTP_GET_SYSTEM_TIME or SNTP_GET_SYSTEM_TIME_NTP needs to be implemented with sub-second precision.

Although not strictly required, it makes sense to combine this option with SNTP_CHECK_RESPONSE >= 2 for sanity-checking of the received timestamps. Also, in order for the round-trip calculation to work, the difference between the local clock and the NTP server clock must not be larger than about 34 years. If that limit is exceeded, the implementation will fall back to setting the clock without compensation. In order to ensure that the local clock is always within the permitted range for compensation, even at first try, it may be necessary to store at least the current year in non-volatile memory.

Definition at line 135 of file sntp_opts.h.

◆ SNTP_DEBUG

#define SNTP_DEBUG   LWIP_DBG_OFF

SNTP_DEBUG: Enable debugging for SNTP.

Definition at line 88 of file sntp_opts.h.

◆ SNTP_GET_SERVERS_FROM_DHCP

#define SNTP_GET_SERVERS_FROM_DHCP   LWIP_DHCP_GET_NTP_SRV

Set this to 1 to implement the callback function called by dhcp when NTP servers are received.

Definition at line 67 of file sntp_opts.h.

◆ SNTP_GET_SERVERS_FROM_DHCPV6

#define SNTP_GET_SERVERS_FROM_DHCPV6   LWIP_DHCP6_GET_NTP_SRV

Set this to 1 to implement the callback function called by dhcpv6 when NTP servers are received.

Definition at line 73 of file sntp_opts.h.

◆ SNTP_GET_SYSTEM_TIME

#define SNTP_GET_SYSTEM_TIME (   sec,
  us 
)    do { (sec) = 0; (us) = 0; } while(0)

SNTP macro to get system time, used with SNTP_CHECK_RESPONSE >= 2 to send in request and compare in response. Also used for round-trip delay compensation if SNTP_COMP_ROUNDTRIP != 0. Alternatively, define SNTP_GET_SYSTEM_TIME_NTP(sec, frac) in order to work with native NTP timestamps instead.

Definition at line 181 of file sntp_opts.h.

◆ SNTP_MAX_SERVERS

#define SNTP_MAX_SERVERS   LWIP_DHCP_MAX_NTP_SERVERS

The maximum number of SNTP servers that can be set

Definition at line 61 of file sntp_opts.h.

◆ SNTP_MONITOR_SERVER_REACHABILITY

#define SNTP_MONITOR_SERVER_REACHABILITY   1

Keep a reachability shift register per server Default is on to conform to RFC.

Definition at line 208 of file sntp_opts.h.

◆ SNTP_PORT

#define SNTP_PORT   LWIP_IANA_PORT_SNTP

SNTP server port

Definition at line 93 of file sntp_opts.h.

◆ SNTP_RECV_TIMEOUT

#define SNTP_RECV_TIMEOUT   15000

SNTP receive timeout - in milliseconds Also used as retry timeout - this shouldn't be too low. Default is 15 seconds. Must not be beolw 15 seconds by specification (i.e. 15000)

Definition at line 164 of file sntp_opts.h.

◆ SNTP_RETRY_TIMEOUT

#define SNTP_RETRY_TIMEOUT   SNTP_RECV_TIMEOUT

Default retry timeout (in milliseconds) if the response received is invalid. This is doubled with each retry until SNTP_RETRY_TIMEOUT_MAX is reached.

Definition at line 189 of file sntp_opts.h.

◆ SNTP_RETRY_TIMEOUT_EXP

#define SNTP_RETRY_TIMEOUT_EXP   1

Increase retry timeout with every retry sent Default is on to conform to RFC.

Definition at line 201 of file sntp_opts.h.

◆ SNTP_RETRY_TIMEOUT_MAX

#define SNTP_RETRY_TIMEOUT_MAX   (SNTP_RETRY_TIMEOUT * 10)

Maximum retry timeout (in milliseconds).

Definition at line 194 of file sntp_opts.h.

◆ SNTP_SERVER_DNS

#define SNTP_SERVER_DNS   0

Set this to 1 to support DNS names (or IP address strings) to set sntp servers One server address/name can be defined as default if SNTP_SERVER_DNS == 1: #define SNTP_SERVER_ADDRESS "pool.ntp.org"

Definition at line 81 of file sntp_opts.h.

◆ SNTP_SET_SYSTEM_TIME

#define SNTP_SET_SYSTEM_TIME (   sec)    LWIP_UNUSED_ARG(sec)

SNTP macro to change system time in seconds Define SNTP_SET_SYSTEM_TIME_US(sec, us) to set the time in microseconds instead of this one if you need the additional precision. Alternatively, define SNTP_SET_SYSTEM_TIME_NTP(sec, frac) in order to work with native NTP timestamps instead.

Definition at line 56 of file sntp_opts.h.

◆ SNTP_STARTUP_DELAY

#define SNTP_STARTUP_DELAY   0

According to the RFC, this shall be a random delay between 1 and 5 minutes (in milliseconds) to prevent load peaks. This can be defined to a random generation function, which must return the delay in milliseconds as u32_t. Turned off by default.

Definition at line 148 of file sntp_opts.h.

◆ SNTP_STARTUP_DELAY_FUNC

#define SNTP_STARTUP_DELAY_FUNC   (LWIP_RAND() % 5000)

If you want the startup delay to be a function, define this to a function (including the brackets) and define SNTP_STARTUP_DELAY to 1.

Definition at line 156 of file sntp_opts.h.

◆ SNTP_UPDATE_DELAY

#define SNTP_UPDATE_DELAY   3600000

SNTP update delay - in milliseconds Default is 1 hour. Must not be beolw 60 seconds by specification (i.e. 60000)

Definition at line 171 of file sntp_opts.h.