Struct nex_packet::dns::MutableDnsQueryPacket
source · 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)
Trait Implementations§
source§impl<'p> Debug for MutableDnsQueryPacket<'p>
impl<'p> Debug for MutableDnsQueryPacket<'p>
source§impl<'p> FromPacket for MutableDnsQueryPacket<'p>
impl<'p> FromPacket for MutableDnsQueryPacket<'p>
source§impl<'a> MutablePacket for MutableDnsQueryPacket<'a>
impl<'a> MutablePacket for MutableDnsQueryPacket<'a>
source§fn packet_mut<'p>(&'p mut self) -> &'p mut [u8] ⓘ
fn packet_mut<'p>(&'p mut self) -> &'p mut [u8] ⓘ
source§fn payload_mut<'p>(&'p mut self) -> &'p mut [u8] ⓘ
fn payload_mut<'p>(&'p mut self) -> &'p mut [u8] ⓘ
source§fn clone_from<T>(&mut self, other: &T)where
T: Packet,
fn clone_from<T>(&mut self, other: &T)where
T: Packet,
source§impl<'a> Packet for MutableDnsQueryPacket<'a>
impl<'a> Packet for MutableDnsQueryPacket<'a>
source§impl<'a> PacketSize for MutableDnsQueryPacket<'a>
impl<'a> PacketSize for MutableDnsQueryPacket<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for MutableDnsQueryPacket<'p>
impl<'p> PartialEq for MutableDnsQueryPacket<'p>
source§fn eq(&self, other: &MutableDnsQueryPacket<'p>) -> bool
fn eq(&self, other: &MutableDnsQueryPacket<'p>) -> bool
self and other values to be equal, and is used
by ==.