Open Frostie314159 opened 8 months ago
Could you please give a code sample that you would like to see working with pcap
? That way it will be easier to target exactly the feature you would like.
In my case, I was relying on the fact, that pcap internally just keeps an fd and using tokio, you can do async read and write operations on that. Providing an API similar to that would be great to have. I just have a fixed length array, into which I read the data, process it and then continue to the next packet.
let mut buf = [0x00; 1500];
let len = capture.read(&mut buf).await.unwrap();
see https://github.com/rust-pcap/pcap/blob/main/examples/lendingiterprint.rs for no allocating codec
There is no codec used in that example and it is sync not async.
It would be nice, to be able to use a capture asynchronously, without the Codec forcing you to allocate.