Struct xenet_packet::sll2::MutableSLL2Packet
source · 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)
Trait Implementations§
source§impl<'p> Debug for MutableSLL2Packet<'p>
impl<'p> Debug for MutableSLL2Packet<'p>
source§impl<'p> FromPacket for MutableSLL2Packet<'p>
impl<'p> FromPacket for MutableSLL2Packet<'p>
source§impl<'a> MutablePacket for MutableSLL2Packet<'a>
impl<'a> MutablePacket for MutableSLL2Packet<'a>
source§fn packet_mut<'p>(&'p mut self) -> &'p mut [u8] ⓘ
fn packet_mut<'p>(&'p mut self) -> &'p mut [u8] ⓘ
source§fn payload_mut<'p>(&'p mut self) -> &'p mut [u8] ⓘ
fn payload_mut<'p>(&'p mut self) -> &'p mut [u8] ⓘ
source§fn clone_from<T>(&mut self, other: &T)where
T: Packet,
fn clone_from<T>(&mut self, other: &T)where
T: Packet,
source§impl<'a> Packet for MutableSLL2Packet<'a>
impl<'a> Packet for MutableSLL2Packet<'a>
source§impl<'a> PacketSize for MutableSLL2Packet<'a>
impl<'a> PacketSize for MutableSLL2Packet<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for MutableSLL2Packet<'p>
impl<'p> PartialEq for MutableSLL2Packet<'p>
source§fn eq(&self, other: &MutableSLL2Packet<'p>) -> bool
fn eq(&self, other: &MutableSLL2Packet<'p>) -> bool
self
and other
values to be equal, and is used
by ==
.