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