pub struct IcmpMessageBuffer { /* private fields */ }
Expand description
A helper for constructing ICMP packets.
It’s an optional convenience for internal use in EncodeIcmpMessage
implementations.
Implementations§
Source§impl IcmpMessageBuffer
impl IcmpMessageBuffer
Sourcepub fn new(typ: u8, code: u8, body: &[u8]) -> Self
pub fn new(typ: u8, code: u8, body: &[u8]) -> Self
Create a new buffer with the provided ICMP type typ
, code
, and body
.
Sourcepub fn set_body(&mut self, body: impl IntoIterator<Item = u8>)
pub fn set_body(&mut self, body: impl IntoIterator<Item = u8>)
Set the type-specific ICMP message body
Sourcepub fn extend_body(&mut self, body_suffix: impl IntoIterator<Item = u8>)
pub fn extend_body(&mut self, body_suffix: impl IntoIterator<Item = u8>)
Append body_suffix
to the buffer, leaving the existing body in place
Sourcepub fn truncate_body(&mut self, body_len: usize)
pub fn truncate_body(&mut self, body_len: usize)
Truncate the message body at body_len
bytes
Sourcepub fn calculate_icmpv4_checksum(&mut self)
pub fn calculate_icmpv4_checksum(&mut self)
Populate bytes 2-3 with the IPv4 ones complement checksum.
Auto Trait Implementations§
impl Freeze for IcmpMessageBuffer
impl RefUnwindSafe for IcmpMessageBuffer
impl Send for IcmpMessageBuffer
impl Sync for IcmpMessageBuffer
impl Unpin for IcmpMessageBuffer
impl UnwindSafe for IcmpMessageBuffer
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