ldns_struct_hdr Struct Reference

Data Fields

uint16_t _id
 Id of a packet. More...
bool _qr
 Query bit (0=query, 1=answer) More...
bool _aa
 Authoritative answer. More...
bool _tc
 Packet truncated. More...
bool _rd
 Recursion desired. More...
bool _cd
 Checking disabled. More...
bool _ra
 Recursion available. More...
bool _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                    |


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

                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

ARCOUNT         an unsigned 16 bit integer specifying the number of
                resource records in the additional records section.

Definition at line 193 of file packet.h.

Field Documentation

◆ _id

uint16_t ldns_struct_hdr::_id

Id of a packet.

Definition at line 196 of file packet.h.

◆ _qr

bool ldns_struct_hdr::_qr

Query bit (0=query, 1=answer)

Definition at line 198 of file packet.h.

◆ _aa

bool ldns_struct_hdr::_aa

Authoritative answer.

Definition at line 200 of file packet.h.

◆ _tc

bool ldns_struct_hdr::_tc

Packet truncated.

Definition at line 202 of file packet.h.

◆ _rd

bool ldns_struct_hdr::_rd

Recursion desired.

Definition at line 204 of file packet.h.

◆ _cd

bool ldns_struct_hdr::_cd

Checking disabled.

Definition at line 206 of file packet.h.

◆ _ra

bool ldns_struct_hdr::_ra

Recursion available.

Definition at line 208 of file packet.h.

◆ _ad

bool ldns_struct_hdr::_ad

Authentic data.

Definition at line 210 of file packet.h.

◆ _opcode

ldns_pkt_opcode ldns_struct_hdr::_opcode

Query type.

Definition at line 212 of file packet.h.

◆ _rcode

uint8_t ldns_struct_hdr::_rcode

Response code.

Definition at line 214 of file packet.h.

◆ _qdcount

uint16_t ldns_struct_hdr::_qdcount

question sec

Definition at line 216 of file packet.h.

◆ _ancount

uint16_t ldns_struct_hdr::_ancount

answer sec

Definition at line 218 of file packet.h.

◆ _nscount

uint16_t ldns_struct_hdr::_nscount

auth sec

Definition at line 220 of file packet.h.

◆ _arcount

uint16_t ldns_struct_hdr::_arcount

add sec

Definition at line 222 of file packet.h.