pub struct RouteRefreshMessage {
pub afi_raw: u16,
pub subtype_raw: u8,
pub safi_raw: u8,
}Expand description
BGP ROUTE-REFRESH message (RFC 2918 + RFC 7313).
Requests a peer to re-advertise its Adj-RIB-Out for the specified address family. RFC 7313 reuses the third octet as a demarcation subtype (BoRR/EoRR). Raw wire values are stored so that unknown AFI/SAFI or subtype values can be decoded without error — the transport layer decides whether to act on or ignore them.
Fields§
§afi_raw: u16Raw AFI value from the wire.
subtype_raw: u8Raw demarcation subtype byte from the wire.
safi_raw: u8Raw SAFI value from the wire.
Implementations§
Source§impl RouteRefreshMessage
impl RouteRefreshMessage
Sourcepub fn new(afi: Afi, safi: Safi) -> Self
pub fn new(afi: Afi, safi: Safi) -> Self
Create a normal (subtype 0) ROUTE-REFRESH from typed AFI/SAFI values.
Sourcepub fn new_with_subtype(
afi: Afi,
safi: Safi,
subtype: RouteRefreshSubtype,
) -> Self
pub fn new_with_subtype( afi: Afi, safi: Safi, subtype: RouteRefreshSubtype, ) -> Self
Create a ROUTE-REFRESH with an explicit subtype.
Sourcepub fn safi(&self) -> Option<Safi>
pub fn safi(&self) -> Option<Safi>
Try to interpret the raw SAFI as a known sub-address family.
Sourcepub fn subtype(&self) -> RouteRefreshSubtype
pub fn subtype(&self) -> RouteRefreshSubtype
Decode the demarcation subtype.
Sourcepub fn decode(buf: &mut impl Buf, body_len: usize) -> Result<Self, DecodeError>
pub fn decode(buf: &mut impl Buf, body_len: usize) -> Result<Self, DecodeError>
Decode a ROUTE-REFRESH message body from a buffer.
§Errors
Returns DecodeError if the body length is not exactly 4.
Unknown AFI/SAFI values and unknown subtypes are preserved.
Sourcepub fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
pub fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
Encode a complete ROUTE-REFRESH message (header + body) into a buffer.
§Errors
This encoding is infallible for valid values, but returns
EncodeError for API consistency.
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Total encoded size on the wire (header + body).
Trait Implementations§
Source§impl Clone for RouteRefreshMessage
impl Clone for RouteRefreshMessage
Source§fn clone(&self) -> RouteRefreshMessage
fn clone(&self) -> RouteRefreshMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more