pcap 2.5.0

A packet capture API around pcap/wpcap
Documentation
fn main() {
    // get the default Device
    let device = pcap::Device::lookup()
        .expect("device lookup failed")
        .expect("no device available");
    println!("Using device {}", device.name);

    // Setup Capture with a big buffer, so packets are not dropped between dispatch calls
    let mut cap = pcap::Capture::from_device(device)
        .unwrap()
        .buffer_size(16000000)
        .timeout(1000)
        .open()
        .unwrap();

    // Process packets in batches until we have seen 100 of them
    let mut count = 0;
    while count <= 100 {
        cap.dispatch(None, |packet| {
            println!("Got {:?}", packet.header);
            count += 1;
        })
        .unwrap();
    }
}