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