pub enum PacketError {
Show 15 variants
BufferTooShort {
expected: usize,
actual: usize,
},
InvalidField(String),
UnsupportedLayer(String),
LayerNotFound(LayerKind),
ChecksumMismatch {
expected: u16,
actual: u16,
},
InvalidProtocol(u8),
ParseError {
offset: usize,
message: String,
},
FieldError(FieldError),
BindingNotFound {
lower: LayerKind,
upper: LayerKind,
},
NeighborResolutionFailed(String),
InvalidMac(String),
InvalidIp(String),
NotSupported(String),
Timeout(u64),
Io(String),
}Expand description
Errors that can occur during packet operations.
Variants§
BufferTooShort
The packet buffer is too short to contain the expected data.
InvalidField(String)
Invalid field value encountered during parsing.
UnsupportedLayer(String)
The layer type is not supported or recognized.
LayerNotFound(LayerKind)
Attempted to access a layer that doesn’t exist in the packet.
ChecksumMismatch
Checksum verification failed.
InvalidProtocol(u8)
Invalid protocol number.
ParseError
Failed to parse layer at the given offset.
FieldError(FieldError)
Field access error.
BindingNotFound
Layer binding not found.
NeighborResolutionFailed(String)
Neighbor resolution failed.
InvalidMac(String)
Invalid MAC address.
InvalidIp(String)
Invalid IP address.
NotSupported(String)
Operation not supported.
Timeout(u64)
Timeout error.
Io(String)
I/O error wrapper.
Implementations§
Source§impl PacketError
impl PacketError
Sourcepub fn buffer_too_short(expected: usize, actual: usize) -> Self
pub fn buffer_too_short(expected: usize, actual: usize) -> Self
Create a buffer too short error.
Sourcepub fn parse_error(offset: usize, message: impl Into<String>) -> Self
pub fn parse_error(offset: usize, message: impl Into<String>) -> Self
Create a parse error.
Sourcepub fn binding_not_found(lower: LayerKind, upper: LayerKind) -> Self
pub fn binding_not_found(lower: LayerKind, upper: LayerKind) -> Self
Create a binding not found error.
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if this is a recoverable error.
Trait Implementations§
Source§impl Debug for PacketError
impl Debug for PacketError
Source§impl Display for PacketError
impl Display for PacketError
Source§impl Error for PacketError
impl Error for PacketError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<Error> for PacketError
impl From<Error> for PacketError
Source§impl From<FieldError> for PacketError
impl From<FieldError> for PacketError
Source§fn from(source: FieldError) -> Self
fn from(source: FieldError) -> Self
Converts to this type from the input type.
Source§impl From<PacketError> for FlowError
impl From<PacketError> for FlowError
Source§fn from(source: PacketError) -> Self
fn from(source: PacketError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PacketError
impl RefUnwindSafe for PacketError
impl Send for PacketError
impl Sync for PacketError
impl Unpin for PacketError
impl UnsafeUnpin for PacketError
impl UnwindSafe for PacketError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more