Expand description

Packet parsing and construction.

Where possible we use traits to support a common API for constructing the ICMPv4 and ICMPv6 versions of the packets.

Both packet types can be constructed from a slice: &[u8] via the TryFrom trait.

Examples

Constructing an ICMPv4 echo request.

let packet = Icmpv4Packet::with_echo_request(
    42, // An identifier so you can recognize responses to your own packets.
    0, // the first echo request packet in our sequence.
    "a payload big enough to matter".as_bytes().to_vec()
).unwrap();

Parsing an ICMPv4 packet from a byte buffer.

use std::convert::TryFrom;
let parsed_packet = Icmpv4Packet::try_from(byte_buffer.as_slice()).unwrap();

Structs

An Icmpv4 Packet.

Enums

Errors returned by constructors for a given packet.

The various messages for an Icmpv4 packet.

The possible Icmpv6 Message types.

Error type returned by parsing the ICMP packets.

Traits

Construct a packet for Echo Reply messages. This packet type is really only used for the ICMPv6 protocol.

Construct a packet for the EchoRequest messages.

Construct a packet for Parameter Problem messages.

Construct a packet for Time Exceeded messages.

Construct a packet for Destination Unreachable messages.