ldns  1.7.0
Data Fields
ldns_struct_hdr Struct Reference

Header of a dns packet. More...

Data Fields

uint16_t _id
 Id of a packet. More...
 
signed char _qr
 Query bit (0=query, 1=answer) More...
 
signed char _aa
 Authoritative answer. More...
 
signed char _tc
 Packet truncated. More...
 
signed char _rd
 Recursion desired. More...
 
signed char _cd
 Checking disabled. More...
 
signed char _ra
 Recursion available. More...
 
signed char _ad
 Authentic data. More...
 
ldns_pkt_opcode _opcode
 Query type. More...
 
uint8_t _rcode
 Response code. More...
 
uint16_t _qdcount
 question sec More...
 
uint16_t _ancount
 answer sec More...
 
uint16_t _nscount
 auth sec More...
 
uint16_t _arcount
 add sec More...
 

Detailed Description

Header of a dns packet.

Contains the information about the packet itself, as specified in RFC1035

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                    |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
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.  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.
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.
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.
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.
 

Definition at line 192 of file packet.h.

Field Documentation

§ _id

uint16_t ldns_struct_hdr::_id

Id of a packet.

Definition at line 195 of file packet.h.

§ _qr

signed char ldns_struct_hdr::_qr

Query bit (0=query, 1=answer)

Definition at line 197 of file packet.h.

§ _aa

signed char ldns_struct_hdr::_aa

Authoritative answer.

Definition at line 199 of file packet.h.

§ _tc

signed char ldns_struct_hdr::_tc

Packet truncated.

Definition at line 201 of file packet.h.

§ _rd

signed char ldns_struct_hdr::_rd

Recursion desired.

Definition at line 203 of file packet.h.

§ _cd

signed char ldns_struct_hdr::_cd

Checking disabled.

Definition at line 205 of file packet.h.

§ _ra

signed char ldns_struct_hdr::_ra

Recursion available.

Definition at line 207 of file packet.h.

§ _ad

signed char ldns_struct_hdr::_ad

Authentic data.

Definition at line 209 of file packet.h.

§ _opcode

ldns_pkt_opcode ldns_struct_hdr::_opcode

Query type.

Definition at line 211 of file packet.h.

§ _rcode

uint8_t ldns_struct_hdr::_rcode

Response code.

Definition at line 213 of file packet.h.

§ _qdcount

uint16_t ldns_struct_hdr::_qdcount

question sec

Definition at line 215 of file packet.h.

§ _ancount

uint16_t ldns_struct_hdr::_ancount

answer sec

Definition at line 217 of file packet.h.

§ _nscount

uint16_t ldns_struct_hdr::_nscount

auth sec

Definition at line 219 of file packet.h.

§ _arcount

uint16_t ldns_struct_hdr::_arcount

add sec

Definition at line 221 of file packet.h.