Expand description
RPKI-to-Router (RTR) Protocol Parser
This module provides parsing and encoding functions for RTR protocol PDUs as defined in RFC 6810 (v0) and RFC 8210 (v1).
§Parsing
use bgpkit_parser::parser::rpki::rtr::{parse_rtr_pdu, read_rtr_pdu};
use bgpkit_parser::models::rpki::rtr::*;
// Parse from a byte slice
let bytes = [1, 2, 0, 0, 0, 0, 0, 8]; // Reset Query v1
let (pdu, consumed) = parse_rtr_pdu(&bytes).unwrap();
assert_eq!(consumed, 8);§Encoding
use bgpkit_parser::parser::rpki::rtr::RtrEncode;
use bgpkit_parser::models::rpki::rtr::*;
let query = RtrResetQuery::new_v1();
let bytes = query.encode();
assert_eq!(bytes.len(), 8);Enums§
- RtrError
- Errors that can occur during RTR PDU parsing or encoding
Constants§
- RTR_
CACHE_ RESET_ LEN - Cache Reset PDU length
- RTR_
CACHE_ RESPONSE_ LEN - Cache Response PDU length
- RTR_
END_ OF_ DATA_ V0_ LEN - End of Data PDU length (v0)
- RTR_
END_ OF_ DATA_ V1_ LEN - End of Data PDU length (v1)
- RTR_
HEADER_ LEN - RTR PDU header length (common to all PDUs)
- RTR_
IPV4_ PREFIX_ LEN - IPv4 Prefix PDU length
- RTR_
IPV6_ PREFIX_ LEN - IPv6 Prefix PDU length
- RTR_
RESET_ QUERY_ LEN - Reset Query PDU length
- RTR_
ROUTER_ KEY_ MIN_ LEN - Router Key PDU minimum length (header(8) + flags(1) + zero(1) + SKI(20) + ASN(4) = 34)
- RTR_
SERIAL_ NOTIFY_ LEN - Serial Notify PDU length
- RTR_
SERIAL_ QUERY_ LEN - Serial Query PDU length
Traits§
- RtrEncode
- Trait for encoding RTR PDUs to bytes
Functions§
- parse_
rtr_ pdu - Parse a single RTR PDU from a byte slice.
- read_
rtr_ pdu - Read a single RTR PDU from a reader.