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 { ... }
}
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. What a netdev knows about its interface — statistics, the operational state, an MTU to configure — arrives with #130; this release names the interface and nothing else, so that a host can carry one beside a modem and the roster shows one producer.

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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§