Struct pnet_packet::ipv6::Ipv6Packet
source · pub struct Ipv6Packet<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> Ipv6Packet<'a>
impl<'a> Ipv6Packet<'a>
sourcepub fn new<'p>(packet: &'p [u8]) -> Option<Ipv6Packet<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<Ipv6Packet<'p>>
Constructs a new Ipv6Packet. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<Ipv6Packet<'static>>
pub fn owned(packet: Vec<u8>) -> Option<Ipv6Packet<'static>>
Constructs a new Ipv6Packet. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the Ipv6Packet will own its own data and the underlying buffer will be dropped when the Ipv6Packet is.
sourcepub fn to_immutable<'p>(&'p self) -> Ipv6Packet<'p>
pub fn to_immutable<'p>(&'p self) -> Ipv6Packet<'p>
Maps from a Ipv6Packet to a Ipv6Packet
sourcepub fn consume_to_immutable(self) -> Ipv6Packet<'a>
pub fn consume_to_immutable(self) -> Ipv6Packet<'a>
Maps from a Ipv6Packet to a Ipv6Packet 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: &Ipv6) -> usize
pub fn packet_size(_packet: &Ipv6) -> usize
The size (in bytes) of a Ipv6 instance when converted into a byte-array
sourcepub fn get_version(&self) -> u4
pub fn get_version(&self) -> u4
Get the version field.
sourcepub fn get_traffic_class(&self) -> u8
pub fn get_traffic_class(&self) -> u8
Get the traffic_class field.
sourcepub fn get_flow_label(&self) -> u20be
pub fn get_flow_label(&self) -> u20be
Get the flow_label field. This field is always stored big-endian within the struct, but this accessor returns host order.
sourcepub fn get_payload_length(&self) -> u16be
pub fn get_payload_length(&self) -> u16be
Get the payload_length field. This field is always stored big-endian within the struct, but this accessor returns host order.
sourcepub fn get_next_header(&self) -> IpNextHeaderProtocol
pub fn get_next_header(&self) -> IpNextHeaderProtocol
Get the value of the next_header field
sourcepub fn get_hop_limit(&self) -> u8
pub fn get_hop_limit(&self) -> u8
Get the hop_limit field.
sourcepub fn get_source(&self) -> Ipv6Addr
pub fn get_source(&self) -> Ipv6Addr
Get the value of the source field
sourcepub fn get_destination(&self) -> Ipv6Addr
pub fn get_destination(&self) -> Ipv6Addr
Get the value of the destination field
Trait Implementations§
source§impl<'p> Debug for Ipv6Packet<'p>
impl<'p> Debug for Ipv6Packet<'p>
source§impl<'p> FromPacket for Ipv6Packet<'p>
impl<'p> FromPacket for Ipv6Packet<'p>
source§impl<'a> Packet for Ipv6Packet<'a>
impl<'a> Packet for Ipv6Packet<'a>
source§impl<'a> PacketSize for Ipv6Packet<'a>
impl<'a> PacketSize for Ipv6Packet<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for Ipv6Packet<'p>
impl<'p> PartialEq for Ipv6Packet<'p>
source§fn eq(&self, other: &Ipv6Packet<'p>) -> bool
fn eq(&self, other: &Ipv6Packet<'p>) -> bool
self
and other
values to be equal, and is used
by ==
.