[][src]Crate pcap_async

pcap-async

Async/await wrappers pcap-sys.

 use futures::StreamExt;
 use pcap_async::{Config, Handle, PacketStream};
 use std::sync::Arc;

 #[tokio::main]
 async fn main() {
     let handle = Handle::lookup().expect("No handle created");
     let mut provider = PacketStream::new(Config::default(), Arc::clone(&handle))
         .expect("Could not create provider")
         .boxed();
     while let Some(packets) = provider.next().await {

     }
     handle.interrupt();
 }

Re-exports

pub use crate::errors::Error;

Modules

bpf
errors
pcap_util

Structs

BridgeStream
Config
Handle

Wrapper around a pcap_t handle to indicate live or offline capture, and allow the handle to be interrupted to stop capture.

Info
Packet
PacketStream
Stats

Enums

BigEndian

Defines big-endian serialization.

LittleEndian

Defines little-endian serialization.

Traits

WriteBytesExt

Extends Write with methods for writing numbers. (For std::io.)

Type Definitions

NativeEndian

Defines system native-endian serialization.

StreamItem