pub struct BgpHeader {
pub length: u16,
pub message_type: MessageType,
}Expand description
Decoded BGP message header.
Fields§
§length: u16Total message length in bytes (including the 19-byte header).
message_type: MessageTypeThe type of this BGP message.
Implementations§
Source§impl BgpHeader
impl BgpHeader
Sourcepub fn decode(
buf: &mut impl Buf,
max_message_len: u16,
) -> Result<Self, DecodeError>
pub fn decode( buf: &mut impl Buf, max_message_len: u16, ) -> Result<Self, DecodeError>
Decode a BGP header from a buffer. Validates marker, length, and type. Advances the buffer by 19 bytes on success.
max_message_len is the negotiated maximum message length: 4096
normally, or 65535 when Extended Messages (RFC 8654) has been
negotiated.
§Errors
Returns a DecodeError if the buffer is too short, the marker is
invalid, the length is out of range, or the message type is unknown.
Trait Implementations§
impl Copy for BgpHeader
impl Eq for BgpHeader
impl StructuralPartialEq for BgpHeader
Auto Trait Implementations§
impl Freeze for BgpHeader
impl RefUnwindSafe for BgpHeader
impl Send for BgpHeader
impl Sync for BgpHeader
impl Unpin for BgpHeader
impl UnsafeUnpin for BgpHeader
impl UnwindSafe for BgpHeader
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