Struct pnet::packet::vlan::VlanPacket
source · pub struct VlanPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> VlanPacket<'a>
impl<'a> VlanPacket<'a>
sourcepub fn new<'p>(packet: &'p [u8]) -> Option<VlanPacket<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<VlanPacket<'p>>
Constructs a new VlanPacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<VlanPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<VlanPacket<'static>>
Constructs a new VlanPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the VlanPacket will own its own data and the underlying buffer will be dropped when the VlanPacket is.
sourcepub fn to_immutable<'p>(&'p self) -> VlanPacket<'p>
pub fn to_immutable<'p>(&'p self) -> VlanPacket<'p>
Maps from a VlanPacket to a VlanPacket
sourcepub fn consume_to_immutable(self) -> VlanPacket<'a>
pub fn consume_to_immutable(self) -> VlanPacket<'a>
Maps from a VlanPacket to a VlanPacket 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: &Vlan) -> usize
pub fn packet_size(_packet: &Vlan) -> usize
The size (in bytes) of a Vlan instance when converted into a byte-array
sourcepub fn get_priority_code_point(&self) -> ClassOfService
pub fn get_priority_code_point(&self) -> ClassOfService
Get the value of the priority_code_point field
sourcepub fn get_drop_eligible_indicator(&self) -> u8
pub fn get_drop_eligible_indicator(&self) -> u8
Get the drop_eligible_indicator field.
sourcepub fn get_vlan_identifier(&self) -> u16
pub fn get_vlan_identifier(&self) -> u16
Get the vlan_identifier field. This field is always stored big-endian within the struct, but this accessor returns host order.
sourcepub fn get_ethertype(&self) -> EtherType
pub fn get_ethertype(&self) -> EtherType
Get the value of the ethertype field
Trait Implementations§
source§impl<'p> Debug for VlanPacket<'p>
impl<'p> Debug for VlanPacket<'p>
source§impl<'p> FromPacket for VlanPacket<'p>
impl<'p> FromPacket for VlanPacket<'p>
source§impl<'a> Packet for VlanPacket<'a>
impl<'a> Packet for VlanPacket<'a>
source§impl<'a> PacketSize for VlanPacket<'a>
impl<'a> PacketSize for VlanPacket<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for VlanPacket<'p>
impl<'p> PartialEq for VlanPacket<'p>
source§fn eq(&self, other: &VlanPacket<'p>) -> bool
fn eq(&self, other: &VlanPacket<'p>) -> bool
self
and other
values to be equal, and is used
by ==
.