Skip to main content

rusty_rtos_sntp_core/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![forbid(unsafe_code)]
3//! `rusty_rtos_sntp-core` — the pure heart of `rusty_rtos_sntp`.
4//!
5//! Rules this crate lives by (from the Kairos mission plan):
6//!
7//! 1. `no_std` by default; `alloc` is a feature, never an assumption.
8//! 2. No CPU, no registers, no allocator, no operating system. Ports and
9//!    backends are separate WRAP crates.
10//! 3. Every type that crosses to another Kairos package comes from
11//!    `rusty_rtos_core`, so packages compose without conversions.
12//! 4. Handles are indices, never pointers; nothing on a hot path allocates.
13//! 5. `forbid(unsafe)`. The C kernel's trace is the oracle; the scalar path
14//!    is the oracle; any faster path is gated identical against it.
15
16#[cfg(feature = "alloc")]
17extern crate alloc;
18
19pub use rusty_rtos_core as rtos_core;
20
21/// The names a firmware wants in scope.
22pub mod prelude {
23    pub use rusty_rtos_core::prelude::*;
24}
25
26/// Crate version, for manifests and logs.
27pub const VERSION: &str = env!("CARGO_PKG_VERSION");
28
29/// The types that cross the SNTP surface.
30pub mod types;
31
32/// `core_sntp_serializer.c`: the SNTPv4 packet codec and its arithmetic.
33pub mod serializer;
34
35/// `core_sntp_client.c`: the polling client over a UDP transport.
36pub mod client;
37
38pub use client::{
39    AuthError, Authenticator, Client, InitError, NetworkError, NoAuth, ReceiveError, Reception,
40    SendError, ServerInfo, SntpHost,
41};
42pub use serializer::{
43    FRACTION_VALUE_PER_MICROSECOND, KISS_OF_DEATH_CODE_LENGTH, PACKET_BASE_SIZE,
44    TIME_AT_UNIX_EPOCH_SECS, UNIX_TIME_SECS_AT_SNTP_ERA_1_SMALLEST_TIME, calculate_poll_interval,
45    convert_to_unix_time, deserialize_response, serialize_request,
46};
47pub use types::{
48    Accepted, DeserializeError, LeapSecond, PollIntervalError, Rejected, Rejection, SerializeError,
49    Timestamp, Verdict,
50};