Struct bgpkit_parser::parser::utils::DataBytes
source · pub struct DataBytes<'input> {
pub bytes: &'input [u8],
pub pos: usize,
pub total: usize,
pub limits: Vec<usize>,
}Fields§
§bytes: &'input [u8]§pos: usize§total: usize§limits: Vec<usize>Implementations§
source§impl DataBytes<'_>
impl DataBytes<'_>
pub fn new(data: &Vec<u8>) -> DataBytes<'_>
pub fn bytes_left(&self) -> usize
pub fn read_128b(&mut self) -> Result<u128, ParserError>
pub fn read_64b(&mut self) -> Result<u64, ParserError>
pub fn read_32b(&mut self) -> Result<u32, ParserError>
pub fn read_16b(&mut self) -> Result<u16, ParserError>
pub fn read_8b(&mut self) -> Result<u8, ParserError>
pub fn read_n_bytes(&mut self, n_bytes: usize) -> Result<Vec<u8>, ParserError>
pub fn read_n_bytes_to_string(
&mut self,
n_bytes: usize
) -> Result<String, ParserError>
pub fn read_and_drop_n_bytes(
&mut self,
n_bytes: usize
) -> Result<(), ParserError>
pub fn fast_forward(&mut self, to: usize)
sourcepub fn read_nlri_prefix(
&mut self,
afi: &Afi,
add_path: bool
) -> Result<NetworkPrefix, ParserError>
pub 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.