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>),
FourOctetAs {
asn: u32,
},
Unknown {
code: u8,
data: Bytes,
},
}Expand description
BGP capability as negotiated in OPEN optional parameters.
Variants§
MultiProtocol
RFC 4760: Multi-Protocol Extensions.
ExtendedNextHop(Vec<ExtendedNextHopFamily>)
RFC 8950: Extended Next Hop Encoding.
GracefulRestart
RFC 4724: Graceful Restart.
Fields
restart_state: boolR-bit: the sender has restarted and its forwarding state may have been preserved.
notification: boolN-bit (RFC 8538): the sender supports Notification GR — NOTIFICATIONs trigger GR unless Cease/Hard Reset (subcode 9) is used.
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.
FourOctetAs
RFC 6793: 4-Byte AS Number.
Unknown
Unknown or unrecognized capability, preserved for re-emission.
Implementations§
Source§impl Capability
impl Capability
Sourcepub fn decode(buf: &mut impl Buf) -> Result<Self, DecodeError>
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.
Sourcepub fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
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.
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Encoded size of this capability TLV (code + length + value).
Trait Implementations§
Source§impl Clone for Capability
impl Clone for Capability
Source§fn clone(&self) -> Capability
fn clone(&self) -> Capability
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more