pub struct HelloProtocol<T: LinkMedium> {
pub core: HelloCore,
pub medium: T,
}Expand description
Generic neighbor discovery protocol over any LinkMedium.
Contains the shared SWIM/hello/probe state machine and delegates to T
for link-specific operations. Concrete types are typically exposed via
type aliases:
pub type UdpNeighborDiscovery = HelloProtocol<UdpMedium>;
pub type EtherNeighborDiscovery = HelloProtocol<EtherMedium>;Fields§
§core: HelloCore§medium: TImplementations§
Source§impl<T: LinkMedium> HelloProtocol<T>
impl<T: LinkMedium> HelloProtocol<T>
Sourcepub fn create(medium: T, node_name: Name, config: DiscoveryConfig) -> Self
pub fn create(medium: T, node_name: Name, config: DiscoveryConfig) -> Self
Create a new HelloProtocol with the given medium, node name, and config.
Sourcepub fn set_served_prefixes(&self, prefixes: Vec<Name>)
pub fn set_served_prefixes(&self, prefixes: Vec<Name>)
Set the prefixes this node serves (announced in Hello Data when InHello mode).
pub fn build_hello_interest(&self, nonce: u32) -> Bytes
Sourcepub fn build_hello_payload(&self) -> HelloPayload
pub fn build_hello_payload(&self) -> HelloPayload
Build a HelloPayload from the current shared state.
Called by LinkMedium::build_hello_data to get the payload content
before applying link-specific signing.
Source§impl HelloProtocol<UdpMedium>
impl HelloProtocol<UdpMedium>
Sourcepub fn new(multicast_face_id: FaceId, node_name: Name) -> Self
pub fn new(multicast_face_id: FaceId, node_name: Name) -> Self
Create a new UdpNeighborDiscovery with the default LAN profile.
pub fn new_with_config( multicast_face_id: FaceId, node_name: Name, config: DiscoveryConfig, ) -> Self
Sourcepub fn new_multi(
face_ids: Vec<FaceId>,
node_name: Name,
config: DiscoveryConfig,
) -> Self
pub fn new_multi( face_ids: Vec<FaceId>, node_name: Name, config: DiscoveryConfig, ) -> Self
Create a UdpNeighborDiscovery listening on multiple multicast faces
(one per network interface).
A transient Ed25519 key is derived deterministically from the node name
via SHA-256. Callers that need a persistent key should use
new_multi_with_signer.
Sourcepub fn new_multi_with_signer(
face_ids: Vec<FaceId>,
node_name: Name,
config: DiscoveryConfig,
signer: Arc<dyn Signer>,
) -> Self
pub fn new_multi_with_signer( face_ids: Vec<FaceId>, node_name: Name, config: DiscoveryConfig, signer: Arc<dyn Signer>, ) -> Self
Create with an explicit signer (e.g. from the router’s PIB).
Sourcepub fn with_unicast_port(self, port: u16) -> Self
pub fn with_unicast_port(self, port: u16) -> Self
Set the UDP unicast port this node listens on for forwarding traffic.
pub fn from_profile( multicast_face_id: FaceId, node_name: Name, profile: &DiscoveryProfile, ) -> Self
Trait Implementations§
Source§impl<T: LinkMedium> DiscoveryProtocol for HelloProtocol<T>
impl<T: LinkMedium> DiscoveryProtocol for HelloProtocol<T>
Source§fn protocol_id(&self) -> ProtocolId
fn protocol_id(&self) -> ProtocolId
Source§fn claimed_prefixes(&self) -> &[Name]
fn claimed_prefixes(&self) -> &[Name]
Source§fn tick_interval(&self) -> Duration
fn tick_interval(&self) -> Duration
on_tick. Read moreSource§fn on_face_up(&self, face_id: FaceId, ctx: &dyn DiscoveryContext)
fn on_face_up(&self, face_id: FaceId, ctx: &dyn DiscoveryContext)
FaceTable::insert).Source§fn on_face_down(&self, face_id: FaceId, ctx: &dyn DiscoveryContext)
fn on_face_down(&self, face_id: FaceId, ctx: &dyn DiscoveryContext)
FaceTable::remove).