Crate ndn_discovery

Crate ndn_discovery 

Source
Expand description

§ndn-discovery — Pluggable neighbor and service discovery

Provides the DiscoveryProtocol and DiscoveryContext traits that decouple discovery logic from the engine core, along with supporting types and the NoDiscovery null object for routers that do not need automatic neighbor finding.

§Architecture

The engine owns a single Arc<dyn DiscoveryProtocol> field. Protocols observe face lifecycle events and inbound packets via hooks; they mutate engine state (faces, FIB, neighbor table) exclusively through the narrow DiscoveryContext interface.

Multiple protocols can run simultaneously via CompositeDiscovery, which validates that their claimed name prefixes do not overlap at construction time and routes inbound packets by prefix match.

§Crate layout

Framework (crate root): Core traits and shared infrastructure.

ModuleContents
protocolDiscoveryProtocol trait, ProtocolId
contextDiscoveryContext, NeighborTableView traits
neighborNeighborTable, NeighborEntry, NeighborState, NeighborUpdate
mac_addrMacAddr — link-layer address shared between discovery and face layer
no_discoveryNoDiscovery — no-op protocol for standalone deployments
compositeCompositeDiscovery — runs multiple protocols simultaneously
backoffBackoffConfig, BackoffState — exponential backoff with jitter
configDiscoveryConfig, DiscoveryProfile, ServiceDiscoveryConfig
scopeWell-known namespace prefixes and link-local scope predicates
wireShared TLV encoding/decoding helpers

Protocol implementations (subdirectories):

ModuleContents
helloSWIM/Hello protocol family: payload codec, state machine, UDP impl
hello::probeSWIM direct/indirect probe packet builders and parsers
gossipEpidemic gossip and SVS service-discovery sync
service_discoveryService record publication and browsing (/ndn/local/sd/services/)
strategyNeighborProbeStrategy trait and scheduler implementations
prefix_announceService record publisher and browser

Re-exports§

pub use backoff::BackoffConfig;
pub use backoff::BackoffState;
pub use composite::CompositeDiscovery;
pub use config::DiscoveryConfig;
pub use config::DiscoveryProfile;
pub use config::DiscoveryScope;
pub use config::HelloStrategyKind;
pub use config::PrefixAnnouncementMode;
pub use config::ServiceDiscoveryConfig;
pub use config::ServiceValidationPolicy;
pub use context::DiscoveryContext;
pub use context::NeighborTableView;
pub use gossip::EpidemicGossip;
pub use gossip::SvsServiceDiscovery;
pub use hello::UdpNeighborDiscovery;
pub use hello::ether::EtherNeighborDiscovery;
pub use hello::CAP_CONTENT_STORE;
pub use hello::CAP_FRAGMENTATION;
pub use hello::CAP_SVS;
pub use hello::CAP_VALIDATION;
pub use hello::DiffEntry;
pub use hello::HelloPayload;
pub use hello::NeighborDiff;
pub use hello::T_ADD_ENTRY;
pub use hello::T_CAPABILITIES;
pub use hello::T_NEIGHBOR_DIFF;
pub use hello::T_NODE_NAME;
pub use hello::T_REMOVE_ENTRY;
pub use hello::T_SERVED_PREFIX;
pub use hello::DirectProbe;
pub use hello::IndirectProbe;
pub use hello::build_direct_probe;
pub use hello::build_indirect_probe;
pub use hello::build_indirect_probe_encoded;
pub use hello::build_probe_ack;
pub use hello::is_probe_ack;
pub use hello::parse_direct_probe;
pub use hello::parse_indirect_probe;
pub use hello::HelloCore;
pub use hello::HelloProtocol;
pub use hello::HelloState;
pub use hello::LinkMedium;
pub use neighbor::NeighborEntry;
pub use neighbor::NeighborState;
pub use neighbor::NeighborTable;
pub use neighbor::NeighborUpdate;
pub use no_discovery::NoDiscovery;
pub use prefix_announce::ServiceRecord;
pub use prefix_announce::build_browse_interest;
pub use prefix_announce::make_record_name;
pub use protocol::DiscoveryProtocol;
pub use protocol::InboundMeta;
pub use protocol::LinkAddr;
pub use protocol::ProtocolId;
pub use scope::global_root;
pub use scope::gossip_prefix;
pub use scope::hello_prefix;
pub use scope::is_nd_packet;
pub use scope::is_sd_packet;
pub use scope::mgmt_prefix;
pub use scope::nd_root;
pub use scope::ndn_local;
pub use scope::peers_prefix;
pub use scope::probe_direct;
pub use scope::probe_via;
pub use scope::routing_lsa;
pub use scope::routing_prefix;
pub use scope::scope_root;
pub use scope::sd_services;
pub use scope::sd_updates;
pub use scope::site_root;
pub use service_discovery::ServiceDiscoveryProtocol;
pub use service_discovery::decode_peer_list;
pub use strategy::composite::CompositeStrategy;
pub use strategy::BackoffScheduler;
pub use strategy::NeighborProbeStrategy;
pub use strategy::PassiveScheduler;
pub use strategy::ProbeRequest;
pub use strategy::ReactiveScheduler;
pub use strategy::SwimScheduler;
pub use strategy::TriggerEvent;
pub use strategy::build_strategy;

Modules§

backoff
Exponential backoff with jitter for hello/probe scheduling.
composite
CompositeDiscovery — runs multiple protocols simultaneously.
config
Discovery configuration — deployment profiles and per-parameter tuning.
context
DiscoveryContext — narrow engine interface exposed to discovery protocols.
gossip
Gossip-based discovery supplements.
hello
SWIM/Hello neighbor discovery protocol family.
mac_addr
Link-layer (MAC) address — re-exported from ndn-transport where it is defined.
neighbor
Neighbor table — engine-owned state for all discovered peers.
no_discovery
NoDiscovery — null-object discovery protocol.
prefix_announce
Service record publisher and browser.
protocol
DiscoveryProtocol trait, ProtocolId, and InboundMeta types.
scope
Namespace isolation — well-known prefix constants and scope enforcement.
service_discovery
ServiceDiscoveryProtocol/ndn/local/sd/services/ and /ndn/local/nd/peers.
strategy
Probe-scheduling strategies for neighbor discovery.
wire
Shared TLV encoding/decoding helpers for discovery packet builders.

Structs§

MacAddr
A 6-byte IEEE 802 MAC address.