Struct icmp_socket::packet::Icmpv4Packet[][src]

pub struct Icmpv4Packet {
    pub typ: u8,
    pub code: u8,
    pub checksum: u16,
    pub message: Icmpv4Message,
}

An Icmpv4 Packet.

Fields

typ: u8code: u8checksum: u16message: Icmpv4Message

Implementations

impl Icmpv4Packet[src]

pub fn parse<B: AsRef<[u8]>>(bytes: B) -> Result<Self, PacketParseError>[src]

Parse an Icmpv4Packet from bytes.

pub fn get_bytes(&self, with_checksum: bool) -> Vec<u8>[src]

Get this packet serialized to bytes suitable for sending on the wire.

pub fn calculate_checksum(&self) -> u16[src]

Calculate the checksum for the packet given the provided source and destination addresses.

pub fn with_checksum(mut self: Self) -> Self[src]

Populate the checksum field of this Packet.

Trait Implementations

impl Debug for Icmpv4Packet[src]

impl TryFrom<&'_ [u8]> for Icmpv4Packet[src]

type Error = PacketParseError

The type returned in the event of a conversion error.

impl WithEchoRequest for Icmpv4Packet[src]

type Packet = Icmpv4Packet

impl WithParameterProblem for Icmpv4Packet[src]

type Packet = Icmpv4Packet

type Pointer = u8

impl WithTimeExceeded for Icmpv4Packet[src]

type Packet = Icmpv4Packet

impl WithUnreachable for Icmpv4Packet[src]

type Packet = Icmpv4Packet

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.