Struct nex_packet::dns::DnsQueryPacket
source · pub struct DnsQueryPacket<'p> { /* private fields */ }Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> DnsQueryPacket<'a>
impl<'a> DnsQueryPacket<'a>
sourcepub fn new<'p>(packet: &'p [u8]) -> Option<DnsQueryPacket<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<DnsQueryPacket<'p>>
Constructs a new DnsQueryPacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<DnsQueryPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<DnsQueryPacket<'static>>
Constructs a new DnsQueryPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the DnsQueryPacket will own its own data and the underlying buffer will be dropped when the DnsQueryPacket is.
sourcepub fn to_immutable<'p>(&'p self) -> DnsQueryPacket<'p>
pub fn to_immutable<'p>(&'p self) -> DnsQueryPacket<'p>
Maps from a DnsQueryPacket to a DnsQueryPacket
sourcepub fn consume_to_immutable(self) -> DnsQueryPacket<'a>
pub fn consume_to_immutable(self) -> DnsQueryPacket<'a>
Maps from a DnsQueryPacket to a DnsQueryPacket 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: &DnsQuery) -> usize
pub fn packet_size(_packet: &DnsQuery) -> usize
The size (in bytes) of a DnsQuery instance when converted into a byte-array
sourcepub fn get_qname_raw(&self) -> &[u8] ⓘ
pub fn get_qname_raw(&self) -> &[u8] ⓘ
Get the raw &u8 value of the qname field, without copying
sourcepub fn get_qclass(&self) -> DnsClass
pub fn get_qclass(&self) -> DnsClass
Get the value of the qclass field
Trait Implementations§
source§impl<'p> Debug for DnsQueryPacket<'p>
impl<'p> Debug for DnsQueryPacket<'p>
source§impl<'p> FromPacket for DnsQueryPacket<'p>
impl<'p> FromPacket for DnsQueryPacket<'p>
source§impl<'a> Packet for DnsQueryPacket<'a>
impl<'a> Packet for DnsQueryPacket<'a>
source§impl<'a> PacketSize for DnsQueryPacket<'a>
impl<'a> PacketSize for DnsQueryPacket<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for DnsQueryPacket<'p>
impl<'p> PartialEq for DnsQueryPacket<'p>
source§fn eq(&self, other: &DnsQueryPacket<'p>) -> bool
fn eq(&self, other: &DnsQueryPacket<'p>) -> bool
self and other values to be equal, and is used
by ==.