Skip to main content

Capability

Enum Capability 

Source
pub enum Capability {
    MultiProtocol {
        afi: Afi,
        safi: Safi,
    },
    ExtendedNextHop(Vec<ExtendedNextHopFamily>),
    GracefulRestart {
        restart_state: bool,
        notification: bool,
        restart_time: u16,
        families: Vec<GracefulRestartFamily>,
    },
    RouteRefresh,
    EnhancedRouteRefresh,
    ExtendedMessage,
    LongLivedGracefulRestart(Vec<LlgrFamily>),
    AddPath(Vec<AddPathFamily>),
    OutboundRouteFilter(Vec<OrfCapEntry>),
    FourOctetAs {
        asn: u32,
    },
    Role {
        role: BgpRole,
    },
    Unknown {
        code: u8,
        data: Bytes,
    },
}
Expand description

BGP capability as negotiated in OPEN optional parameters.

Variants§

§

MultiProtocol

RFC 4760: Multi-Protocol Extensions.

Fields

§afi: Afi

Address family.

§safi: Safi

Sub-address family.

§

ExtendedNextHop(Vec<ExtendedNextHopFamily>)

RFC 8950: Extended Next Hop Encoding.

§

GracefulRestart

RFC 4724: Graceful Restart.

Fields

§restart_state: bool

R-bit: the sender has restarted and its forwarding state may have been preserved.

§notification: bool

N-bit (RFC 8538): the sender supports Notification GR — NOTIFICATIONs trigger GR unless Cease/Hard Reset (subcode 9) is used.

§restart_time: u16

Time in seconds the sender will retain stale routes (12-bit, max 4095).

§families: Vec<GracefulRestartFamily>

Per-AFI/SAFI forwarding state flags.

§

RouteRefresh

RFC 2918: Route Refresh.

§

EnhancedRouteRefresh

RFC 7313: Enhanced Route Refresh.

§

ExtendedMessage

RFC 8654: Extended Messages (raise max message length to 65535).

§

LongLivedGracefulRestart(Vec<LlgrFamily>)

RFC 9494: Long-Lived Graceful Restart.

§

AddPath(Vec<AddPathFamily>)

RFC 7911: Add-Path — advertise/receive multiple paths per prefix.

§

OutboundRouteFilter(Vec<OrfCapEntry>)

RFC 5291: Outbound Route Filtering — per-family ORF-Type/role blocks.

§

FourOctetAs

RFC 6793: 4-Byte AS Number.

Fields

§asn: u32

The 4-byte autonomous system number.

§

Role

RFC 9234 §4: BGP Role. The speaker’s role on this eBGP session.

Fields

§role: BgpRole

The role advertised by this speaker.

§

Unknown

Unknown or unrecognized capability, preserved for re-emission.

Fields

§code: u8

Capability code.

§data: Bytes

Raw capability value bytes.

Implementations§

Source§

impl Capability

Source

pub fn decode(buf: &mut impl Buf) -> Result<Self, DecodeError>

Decode a single capability TLV from a buffer.

§Errors

Returns DecodeError::MalformedOptionalParameter if the TLV is truncated or the claimed length exceeds the remaining bytes.

Source

pub fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>

Encode a single capability TLV into a buffer.

§Errors

Returns EncodeError::ValueOutOfRange if the capability value exceeds the 255-byte limit of the single-octet length field.

Source

pub fn code(&self) -> u8

Returns the capability code byte.

Source

pub fn encoded_len(&self) -> usize

Encoded size of this capability TLV (code + length + value).

Trait Implementations§

Source§

impl Clone for Capability

Source§

fn clone(&self) -> Capability

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 Capability

Source§

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

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

impl Eq for Capability

Source§

impl PartialEq for Capability

Source§

fn eq(&self, other: &Capability) -> 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 StructuralPartialEq for Capability

Auto Trait Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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