Trait bgpkit_parser::parser::utils::ReadUtils
source · pub trait ReadUtils: Read {
Show 17 methods
// Provided methods
fn read_8b(&mut self) -> Result<u8> { ... }
fn read_16b(&mut self) -> Result<u16> { ... }
fn read_32b(&mut self) -> Result<u32> { ... }
fn read_64b(&mut self) -> Result<u64> { ... }
fn read_128b(&mut self) -> Result<u128> { ... }
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 read_8b(&mut self) -> Result<u8>
fn read_16b(&mut self) -> Result<u16>
fn read_32b(&mut self) -> Result<u32>
fn read_64b(&mut self) -> Result<u64>
fn read_128b(&mut self) -> Result<u128>
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.