pub struct NtpPacket {Show 13 fields
pub leap: LeapIndicator,
pub version: u8,
pub mode: Mode,
pub stratum: u8,
pub poll: i8,
pub precision: i8,
pub root_delay: NtpShort,
pub root_dispersion: NtpShort,
pub reference_id: [u8; 4],
pub reference_ts: NtpTimestamp,
pub origin_ts: NtpTimestamp,
pub receive_ts: NtpTimestamp,
pub transmit_ts: NtpTimestamp,
}Expand description
The fixed NTPv4 header.
Fields§
§leap: LeapIndicator§version: u8§mode: Mode§stratum: u8§poll: i8§precision: i8§root_delay: NtpShort§root_dispersion: NtpShort§reference_id: [u8; 4]§reference_ts: NtpTimestamp§origin_ts: NtpTimestamp§receive_ts: NtpTimestamp§transmit_ts: NtpTimestampImplementations§
Source§impl NtpPacket
impl NtpPacket
Sourcepub fn client_request(version: u8, transmit_ts: NtpTimestamp) -> Self
pub fn client_request(version: u8, transmit_ts: NtpTimestamp) -> Self
A mode-3 client request. The caller supplies transmit_ts, which SHOULD be
an unpredictable nonce rather than the real clock (BCP: it is echoed back as
origin_ts and is the only spoofing defence an unauthenticated client has).
Sourcepub fn parse(buf: &[u8]) -> Result<NtpPacket, ParseError>
pub fn parse(buf: &[u8]) -> Result<NtpPacket, ParseError>
Parse the 48-byte header. Trailing bytes (extension fields / legacy MAC) are
left to extension_fields.
pub fn to_bytes(&self) -> [u8; 48]
Trait Implementations§
impl Copy for NtpPacket
impl Eq for NtpPacket
impl StructuralPartialEq for NtpPacket
Auto Trait Implementations§
impl Freeze for NtpPacket
impl RefUnwindSafe for NtpPacket
impl Send for NtpPacket
impl Sync for NtpPacket
impl Unpin for NtpPacket
impl UnsafeUnpin for NtpPacket
impl UnwindSafe for NtpPacket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more