pub struct MutableSLL2Packet<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
Source§impl<'a> MutableSLL2Packet<'a>
impl<'a> MutableSLL2Packet<'a>
Sourcepub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableSLL2Packet<'p>>
pub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableSLL2Packet<'p>>
Constructs a new MutableSLL2Packet. If the provided buffer is less than the minimum required packet size, this will return None.
Sourcepub fn owned(packet: Vec<u8>) -> Option<MutableSLL2Packet<'static>>
pub fn owned(packet: Vec<u8>) -> Option<MutableSLL2Packet<'static>>
Constructs a new MutableSLL2Packet. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the MutableSLL2Packet will own its own data and the underlying buffer will be dropped when the MutableSLL2Packet is.
Sourcepub fn to_immutable<'p>(&'p self) -> SLL2Packet<'p>
pub fn to_immutable<'p>(&'p self) -> SLL2Packet<'p>
Maps from a MutableSLL2Packet to a SLL2Packet
Sourcepub fn consume_to_immutable(self) -> SLL2Packet<'a>
pub fn consume_to_immutable(self) -> SLL2Packet<'a>
Maps from a MutableSLL2Packet to a SLL2Packet 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: &SLL2) -> usize
pub fn packet_size(_packet: &SLL2) -> usize
The size (in bytes) of a SLL2 instance when converted into a byte-array
Sourcepub fn get_protocol_type(&self) -> EtherType
pub fn get_protocol_type(&self) -> EtherType
Get the value of the protocol_type field
Sourcepub fn get_reserved(&self) -> u16be
pub fn get_reserved(&self) -> u16be
Get the reserved field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_interface_index(&self) -> u32be
pub fn get_interface_index(&self) -> u32be
Get the interface_index field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_arphrd_type(&self) -> u16be
pub fn get_arphrd_type(&self) -> u16be
Get the arphrd_type field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_packet_type(&self) -> u8
pub fn get_packet_type(&self) -> u8
Get the packet_type field.
Sourcepub fn get_link_layer_address_length(&self) -> u8
pub fn get_link_layer_address_length(&self) -> u8
Get the link_layer_address_length field.
Sourcepub fn get_link_layer_address_raw(&self) -> &[u8] ⓘ
pub fn get_link_layer_address_raw(&self) -> &[u8] ⓘ
Get the raw &u8 value of the link_layer_address field, without copying
Sourcepub fn get_link_layer_address(&self) -> Vec<u8> ⓘ
pub fn get_link_layer_address(&self) -> Vec<u8> ⓘ
Get the value of the link_layer_address field (copies contents)
Sourcepub fn set_protocol_type(&mut self, val: EtherType)
pub fn set_protocol_type(&mut self, val: EtherType)
Set the value of the protocol_type field.
Sourcepub fn set_reserved(&mut self, val: u16be)
pub fn set_reserved(&mut self, val: u16be)
Set the reserved field. This field is always stored big-endian within the struct, but this mutator wants host order.
Sourcepub fn set_interface_index(&mut self, val: u32be)
pub fn set_interface_index(&mut self, val: u32be)
Set the interface_index field. This field is always stored big-endian within the struct, but this mutator wants host order.
Sourcepub fn set_arphrd_type(&mut self, val: u16be)
pub fn set_arphrd_type(&mut self, val: u16be)
Set the arphrd_type field. This field is always stored big-endian within the struct, but this mutator wants host order.
Sourcepub fn set_packet_type(&mut self, val: u8)
pub fn set_packet_type(&mut self, val: u8)
Set the packet_type field.
Sourcepub fn set_link_layer_address_length(&mut self, val: u8)
pub fn set_link_layer_address_length(&mut self, val: u8)
Set the link_layer_address_length field.
Sourcepub fn get_link_layer_address_raw_mut(&mut self) -> &mut [u8] ⓘ
pub fn get_link_layer_address_raw_mut(&mut self) -> &mut [u8] ⓘ
Get the raw &mut u8 value of the link_layer_address field, without copying
Sourcepub fn set_link_layer_address(&mut self, vals: &[u8])
pub fn set_link_layer_address(&mut self, vals: &[u8])
Set the value of the link_layer_address field (copies contents)
Sourcepub fn set_payload(&mut self, vals: &[u8])
pub fn set_payload(&mut self, vals: &[u8])
Set the value of the payload field (copies contents)