pub struct Header {
pub id: u16,
pub is_response: bool,
pub opcode: Opcode,
pub is_authoritative: bool,
pub is_truncated: bool,
pub recursion_desired: bool,
pub recursion_available: bool,
pub rcode: Rcode,
}
Expand description
Common header type for all messages.
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 |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
See section 4.1.1 of RFC 1035.
The QECOUNT, ANCOUNT, NSCOUNT, and ARCOUNT fields are omitted from this
type, as they are only used during serialisation and deserialisation and can
be inferred from the other Message
fields.
Fields§
§id: u16
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
A one bit field that specifies whether this message is a query (0), or a response (1).
opcode: 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
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.
is_truncated: bool
Truncation - specifies that this message was truncated due to length greater than that permitted on the transmission channel.
recursion_desired: bool
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
Recursion Available - this be is set or cleared in a response, and denotes whether recursive query support is available in the name server.
rcode: Rcode
Response code - this 4 bit field is set as part of responses. The values have the following interpretation:
-
0
No error condition -
1
Format error - The name server was unable to interpret the query. -
2
Server failure - The name server was unable to process this query due to a problem with the name server. -
3
Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist. -
4
Not Implemented - The name server does not support the requested kind of query. -
5
Refused - The name server refuses to perform the specified operation for policy reasons. For example, a name server may not wish to provide the information to the particular requester, or a name server may not wish to perform a particular operation (e.g., zone transfer) for particular data. -
6-15
Reserved for future use.
Implementations§
Source§impl Header
impl Header
Sourcefn deserialise(buffer: &mut ConsumableBuffer<'_>) -> Result<Self, Error>
fn deserialise(buffer: &mut ConsumableBuffer<'_>) -> Result<Self, Error>
§Errors
If the header is too short.