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