Trait bgpkit_parser::parser::utils::ReadUtils
source · pub trait ReadUtils: Buf {
Show 18 methods
// Provided methods
fn has_n_remaining(&self, n: usize) -> Result<(), ParserError> { ... }
fn read_u8(&mut self) -> Result<u8, ParserError> { ... }
fn read_u16(&mut self) -> Result<u16, ParserError> { ... }
fn read_u32(&mut self) -> Result<u32, ParserError> { ... }
fn read_u64(&mut self) -> Result<u64, ParserError> { ... }
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ParserError> { ... }
fn read_address(&mut self, afi: &Afi) -> Result<IpAddr> { ... }
fn read_ipv4_address(&mut self) -> Result<Ipv4Addr, ParserError> { ... }
fn read_ipv6_address(&mut self) -> Result<Ipv6Addr, ParserError> { ... }
fn read_ipv4_prefix(&mut self) -> Result<Ipv4Net, ParserError> { ... }
fn read_ipv6_prefix(&mut self) -> Result<Ipv6Net, ParserError> { ... }
fn read_asn(&mut self, as_length: AsnLength) -> Result<Asn, ParserError> { ... }
fn read_asns(
&mut self,
as_length: &AsnLength,
count: usize
) -> Result<Vec<Asn>, ParserError> { ... }
fn read_afi(&mut self) -> Result<Afi, ParserError> { ... }
fn read_safi(&mut self) -> Result<Safi, ParserError> { ... }
fn read_nlri_prefix(
&mut self,
afi: &Afi,
add_path: bool
) -> Result<NetworkPrefix, ParserError> { ... }
fn read_n_bytes(&mut self, n_bytes: usize) -> Result<Vec<u8>, ParserError> { ... }
fn read_n_bytes_to_string(
&mut self,
n_bytes: usize
) -> Result<String, ParserError> { ... }
}
Provided Methods§
fn has_n_remaining(&self, n: usize) -> Result<(), ParserError>
fn read_u8(&mut self) -> Result<u8, ParserError>
fn read_u16(&mut self) -> Result<u16, ParserError>
fn read_u32(&mut self) -> Result<u32, ParserError>
fn read_u64(&mut self) -> Result<u64, ParserError>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ParserError>
fn read_address(&mut self, afi: &Afi) -> Result<IpAddr>
fn read_ipv4_address(&mut self) -> Result<Ipv4Addr, ParserError>
fn read_ipv6_address(&mut self) -> Result<Ipv6Addr, ParserError>
fn read_ipv4_prefix(&mut self) -> Result<Ipv4Net, ParserError>
fn read_ipv6_prefix(&mut self) -> Result<Ipv6Net, ParserError>
fn read_asn(&mut self, as_length: AsnLength) -> Result<Asn, ParserError>
fn read_asns( &mut self, as_length: &AsnLength, count: usize ) -> Result<Vec<Asn>, ParserError>
fn read_afi(&mut self) -> Result<Afi, ParserError>
fn read_safi(&mut self) -> Result<Safi, ParserError>
sourcefn read_nlri_prefix(
&mut self,
afi: &Afi,
add_path: bool
) -> Result<NetworkPrefix, ParserError>
fn read_nlri_prefix( &mut self, afi: &Afi, add_path: bool ) -> Result<NetworkPrefix, ParserError>
Read announced/withdrawn prefix.
The length in bits is 1 byte, and then based on the IP version it reads different number of bytes.
If the add_path
is true, it will also first read a 4-byte path id first; otherwise, a path-id of 0
is automatically set.