1pub mod file_header;
6pub mod packet_header;
7pub mod sync;
8#[cfg(feature = "tokio-async")]
9pub mod tokio_impl;
10use thiserror::Error;
11
12use crate::{byte_order::UnexpectedSize, link_type::InvalidLinkType};
13
14#[derive(Debug, Error)]
16pub enum PcapParseError {
17 #[error(transparent)]
18 IO(#[from] std::io::Error),
19 #[error("Invalid magic number got {0:?}")]
20 InvalidMagicNumber(Option<[u8; 4]>),
21 #[error(transparent)]
22 InvalidLinkType(#[from] InvalidLinkType),
23 #[error(
24 "Invalid packet length: snap length {snap_length} is greater than included length {incl_len}"
25 )]
26 InvalidPacketLength { snap_length: u32, incl_len: u32 },
27 #[error("Invalid version")]
28 InvalidVersion,
29 #[error(transparent)]
31 TryFromSliceError(#[from] std::array::TryFromSliceError),
32 #[error(transparent)]
33 UnexpectedSize(#[from] UnexpectedSize),
34}