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 #name. 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 #name. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the #name will own its own data and the underlying buffer will be dropped when the #name is.
Sourcepub fn to_immutable<'p>(&'p self) -> Ipv4OptionPacket<'p>
pub fn to_immutable<'p>(&'p self) -> Ipv4OptionPacket<'p>
Maps from a #name to a #imm_name
Sourcepub fn consume_to_immutable(self) -> Ipv4OptionPacket<'a>
pub fn consume_to_immutable(self) -> Ipv4OptionPacket<'a>
Maps from a #name to a #imm_name 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 #base_name instance when converted into a byte-array
Sourcepub fn populate(&mut self, packet: &Ipv4Option)
pub fn populate(&mut self, packet: &Ipv4Option)
Populates a {name}Packet using a {name} structure
Sourcepub fn get_copied(&self) -> u1
pub fn get_copied(&self) -> u1
Get the copied field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_class(&self) -> u2
pub fn get_class(&self) -> u2
Get the class field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_number(&self) -> Ipv4OptionNumber
pub fn get_number(&self) -> Ipv4OptionNumber
Get the value of the {name} field
Sourcepub fn get_length_raw(&self) -> &[u8] ⓘ
pub fn get_length_raw(&self) -> &[u8] ⓘ
Get the raw &u8 value of the {name} field, without copying
Sourcepub fn get_length(&self) -> Vec<u8> ⓘ
pub fn get_length(&self) -> Vec<u8> ⓘ
Get the value of the {name} field (copies contents)
Sourcepub fn set_copied(&mut self, val: u1)
pub fn set_copied(&mut self, val: u1)
Set the copied field. This field is always stored big-endian within the struct, but this mutator wants host order.
Sourcepub fn set_class(&mut self, val: u2)
pub fn set_class(&mut self, val: u2)
Set the class field. This field is always stored big-endian within the struct, but this mutator wants host order.
Sourcepub fn set_number(&mut self, val: Ipv4OptionNumber)
pub fn set_number(&mut self, val: Ipv4OptionNumber)
Set the value of the {name} 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 {name} field, without copying
Sourcepub fn set_length(&mut self, vals: &[u8])
pub fn set_length(&mut self, vals: &[u8])
Set the value of the {name} field (copies contents)