Struct nex_packet::dns::DnsResponsePacket
source · pub struct DnsResponsePacket<'p> { /* private fields */ }Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> DnsResponsePacket<'a>
impl<'a> DnsResponsePacket<'a>
sourcepub fn new<'p>(packet: &'p [u8]) -> Option<DnsResponsePacket<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<DnsResponsePacket<'p>>
Constructs a new DnsResponsePacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<DnsResponsePacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<DnsResponsePacket<'static>>
Constructs a new DnsResponsePacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the DnsResponsePacket will own its own data and the underlying buffer will be dropped when the DnsResponsePacket is.
sourcepub fn to_immutable<'p>(&'p self) -> DnsResponsePacket<'p>
pub fn to_immutable<'p>(&'p self) -> DnsResponsePacket<'p>
Maps from a DnsResponsePacket to a DnsResponsePacket
sourcepub fn consume_to_immutable(self) -> DnsResponsePacket<'a>
pub fn consume_to_immutable(self) -> DnsResponsePacket<'a>
Maps from a DnsResponsePacket to a DnsResponsePacket 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: &DnsResponse) -> usize
pub fn packet_size(_packet: &DnsResponse) -> usize
The size (in bytes) of a DnsResponse instance when converted into a byte-array
sourcepub fn get_name_tag(&self) -> u16be
pub fn get_name_tag(&self) -> u16be
Get the name_tag field. This field is always stored big-endian within the struct, but this accessor returns host order.
sourcepub fn get_rclass(&self) -> DnsClass
pub fn get_rclass(&self) -> DnsClass
Get the value of the rclass field
sourcepub fn get_ttl(&self) -> u32be
pub fn get_ttl(&self) -> u32be
Get the ttl field. This field is always stored big-endian within the struct, but this accessor returns host order.
sourcepub fn get_data_len(&self) -> u16be
pub fn get_data_len(&self) -> u16be
Get the data_len field. This field is always stored big-endian within the struct, but this accessor returns host order.
sourcepub fn get_data_raw(&self) -> &[u8] ⓘ
pub fn get_data_raw(&self) -> &[u8] ⓘ
Get the raw &u8 value of the data field, without copying
Trait Implementations§
source§impl<'p> Debug for DnsResponsePacket<'p>
impl<'p> Debug for DnsResponsePacket<'p>
source§impl<'p> FromPacket for DnsResponsePacket<'p>
impl<'p> FromPacket for DnsResponsePacket<'p>
§type T = DnsResponse
type T = DnsResponse
source§fn from_packet(&self) -> DnsResponse
fn from_packet(&self) -> DnsResponse
source§impl<'a> Packet for DnsResponsePacket<'a>
impl<'a> Packet for DnsResponsePacket<'a>
source§impl<'a> PacketSize for DnsResponsePacket<'a>
impl<'a> PacketSize for DnsResponsePacket<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for DnsResponsePacket<'p>
impl<'p> PartialEq for DnsResponsePacket<'p>
source§fn eq(&self, other: &DnsResponsePacket<'p>) -> bool
fn eq(&self, other: &DnsResponsePacket<'p>) -> bool
self and other values to be equal, and is used
by ==.