pub struct RouterTable { /* private fields */ }Expand description
BACnet routing table.
Maps network numbers to the port through which they can be reached.
Implementations§
Source§impl RouterTable
impl RouterTable
Sourcepub fn add_direct(&mut self, network: u16, port_index: usize)
pub fn add_direct(&mut self, network: u16, port_index: usize)
Add a directly-connected network on the given port. Network 0 and 0xFFFF are reserved and will be silently ignored.
Sourcepub fn add_learned(
&mut self,
network: u16,
port_index: usize,
next_hop_mac: MacAddr,
)
pub fn add_learned( &mut self, network: u16, port_index: usize, next_hop_mac: MacAddr, )
Add a learned route (network reachable via a next-hop router on the given port). Network 0 and 0xFFFF are reserved and will be silently ignored. Does not overwrite direct routes.
Sourcepub fn add_learned_with_flap_detection(
&mut self,
network: u16,
port_index: usize,
next_hop_mac: MacAddr,
) -> bool
pub fn add_learned_with_flap_detection( &mut self, network: u16, port_index: usize, next_hop_mac: MacAddr, ) -> bool
Add a learned route, always accepting (spec 6.6.3.2: last I-Am-Router wins). Detects rapid port changes for operator visibility but never suppresses updates.
Returns true if the route was inserted/updated.
Sourcepub fn mark_busy(&mut self, network: u16, deadline: Instant)
pub fn mark_busy(&mut self, network: u16, deadline: Instant)
Mark a network as busy with a deadline for auto-clear (spec 6.6.3.6).
Sourcepub fn mark_available(&mut self, network: u16)
pub fn mark_available(&mut self, network: u16)
Mark a network as available, clearing any busy state (spec 6.6.3.7).
Sourcepub fn mark_unreachable(&mut self, network: u16)
pub fn mark_unreachable(&mut self, network: u16)
Mark a network as permanently unreachable (spec 6.6.3.5, reject reason 1).
Keeps the entry in the table (unlike remove).
Sourcepub fn clear_expired_busy(&mut self)
pub fn clear_expired_busy(&mut self)
Clear busy state for entries whose busy_until deadline has elapsed.
Sourcepub fn effective_reachability(&self, network: u16) -> Option<ReachabilityStatus>
pub fn effective_reachability(&self, network: u16) -> Option<ReachabilityStatus>
Get effective reachability, checking busy_until inline for immediate accuracy. This avoids up to 90s worst-case from the 60s aging sweep granularity.
Sourcepub fn lookup(&self, network: u16) -> Option<&RouteEntry>
pub fn lookup(&self, network: u16) -> Option<&RouteEntry>
Look up the route for a network number.
Sourcepub fn lookup_mut(&mut self, network: u16) -> Option<&mut RouteEntry>
pub fn lookup_mut(&mut self, network: u16) -> Option<&mut RouteEntry>
Lookup a mutable route entry by network number.
Sourcepub fn remove(&mut self, network: u16) -> Option<RouteEntry>
pub fn remove(&mut self, network: u16) -> Option<RouteEntry>
Remove a route.
Sourcepub fn networks_not_on_port(&self, exclude_port: usize) -> Vec<u16>
pub fn networks_not_on_port(&self, exclude_port: usize) -> Vec<u16>
List networks reachable via ports OTHER than exclude_port.
Sourcepub fn networks_on_port(&self, port_index: usize) -> Vec<u16>
pub fn networks_on_port(&self, port_index: usize) -> Vec<u16>
List networks reachable on a given port.
Sourcepub fn touch(&mut self, network: u16)
pub fn touch(&mut self, network: u16)
Refresh the last_seen timestamp for a learned route.
Direct routes are unaffected since they never expire.
Sourcepub fn purge_stale(&mut self, max_age: Duration) -> Vec<u16>
pub fn purge_stale(&mut self, max_age: Duration) -> Vec<u16>
Remove learned routes that have not been refreshed within max_age.
Returns the network numbers that were purged.
Trait Implementations§
Source§impl Clone for RouterTable
impl Clone for RouterTable
Source§fn clone(&self) -> RouterTable
fn clone(&self) -> RouterTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more