Struct pnet_packet::vlan::MutableVlanPacket
source · pub struct MutableVlanPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> MutableVlanPacket<'a>
impl<'a> MutableVlanPacket<'a>
sourcepub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableVlanPacket<'p>>
pub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableVlanPacket<'p>>
Constructs a new MutableVlanPacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<MutableVlanPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<MutableVlanPacket<'static>>
Constructs a new MutableVlanPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the MutableVlanPacket will own its own data and the underlying buffer will be dropped when the MutableVlanPacket is.
sourcepub fn to_immutable<'p>(&'p self) -> VlanPacket<'p>
pub fn to_immutable<'p>(&'p self) -> VlanPacket<'p>
Maps from a MutableVlanPacket to a VlanPacket
sourcepub fn consume_to_immutable(self) -> VlanPacket<'a>
pub fn consume_to_immutable(self) -> VlanPacket<'a>
Maps from a MutableVlanPacket 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) -> u1
pub fn get_drop_eligible_indicator(&self) -> u1
Get the drop_eligible_indicator field.
sourcepub fn get_vlan_identifier(&self) -> u12be
pub fn get_vlan_identifier(&self) -> u12be
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
sourcepub fn set_priority_code_point(&mut self, val: ClassOfService)
pub fn set_priority_code_point(&mut self, val: ClassOfService)
Set the value of the priority_code_point field.
sourcepub fn set_drop_eligible_indicator(&mut self, val: u1)
pub fn set_drop_eligible_indicator(&mut self, val: u1)
Set the drop_eligible_indicator field.
sourcepub fn set_vlan_identifier(&mut self, val: u12be)
pub fn set_vlan_identifier(&mut self, val: u12be)
Set the vlan_identifier field. This field is always stored big-endian within the struct, but this mutator wants host order.
sourcepub fn set_ethertype(&mut self, val: EtherType)
pub fn set_ethertype(&mut self, val: EtherType)
Set the value of the ethertype field.
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 MutableVlanPacket<'p>
impl<'p> Debug for MutableVlanPacket<'p>
source§impl<'p> FromPacket for MutableVlanPacket<'p>
impl<'p> FromPacket for MutableVlanPacket<'p>
source§impl<'a> MutablePacket for MutableVlanPacket<'a>
impl<'a> MutablePacket for MutableVlanPacket<'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 MutableVlanPacket<'a>
impl<'a> Packet for MutableVlanPacket<'a>
source§impl<'a> PacketSize for MutableVlanPacket<'a>
impl<'a> PacketSize for MutableVlanPacket<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq<MutableVlanPacket<'p>> for MutableVlanPacket<'p>
impl<'p> PartialEq<MutableVlanPacket<'p>> for MutableVlanPacket<'p>
source§fn eq(&self, other: &MutableVlanPacket<'p>) -> bool
fn eq(&self, other: &MutableVlanPacket<'p>) -> bool
self
and other
values to be equal, and is used
by ==
.