pub enum DecodeError {
Incomplete {
needed: usize,
available: usize,
},
InvalidMarker,
InvalidLength {
length: u16,
},
UnknownMessageType(u8),
UnsupportedVersion {
version: u8,
},
InvalidKeepaliveLength {
length: u16,
},
MalformedField {
message_type: &'static str,
detail: String,
},
MalformedOptionalParameter {
offset: usize,
detail: String,
},
UpdateLengthMismatch {
detail: String,
},
UpdateAttributeError {
subcode: u8,
data: Vec<u8>,
detail: String,
},
InvalidNetworkField {
detail: String,
data: Vec<u8>,
},
}Expand description
Errors encountered while decoding a BGP message from bytes.
Variants§
Incomplete
Not enough bytes are available to decode the message.
InvalidMarker
The 16-byte header marker is not all 0xFF.
InvalidLength
Message length field is outside the valid range.
UnknownMessageType(u8)
Message type byte is not a known BGP message type.
UnsupportedVersion
BGP version in OPEN is not 4.
InvalidKeepaliveLength
KEEPALIVE message has an invalid length (must be exactly 19).
MalformedField
A field within the message body is structurally invalid.
Fields
MalformedOptionalParameter
An optional parameter in OPEN is malformed.
Fields
UpdateLengthMismatch
UPDATE withdrawn/attribute/NLRI length fields are inconsistent.
UpdateAttributeError
UPDATE attribute fails RFC 4271 §6.3 validation.
Fields
InvalidNetworkField
NLRI prefix encoding is invalid (RFC 4271 §4.3).
Implementations§
Source§impl DecodeError
impl DecodeError
Sourcepub fn to_notification(&self) -> (NotificationCode, u8, Bytes)
pub fn to_notification(&self) -> (NotificationCode, u8, Bytes)
Returns the NOTIFICATION (code, subcode, data) that should be sent to the peer when this decode error is encountered.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§fn clone(&self) -> DecodeError
fn clone(&self) -> DecodeError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()