Skip to main content

iter_packets

Function iter_packets 

Source
pub fn iter_packets(
    input: &[u8],
) -> Result<(PcapHeader, Vec<RawPacket<'_>>), String>
Expand description

Parses a full legacy PCAP buffer and returns the header plus every packet it contains. Truncated trailing records are silently dropped rather than causing the whole capture to be rejected, matching the tolerant behavior of Wireshark.

ยงErrors

Returns Err if the global header is malformed or the link-layer type is not Ethernet (network != 1).