Struct pnet::packet::sll2::SLL2Packet
source · pub struct SLL2Packet<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> SLL2Packet<'a>
impl<'a> SLL2Packet<'a>
sourcepub fn new<'p>(packet: &'p [u8]) -> Option<SLL2Packet<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<SLL2Packet<'p>>
Constructs a new SLL2Packet. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<SLL2Packet<'static>>
pub fn owned(packet: Vec<u8>) -> Option<SLL2Packet<'static>>
Constructs a new SLL2Packet. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the SLL2Packet will own its own data and the underlying buffer will be dropped when the SLL2Packet is.
sourcepub fn to_immutable<'p>(&'p self) -> SLL2Packet<'p>
pub fn to_immutable<'p>(&'p self) -> SLL2Packet<'p>
Maps from a SLL2Packet to a SLL2Packet
sourcepub fn consume_to_immutable(self) -> SLL2Packet<'a>
pub fn consume_to_immutable(self) -> SLL2Packet<'a>
Maps from a SLL2Packet 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) -> u16
pub fn get_reserved(&self) -> u16
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) -> u32
pub fn get_interface_index(&self) -> u32
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) -> u16
pub fn get_arphrd_type(&self) -> u16
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)
Trait Implementations§
source§impl<'p> Debug for SLL2Packet<'p>
impl<'p> Debug for SLL2Packet<'p>
source§impl<'p> FromPacket for SLL2Packet<'p>
impl<'p> FromPacket for SLL2Packet<'p>
source§impl<'a> Packet for SLL2Packet<'a>
impl<'a> Packet for SLL2Packet<'a>
source§impl<'a> PacketSize for SLL2Packet<'a>
impl<'a> PacketSize for SLL2Packet<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for SLL2Packet<'p>
impl<'p> PartialEq for SLL2Packet<'p>
source§fn eq(&self, other: &SLL2Packet<'p>) -> bool
fn eq(&self, other: &SLL2Packet<'p>) -> bool
self
and other
values to be equal, and is used
by ==
.