Enum etherparse::ReadError
source · [−]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
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
sourceimpl ReadError
impl ReadError
sourcepub fn add_slice_offset(self, offset: usize) -> ReadError
pub fn add_slice_offset(self, offset: usize) -> ReadError
Adds an offset value to the UnexpectedEndOfSlice error.
sourcepub fn io_error(self) -> Option<Error>
pub fn io_error(self) -> Option<Error>
Returns the std::io::Error
value if the ReadError
is an IoError
.
Otherwise `None is returned.
sourcepub fn unexpected_end_of_slice_min_expected_size(self) -> Option<usize>
pub fn unexpected_end_of_slice_min_expected_size(self) -> Option<usize>
Returns the expected minimum size if the error is an UnexpectedEndOfSlice
.
Trait Implementations
sourceimpl Error for ReadError
impl Error for ReadError
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations
impl !RefUnwindSafe for ReadError
impl Send for ReadError
impl Sync for ReadError
impl Unpin for ReadError
impl !UnwindSafe for ReadError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more