Struct pnet_packet::icmpv6::ndp::RedirectPacket
source · pub struct RedirectPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> RedirectPacket<'a>
impl<'a> RedirectPacket<'a>
sourcepub fn new<'p>(packet: &'p [u8]) -> Option<RedirectPacket<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<RedirectPacket<'p>>
Constructs a new RedirectPacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<RedirectPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<RedirectPacket<'static>>
Constructs a new RedirectPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the RedirectPacket will own its own data and the underlying buffer will be dropped when the RedirectPacket is.
sourcepub fn to_immutable<'p>(&'p self) -> RedirectPacket<'p>
pub fn to_immutable<'p>(&'p self) -> RedirectPacket<'p>
Maps from a RedirectPacket to a RedirectPacket
sourcepub fn consume_to_immutable(self) -> RedirectPacket<'a>
pub fn consume_to_immutable(self) -> RedirectPacket<'a>
Maps from a RedirectPacket to a RedirectPacket 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: &Redirect) -> usize
pub fn packet_size(_packet: &Redirect) -> usize
The size (in bytes) of a Redirect instance when converted into a byte-array
sourcepub fn get_icmpv6_type(&self) -> Icmpv6Type
pub fn get_icmpv6_type(&self) -> Icmpv6Type
Get the value of the icmpv6_type field
sourcepub fn get_icmpv6_code(&self) -> Icmpv6Code
pub fn get_icmpv6_code(&self) -> Icmpv6Code
Get the value of the icmpv6_code field
sourcepub fn get_checksum(&self) -> u16be
pub fn get_checksum(&self) -> u16be
Get the checksum field. This field is always stored big-endian within the struct, but this accessor returns host order.
sourcepub fn get_reserved(&self) -> u32be
pub fn get_reserved(&self) -> u32be
Get the reserved field. This field is always stored big-endian within the struct, but this accessor returns host order.
sourcepub fn get_target_addr(&self) -> Ipv6Addr
pub fn get_target_addr(&self) -> Ipv6Addr
Get the value of the target_addr field
sourcepub fn get_dest_addr(&self) -> Ipv6Addr
pub fn get_dest_addr(&self) -> Ipv6Addr
Get the value of the dest_addr field
sourcepub fn get_options_raw(&self) -> &[u8] ⓘ
pub fn get_options_raw(&self) -> &[u8] ⓘ
Get the raw &u8 value of the options field, without copying
sourcepub fn get_options(&self) -> Vec<NdpOption>
pub fn get_options(&self) -> Vec<NdpOption>
Get the value of the options field (copies contents)
sourcepub fn get_options_iter(&self) -> NdpOptionIterable<'_> ⓘ
pub fn get_options_iter(&self) -> NdpOptionIterable<'_> ⓘ
Get the value of the options field as iterator
Trait Implementations§
source§impl<'p> Debug for RedirectPacket<'p>
impl<'p> Debug for RedirectPacket<'p>
source§impl<'p> FromPacket for RedirectPacket<'p>
impl<'p> FromPacket for RedirectPacket<'p>
source§impl<'a> Packet for RedirectPacket<'a>
impl<'a> Packet for RedirectPacket<'a>
source§impl<'a> PacketSize for RedirectPacket<'a>
impl<'a> PacketSize for RedirectPacket<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for RedirectPacket<'p>
impl<'p> PartialEq for RedirectPacket<'p>
source§fn eq(&self, other: &RedirectPacket<'p>) -> bool
fn eq(&self, other: &RedirectPacket<'p>) -> bool
self
and other
values to be equal, and is used
by ==
.