pub struct IcmpPacket<'a> { /* private fields */ }Expand description
Zero-copy ICMPv4 packet parser.
Implementations§
Source§impl<'a> IcmpPacket<'a>
impl<'a> IcmpPacket<'a>
pub fn new(buf: &'a [u8]) -> Option<Self>
pub fn type_(&self) -> u8
pub fn code(&self) -> u8
pub fn checksum(&self) -> u16
Sourcepub fn rest_of_header(&self) -> u32
pub fn rest_of_header(&self) -> u32
The rest-of-header field (bytes 4..8), interpreted per message type.
Sourcepub fn verify_checksum(&self) -> bool
pub fn verify_checksum(&self) -> bool
Verify the ICMP checksum over the entire message.
Sourcepub fn message(&self) -> IcmpMessage<'a>
pub fn message(&self) -> IcmpMessage<'a>
Parse the ICMP message into a typed variant.
Trait Implementations§
Source§impl<'a> Clone for IcmpPacket<'a>
impl<'a> Clone for IcmpPacket<'a>
Source§fn clone(&self) -> IcmpPacket<'a>
fn clone(&self) -> IcmpPacket<'a>
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 moreAuto Trait Implementations§
impl<'a> Freeze for IcmpPacket<'a>
impl<'a> RefUnwindSafe for IcmpPacket<'a>
impl<'a> Send for IcmpPacket<'a>
impl<'a> Sync for IcmpPacket<'a>
impl<'a> Unpin for IcmpPacket<'a>
impl<'a> UnsafeUnpin for IcmpPacket<'a>
impl<'a> UnwindSafe for IcmpPacket<'a>
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