Struct pcap::Capture [] [src]

pub struct Capture {
    // some fields omitted
}

This represents an open capture handle attached to a device.

Internally it represents a pcap_t.

Methods

impl Capture
[src]

fn new<D: AsRef<str>>(device: D) -> Result<CaptureError>

Creates a capture handle from the specified device, or an error from pcap.

You can provide this a Device from Devices::list_all() or an &str name of the device such as "any" on Linux.

fn next<'a>(&'a mut self) -> Option<&'a [u8]>

Blocks until a packet is returned from the capture handle or an error occurs.

fn filter(&mut self, program: &str) -> Result<()Error>

Adds a filter to the capture using the given BPF program string. Internally this is compiled using pcap_compile().

See http://biot.com/capstats/bpf.html for more information about this syntax.

Trait Implementations

impl Drop for Capture
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more