pub struct ControlMessage {
pub li_vn_mode: u8,
pub opcode: u8,
pub sequence: u16,
pub status: u16,
pub associd: u16,
pub offset: u16,
pub count: u16,
}Expand description
Control message header — 12 bytes on wire, all big-endian. Instead of #[repr(packed)] (which caused OOB reads), we use explicit encode/decode with to_be_bytes/from_be_bytes.
Fields§
§li_vn_mode: u8§opcode: u8§sequence: u16§status: u16§associd: u16§offset: u16§count: u16Implementations§
Source§impl ControlMessage
impl ControlMessage
pub fn zeroed() -> ControlMessage
Sourcepub fn decode(data: &[u8]) -> Option<(ControlMessage, &[u8])>
pub fn decode(data: &[u8]) -> Option<(ControlMessage, &[u8])>
Decode from 12-byte big-endian wire format. Returns None if too short.
pub fn version(&self) -> NtpVersion
pub fn mode(&self) -> NtpMode
pub fn decode_opcode(&self) -> ControlOpcode
Trait Implementations§
Source§impl Clone for ControlMessage
impl Clone for ControlMessage
Source§fn clone(&self) -> ControlMessage
fn clone(&self) -> ControlMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ControlMessage
Source§impl Debug for ControlMessage
impl Debug for ControlMessage
impl Eq for ControlMessage
Source§impl PartialEq for ControlMessage
impl PartialEq for ControlMessage
impl StructuralPartialEq for ControlMessage
Auto Trait Implementations§
impl Freeze for ControlMessage
impl RefUnwindSafe for ControlMessage
impl Send for ControlMessage
impl Sync for ControlMessage
impl Unpin for ControlMessage
impl UnsafeUnpin for ControlMessage
impl UnwindSafe for ControlMessage
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