pub struct SLLPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
Source§impl<'a> SLLPacket<'a>
impl<'a> SLLPacket<'a>
Sourcepub fn new<'p>(packet: &'p [u8]) -> Option<SLLPacket<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<SLLPacket<'p>>
Constructs a new SLLPacket. If the provided buffer is less than the minimum required packet size, this will return None.
Sourcepub fn owned(packet: Vec<u8>) -> Option<SLLPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<SLLPacket<'static>>
Constructs a new SLLPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the SLLPacket will own its own data and the underlying buffer will be dropped when the SLLPacket is.
Sourcepub fn to_immutable<'p>(&'p self) -> SLLPacket<'p>
pub fn to_immutable<'p>(&'p self) -> SLLPacket<'p>
Maps from a SLLPacket to a SLLPacket
Sourcepub fn consume_to_immutable(self) -> SLLPacket<'a>
pub fn consume_to_immutable(self) -> SLLPacket<'a>
Maps from a SLLPacket to a SLLPacket 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: &SLL) -> usize
pub fn packet_size(_packet: &SLL) -> usize
The size (in bytes) of a SLL instance when converted into a byte-array
Sourcepub fn get_packet_type(&self) -> u16be
pub fn get_packet_type(&self) -> u16be
Get the packet_type field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_link_layer_address_type(&self) -> u16be
pub fn get_link_layer_address_type(&self) -> u16be
Get the link_layer_address_type field. This field is always stored big-endian within the struct, but this accessor returns host order.
Sourcepub fn get_link_layer_address_len(&self) -> u16be
pub fn get_link_layer_address_len(&self) -> u16be
Get the link_layer_address_len field. This field is always stored big-endian within the struct, but this accessor returns host order.
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 get_protocol(&self) -> EtherType
pub fn get_protocol(&self) -> EtherType
Get the value of the protocol field