pub struct Nlri {
pub afi: Afi,
pub safi: Safi,
pub next_hop: Option<NextHopAddress>,
pub prefixes: Vec<NetworkPrefix>,
pub labeled_prefixes: Option<Vec<LabeledNetworkPrefix>>,
pub link_state_nlris: Option<Vec<LinkStateNlri>>,
pub flowspec_nlris: Option<Vec<FlowSpecNlri>>,
}Expand description
Network Layer Reachability Information
Fields§
§afi: Afi§safi: Safi§next_hop: Option<NextHopAddress>§prefixes: Vec<NetworkPrefix>Traditional IP prefixes for unicast/multicast Also used for SAFI 4 withdrawals (RFC 8277 withdrawals carry no label semantics)
labeled_prefixes: Option<Vec<LabeledNetworkPrefix>>MPLS-labeled IP prefixes (SAFI 4 announcements only) - RFC 3107/8277
Withdrawals are routed to prefixes, not here
link_state_nlris: Option<Vec<LinkStateNlri>>Link-State NLRI data - RFC 7752
flowspec_nlris: Option<Vec<FlowSpecNlri>>Flow-Spec NLRI data - RFC 8955/8956
Implementations§
Source§impl Nlri
impl Nlri
Sourcepub const fn is_ipv4(&self) -> bool
pub const fn is_ipv4(&self) -> bool
Returns true if this NLRI refers to the IPv4 address space.
Sourcepub const fn is_ipv6(&self) -> bool
pub const fn is_ipv6(&self) -> bool
Returns true if this NLRI refers to the IPv6 address space.
Sourcepub const fn is_link_state(&self) -> bool
pub const fn is_link_state(&self) -> bool
Returns true if this NLRI refers to Link-State information.
Sourcepub const fn is_flowspec(&self) -> bool
pub const fn is_flowspec(&self) -> bool
Returns true if this NLRI refers to Flow-Spec information.
Sourcepub const fn is_mpls_labeled(&self) -> bool
pub const fn is_mpls_labeled(&self) -> bool
Returns true if this NLRI refers to MPLS-labeled prefixes (SAFI 4).
Sourcepub const fn is_reachable(&self) -> bool
pub const fn is_reachable(&self) -> bool
Returns true if this NLRI refers to reachable prefixes
Sourcepub const fn next_hop_addr(&self) -> IpAddr
pub const fn next_hop_addr(&self) -> IpAddr
Get the address of the next hop indicated by this NLRI.
Panics if used on a unreachable NLRI message (ie. there is no next hop).
pub fn new_reachable(prefix: NetworkPrefix, next_hop: Option<IpAddr>) -> Nlri
pub fn new_unreachable(prefix: NetworkPrefix) -> Nlri
pub fn new_link_state_reachable( next_hop: Option<IpAddr>, safi: Safi, nlri_list: Vec<LinkStateNlri>, ) -> Nlri
pub fn new_link_state_unreachable( safi: Safi, nlri_list: Vec<LinkStateNlri>, ) -> Nlri
Sourcepub fn new_flowspec_reachable(
afi: Afi,
safi: Safi,
next_hop: Option<IpAddr>,
flowspec_nlris: Vec<FlowSpecNlri>,
) -> Nlri
pub fn new_flowspec_reachable( afi: Afi, safi: Safi, next_hop: Option<IpAddr>, flowspec_nlris: Vec<FlowSpecNlri>, ) -> Nlri
Create a new Flow-Spec reachable NLRI
Sourcepub fn new_flowspec_unreachable(
afi: Afi,
safi: Safi,
flowspec_nlris: Vec<FlowSpecNlri>,
) -> Nlri
pub fn new_flowspec_unreachable( afi: Afi, safi: Safi, flowspec_nlris: Vec<FlowSpecNlri>, ) -> Nlri
Create a new Flow-Spec unreachable NLRI
Sourcepub fn new_labeled_reachable(
afi: Afi,
next_hop: Option<IpAddr>,
labeled_prefixes: Vec<LabeledNetworkPrefix>,
) -> Nlri
pub fn new_labeled_reachable( afi: Afi, next_hop: Option<IpAddr>, labeled_prefixes: Vec<LabeledNetworkPrefix>, ) -> Nlri
Create a new MPLS-labeled reachable NLRI (SAFI 4) - RFC 3107/8277
Sourcepub fn new_labeled_unreachable(afi: Afi, prefixes: Vec<NetworkPrefix>) -> Nlri
pub fn new_labeled_unreachable(afi: Afi, prefixes: Vec<NetworkPrefix>) -> Nlri
Create a new MPLS-labeled unreachable NLRI (SAFI 4) - RFC 3107/8277 Note: Withdrawals use standard prefixes (no label semantics per RFC 8277 §2.4)
Trait Implementations§
Source§impl<'a> IntoIterator for &'a Nlri
impl<'a> IntoIterator for &'a Nlri
Source§impl IntoIterator for Nlri
Iterator over all prefixes in the NLRI.
impl IntoIterator for Nlri
Iterator over all prefixes in the NLRI.
Note: This iterator intentionally flattens both traditional prefixes and
labeled prefixes into IpNet, discarding MPLS labels and path IDs. This preserves
backward compatibility for users expecting only IpNet, but means label information
is not accessible through iteration. To access labels, use Nlri::labeled_prefixes directly.
impl Eq for Nlri
impl StructuralPartialEq for Nlri
Auto Trait Implementations§
impl Freeze for Nlri
impl RefUnwindSafe for Nlri
impl Send for Nlri
impl Sync for Nlri
impl Unpin for Nlri
impl UnsafeUnpin for Nlri
impl UnwindSafe for Nlri
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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