Skip to main content

Netdev

Trait Netdev 

Source
pub trait Netdev: Device {
    // Required method
    fn interface(&self) -> &str;

    // Provided methods
    fn statistics(&self) -> NetdevStats { ... }
    fn epoch(&self) -> u64 { ... }
    fn destinations(&self) -> Option<Vec<Destination>> { ... }
}
Expand description

A device whose data plane is the kernel’s: a network interface that Zenoh reaches over an ordinary TCP link bound to it (#118, #130).

Nothing here moves a byte — that is the point. The driver serves such a device on the management plane exactly as it serves a Medium, and the lanes, the scheduler and the framing never see it: Netdev: Device, not Netdev: Medium. The kernel’s view (statistics, the presence epoch) is this trait’s; what the vendor’s control API knows (signal, registration, data rates) arrives through Device::report, and an adapter that wraps the kernel view with a vendor’s must forward both.

Required Methods§

Source

fn interface(&self) -> &str

The interface name, as the kernel spells it: wwan0, ppp0.

Provided Methods§

Source

fn statistics(&self) -> NetdevStats

The interface’s counters, as the kernel keeps them (#130): sync and cached, like Device::report. A counter the kernel does not keep is absent, never zero.

Source

fn epoch(&self) -> u64

The presence epoch (zenkey RFC 04 §5, v1.39): moves when the interface is re-enumerated (its ifindex changed) or a counter is observed to decrease — what a USB modem re-enumerating looks like — and the management plane cycles device/{device}/alive when it does, which is the one reset the registry sanctions for the counters under this device. 0 until it moves.

Source

fn destinations(&self) -> Option<Vec<Destination>>

The neighbours the device’s radio reports it can reach (#137): a DLEP radio’s destinations. None, the default, is a device that has no such notion, which is every netdev that is not a radio with a neighbour table; Some of an empty list is one that has the notion and no neighbour now. Sync and cached, like statistics.

Not endpoints (architecture §4.6): an endpoint is a remote the operator configured lanes toward; a destination is what a radio discovered, and comes and goes on its own.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§