pub struct Router<P: Prefix, Ospf = GlobalOspfProcess> {
pub ospf: Ospf,
pub sr: SrProcess<P>,
pub bgp: BgpProcess<P>,
/* private fields */
}Expand description
Bgp Router
Fields§
§ospf: OspfThe IGP routing process
sr: SrProcess<P>The Static Routing Process
bgp: BgpProcess<P>The BGP routing process
Implementations§
Source§impl<P: Prefix, Ospf: OspfProcess> Router<P, Ospf>
impl<P: Prefix, Ospf: OspfProcess> Router<P, Ospf>
Sourcepub unsafe fn trigger_event<T: Default>(
&mut self,
event: Event<P, T>,
) -> Result<(StepUpdate<P>, Vec<Event<P, T>>), DeviceError>
pub unsafe fn trigger_event<T: Default>( &mut self, event: Event<P, T>, ) -> Result<(StepUpdate<P>, Vec<Event<P, T>>), DeviceError>
Manually trigger the given event, returning the result of that event. No new events will be enqueued automatically.
§Safety
The network (that this router is in) will be in an inconsistent state. Make sure to deal with that properly.
Sourcepub fn get_fib(&self) -> P::Map<Vec<RouterId>>
pub fn get_fib(&self) -> P::Map<Vec<RouterId>>
Get the forwarding table of the router. The forwarding table is a mapping from each prefix to a next-hop.
TODO: Make this function work with longest prefix map!
Sourcepub fn get_next_hop(&self, prefix: P) -> Vec<RouterId> ⓘ
pub fn get_next_hop(&self, prefix: P) -> Vec<RouterId> ⓘ
Get the IGP next hop for a prefix. Prefixes are matched using longest prefix match.
TODO make this function return a slice
Trait Implementations§
Source§impl<'de, P, Ospf> Deserialize<'de> for Router<P, Ospf>
impl<'de, P, Ospf> Deserialize<'de> for Router<P, Ospf>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<P: Prefix, Ospf> StructuralPartialEq for Router<P, Ospf>
Auto Trait Implementations§
impl<P, Ospf> Freeze for Router<P, Ospf>
impl<P, Ospf> RefUnwindSafe for Router<P, Ospf>where
Ospf: RefUnwindSafe,
<P as Prefix>::Map<StaticRoute>: RefUnwindSafe,
<P as Prefix>::Map<BTreeMap<NodeIndex, BgpRibEntry<P>>>: RefUnwindSafe,
<P as Prefix>::Map<BgpRibEntry<P>>: RefUnwindSafe,
<P as Prefix>::Set: RefUnwindSafe,
impl<P, Ospf> Send for Router<P, Ospf>where
Ospf: Send,
impl<P, Ospf> Sync for Router<P, Ospf>where
Ospf: Sync,
impl<P, Ospf> Unpin for Router<P, Ospf>
impl<P, Ospf> UnsafeUnpin for Router<P, Ospf>where
Ospf: UnsafeUnpin,
<P as Prefix>::Map<StaticRoute>: UnsafeUnpin,
<P as Prefix>::Map<BTreeMap<NodeIndex, BgpRibEntry<P>>>: UnsafeUnpin,
<P as Prefix>::Map<BgpRibEntry<P>>: UnsafeUnpin,
<P as Prefix>::Set: UnsafeUnpin,
impl<P, Ospf> UnwindSafe for Router<P, Ospf>where
Ospf: UnwindSafe,
<P as Prefix>::Map<StaticRoute>: UnwindSafe,
<P as Prefix>::Map<BTreeMap<NodeIndex, BgpRibEntry<P>>>: UnwindSafe,
<P as Prefix>::Map<BgpRibEntry<P>>: UnwindSafe,
<P as Prefix>::Set: UnwindSafe + RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more