pub struct BmpPerPeerHeader {
pub peer_type: BmpPeerType,
pub peer_flags: PerPeerFlags,
pub peer_distinguisher: u64,
pub peer_ip: IpAddr,
pub peer_asn: Asn,
pub peer_bgp_id: BgpIdentifier,
pub timestamp: f64,
}
Expand description
BMP Per-peer Header
Features:
- 42 bytes total size
- Hash and PartialEq implemented without considering the timestamp
- i.e., two headers are equal if all fields except the timestamp are equal
- implements Copy and Clone
https://www.rfc-editor.org/rfc/rfc7854#section-4.2
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Peer Type | Peer Flags |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Peer Distinguisher (present based on peer type) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Peer Address (16 bytes) |
~ ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Peer AS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Peer BGP ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Timestamp (seconds) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Timestamp (microseconds) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Fields§
§peer_type: BmpPeerType
§peer_flags: PerPeerFlags
§peer_distinguisher: u64
§peer_ip: IpAddr
§peer_asn: Asn
§peer_bgp_id: BgpIdentifier
§timestamp: f64
Implementations§
Source§impl BmpPerPeerHeader
impl BmpPerPeerHeader
Sourcepub fn strip_timestamp(&self) -> BmpPerPeerHeader
pub fn strip_timestamp(&self) -> BmpPerPeerHeader
Strip the timestamp from the header.
This is useful when comparing two headers where the timestamp is not important.
Sourcepub fn asn_length(&self) -> AsnLength
pub fn asn_length(&self) -> AsnLength
Returns the ASN length based on the peer flags
Trait Implementations§
Source§impl Clone for BmpPerPeerHeader
impl Clone for BmpPerPeerHeader
Source§fn clone(&self) -> BmpPerPeerHeader
fn clone(&self) -> BmpPerPeerHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BmpPerPeerHeader
impl Debug for BmpPerPeerHeader
Source§impl Default for BmpPerPeerHeader
impl Default for BmpPerPeerHeader
Source§impl Hash for BmpPerPeerHeader
impl Hash for BmpPerPeerHeader
Source§impl PartialEq for BmpPerPeerHeader
impl PartialEq for BmpPerPeerHeader
impl Copy for BmpPerPeerHeader
impl Eq for BmpPerPeerHeader
Auto Trait Implementations§
impl Freeze for BmpPerPeerHeader
impl RefUnwindSafe for BmpPerPeerHeader
impl Send for BmpPerPeerHeader
impl Sync for BmpPerPeerHeader
impl Unpin for BmpPerPeerHeader
impl UnwindSafe for BmpPerPeerHeader
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
Mutably borrows from an owned value. Read more
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
Compare self to
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>
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 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>
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