Struct pcap_parser::pcapng::EnhancedPacketBlock [−][src]
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: u32
block_len1: u32
if_id: u32
ts_high: u32
ts_low: u32
caplen: u32
Captured packet length
origlen: u32
Original packet length
data: &'a [u8]
Raw data from packet (with padding)
options: Vec<PcapNGOption<'a>>
block_len2: u32
Implementations
Trait Implementations
Return true if block is encoded as big-endian
Return true if block data was truncated (typically when snaplen < origlen)
Return the raw captured packet data, with padding if present, and eventually truncated.
Serialize to bytes representation (little-endian). Do not check values