Skip to main content

Module link_sensor

Module link_sensor 

Source
Expand description

Cross-platform link-quality sensing: the radio / interface stats the adaptive controller reads to anticipate loss before the in-band loss estimate sees it.

Each OS exposes a different best signal, normalized behind one trait:

  • Linux: /sys/class/net/<iface>/statistics drop and error counters (delta-based drop rate). Works on any interface, wired or wireless - the relevant signal on a wired / virtual link where no RSSI exists.
  • Windows: both WlanQueryInterface connection signal quality (0..100, the RSSI-equivalent) on a Wi-Fi interface AND the GetIfTable2 discard / error counters on ANY adapter (the Ethernet path, and a fallback where there is no Wi-Fi). The worse of the two wins, so wired and wireless links are both covered.
  • macOS / other: a stub returning “unknown” until a CoreWLAN backend lands.

The controller fuses LinkSnapshot::link_stress (0..1) with the loss / burstiness / delay sensors: a degrading link raises protection pre-emptively.

Structs§

LinkSnapshot
A normalized link-quality reading. Every field is optional because no single platform / interface exposes them all.
StubSensor
A sensor that knows nothing (macOS until CoreWLAN lands, and any other target). Always returns an empty snapshot.

Enums§

LinkClass
The kind of link the local interface presents. A class change (Wi-Fi to cellular, a wired uplink dropping to Wi-Fi) is a path event in its own right.

Traits§

LinkSensor
A pollable link-quality sensor. sample is called on the controller’s slow cadence (not per packet).

Functions§

platform_sensor
Construct the best link sensor for this platform. iface names the interface to watch (Linux); None auto-detects the first non-loopback up interface.