Expand description
Raw Ethernet on Linux, macOS and Windows: MAC addresses, the computer’s interfaces, frames of one ethertype, frames with the times the hardware stamped on them, PTP hardware clocks, and capturing whole frames; on Linux, also 802.11 Action frames with the radio’s times. It moves frames and reads clocks, and parses no payload: gPTP, MRP and AVTP are other crates’ business.
Without the std feature only the address types remain, so protocol
crates built on them also run on microcontrollers.
Re-exports§
pub use interfaces::Interface;pub use interfaces::LinkPower;pub use interfaces::interfaces;pub use socket::Blocked;pub use socket::Received;pub use socket::Socket;pub use socket::check_access;
Modules§
- broker
- Raw sockets from a helper, so the program using them holds no
capability. On Linux a raw Ethernet socket takes CAP_NET_RAW only to be
created; once open it works for whoever holds it. A program holding the
capability itself runs as one other programs may not look into: the
desktop portals refuse it file dialogs and screen sharing, and
debuggers and crash reports pass it by. So an app ships a tiny helper
of its own, the one file granted the capability, whose
maincallsserve; the app starts it withBroker::startandinstalls it, and every raw socket this crate opens comes from it from then on. - capture
- Whole frames crossing an interface, both ways, for capturing: those of chosen ethertypes the interface receives and sends, a bridge port’s forwarded frames among them, each with the time the kernel saw it and its VLAN tag put back where the kernel had taken it off. The filter runs in the kernel, so frames of other ethertypes cost the program nothing, and the kernel hands frames over in blocks of a ring shared with the program, so a busy capture wakes it a few times a second rather than once a frame. Linux only so far; elsewhere opening fails as unsupported.
- clock
- A network interface’s PTP hardware clock, which gPTP keeps on the
network’s time, read from Linux’s
/dev/ptpN, and two such clocks compared. Elsewhere opening fails as unsupported. - interfaces
- The Ethernet interfaces of this computer and what each can do.
- socket
- Raw Ethernet frames of one ethertype on one interface.
- stamped
- Frames of one ethertype sent and received with the times the
interface’s hardware put on them, as gPTP needs: when each received
frame crossed the wire in, and when each sent one went out, by the
interface’s PTP hardware clock. The kernel adds and removes the
Ethernet header, as for a
crate::socket::Socket. - wifi
- 802.11 Action frames on Linux through nl80211, with the times the
radio stamped on them: what gPTP over Wi-Fi (802.1AS-2020 clause 12)
needs of a station’s or an access point’s interface. A Timing
Measurement frame goes out with
Radio::send_action, and when it left and when its Ack came back arrive inEvent::TxStatus; one received arrives inEvent::Frame, with when it came and when its Ack left. The radio stamps the frames to and from the station named toRadio::set_hw_timestamp, one station at a time on Intel’s.