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: u16A 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: boolA one bit field that specifies whether this message is a query (0), or a response (1).
opcode: OpcodeA 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:
-
0a standard query (QUERY) -
1an inverse query (IQUERY) -
2a server status request (STATUS) -
3-15reserved 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: boolTruncation - specifies that this message was truncated due to length greater than that permitted on the transmission channel.
recursion_desired: boolRecursion 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: boolRecursion Available - this be is set or cleared in a response, and denotes whether recursive query support is available in the name server.
rcode: RcodeResponse code - this 4 bit field is set as part of responses. The values have the following interpretation:
-
0No error condition -
1Format error - The name server was unable to interpret the query. -
2Server failure - The name server was unable to process this query due to a problem with the name server. -
3Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist. -
4Not Implemented - The name server does not support the requested kind of query. -
5Refused - 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-15Reserved 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.