Skip to main content

ContentValidationError

Enum ContentValidationError 

Source
pub enum ContentValidationError {
Show 18 variants InvalidMagicNumber(u32), InvalidReservedField(u16), InvalidTsResolution(u8, bool, u8), InvalidLinktype(DataLink), NoInterface, InvalidInterfaceId(u32), FailedToDecodeTimestamp { timestamp_high: u32, timestamp_low: u32, resolution: InterfaceTsResolution, offset: i64, }, FailedToEncodeTimestamp { timestamp: Duration, resolution: InterfaceTsResolution, offset: i64, }, InvalidOriginalLen(u32, usize), InvalidCapturedLen { expected: usize, actual: usize, }, RecordWrongSize { expected: usize, actual: usize, }, RecordWrongMinSize { min: usize, actual: usize, }, RecordTooBig(usize), RecordNameNotUtf8(Utf8Error), RecordNamesEmpty, CustomBlockConversionError(u32, Box<dyn Error + Sync + Send>), BlockContentTooBig(u64), OptionTooBig(usize),
}
Expand description

Errors that can occur while validating decoded pcapng content.

Variants§

§

InvalidMagicNumber(u32)

The magic number of the pcapng SectionBlock is invalid.

§

InvalidReservedField(u16)

A reserved field is not zero.

§

InvalidTsResolution(u8, bool, u8)

The timestamp resolution value is invalid.

§

InvalidLinktype(DataLink)

The linktype in invalid (superior to u16::MAX)

§

NoInterface

No interface in the current section state.

§

InvalidInterfaceId(u32)

The interface ID does not exist in the current section state.

§

FailedToDecodeTimestamp

A raw timestamp and its interface offset could not be represented as a duration since the Unix epoch.

Fields

§timestamp_high: u32

Most significant 32 bits of the raw timestamp.

§timestamp_low: u32

Least significant 32 bits of the raw timestamp.

§resolution: InterfaceTsResolution

Interface timestamp resolution.

§offset: i64

Interface timestamp offset in seconds.

§

FailedToEncodeTimestamp

A timestamp could not be encoded in the raw 64-bit timestamp field.

Fields

§timestamp: Duration

Timestamp supplied for encoding.

§resolution: InterfaceTsResolution

Interface timestamp resolution.

§offset: i64

Interface timestamp offset in seconds.

§

InvalidOriginalLen(u32, usize)

The original length of the packet is lower than its actual length

§

InvalidCapturedLen

The captured length of the packet does not match the expected length.

Fields

§expected: usize

Expected captured length

§actual: usize

Actual captured length

§

RecordWrongSize

The Name Resolution record entry size is invalid.

Fields

§expected: usize

Expected size

§actual: usize

Actual size

§

RecordWrongMinSize

The Name Resolution record entry is smaller than its minimum valid size.

Fields

§min: usize

Expected size

§actual: usize

Actual size

§

RecordTooBig(usize)

The Name Resolution record entry is too big to be written

§

RecordNameNotUtf8(Utf8Error)

A record name is not valid UTF-8.

§

RecordNamesEmpty

A Name Resolution record does not contain any names.

§

CustomBlockConversionError(u32, Box<dyn Error + Sync + Send>)

Error converting a custom block payload.

§

BlockContentTooBig(u64)

The content of a block is too big to fit on a block.

§

OptionTooBig(usize)

The content of a PcapNgOption is too big to be written

Trait Implementations§

Source§

impl Debug for ContentValidationError

Source§

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

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

impl Display for ContentValidationError

Source§

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

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

impl Error for ContentValidationError

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<ContentValidationError> for PcapNgError

Source§

fn from(source: ContentValidationError) -> Self

Converts to this type from the input type.
Source§

impl From<ContentValidationError> for BlockContentParseError

Source§

fn from(source: ContentValidationError) -> Self

Converts to this type from the input type.
Source§

impl From<ContentValidationError> for OptionEntryError

Source§

fn from(source: ContentValidationError) -> Self

Converts to this type from the input type.

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.