pub struct DnsMessageHeader {
pub id: u16,
pub is_response: bool,
pub op_code: DnsOpCode,
pub authoritative_answer: bool,
pub truncated: bool,
pub recursion_desired: bool,
pub recursion_available: bool,
pub response_code: DnsResponseCode,
pub question_count: u16,
pub answer_count: u16,
pub name_server_count: u16,
pub additional_count: u16,
}
Expand description
4.1.1. Header section format
The header contains the following fields:
1 1 1 1 1 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RCODE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | QDCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ANCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | NSCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ARCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Fields§
§id: u16
ID
A 16 bit identifier assigned by the program that generates any kind of query. This identifier is copied the corresponding reply and can be used by the requester to match up replies to outstanding queries.
is_response: bool
QR
A one bit field that specifies whether this message is a query (0
), or a response (1
).
op_code: DnsOpCode
OPCODE
A four bit field that specifies kind of query in this message. This value is set by the originator of a query and copied into the response. The values are:
0
a standard query (QUERY
)1
an inverse query (IQUERY
)2
a server status request (STATUS
)3-15
reserved for future use
AA
Authoritative Answer - this bit is valid in responses, and specifies that the responding name server is an authority for the domain name in question section.Note that the contents of the answer section may have multiple owner names because of aliases. The AA bit corresponds to the name which matches the query name, or the first owner name in the answer section.
truncated: bool
TC
TrunCation - specifies that this message was truncated due to length greater than that permitted on the transmission channel.
recursion_desired: bool
RD
Recursion Desired - this bit may be set in a query and is copied into the response. If RD is set, it directs the name server to pursue the query recursively. Recursive query support is optional.
recursion_available: bool
RA
Recursion Available - this be is set or cleared in a response, and denotes whether recursive query support is available in the name server.
response_code: DnsResponseCode
§question_count: u16
§answer_count: u16
§name_server_count: u16
§additional_count: u16
Implementations§
Trait Implementations§
Source§impl Clone for DnsMessageHeader
impl Clone for DnsMessageHeader
Source§fn clone(&self) -> DnsMessageHeader
fn clone(&self) -> DnsMessageHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more