ntp_proto/lib.rs
1// Copyright 2026 U.S. Federal Government (in countries where recognized)
2// SPDX-License-Identifier: Apache-2.0
3
4//! NTP protocol types, extension fields, and NTS cryptographic primitives.
5//!
6//! This crate provides the foundational types and parsing logic for the
7//! Network Time Protocol (RFC 5905) and Network Time Security (RFC 8915).
8
9#![cfg_attr(not(feature = "std"), no_std)]
10#![warn(missing_docs)]
11
12#[cfg(feature = "alloc")]
13extern crate alloc;
14
15/// Custom error types for buffer-based NTP packet parsing and serialization.
16pub mod error;
17
18/// NTP extension field parsing and NTS extension types.
19pub mod extension;
20
21/// NTP protocol types and constants (RFC 5905).
22pub mod protocol;
23
24/// Unix time conversion utilities for NTP timestamps.
25pub mod unix_time;
26
27/// Shared NTS logic: AEAD encryption, key establishment records, and NTS packet building.
28///
29/// Used by both client and server NTS implementations.
30#[cfg(feature = "nts")]
31pub mod nts_common;
32
33/// Roughtime protocol types, wire format, and cryptographic verification.
34///
35/// Provides Ed25519 signature verification and SHA-512 Merkle tree proofs
36/// for authenticated coarse time (draft-ietf-ntp-roughtime-15).
37#[cfg(feature = "roughtime")]
38pub mod roughtime;
39
40/// NTPv5 extension field constants and typed wrappers (`draft-ietf-ntp-ntpv5-07`).
41///
42/// Defines provisional extension field type codes (0xF5xx range) and typed
43/// structs for NTPv5-specific extension fields including Draft Identification,
44/// Server Information, Reference IDs, and Reference Timestamp.
45#[cfg(feature = "ntpv5")]
46pub mod ntpv5_ext;