Struct ippacket::IcmpHeader
source · pub struct IcmpHeader(/* private fields */);
Implementations§
source§impl IcmpHeader
impl IcmpHeader
pub fn with_bytes(bytes: Bytes) -> Result<(IcmpHeader, Bytes)>
pub fn len() -> usize
pub fn icmp_type(&self) -> u8
pub fn icmp_code(&self) -> u8
pub fn id(&self) -> u16
pub fn seq(&self) -> u16
pub fn checksum_valid<V: Iterator<Item = u16>>(&self, data: V) -> bool
sourcepub fn calculated_checksum<V: Iterator<Item = u16>>(&self, data: V) -> u16
pub fn calculated_checksum<V: Iterator<Item = u16>>(&self, data: V) -> u16
This function should only be used to calculate the checksum for ICMPv4 packets as it does not include the pseudo-header for ICMPv6 packets. Usually, the OS will calculate the checksum for ICMPv6 packets.
pub fn set_icmp_type(&mut self, icmp_type: u8)
pub fn set_icmp_code(&mut self, icmp_code: u8)
pub fn set_id(&mut self, id: u16)
pub fn set_seq(&mut self, seq: u16)
sourcepub fn calculate_checksum<V: Iterator<Item = u16>>(&mut self, data: V)
pub fn calculate_checksum<V: Iterator<Item = u16>>(&mut self, data: V)
This function should only be used to calculate the checksum for ICMPv4 packets as it does not include the pseudo-header for ICMPv6 packets. Usually, the OS will calculate the checksum for ICMPv6 packets.
Trait Implementations§
source§impl Clone for IcmpHeader
impl Clone for IcmpHeader
source§fn clone(&self) -> IcmpHeader
fn clone(&self) -> IcmpHeader
Returns a copy of the value. Read more
1.0.0 · 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 Freeze for IcmpHeader
impl !RefUnwindSafe for IcmpHeader
impl !Send for IcmpHeader
impl !Sync for IcmpHeader
impl Unpin for IcmpHeader
impl !UnwindSafe for IcmpHeader
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