SatCat5
satcat5::ntp::Header Struct Reference

Detailed Description

Message headers for the Network Time Protocol (NTP / IETF RFC-5905).

This struct represents the NTP message header, as defined in RFC-5905 Section 7.3 and Figure 8. It includes all basic information, but not the extension fields or message digest. Support for MD5 authentication may be added in future versions.

Definition at line 20 of file ntp_header.h.

#include <ntp_header.h>

Public Member Functions

 Header (const Header &t)=default
 
Headeroperator= (const Header &t)=default
 
void log_to (satcat5::log::LogBuffer &wr) const
 Human-readable formatting of the header contents.
 
bool read_from (satcat5::io::Readable *rd)
 Read this header from a data source.
 
void write_to (satcat5::io::Writeable *wr) const
 Write this header to a data sink.
 
u8 li () const
 Accessors for splitting LI, VN, and Mode fields.
 
u8 vn () const
 Accessors for splitting LI, VN, and Mode fields.
 
u8 mode () const
 Accessors for splitting LI, VN, and Mode fields.
 

Public Attributes

u8 lvm
 Combined LI + VN + Mode.
 
u8 stratum
 Hops to grandmaster (1-15)
 
s8 poll
 Interval = 2^N seconds.
 
s8 precision
 Precision = 2^N seconds.
 
u32 rootdelay
 Round trip delay to grandmaster.
 
u32 rootdisp
 Total dispersion to grandmaster.
 
u32 refid
 Server-ID or KoD code.
 
u64 ref
 Time of last sync to parent.
 
u64 org
 T1 (Client transmit time)
 
u64 rec
 T2 (Server receive time)
 
u64 xmt
 T3 (Server transmit time)
 

Static Public Attributes

static constexpr unsigned HEADER_LEN = 48
 The basic header is exactly 12 words = 48 bytes long.
 
static constexpr u8 LI_MASK = (3 << 6)
 Leap second indictor (LI) for last minute of current day.
 
static constexpr u8 LEAP_NONE = (0 << 6)
 
static constexpr u8 LEAP_61 = (1 << 6)
 
static constexpr u8 LEAP_59 = (2 << 6)
 
static constexpr u8 LEAP_UNK = (3 << 6)
 
static constexpr u8 VN_MASK = (7 << 3)
 Version number is always 4.
 
static constexpr u8 VERSION_3 = (3 << 3)
 
static constexpr u8 VERSION_4 = (4 << 3)
 
static constexpr u8 MODE_MASK = 0x7
 Mode number indicates client or server role.
 
static constexpr u8 MODE_RSVD = 0
 
static constexpr u8 MODE_SYMM1 = 1
 
static constexpr u8 MODE_SYMM0 = 2
 
static constexpr u8 MODE_CLIENT = 3
 
static constexpr u8 MODE_SERVER = 4
 
static constexpr u8 MODE_BCAST = 5
 
static constexpr u8 MODE_CTRL = 6
 
static constexpr u8 MODE_PRIVAT = 7
 
static constexpr u32 KISS_ACST = 0x41435354u
 Reserved RefIDs, aka "kiss codes" (Section 7.4)
 
static constexpr u32 KISS_AUTH = 0x41555448u
 
static constexpr u32 KISS_AUTO = 0x4155544Fu
 
static constexpr u32 KISS_BCST = 0x42435354u
 
static constexpr u32 KISS_CRYP = 0x43525950u
 
static constexpr u32 KISS_DENY = 0x44454E59u
 
static constexpr u32 KISS_DROP = 0x44524F50u
 
static constexpr u32 KISS_RSTR = 0x52535452u
 
static constexpr u32 KISS_INIT = 0x494E4954u
 
static constexpr u32 KISS_MCST = 0x4D435354u
 
static constexpr u32 KISS_NKEY = 0x4E4B4559u
 
static constexpr u32 KISS_RATE = 0x52415445u
 
static constexpr u32 KISS_RMOT = 0x524D4F54u
 
static constexpr u32 KISS_STEP = 0x53544550u
 
static constexpr s8 TIME_1HOUR = 12
 Named constants for polling intervals and dispersion.
 
static constexpr s8 TIME_32MIN = 11
 
static constexpr s8 TIME_16MIN = 10
 
static constexpr s8 TIME_8MIN = 9
 
static constexpr s8 TIME_4MIN = 8
 
static constexpr s8 TIME_2MIN = 7
 
static constexpr s8 TIME_1MIN = 6
 
static constexpr s8 TIME_32SEC = 5
 
static constexpr s8 TIME_16SEC = 4
 
static constexpr s8 TIME_8SEC = 3
 
static constexpr s8 TIME_4SEC = 2
 
static constexpr s8 TIME_2SEC = 1
 
static constexpr s8 TIME_1SEC = 0
 
static constexpr s8 TIME_500MSEC = -1
 
static constexpr s8 TIME_250MSEC = -2
 
static constexpr s8 TIME_125MSEC = -3
 
static constexpr s8 TIME_64MSEC = -4
 
static constexpr s8 TIME_32MSEC = -5
 
static constexpr s8 TIME_16MSEC = -6
 
static constexpr s8 TIME_8MSEC = -7
 
static constexpr s8 TIME_4MSEC = -8
 
static constexpr s8 TIME_2MSEC = -9
 
static constexpr s8 TIME_1MSEC = -10
 
static constexpr s8 TIME_500USEC = -11
 
static constexpr s8 TIME_250USEC = -12
 
static constexpr s8 TIME_125USEC = -13
 
static constexpr s8 TIME_64USEC = -14
 
static constexpr s8 TIME_32USEC = -15
 
static constexpr s8 TIME_16USEC = -16
 
static constexpr s8 TIME_8USEC = -17
 
static constexpr s8 TIME_4USEC = -18
 
static constexpr s8 TIME_2USEC = -19
 
static constexpr s8 TIME_1USEC = -20
 
static constexpr s8 TIME_500NSEC = -21
 
static constexpr s8 TIME_250NSEC = -22
 
static constexpr s8 TIME_125NSEC = -23
 
static constexpr s8 TIME_64NSEC = -24
 
static constexpr s8 TIME_32NSEC = -25
 
static constexpr s8 TIME_16NSEC = -26
 
static constexpr s8 TIME_8NSEC = -27
 
static constexpr s8 TIME_4NSEC = -28
 
static constexpr s8 TIME_2NSEC = -29
 
static constexpr s8 TIME_1NSEC = -30
 

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