friendev EtherDune TCP/IP library
Public Member Functions | Public Attributes | List of all members
DNSHeader Struct Reference

Structure used to encode part of a DNS query. More...

#include <inet.h>

Public Member Functions

void zero ()
 Sets the entire header to zero. More...
 

Public Attributes

uint16_t identification
 A 16-bit identification number chosen by the client. More...
 
union {
   struct {
      uint8_t   RD: 1
 Recursion Desired. More...
 
      uint8_t   TC: 1
 Truncation Flag. More...
 
      uint8_t   AA: 1
 Authoritative Answer Flag. More...
 
      uint8_t   opcode: 4
 Operation Code. More...
 
      uint8_t   QR: 1
 Query or Response. More...
 
      uint8_t   rcode: 4
 Response Code. More...
 
      uint8_t   reserved: 3
 
      uint8_t   RA: 1
 Recursion Available. More...
 
   } 
 
   uint16_t   flags
 
}; 
 
nint16_t numberOfQuestions
 Question Count. More...
 
nint16_t numberOfAnswerRRs
 Answer Record Count. More...
 
nint16_t numberOfAuthorityRRs
 Authority Record Count. More...
 
nint16_t numberOfAdditionalRRs
 Additional Record Count. More...
 

Detailed Description

Structure used to encode part of a DNS query.

Definition at line 397 of file inet.h.

Member Function Documentation

void DNSHeader::zero ( )
inline

Sets the entire header to zero.

Definition at line 423 of file inet.h.

Member Data Documentation

union { ... }
uint8_t DNSHeader::AA

Authoritative Answer Flag.

This bit is set to 1 in a response to indicate that the server that created the response is authoritative for the zone in which the domain name specified in the Question section is located. If it is 0, the response is non-authoritative.

Definition at line 406 of file inet.h.

uint16_t DNSHeader::flags

Definition at line 413 of file inet.h.

uint16_t DNSHeader::identification

A 16-bit identification number chosen by the client.

The server will reply with the same number so the client can match a response to a request.

Definition at line 399 of file inet.h.

nint16_t DNSHeader::numberOfAdditionalRRs

Additional Record Count.

Specifies the number of resource records in the Additional section of the message.

Definition at line 418 of file inet.h.

nint16_t DNSHeader::numberOfAnswerRRs

Answer Record Count.

Specifies the number of resource records in the Answer section of the message.

Definition at line 416 of file inet.h.

nint16_t DNSHeader::numberOfAuthorityRRs

Authority Record Count.

Specifies the number of resource records in the Authority section of the message.

Definition at line 417 of file inet.h.

nint16_t DNSHeader::numberOfQuestions

Question Count.

Specifies the number of questions in the Question section of the message.

Definition at line 415 of file inet.h.

uint8_t DNSHeader::opcode

Operation Code.

Definition at line 407 of file inet.h.

uint8_t DNSHeader::QR

Query or Response.

Query:0, Response:1

Definition at line 408 of file inet.h.

uint8_t DNSHeader::RA

Recursion Available.

Set to 1 or cleared to 0 in a response to indicate whether the server creating the response supports recursive queries. This can then be noted by the device that sent the query for future use.

Definition at line 411 of file inet.h.

uint8_t DNSHeader::rcode

Response Code.

This field indicates whether the query was successful (0) or not (nonzero)

Definition at line 409 of file inet.h.

uint8_t DNSHeader::RD

Recursion Desired.

When set in a query, requests that the server receiving the query attempt to answer the query recursively, if the server supports recursive resolution. The value of this bit is not changed in the response.

Definition at line 404 of file inet.h.

uint8_t DNSHeader::reserved

Definition at line 410 of file inet.h.

uint8_t DNSHeader::TC

Truncation Flag.

When set to 1, indicates that the message was truncated due to its length being longer than the maximum permitted for the type of transport mechanism used. TCP doesn't have a length limit for messages, while UDP messages are limited to 512 bytes, so this bit being sent usually is an indication that the message was sent using UDP and was too long to fit. The client may need to establish a TCP session to get the full message. On the other hand, if the portion truncated was part of the Additional section, it may choose not to bother.

Definition at line 405 of file inet.h.


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