Struct pnet_packet::icmpv6::ndp::MutableNdpOptionPacket
source · [−]pub struct MutableNdpOptionPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations
sourceimpl<'a> MutableNdpOptionPacket<'a>
impl<'a> MutableNdpOptionPacket<'a>
sourcepub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableNdpOptionPacket<'p>>
pub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableNdpOptionPacket<'p>>
Constructs a new MutableNdpOptionPacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<MutableNdpOptionPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<MutableNdpOptionPacket<'static>>
Constructs a new MutableNdpOptionPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the MutableNdpOptionPacket will own its own data and the underlying buffer will be dropped when the MutableNdpOptionPacket is.
sourcepub fn to_immutable<'p>(&'p self) -> NdpOptionPacket<'p>
pub fn to_immutable<'p>(&'p self) -> NdpOptionPacket<'p>
Maps from a MutableNdpOptionPacket to a NdpOptionPacket
sourcepub fn consume_to_immutable(self) -> NdpOptionPacket<'a>
pub fn consume_to_immutable(self) -> NdpOptionPacket<'a>
Maps from a MutableNdpOptionPacket 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 populate(&mut self, packet: &NdpOption)
pub fn populate(&mut self, packet: &NdpOption)
Populates a NdpOptionPacket using a NdpOption structure
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.
sourcepub fn set_option_type(&mut self, val: NdpOptionType)
pub fn set_option_type(&mut self, val: NdpOptionType)
Set the value of the option_type field.
sourcepub fn set_length(&mut self, val: u8)
pub fn set_length(&mut self, val: u8)
Set the length field.
Trait Implementations
sourceimpl<'p> Debug for MutableNdpOptionPacket<'p>
impl<'p> Debug for MutableNdpOptionPacket<'p>
sourceimpl<'p> FromPacket for MutableNdpOptionPacket<'p>
impl<'p> FromPacket for MutableNdpOptionPacket<'p>
sourcefn from_packet(&self) -> NdpOption
fn from_packet(&self) -> NdpOption
Converts a wire-format packet to #[packet] struct format.
sourceimpl<'a> MutablePacket for MutableNdpOptionPacket<'a>
impl<'a> MutablePacket for MutableNdpOptionPacket<'a>
sourcefn packet_mut<'p>(&'p mut self) -> &'p mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn packet_mut<'p>(&'p mut self) -> &'p mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Retreive the underlying, mutable, buffer for the packet.
sourcefn payload_mut<'p>(&'p mut self) -> &'p mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
fn payload_mut<'p>(&'p mut self) -> &'p mut [u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Retreive the mutable payload for the packet.
sourcefn clone_from<T>(&mut self, other: &T) where
T: Packet,
fn clone_from<T>(&mut self, other: &T) where
T: Packet,
Initialize this packet by cloning another.
sourceimpl<'a> Packet for MutableNdpOptionPacket<'a>
impl<'a> Packet for MutableNdpOptionPacket<'a>
sourceimpl<'a> PacketSize for MutableNdpOptionPacket<'a>
impl<'a> PacketSize for MutableNdpOptionPacket<'a>
sourcefn packet_size(&self) -> usize
fn packet_size(&self) -> usize
Get the calculated size of the packet.
sourceimpl<'p> PartialEq<MutableNdpOptionPacket<'p>> for MutableNdpOptionPacket<'p>
impl<'p> PartialEq<MutableNdpOptionPacket<'p>> for MutableNdpOptionPacket<'p>
sourcefn eq(&self, other: &MutableNdpOptionPacket<'p>) -> bool
fn eq(&self, other: &MutableNdpOptionPacket<'p>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &MutableNdpOptionPacket<'p>) -> bool
fn ne(&self, other: &MutableNdpOptionPacket<'p>) -> bool
This method tests for !=
.
impl<'p> StructuralPartialEq for MutableNdpOptionPacket<'p>
Auto Trait Implementations
impl<'p> RefUnwindSafe for MutableNdpOptionPacket<'p>
impl<'p> Send for MutableNdpOptionPacket<'p>
impl<'p> Sync for MutableNdpOptionPacket<'p>
impl<'p> Unpin for MutableNdpOptionPacket<'p>
impl<'p> !UnwindSafe for MutableNdpOptionPacket<'p>
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