Skip to main content

Nlri

Struct Nlri 

Source
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

Source

pub const fn is_ipv4(&self) -> bool

Returns true if this NLRI refers to the IPv4 address space.

Source

pub const fn is_ipv6(&self) -> bool

Returns true if this NLRI refers to the IPv6 address space.

Returns true if this NLRI refers to Link-State information.

Source

pub const fn is_flowspec(&self) -> bool

Returns true if this NLRI refers to Flow-Spec information.

Source

pub const fn is_mpls_labeled(&self) -> bool

Returns true if this NLRI refers to MPLS-labeled prefixes (SAFI 4).

Source

pub const fn is_reachable(&self) -> bool

Returns true if this NLRI refers to reachable prefixes

Source

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).

Source

pub fn new_reachable(prefix: NetworkPrefix, next_hop: Option<IpAddr>) -> Nlri

Source

pub fn new_unreachable(prefix: NetworkPrefix) -> Nlri

Source

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

Source

pub fn new_flowspec_unreachable( afi: Afi, safi: Safi, flowspec_nlris: Vec<FlowSpecNlri>, ) -> Nlri

Create a new Flow-Spec unreachable NLRI

Source

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

Source

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 Clone for Nlri

Source§

fn clone(&self) -> Nlri

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Nlri

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> IntoIterator for &'a Nlri

Source§

type Item = &'a IpNet

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<&'a IpNet>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

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.

Source§

type Item = IpNet

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<IpNet>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for Nlri

Source§

fn eq(&self, other: &Nlri) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Nlri

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more