pub struct MutableDnsQueryPacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
Source§impl<'a> MutableDnsQueryPacket<'a>
impl<'a> MutableDnsQueryPacket<'a>
Sourcepub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableDnsQueryPacket<'p>>
pub fn new<'p>(packet: &'p mut [u8]) -> Option<MutableDnsQueryPacket<'p>>
Constructs a new MutableDnsQueryPacket. If the provided buffer is less than the minimum required packet size, this will return None.
Sourcepub fn owned(packet: Vec<u8>) -> Option<MutableDnsQueryPacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<MutableDnsQueryPacket<'static>>
Constructs a new MutableDnsQueryPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the MutableDnsQueryPacket will own its own data and the underlying buffer will be dropped when the MutableDnsQueryPacket is.
Sourcepub fn to_immutable<'p>(&'p self) -> DnsQueryPacket<'p>
pub fn to_immutable<'p>(&'p self) -> DnsQueryPacket<'p>
Maps from a MutableDnsQueryPacket to a DnsQueryPacket
Sourcepub fn consume_to_immutable(self) -> DnsQueryPacket<'a>
pub fn consume_to_immutable(self) -> DnsQueryPacket<'a>
Maps from a MutableDnsQueryPacket 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 populate(&mut self, packet: &DnsQuery)
pub fn populate(&mut self, packet: &DnsQuery)
Populates a DnsQueryPacket using a DnsQuery structure
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
Sourcepub fn get_qname_raw_mut(&mut self) -> &mut [u8] ⓘ
pub fn get_qname_raw_mut(&mut self) -> &mut [u8] ⓘ
Get the raw &mut u8 value of the qname field, without copying
Sourcepub fn set_qclass(&mut self, val: DnsClass)
pub fn set_qclass(&mut self, val: DnsClass)
Set the value of the qclass field.
Sourcepub fn set_payload(&mut self, vals: &[u8])
pub fn set_payload(&mut self, vals: &[u8])
Set the value of the payload field (copies contents)