pub fn peek_message_length(
buf: &[u8],
max_message_len: u16,
) -> Result<Option<u16>, DecodeError>Expand description
Peek at a buffer to check if a complete BGP message is available.
Returns Ok(Some(length)) if the header is valid and the full message
needs length bytes. Returns Ok(None) if fewer than 19 bytes are
available. Returns Err if the header is malformed.
max_message_len is the negotiated maximum message length: 4096
normally, or 65535 when Extended Messages (RFC 8654) has been negotiated.
Does NOT advance the buffer.
§Errors
Returns a DecodeError if the marker is invalid, the length is out
of range, or the message type is unknown.