pub struct MutableIpv4OptionPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
Source§impl<'a> MutableIpv4OptionPacket<'a>
impl<'a> MutableIpv4OptionPacket<'a>
Sourcepub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableIpv4OptionPacket<'p>>
pub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableIpv4OptionPacket<'p>>
Constructs a new MutableIpv4OptionPacket. If the provided buffer is less than the minimum required packet size, this will return None.
Sourcepub fn owned(packet: Vec<u8>) -> Option<MutableIpv4OptionPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<MutableIpv4OptionPacket<'static>>
Constructs a new MutableIpv4OptionPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the MutableIpv4OptionPacket will own its own data and the underlying buffer will be dropped when the MutableIpv4OptionPacket is.
Sourcepub fn to_immutable<'p>(&'p self) -> Ipv4OptionPacket<'p>
pub fn to_immutable<'p>(&'p self) -> Ipv4OptionPacket<'p>
Maps from a MutableIpv4OptionPacket to a Ipv4OptionPacket
Sourcepub fn consume_to_immutable(self) -> Ipv4OptionPacket<'a>
pub fn consume_to_immutable(self) -> Ipv4OptionPacket<'a>
Maps from a MutableIpv4OptionPacket to a Ipv4OptionPacket 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: &Ipv4Option) -> usize
pub fn packet_size(_packet: &Ipv4Option) -> usize
The size (in bytes) of a Ipv4Option instance when converted into a byte-array
Sourcepub fn populate(&mut self, packet: &Ipv4Option)
pub fn populate(&mut self, packet: &Ipv4Option)
Populates a Ipv4OptionPacket using a Ipv4Option structure
Sourcepub fn get_copied(&self) -> u1
pub fn get_copied(&self) -> u1
Get the copied field.
Sourcepub fn get_number(&self) -> Ipv4OptionType
pub fn get_number(&self) -> Ipv4OptionType
Get the value of the number field
Sourcepub fn get_length_raw(&self) -> &[u8] ⓘ
pub fn get_length_raw(&self) -> &[u8] ⓘ
Get the raw &u8 value of the length field, without copying
Sourcepub fn get_length(&self) -> Vec<u8> ⓘ
pub fn get_length(&self) -> Vec<u8> ⓘ
Get the value of the length field (copies contents)
Sourcepub fn set_copied(&mut self, val: u1)
pub fn set_copied(&mut self, val: u1)
Set the copied field.
Sourcepub fn set_number(&mut self, val: Ipv4OptionType)
pub fn set_number(&mut self, val: Ipv4OptionType)
Set the value of the number field.
Sourcepub fn get_length_raw_mut(&mut self) -> &mut [u8] ⓘ
pub fn get_length_raw_mut(&mut self) -> &mut [u8] ⓘ
Get the raw &mut u8 value of the length field, without copying
Sourcepub fn set_length(&mut self, vals: &[u8])
pub fn set_length(&mut self, vals: &[u8])
Set the value of the length field (copies contents)