DNS.Message.Header (DNS v0.4.1)
View SourceDNS Header
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 |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
where:
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.
QR
A one bit field that specifies whether this message is a query (0), or a response (1).
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.
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.
TC
TrunCation - specifies that this message was truncated due to length greater than that permitted on the transmission channel.
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.
RA
Recursion Available - this be is set or cleared in a response, and denotes whether recursive query support is available in the name server.
Z
Reserved for future use. Must be zero in all queries and responses.
AD
The AD bit exists in order to provide a means for a security-aware resolver to signal to a security-aware name server that the resolver considers authentic data to be more important than unauthenticated data. The AD bit is only intended to provide a signal from the resolver to the name server; it is not intended to provide a signal from the name server to the resolver.
[rfc4035]
CD
The CD bit exists in order to allow a security-aware resolver to disable signature validation in a security-aware name server's processing of a particular query.
[rfc4035]
RCODE
Response code - this 4 bit field is set as part of responses.
QDCOUNT
an unsigned 16 bit integer specifying the number of entries in the question section.
ANCOUNT
an unsigned 16 bit integer specifying the number of resource records in the answer section.
NSCOUNT
an unsigned 16 bit integer specifying the number of name server resource records in the authority records section.
ARCOUNT
an unsigned 16 bit integer specifying the number of resource records in the additional records section.
Reference
Summary
Types
@type t() :: %DNS.Message.Header{ aa: 0 | 1, ad: 0 | 1, ancount: integer(), arcount: integer(), cd: 0 | 1, id: integer(), nscount: integer(), opcode: DNS.Message.OpCode.t(), qdcount: integer(), qr: 0 | 1, ra: 0 | 1, rcode: DNS.Message.RCode.t(), rd: 0 | 1, tc: 0 | 1, z: 0 | 1 }