pub trait L3Device: Send + Sync {
// Required methods
fn set_handler(&self, h: L3Handler);
fn send(&self, packet: &Packet) -> Result<()>;
fn addr(&self) -> IpPrefix;
fn set_addr(&self, prefix: IpPrefix) -> Result<()>;
fn close(&self) -> Result<()>;
// Provided method
fn stats(&self) -> Option<&DeviceStats> { ... }
}Expand description
A Layer 3 (IP) network device.
Addr returns the device’s current IP prefix; set_addr updates it,
typically from a DHCP client or other source of dynamic configuration.
Required Methods§
fn set_handler(&self, h: L3Handler)
fn send(&self, packet: &Packet) -> Result<()>
fn addr(&self) -> IpPrefix
fn set_addr(&self, prefix: IpPrefix) -> Result<()>
fn close(&self) -> Result<()>
Provided Methods§
Sourcefn stats(&self) -> Option<&DeviceStats>
fn stats(&self) -> Option<&DeviceStats>
Traffic counters, if the device keeps any. See L2Device::stats.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Implementors§
impl L3Device for Client
Available on crate feature
vclient only.impl L3Device for ImpairL3
Available on crate feature
impair only.impl L3Device for Nat
Available on crate feature
nat only.impl L3Device for NsSide
Available on crate feature
slirp only.impl L3Device for PipeL3
impl L3Device for Stack
Available on crate feature
slirp only.impl L3Device for TapL3
Available on crate feature
pcap only.impl L3Device for Tun
Available on crate feature
tuntap only.