pub struct Fib { /* private fields */ }Expand description
The Forwarding Information Base.
A name trie mapping prefixes to FibEntry values. Concurrent longest-prefix
match with per-node RwLock (via NameTrie).
Implementations§
Source§impl Fib
impl Fib
pub fn new() -> Self
Sourcepub fn add_nexthop(&self, prefix: &Name, face_id: FaceId, cost: u32)
pub fn add_nexthop(&self, prefix: &Name, face_id: FaceId, cost: u32)
Register a nexthop for prefix. Replaces any existing entry.
Sourcepub fn dump(&self) -> Vec<(Name, Arc<FibEntry>)>
pub fn dump(&self) -> Vec<(Name, Arc<FibEntry>)>
Return all FIB entries as (prefix_uri, [(face_id, cost)]) tuples.
Sourcepub fn remove_prefix(&self, prefix: &Name)
pub fn remove_prefix(&self, prefix: &Name)
Remove the entry for prefix entirely, regardless of nexthops.
Sourcepub fn set_nexthops(&self, prefix: &Name, nexthops: Vec<FibNexthop>)
pub fn set_nexthops(&self, prefix: &Name, nexthops: Vec<FibNexthop>)
Atomically replace all nexthops for prefix.
Used by the RIB to apply computed nexthops. If nexthops is empty the
entry is removed.
Sourcepub fn remove_face(&self, face_id: FaceId)
pub fn remove_face(&self, face_id: FaceId)
Remove all nexthops pointing to face_id across all prefixes.
Called when a face is closed to prevent stale routes from accumulating.
Sourcepub fn remove_nexthop(&self, prefix: &Name, face_id: FaceId)
pub fn remove_nexthop(&self, prefix: &Name, face_id: FaceId)
Remove the nexthop for face_id from prefix.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Fib
impl RefUnwindSafe for Fib
impl Send for Fib
impl Sync for Fib
impl Unpin for Fib
impl UnwindSafe for Fib
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more