Expand description
Zero-copy Ethernet frames.
This is a packet-level subscription that delivers raw Ethernet frames in the order of arrival. It has identical behavior to the Frame type, except is zero-copy, meaning that callbacks are invoked on raw DPDK memory buffers instead of a heap-allocated buffer. This is useful for performance sensitive applications that do not need to store packet data. If ownership of the packet data is required, it is recommended to use Frame instead.
§Warning
All ZcFrames must be dropped (freed and returned to the memory pool) before the Retina runtime
is dropped.
§Example
Prints IPv4 packets with a TTL greater than 64:
#[filter("ipv4.time_to_live > 64")]
fn main() {
let config = default_config();
let cb = |pkt: ZcFrame| {
println!("{:?}", pkt.data());
// implicit drop at end of scope
};
let mut runtime = Runtime::new(config, filter, cb).unwrap();
runtime.run();
// runtime dropped at end of scope
}Type Aliases§
- ZcFrame
- A zero-copy Ethernet frame.