Skip to main content

IcmpPacketTypeRaw

Trait IcmpPacketTypeRaw 

Source
pub trait IcmpPacketTypeRaw<B: SplitByteSliceMut, I: Ip>: Sized + ParsablePacket<B, (), Error = ParseError> {
    // Required methods
    fn update_checksum_pseudo_header_address(
        &mut self,
        old: I::Addr,
        new: I::Addr,
    );
    fn update_checksum_header_field<F: IntoBytes + Immutable>(
        &mut self,
        old: F,
        new: F,
    );
    fn try_write_checksum(
        &mut self,
        src_addr: I::Addr,
        dst_addr: I::Addr,
    ) -> bool;
    fn message_body_mut(&mut self) -> &mut B;

    // Provided method
    fn update_checksum_header_field_u16(&mut self, old: u16, new: u16) { ... }
}
Expand description

An ICMP or ICMPv6 packet

‘IcmpPacketType’ is implemented by Icmpv4Packet and Icmpv6Packet

Required Methods§

Source

fn update_checksum_pseudo_header_address(&mut self, old: I::Addr, new: I::Addr)

Update the checksum to reflect an updated address in the pseudo header.

Source

fn update_checksum_header_field<F: IntoBytes + Immutable>( &mut self, old: F, new: F, )

Update the checksum to reflect a field change in the header.

It is the caller’s responsibility to ensure the field is actually part of an ICMP header for checksumming.

Source

fn try_write_checksum(&mut self, src_addr: I::Addr, dst_addr: I::Addr) -> bool

Recalculates and attempts to write a checksum for this packet.

Returns whether the checksum was successfully calculated and written. In the false case, self is left unmodified.

Source

fn message_body_mut(&mut self) -> &mut B

Returns a mutable reference to the body of this packet.

Provided Methods§

Source

fn update_checksum_header_field_u16(&mut self, old: u16, new: u16)

Like IcmpPacketTypeRaw::update_checksum_header_field, but takes native endian u16s.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§