Skip to main content

decode

Function decode 

Source
pub fn decode(bytes: &[u8], asn4: bool) -> Result<BgpMessage, DecodeError>
Expand description

Decode one complete BGP message (header included).

asn4 must be the negotiated four-octet-AS state: it decides whether AS_PATH in an UPDATE is read as two-octet or four-octet ASNs. Getting it wrong does not fail loudly, it silently yields the wrong AS path, which is why it is threaded through from the session rather than defaulted.

The error carries the NOTIFICATION that RFC 4271 section 6 prescribes for that failure.