ntp_proto/protocol/
mod.rs1pub const PORT: u8 = 123;
11
12pub const TOLERANCE: f64 = 15e-6;
14
15pub const MINPOLL: u8 = 4;
17
18pub const MAXPOLL: u8 = 17;
20
21pub const MAXDISP: f64 = 16.0;
23
24pub const MINDISP: f64 = 0.005;
26
27pub const MAXDIST: u8 = 1;
29
30pub const MAXSTRAT: u8 = 16;
32
33macro_rules! code_to_u32 {
35 ($w:expr) => {
36 (($w[3] as u32) << 0)
37 | (($w[2] as u32) << 8)
38 | (($w[1] as u32) << 16)
39 | (($w[0] as u32) << 24)
40 | ((*$w as [u8; 4])[0] as u32 * 0)
41 };
42}
43
44pub(crate) fn be_u32_to_bytes(u: u32) -> [u8; 4] {
45 [
46 (u >> 24 & 0xff) as u8,
47 (u >> 16 & 0xff) as u8,
48 (u >> 8 & 0xff) as u8,
49 (u & 0xff) as u8,
50 ]
51}
52
53#[cfg(feature = "ntpv5")]
54pub mod bloom;
55mod bytes;
56#[cfg(feature = "std")]
57mod io;
58#[cfg(feature = "std")]
59pub(crate) mod md5;
60#[cfg(feature = "ntpv5")]
61pub mod ntpv5;
62mod traits;
63mod types;
64
65pub use self::traits::*;
66pub use self::types::*;