pub struct DnsQuestion {
pub qname: DnsName,
pub qtype: u16,
pub qclass: u16,
}Expand description
A DNS question record.
Fields§
§qname: DnsNameThe domain name being queried.
qtype: u16The query type (e.g., A=1, AAAA=28, MX=15).
qclass: u16The query class (typically IN=1). For mDNS, bit 15 is the unicast-response flag.
Implementations§
Source§impl DnsQuestion
impl DnsQuestion
Sourcepub fn from_name(name: &str) -> Result<Self, FieldError>
pub fn from_name(name: &str) -> Result<Self, FieldError>
Create a question from a domain name string.
Sourcepub fn unicast_response(&self) -> bool
pub fn unicast_response(&self) -> bool
Whether this is an mDNS unicast-response question.
Sourcepub fn actual_class(&self) -> u16
pub fn actual_class(&self) -> u16
Get the actual class (without the mDNS unicast-response bit).
Sourcepub fn set_unicast_response(&mut self, unicast: bool)
pub fn set_unicast_response(&mut self, unicast: bool)
Set the mDNS unicast-response flag.
Sourcepub fn parse(packet: &[u8], offset: usize) -> Result<(Self, usize), FieldError>
pub fn parse(packet: &[u8], offset: usize) -> Result<(Self, usize), FieldError>
Parse a question from wire format.
packet is the full DNS packet (for pointer decompression).
offset is the start of the question record.
Returns the parsed question and bytes consumed.
Trait Implementations§
Source§impl Clone for DnsQuestion
impl Clone for DnsQuestion
Source§fn clone(&self) -> DnsQuestion
fn clone(&self) -> DnsQuestion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DnsQuestion
impl Debug for DnsQuestion
Source§impl Default for DnsQuestion
impl Default for DnsQuestion
Source§impl PartialEq for DnsQuestion
impl PartialEq for DnsQuestion
impl StructuralPartialEq for DnsQuestion
Auto Trait Implementations§
impl Freeze for DnsQuestion
impl RefUnwindSafe for DnsQuestion
impl Send for DnsQuestion
impl Sync for DnsQuestion
impl Unpin for DnsQuestion
impl UnsafeUnpin for DnsQuestion
impl UnwindSafe for DnsQuestion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more