Struct netlink_packet_utils::nla::NlaBuffer
source · Implementations§
source§impl<T: AsRef<[u8]>> NlaBuffer<T>
impl<T: AsRef<[u8]>> NlaBuffer<T>
pub fn new(buffer: T) -> NlaBuffer<T>
pub fn new_checked(buffer: T) -> Result<NlaBuffer<T>, DecodeError>
pub fn check_buffer_length(&self) -> Result<(), DecodeError>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the buffer, returning the underlying buffer.
pub fn nested_flag(&self) -> bool
pub fn network_byte_order_flag(&self) -> bool
sourcepub fn length(&self) -> u16
pub fn length(&self) -> u16
Return the length
field. The length
field corresponds to the length
of the nla header (type and length fields, and the value field).
However, it does not account for the potential padding that follows
the value field.
sourcepub fn value_length(&self) -> usize
pub fn value_length(&self) -> usize
Return the length of the value
field
Panic
This panics if the length field value is less than the attribut header size.
source§impl<T: AsRef<[u8]> + AsMut<[u8]>> NlaBuffer<T>
impl<T: AsRef<[u8]> + AsMut<[u8]>> NlaBuffer<T>
pub fn set_nested_flag(&mut self)
pub fn set_network_byte_order_flag(&mut self)
sourcepub fn set_length(&mut self, length: u16)
pub fn set_length(&mut self, length: u16)
Set the length
field
Trait Implementations§
source§impl<'buffer, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'buffer T>> for DefaultNla
impl<'buffer, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'buffer T>> for DefaultNla
source§fn parse(buf: &NlaBuffer<&'buffer T>) -> Result<Self, DecodeError>
fn parse(buf: &NlaBuffer<&'buffer T>) -> Result<Self, DecodeError>
Deserialize the current type.