24#ifndef PROTOCORE_NTP_SERVER_H
25#define PROTOCORE_NTP_SERVER_H
31#define NTP_PACKET_LEN 48u
34#define NTP_UNIX_OFFSET 2208988800u
37#define NTP_REFID_LOCL 0x4C4F434Cu
40#define NTP_REFID_GPS 0x47505320u
60 uint32_t pc_ntp_secs, uint32_t pc_ntp_frac, uint8_t *out,
size_t out_cap);
#define NTP_REFID_LOCL
Reference ID "LOCL" - an undisciplined local clock (RFC 5905 sec 7.3).
size_t pc_ntp_server_build_response(const uint8_t *req, size_t req_len, uint8_t stratum, uint32_t refid, uint32_t pc_ntp_secs, uint32_t pc_ntp_frac, uint8_t *out, size_t out_cap)
Build a server (mode 4) reply to a client NTP request. Pure - no clock, no I/O.
bool pc_ntp_server_begin(uint8_t stratum, uint32_t refid=NTP_REFID_LOCL)
Start answering NTP requests on UDP/123 from the device's own clock.