Expand description
SWIM/Hello neighbor discovery protocol family.
This module contains the shared hello protocol state machine and its link-medium implementations.
§Module layout
| Sub-module | Contents |
|---|---|
payload | HelloPayload TLV codec — the wire format for hello Data Content |
medium | LinkMedium trait — link-specific face creation, signing, address extraction |
protocol | HelloProtocol<T> — generic SWIM/hello/probe state machine |
udp | UdpNeighborDiscovery — UDP multicast neighbor discovery (requires udp-hello feature) |
probe | SWIM direct/indirect probe packet builders and parsers |
§Adding a new link-medium
To support a new link type (e.g. Ethernet, Bluetooth, LoRa):
- Create a new file in this module (e.g.
ether.rs). - Implement
medium::LinkMediumfor your medium struct — this provides link-specific face creation, hello Data signing, and address extraction. - Define a type alias:
pub type EtherNeighborDiscovery = HelloProtocol<YourMedium>; - Re-export it from this
mod.rsand from the crate root (lib.rs).
The generic protocol::HelloProtocol<T> handles all the shared logic:
hello scheduling, SWIM probes, neighbor lifecycle, gossip diffs. Your
medium only implements the link-specific parts.
Re-exports§
pub use medium::HELLO_PREFIX_DEPTH;pub use medium::HELLO_PREFIX_STR;pub use medium::HelloCore;pub use medium::HelloState;pub use medium::LinkMedium;pub use payload::CAP_CONTENT_STORE;pub use payload::CAP_FRAGMENTATION;pub use payload::CAP_SVS;pub use payload::CAP_VALIDATION;pub use payload::DiffEntry;pub use payload::HelloPayload;pub use payload::NeighborDiff;pub use payload::T_ADD_ENTRY;pub use payload::T_CAPABILITIES;pub use payload::T_NEIGHBOR_DIFF;pub use payload::T_NODE_NAME;pub use payload::T_PUBLIC_KEY;pub use payload::T_REMOVE_ENTRY;pub use payload::T_SERVED_PREFIX;pub use payload::T_UNICAST_PORT;pub use probe::DirectProbe;pub use probe::IndirectProbe;pub use probe::build_direct_probe;pub use probe::build_indirect_probe;pub use probe::build_indirect_probe_encoded;pub use probe::build_probe_ack;pub use probe::is_probe_ack;pub use probe::parse_direct_probe;pub use probe::parse_indirect_probe;pub use protocol::HelloProtocol;pub use udp::UdpNeighborDiscovery;
Modules§
- ether
EtherNeighborDiscovery— NDN neighbor discovery over raw Ethernet.- medium
LinkMediumtrait — abstraction over link-layer differences for discovery.- payload
HelloPayload— NDN neighbor discovery hello packet TLV codec.- probe
- SWIM direct and indirect liveness probe packets.
- protocol
HelloProtocol<T>— generic SWIM/hello/probe discovery state machine.- udp
UdpNeighborDiscovery— cross-platform NDN neighbor discovery over UDP.