sdns
low-level DNS library
Loading...
Searching...
No Matches
Public Attributes | List of all members
sdns_header Struct Reference

#include <sdns.h>

Public Attributes

uint16_t id
 RFC1035: 16-bit identifier.
 
uint8_t qr:1
 RFC1035: one bit if the msg is query(0) or response(1)
 
uint8_t opcode:4
 RFC1035: 4-bit specifies the kind of query in the message.
 
uint8_t aa:1
 RFC1035: 1-bit if this is an authoritative answer.
 
uint8_t tc:1
 RFC1035: 1-bit TrunCation.
 
uint8_t rd:1
 RFC1035: Recursion Desired.
 
uint8_t ra:1
 RFC1035: Recursion Available.
 
uint8_t z:1
 RFC1035: Reserved for future use.
 
uint8_t AD:1
 RFC2535: Section 6.1: authentic data.
 
uint8_t CD:1
 RFC2535: Section 6.1: checking disabled.
 
uint8_t rcode:4
 RFC1035: Response code.
 
uint16_t qdcount
 RFC1035: Number of entries in question section.
 
uint16_t ancount
 RFC1035: Number of entries in answer section.
 
uint16_t nscount
 RFC1035: Number of entries in authority section.
 
uint16_t arcount
 RFC1035: Number of entries in additional section.
 

Detailed Description

Structure of the DNS packet header based on RFC1035 Section 4.1.1

                                    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 |AD|CD|   RCODE   |
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  |                    QDCOUNT                    |
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  |                    ANCOUNT                    |
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  |                    NSCOUNT                    |
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  |                    ARCOUNT                    |
  +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

The header is exactly 12 bytes and it's always the same.

Although QDCOUNT can be > 1 but most DNS resolvers return FormError if QDCOUNT > 1


The documentation for this struct was generated from the following file: