packet_formats::icmp

Trait IcmpMessage

Source
pub trait IcmpMessage<I: IcmpIpExt>:
    Sized
    + Copy
    + FromBytes
    + IntoBytes
    + KnownLayout
    + Immutable
    + Unaligned {
    type Code: Into<u8> + Copy + Debug;
    type Body<B: SplitByteSlice>: MessageBody<B = B>;

    const TYPE: I::IcmpMessageType;
    const EXPECTS_BODY: bool = true;

    // Required method
    fn code_from_u8(code: u8) -> Option<Self::Code>;
}
Expand description

An ICMP message.

Required Associated Constants§

Source

const TYPE: I::IcmpMessageType

The type corresponding to this message type.

The value of the “type” field in the ICMP header corresponding to messages of this type.

Provided Associated Constants§

Source

const EXPECTS_BODY: bool = true

Whether or not a message body is expected in an ICMP packet.

Required Associated Types§

Source

type Code: Into<u8> + Copy + Debug

The type of codes used with this message.

The ICMP header includes an 8-bit “code” field. For a given message type, different values of this field carry different meanings. Not all code values are used - some may be invalid. This type represents a parsed code. For example, for TODO, it is the TODO type.

Source

type Body<B: SplitByteSlice>: MessageBody<B = B>

The type of the body used with this message.

Required Methods§

Source

fn code_from_u8(code: u8) -> Option<Self::Code>

Parse a Code from an 8-bit number.

Parse a Code from the 8-bit “code” field in the ICMP header. Not all values for this field are valid. If an invalid value is passed, code_from_u8 returns None.

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.

Implementors§

Source§

impl IcmpMessage<Ipv4> for IcmpDestUnreachable

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv4 as IcmpIpExt>::IcmpMessageType = {transmute(0x01): <net_types::ip::Ipv4 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = Icmpv4DestUnreachableCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>

Source§

impl IcmpMessage<Ipv4> for IcmpTimeExceeded

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv4 as IcmpIpExt>::IcmpMessageType = {transmute(0x04): <net_types::ip::Ipv4 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = Icmpv4TimeExceededCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>

Source§

impl IcmpMessage<Ipv4> for Icmpv4ParameterProblem

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv4 as IcmpIpExt>::IcmpMessageType = {transmute(0x05): <net_types::ip::Ipv4 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = Icmpv4ParameterProblemCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>

Source§

impl IcmpMessage<Ipv4> for Icmpv4Redirect

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv4 as IcmpIpExt>::IcmpMessageType = {transmute(0x02): <net_types::ip::Ipv4 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = Icmpv4RedirectCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>

Source§

impl IcmpMessage<Ipv4> for Icmpv4TimestampReply

Source§

const EXPECTS_BODY: bool = false

Source§

const TYPE: <Ipv4 as IcmpIpExt>::IcmpMessageType = {transmute(0x07): <net_types::ip::Ipv4 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = EmptyMessage<B>

Source§

impl IcmpMessage<Ipv4> for Icmpv4TimestampRequest

Source§

const EXPECTS_BODY: bool = false

Source§

const TYPE: <Ipv4 as IcmpIpExt>::IcmpMessageType = {transmute(0x06): <net_types::ip::Ipv4 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = EmptyMessage<B>

Source§

impl IcmpMessage<Ipv6> for MulticastListenerDone

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x0d): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Mldv1Body<B>

Source§

impl IcmpMessage<Ipv6> for MulticastListenerQuery

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x0b): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Mldv1Body<B>

Source§

impl IcmpMessage<Ipv6> for MulticastListenerQueryV2

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x0b): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Mldv2QueryBody<B>

Source§

impl IcmpMessage<Ipv6> for MulticastListenerReport

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x0c): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Mldv1Body<B>

Source§

impl IcmpMessage<Ipv6> for MulticastListenerReportV2

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x0e): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Mldv2ReportBody<B>

Source§

impl IcmpMessage<Ipv6> for NeighborAdvertisement

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x09): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Records<B, NdpOptionsImpl>

Source§

impl IcmpMessage<Ipv6> for NeighborSolicitation

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x08): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Records<B, NdpOptionsImpl>

Source§

impl IcmpMessage<Ipv6> for Redirect

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x0a): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Records<B, NdpOptionsImpl>

Source§

impl IcmpMessage<Ipv6> for RouterAdvertisement

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x07): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Records<B, NdpOptionsImpl>

Source§

impl IcmpMessage<Ipv6> for RouterSolicitation

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x06): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = Records<B, NdpOptionsImpl>

Source§

impl IcmpMessage<Ipv6> for IcmpDestUnreachable

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x00): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = Icmpv6DestUnreachableCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>

Source§

impl IcmpMessage<Ipv6> for IcmpTimeExceeded

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x02): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = Icmpv6TimeExceededCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>

Source§

impl IcmpMessage<Ipv6> for Icmpv6PacketTooBig

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x01): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>

Source§

impl IcmpMessage<Ipv6> for Icmpv6ParameterProblem

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: <Ipv6 as IcmpIpExt>::IcmpMessageType = {transmute(0x03): <net_types::ip::Ipv6 as icmp::IcmpIpExt>::IcmpMessageType}

Source§

type Code = Icmpv6ParameterProblemCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>

Source§

impl<I: IcmpIpExt> IcmpMessage<I> for IcmpEchoReply

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: I::IcmpMessageType = I::ECHO_REPLY

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>

Source§

impl<I: IcmpIpExt> IcmpMessage<I> for IcmpEchoRequest

Source§

const EXPECTS_BODY: bool = true

Source§

const TYPE: I::IcmpMessageType = I::ECHO_REQUEST

Source§

type Code = IcmpUnusedCode

Source§

type Body<B: SplitByteSlice> = OriginalPacket<B>