Skip to main content

parse_pcapng

Function parse_pcapng 

Source
pub fn parse_pcapng(data: &[u8]) -> Result<Vec<(u32, u32, Vec<u8>)>, String>
Expand description

Parses a PCAPng buffer and returns every Ethernet-linked packet found as (ts_sec, ts_usec, frame_bytes). Non-Ethernet interfaces are skipped. Packet data is copied out (owned Vec<u8>) because PCAPng blocks are not guaranteed to be contiguous with a single packet’s logical payload once padding/options are accounted for.

§Errors

Returns Err if the buffer is too short, doesn’t start with a Section Header Block, or declares an invalid byte-order magic.