Skip to main content

L2Reader

Trait L2Reader 

Source
pub trait L2Reader {
    // Required methods
    fn recv(&mut self) -> Result<EthernetPacket<'_>, IoError>;
    fn set_timeout(&mut self, dur: Option<Duration>) -> Result<(), IoError>;
    fn set_promiscuous(&mut self, on: bool) -> Result<(), IoError>;
}
Expand description

Receiver for raw L2 Ethernet frames.

Implementations internally manage a receive buffer (typically 64 KB) and return zero-copy parsed EthernetPacket references.

Required Methods§

Source

fn recv(&mut self) -> Result<EthernetPacket<'_>, IoError>

Receive a single Ethernet frame and parse it.

Source

fn set_timeout(&mut self, dur: Option<Duration>) -> Result<(), IoError>

Set the receive timeout. None means blocking (no timeout).

Source

fn set_promiscuous(&mut self, on: bool) -> Result<(), IoError>

Enable or disable promiscuous mode.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§