Struct pcap_parser::pcapng::EnhancedPacketBlock
source · [−]pub struct EnhancedPacketBlock<'a> {
pub block_type: u32,
pub block_len1: u32,
pub if_id: u32,
pub ts_high: u32,
pub ts_low: u32,
pub caplen: u32,
pub origlen: u32,
pub data: &'a [u8],
pub options: Vec<PcapNGOption<'a>>,
pub block_len2: u32,
}Expand description
An Enhanced Packet Block (EPB) is the standard container for storing the packets coming from the network.
This struct is a thin abstraction layer, and stores the raw block data.
For ex the data field is stored with the padding.
It implements the PcapNGPacketBlock trait, which provides helper functions.
Examples
use pcap_parser::pcapng::parse_enhancedpacketblock_le;
use pcap_parser::traits::PcapNGPacketBlock;
let (i, epb) = parse_enhancedpacketblock_le(pcap_data).unwrap();
let packet_data = epb.packet_data();
if packet_data.len() < epb.orig_len() as usize {
// packet was truncated
} else {
// we have a full packet
}Fields
block_type: u32block_len1: u32if_id: u32ts_high: u32ts_low: u32caplen: u32Captured packet length
origlen: u32Original packet length
data: &'a [u8]Raw data from packet (with padding)
options: Vec<PcapNGOption<'a>>block_len2: u32Implementations
sourceimpl<'a> EnhancedPacketBlock<'a>
impl<'a> EnhancedPacketBlock<'a>
Trait Implementations
sourceimpl<'a> Debug for EnhancedPacketBlock<'a>
impl<'a> Debug for EnhancedPacketBlock<'a>
sourceimpl<'a> PcapNGPacketBlock for EnhancedPacketBlock<'a>
impl<'a> PcapNGPacketBlock for EnhancedPacketBlock<'a>
sourcefn big_endian(&self) -> bool
fn big_endian(&self) -> bool
Return true if block is encoded as big-endian
sourcefn truncated(&self) -> bool
fn truncated(&self) -> bool
Return true if block data was truncated (typically when snaplen < origlen)
sourceimpl<'a> ToVec for EnhancedPacketBlock<'a>
This is supported on crate feature serialize only.
impl<'a> ToVec for EnhancedPacketBlock<'a>
This is supported on crate feature
serialize only.Auto Trait Implementations
impl<'a> RefUnwindSafe for EnhancedPacketBlock<'a>
impl<'a> Send for EnhancedPacketBlock<'a>
impl<'a> Sync for EnhancedPacketBlock<'a>
impl<'a> Unpin for EnhancedPacketBlock<'a>
impl<'a> UnwindSafe for EnhancedPacketBlock<'a>
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