pub struct NdpOptionPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> NdpOptionPacket<'a>
impl<'a> NdpOptionPacket<'a>
sourcepub fn new<'p>(packet: &'p [u8]) -> Option<NdpOptionPacket<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<NdpOptionPacket<'p>>
Constructs a new NdpOptionPacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<NdpOptionPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<NdpOptionPacket<'static>>
Constructs a new NdpOptionPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the NdpOptionPacket will own its own data and the underlying buffer will be dropped when the NdpOptionPacket is.
sourcepub fn to_immutable<'p>(&'p self) -> NdpOptionPacket<'p>
pub fn to_immutable<'p>(&'p self) -> NdpOptionPacket<'p>
Maps from a NdpOptionPacket to a NdpOptionPacket
sourcepub fn consume_to_immutable(self) -> NdpOptionPacket<'a>
pub fn consume_to_immutable(self) -> NdpOptionPacket<'a>
Maps from a NdpOptionPacket to a NdpOptionPacket while consuming the source
sourcepub const fn minimum_packet_size() -> usize
pub const fn minimum_packet_size() -> usize
The minimum size (in bytes) a packet of this type can be. It’s based on the total size of the fixed-size fields.
sourcepub fn packet_size(_packet: &NdpOption) -> usize
pub fn packet_size(_packet: &NdpOption) -> usize
The size (in bytes) of a NdpOption instance when converted into a byte-array
sourcepub fn get_option_type(&self) -> NdpOptionType
pub fn get_option_type(&self) -> NdpOptionType
Get the value of the option_type field
sourcepub fn get_length(&self) -> u8
pub fn get_length(&self) -> u8
Get the length field.
Trait Implementations§
source§impl<'p> Debug for NdpOptionPacket<'p>
impl<'p> Debug for NdpOptionPacket<'p>
source§impl<'p> FromPacket for NdpOptionPacket<'p>
impl<'p> FromPacket for NdpOptionPacket<'p>
source§impl<'a> Packet for NdpOptionPacket<'a>
impl<'a> Packet for NdpOptionPacket<'a>
source§impl<'a> PacketSize for NdpOptionPacket<'a>
impl<'a> PacketSize for NdpOptionPacket<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for NdpOptionPacket<'p>
impl<'p> PartialEq for NdpOptionPacket<'p>
source§fn eq(&self, other: &NdpOptionPacket<'p>) -> bool
fn eq(&self, other: &NdpOptionPacket<'p>) -> bool
self
and other
values to be equal, and is used
by ==
.