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
sourceimpl DataBytes<'_>
impl DataBytes<'_>
pub fn new(data: &Vec<u8>) -> DataBytes<'_>
pub fn bytes_left(&self) -> usize
pub fn read_128b(&mut self) -> Result<u128, ParserErrorKind>
pub fn read_64b(&mut self) -> Result<u64, ParserErrorKind>
pub fn read_32b(&mut self) -> Result<u32, ParserErrorKind>
pub fn read_16b(&mut self) -> Result<u16, ParserErrorKind>
pub fn read_8b(&mut self) -> Result<u8, ParserErrorKind>
pub fn read_n_bytes(
&mut self,
n_bytes: usize
) -> Result<Vec<u8>, ParserErrorKind>
pub fn read_n_bytes_to_string(
&mut self,
n_bytes: usize
) -> Result<String, ParserErrorKind>
pub fn read_and_drop_n_bytes(
&mut self,
n_bytes: usize
) -> Result<(), ParserErrorKind>
pub fn fast_forward(&mut self, to: usize)
sourcepub fn read_nlri_prefix(
&mut self,
afi: &Afi,
add_path: bool
) -> Result<NetworkPrefix, ParserErrorKind>
pub fn read_nlri_prefix(
&mut self,
afi: &Afi,
add_path: bool
) -> Result<NetworkPrefix, ParserErrorKind>
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.
pub fn read_address(&mut self, afi: &Afi) -> Result<IpAddr>
pub fn read_ipv4_address(&mut self) -> Result<Ipv4Addr, ParserErrorKind>
pub fn read_ipv6_address(&mut self) -> Result<Ipv6Addr, ParserErrorKind>
pub fn read_ipv4_prefix(&mut self) -> Result<Ipv4Network, ParserErrorKind>
pub fn read_ipv6_prefix(&mut self) -> Result<Ipv6Network, ParserErrorKind>
pub fn read_asn(&mut self, as_length: &AsnLength) -> Result<Asn, ParserErrorKind>
pub fn read_asns(
&mut self,
as_length: &AsnLength,
count: usize
) -> Result<Vec<Asn>, ParserErrorKind>
pub fn read_afi(&mut self) -> Result<Afi, ParserErrorKind>
pub fn read_safi(&mut self) -> Result<Safi, ParserErrorKind>
pub fn parse_nlri_list(
&mut self,
add_path: bool,
afi: &Afi,
total_bytes: usize
) -> Result<Vec<NetworkPrefix>, ParserErrorKind>
Auto Trait Implementations
impl<'input> RefUnwindSafe for DataBytes<'input>
impl<'input> Send for DataBytes<'input>
impl<'input> Sync for DataBytes<'input>
impl<'input> Unpin for DataBytes<'input>
impl<'input> UnwindSafe for DataBytes<'input>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more