pub enum ReadError {
Show 14 variants IoError(Error), UnexpectedEndOfSlice(usize), UnexpectedLenOfSlice { expected: usize, actual: usize, }, DoubleVlanOuterNonVlanEtherType(u16), IpUnsupportedVersion(u8), Ipv4UnexpectedVersion(u8), Ipv4HeaderLengthBad(u8), Ipv4TotalLengthTooSmall(u16), Ipv6UnexpectedVersion(u8), Ipv6TooManyHeaderExtensions, Ipv6HopByHopHeaderNotAtStart, IpAuthenticationHeaderTooSmallPayloadLength(u8), TcpDataOffsetTooSmall(u8), Icmpv6PacketTooBig(usize),
}
Expand description

Errors that can occur when reading.

Variants

IoError(Error)

Whenever an std::io::Error gets triggerd during a write it gets forwarded via this enum value.

UnexpectedEndOfSlice(usize)

Error when an unexpected end of a slice was reached even though more data was expected to be present (expected minimum size as argument).

UnexpectedLenOfSlice

Fields

expected: usize
actual: usize

Error when a slice has a different size then expected.

DoubleVlanOuterNonVlanEtherType(u16)

Error when a double vlan tag was expected but the ether type of the the first vlan header does not an vlan header ether type. The value is the unexpected ether type value in the outer vlan header.

IpUnsupportedVersion(u8)

Error when the ip header version is not supported (only 4 & 6 are supported). The value is the version that was received.

Ipv4UnexpectedVersion(u8)

Error when the ip header version field is not equal 4. The value is the version that was received.

Ipv4HeaderLengthBad(u8)

Error when the ipv4 header length is smaller then the header itself (5).

Ipv4TotalLengthTooSmall(u16)

Error when the total length field is too small to contain the header itself.

Ipv6UnexpectedVersion(u8)

Error when then ip header version field is not equal 6. The value is the version that was received.

Ipv6TooManyHeaderExtensions

Error when more then 7 header extensions are present (according to RFC82000 this should never happen).

Ipv6HopByHopHeaderNotAtStart

Error if the ipv6 hop by hop header does not occur directly after the ipv6 header (see rfc8200 chapter 4.1.)

IpAuthenticationHeaderTooSmallPayloadLength(u8)

Error if the header length in the ip authentication header is smaller then the minimum size of 1.

TcpDataOffsetTooSmall(u8)

Error given if the data_offset field in a TCP header is smaller then the minimum size of the tcp header itself.

Icmpv6PacketTooBig(usize)

Error when the packet size is too big (e.g larger then can be represendted in a length field).

This error can be triggered by

  • Icmpv6Slice::from_slice

Implementations

Adds an offset value to the UnexpectedEndOfSlice error.

Returns the std::io::Error value if the ReadError is an IoError. Otherwise `None is returned.

Returns the expected minimum size if the error is an UnexpectedEndOfSlice.

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

🔬 This is a nightly-only experimental API. (error_generic_member_access)

Provides type based access to context intended for error reports. Read more

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.