packet_formats::icmp

Trait IcmpIpExt

Source
pub trait IcmpIpExt: IpProtoExt {
    type IcmpPacketTypeRaw<B: SplitByteSliceMut>: IcmpPacketTypeRaw<B, Self> + GenericOverIp<Self, Type = Self::IcmpPacketTypeRaw<B>> + GenericOverIp<Ipv4, Type = Icmpv4PacketRaw<B>> + GenericOverIp<Ipv6, Type = Icmpv6PacketRaw<B>>;
    type IcmpMessageType: IcmpMessageType + GenericOverIp<Self, Type = Self::IcmpMessageType> + GenericOverIp<Ipv4, Type = Icmpv4MessageType> + GenericOverIp<Ipv6, Type = Icmpv6MessageType>;
    type ParameterProblemCode: PartialEq + Send + Sync + Debug;
    type ParameterProblemPointer: PartialEq + Send + Sync + Debug;
    type HeaderLen: PartialEq + Send + Sync + Debug;

    const ICMP_IP_PROTO: <Self as IpProtoExt>::Proto;
    const ECHO_REPLY: Self::IcmpMessageType;
    const ECHO_REQUEST: Self::IcmpMessageType;

    // Required method
    fn header_len(bytes: &[u8]) -> usize;
}
Expand description

An extension trait adding ICMP-related functionality to Ipv4 and Ipv6.

Required Associated Constants§

Source

const ICMP_IP_PROTO: <Self as IpProtoExt>::Proto

The identifier for this ICMP version.

This value will be found in an IPv4 packet’s Protocol field (for ICMPv4 packets) or an IPv6 fixed header’s or last extension header’s Next Heeader field (for ICMPv6 packets).

Source

const ECHO_REPLY: Self::IcmpMessageType

Icmp{v4,v6}MessageType::EchoReply.

Source

const ECHO_REQUEST: Self::IcmpMessageType

Icmp{v4,v6}MessageType::EchoRequest.

Required Associated Types§

Source

type IcmpPacketTypeRaw<B: SplitByteSliceMut>: IcmpPacketTypeRaw<B, Self> + GenericOverIp<Self, Type = Self::IcmpPacketTypeRaw<B>> + GenericOverIp<Ipv4, Type = Icmpv4PacketRaw<B>> + GenericOverIp<Ipv6, Type = Icmpv6PacketRaw<B>>

The ICMP packet type for this IP version.

Source

type IcmpMessageType: IcmpMessageType + GenericOverIp<Self, Type = Self::IcmpMessageType> + GenericOverIp<Ipv4, Type = Icmpv4MessageType> + GenericOverIp<Ipv6, Type = Icmpv6MessageType>

The type of ICMP messages.

For Ipv4, this is Icmpv4MessageType, and for Ipv6, this is Icmpv6MessageType.

Source

type ParameterProblemCode: PartialEq + Send + Sync + Debug

The type of an ICMP parameter problem code.

For Ipv4, this is Icmpv4ParameterProblemCode, and for Ipv6 this is Icmpv6ParameterProblemCode.

Source

type ParameterProblemPointer: PartialEq + Send + Sync + Debug

The type of an ICMP parameter problem pointer.

For Ipv4, this is u8, and for Ipv6 this is u32.

Source

type HeaderLen: PartialEq + Send + Sync + Debug

The type of an ICMP parameter header length.

For Ipv4, this is usize, and for Ipv6 this is ().

Required Methods§

Source

fn header_len(bytes: &[u8]) -> usize

Computes the length of the header of the packet prefix stored in bytes.

Given the prefix of a packet stored in bytes, compute the length of the header of that packet, or bytes.len() if bytes does not contain the entire header. If the version is IPv6, the returned length should include all extension headers.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl IcmpIpExt for Ipv4

Source§

impl IcmpIpExt for Ipv6

Implementors§