Enum etherparse::icmpv4::DestUnreachableHeader

source ·
pub enum DestUnreachableHeader {
Show 16 variants Network, Host, Protocol, Port, FragmentationNeeded { next_hop_mtu: u16, }, SourceRouteFailed, NetworkUnknown, HostUnknown, Isolated, NetworkProhibited, HostProhibited, TosNetwork, TosHost, FilterProhibited, HostPrecedenceViolation, PrecedenceCutoff,
}
Expand description

“Destination Unreachable” ICMP header for IPv4 (without the invoking packet).

§Description in RFC 792:

If, according to the information in the gateway’s routing tables, the network specified in the internet destination field of a datagram is unreachable, e.g., the distance to the network is infinity, the gateway may send a destination unreachable message to the internet source host of the datagram. In addition, in some networks, the gateway may be able to determine if the internet destination host is unreachable. Gateways in these networks may send destination unreachable messages to the source host when the destination host is unreachable.

If, in the destination host, the IP module cannot deliver the datagram because the indicated protocol module or process port is not active, the destination host may send a destination unreachable message to the source host.

Another case is when a datagram must be fragmented to be forwarded by a gateway yet the Don’t Fragment flag is on. In this case the gateway must discard the datagram and may return a destination unreachable message.

Codes 0, 1, 4, and 5 may be received from a gateway. Codes 2 and 3 may be received from a host.

Variants§

§

Network

Network unreachable error.

§

Host

Host unreachable error.

§

Protocol

Transport protocol not supported error.

§

Port

Port unreachable error.

§

FragmentationNeeded

Fragmentation would be needed but the don’t fragment bit is set.

Fields

§next_hop_mtu: u16
§

SourceRouteFailed

Source Route Failed

§

NetworkUnknown

Destination Network Unknown (from RFC 1122)

§

HostUnknown

Destination Host Unknown (no route to host known) (from RFC 1122)

§

Isolated

Source Host Isolated - obsolete (from RFC 1122)

§

NetworkProhibited

Communication with Destination Network is Administratively Prohibited (from RFC 1122)

§

HostProhibited

Communication with Destination Host is Administratively Prohibited (from RFC 1122)

§

TosNetwork

Destination Network Unreachable for Type of Service (from RFC 1122)

§

TosHost

Destination Host Unreachable for Type of Service (from RFC 1122)

§

FilterProhibited

Cannot forward because packet administratively filtered (from RFC 1812)

§

HostPrecedenceViolation

Required level of precidence not supported (from RFC 1812)

§

PrecedenceCutoff

Packet was below minimum precidence (from RFC 1812)

Implementations§

source§

impl DestUnreachableHeader

source

pub fn from_values( code_u8: u8, next_hop_mtu: u16 ) -> Option<DestUnreachableHeader>

Tries to convert the code u8 value and next_hop_mtu to a DestUnreachableHeader value.

Returns None in case the code value is not known as a destination unreachable code.

source

pub fn code_u8(&self) -> u8

Returns the icmp code value of the destination unreachable packet.

Trait Implementations§

source§

impl Clone for DestUnreachableHeader

source§

fn clone(&self) -> DestUnreachableHeader

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DestUnreachableHeader

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for DestUnreachableHeader

source§

fn eq(&self, other: &DestUnreachableHeader) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for DestUnreachableHeader

source§

impl StructuralPartialEq for DestUnreachableHeader

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.