Skip to main content

PacketCaptureReader

Trait PacketCaptureReader 

Source
pub trait PacketCaptureReader {
    type Error;

    // Required methods
    fn link_type(&self) -> Option<LinkType>;
    fn next_packet(
        &mut self,
    ) -> Option<Result<(Duration, Vec<u8>), Self::Error>>;
}
Expand description

Common interface for reading packet captures (pcap or pcapng).

Two adapters implement this trait: PcapReader and PcapNgReader. Both yield (timestamp, raw_packet_data) tuples regardless of the underlying file format.

Required Associated Types§

Required Methods§

The link-layer type of the captured packets, if known.

Source

fn next_packet(&mut self) -> Option<Result<(Duration, Vec<u8>), Self::Error>>

Read the next captured packet. Returns None at end-of-file.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§