Expand description
NTPv4 packet codec (RFC 5905) with extension-field iteration (RFC 7822).
Every entry point is a parse-constructor returning Result; nothing here can
panic on untrusted bytes (the fuzz targets in fuzz/ hold this line).
Structs§
- Extension
Field - One RFC 7822 extension field: type, and its value bytes (header excluded).
- Extension
Iter - NtpPacket
- The fixed NTPv4 header.
- NtpShort
- 32-bit NTP short format: 16.16 fixed-point seconds (root delay / dispersion).
- NtpTimestamp
- 64-bit NTP timestamp: 32.32 fixed-point seconds since the era epoch.
Enums§
- Leap
Indicator - Mode
- Parse
Error - Trailer
- What follows the fixed header.
Constants§
- HEADER_
LEN - Length of the fixed NTPv4 header.
- UNIX_
EPOCH_ OFFSET - Seconds between the NTP era-0 epoch (1900-01-01) and the Unix epoch (1970-01-01).
Functions§
- extension_
fields - Iterate whatever follows the 48-byte header. Malformed input can never panic:
anything that does not parse as an extension field is yielded once as
Trailer::Opaqueand iteration ends. - offset_
delay - Offset/delay from the four client-exchange timestamps (RFC 5905 §8), all in seconds on any common timescale. Returns (offset, delay); offset is seconds to ADD to the local clock.