Difference between revisions of "Unit DNS"
From Ultibo.org
(13 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
---- | ---- | ||
− | '' | + | '''Ultibo DNS Client unit''' |
+ | |||
+ | Note: DNS Client is IPv4 based, for IPv6 see new Winsock2 functions | ||
+ | |||
+ | See RFC 1035 Section 4 for details | ||
=== Constants === | === Constants === | ||
---- | ---- | ||
− | '' | + | |
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''DNS specific constants''' <code> DNS_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DNS_TIMEOUT = 5000;</code> | ||
+ | | We wait for 5 seconds for a DNS reply | ||
+ | |- | ||
+ | | <code>DNS_RETRIES = 4;</code> | ||
+ | | Try the request 4 times | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>DNS_HEADER_SIZE = 12;</code> | ||
+ | | SizeOf(TDNSHeader); | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>DNS_QUESTION_SIZE = 4;</code> | ||
+ | | SizeOf(TDNSQuestion); | ||
+ | |- | ||
+ | | <code>DNS_RESOURCE_SIZE = 10;</code> | ||
+ | | SizeOf(TDNSResource); Not including Record Data | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>MAX_DNS_NAME = 255;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>MAX_DNS_LABEL = 63;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>MAX_DNS_MESSAGE = 512;</code> | ||
+ | | Maximum Size of DNS Message | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''DNS flag''' <code> DNS_FLAG_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DNS_FLAG_RESPONSE = $8000;</code> | ||
+ | | query = 0, response = 1 | ||
+ | |- | ||
+ | | <code>DNS_FLAG_AUTHORITY = $0400;</code> | ||
+ | | Authoritative answer | ||
+ | |- | ||
+ | | <code>DNS_FLAG_TRUNCATED = $0200;</code> | ||
+ | | Truncation, response was cut off at 512 | ||
+ | |- | ||
+ | | <code>DNS_FLAG_DO_RECURSE = $0100;</code> | ||
+ | | Recursion desired | ||
+ | |- | ||
+ | | <code>DNS_FLAG_CAN_RECURSE = $0080;</code> | ||
+ | | Recursion available | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''DNS field masks''' <code> DNS_OPCODE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DNS_OPCODE_MASK = $7800;</code> | ||
+ | | Opcode | ||
+ | |- | ||
+ | | <code>DNS_RESPONSE_MASK = $000F;</code> | ||
+ | | Response code | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''DNS query code''' <code> DNS_QUERY* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DNS_QUERY = 0;</code> | ||
+ | | A standard query | ||
+ | |- | ||
+ | | <code>DNS_INV_QUERY = 1;</code> | ||
+ | | An inverse query | ||
+ | |- | ||
+ | | <code>DNS_COMP_QUERY_MULTI = 2;</code> | ||
+ | | A completion query, multiple reply (Obsolete) | ||
+ | |- | ||
+ | | <code>DNS_COMP_QUERY_SINGLE = 3;</code> | ||
+ | | A completion query, single reply (Obsolete) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''DNS response code''' <code> DNS_NO_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DNS_NO_ERROR = 0;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>DNS_FORMAT_ERROR = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_SERVER_FAILURE = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_NAME_ERROR = 3;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_NOT_IMPLEMENTED = 4;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_REFUSED = 5;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''DNS record type''' <code> DNS_TYPE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DNS_TYPE_A = 1;</code> | ||
+ | | Host address resource record (RR) | ||
+ | |- | ||
+ | | <code>DNS_TYPE_NS = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_MD = 3;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_MF = 4;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_CNAME = 5;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_SOA = 6;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_MB = 7;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_MG = 8;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_MR = 9;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_RT_NULL = 10;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_WKS = 11;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_PTR = 12;</code> | ||
+ | | A domain name ptr | ||
+ | |- | ||
+ | | <code>DNS_TYPE_HINFO = 13;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_MINFO = 14;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_TYPE_MX = 15;</code> | ||
+ | | Mail exchange | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''DNS address class''' <code> DNS_CLASS_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DNS_CLASS_IN = 1;</code> | ||
+ | | ARPA internet class | ||
+ | |- | ||
+ | | <code>DNS_CLASS_CS = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DNS_CLASS_WILD = 255;</code> | ||
+ | | Wildcard for several of the classifications | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''DNS message compression''' <code> DNS_POINTER_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DNS_POINTER_MASK = $C0;</code> | ||
+ | | Mask to indicate pointer to previously used name | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Type definitions === | === Type definitions === | ||
---- | ---- | ||
− | '' | + | |
+ | '''DNS specific types''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDNSHeader = ^TDNSHeader;</code> | ||
+ | |||
+ | <code>TDNSHeader = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: All Network Order | ||
+ | |- | ||
+ | | <code>Identifier:Word;</code> | ||
+ | | unique identifier | ||
+ | |- | ||
+ | | <code>Flags:Word;</code> | ||
+ | | QD/Opcode/AA/TC/RD/RA/RCODE | ||
+ | |- | ||
+ | | <code>QuestionCount:Word;</code> | ||
+ | | question section, number of entries | ||
+ | |- | ||
+ | | <code>AnswerCount:Word;</code> | ||
+ | | answers, how many | ||
+ | |- | ||
+ | | <code>AuthorityCount:Word;</code> | ||
+ | | count of name server RRs | ||
+ | |- | ||
+ | | <code>AdditionalCount:Word;</code> | ||
+ | | number of "additional" records | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''DNS message''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDNSMessage = ^TDNSMessage;</code> | ||
+ | |||
+ | <code>TDNSMessage = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>DNS:TDNSHeader;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Data:array[0..(MAX_DNS_MESSAGE - DNS_HEADER_SIZE) - 1] of Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''DNS name''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDNSName = ^TDNSName;</code> | ||
+ | |||
+ | <code>TDNSName = array[0..MAX_DNS_NAME - 1] of Char;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''DNS question''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDNSQuestion = ^TDNSQuestion;</code> | ||
+ | |||
+ | <code>TDNSQuestion = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: All Network Order | ||
+ | |- | ||
+ | | <code>Name:TDNSName;</code> | ||
+ | | variable length question name | ||
+ | |- | ||
+ | | <code>QuestionType:Word;</code> | ||
+ | | question type (eg DNS_TYPE_A) | ||
+ | |- | ||
+ | | <code>QuestionClass:Word;</code> | ||
+ | | question class (eg DNS_CLASS_IN) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''DNS resource''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDNSResource = ^TDNSResource;</code> | ||
+ | |||
+ | <code>TDNSResource = packed record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: All Network Order | ||
+ | |- | ||
+ | | <code>Name:TDNSName;</code> | ||
+ | | variable length resource name | ||
+ | |- | ||
+ | | <code>RecordType:Word;</code> | ||
+ | | resource record type (eg DNS_TYPE_A) | ||
+ | |- | ||
+ | | <code>RecordClass:Word;</code> | ||
+ | | resource record class (eg DNS_CLASS_IN) | ||
+ | |- | ||
+ | | <code>Ttl:LongWord;</code> | ||
+ | | time-to-live, changed to 32 bits | ||
+ | |- | ||
+ | | <code>DataLength:Word;</code> | ||
+ | | length of data field | ||
+ | |- | ||
+ | | <code>RecordData:array[0..MAX_DNS_MESSAGE - 1] of Byte;</code> | ||
+ | | data field | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''DNS client data''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PDNSClientData = ^TDNSClientData;</code> | ||
+ | |||
+ | <code>TDNSClientData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: Used for TLS Data | ||
+ | |- | ||
+ | |colspan="2"|''Host Ent'' | ||
+ | |- | ||
+ | | <code>HostEnt:THostEnt;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>HostEntName:array[0..MAX_NAME_SIZE - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>HostAliasesPtr:PChar;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>HostAliases:array[0..(MAX_NAME_SIZE * MAX_NAME_ALIASES) - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>HostAddrListPtr:PChar;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>HostAddrList:array[0..MAX_HOST_ALIASES - 1] of TInAddr;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Net Ent'' | ||
+ | |- | ||
+ | | <code>NetEnt:TNetEnt;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>NetEntName:array[0..MAX_NAME_SIZE - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>NetAliasesPtr:PChar;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>NetAliases:array[0..(MAX_NAME_SIZE * MAX_NAME_ALIASES) - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Serv Ent'' | ||
+ | |- | ||
+ | | <code>ServEnt:TServEnt;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ServEntName:array[0..MAX_NAME_SIZE - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ServAliasesPtr:PChar;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ServAliases:array[0..(MAX_NAME_SIZE * MAX_NAME_ALIASES) - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ServEntProto:array[0..MAX_NAME_SIZE - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Proto Ent'' | ||
+ | |- | ||
+ | | <code>ProtoEnt:TProtoEnt;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ProtoEntName:array[0..MAX_NAME_SIZE - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ProtoAliasesPtr:PChar;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ProtoAliases:array[0..(MAX_NAME_SIZE * MAX_NAME_ALIASES) - 1] of Char;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | === Class definitions === | ||
+ | ---- | ||
+ | |||
+ | |||
+ | '''DNS specific classes''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | [[TDNSClient|<code>TDNSClient = class(TNetworkClient)</code>]] | ||
+ | |- | ||
+ | |} | ||
+ | <br /> | ||
=== Public variables === | === Public variables === | ||
---- | ---- | ||
− | '' | + | ''None defined'' |
=== Function declarations === | === Function declarations === | ||
Line 34: | Line 452: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 46: | Line 464: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 58: | Line 476: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- |
Latest revision as of 05:21, 31 August 2021
Return to Unit Reference
Contents
Description
Ultibo DNS Client unit
Note: DNS Client is IPv4 based, for IPv6 see new Winsock2 functions
See RFC 1035 Section 4 for details
Constants
DNS specific constants
DNS_*
DNS_TIMEOUT = 5000;
|
We wait for 5 seconds for a DNS reply |
DNS_RETRIES = 4;
|
Try the request 4 times |
DNS_HEADER_SIZE = 12;
|
SizeOf(TDNSHeader); |
DNS_QUESTION_SIZE = 4;
|
SizeOf(TDNSQuestion); |
DNS_RESOURCE_SIZE = 10;
|
SizeOf(TDNSResource); Not including Record Data |
MAX_DNS_NAME = 255;
|
|
MAX_DNS_LABEL = 63;
|
|
MAX_DNS_MESSAGE = 512;
|
Maximum Size of DNS Message |
DNS flag
DNS_FLAG_*
DNS_FLAG_RESPONSE = $8000;
|
query = 0, response = 1 |
DNS_FLAG_AUTHORITY = $0400;
|
Authoritative answer |
DNS_FLAG_TRUNCATED = $0200;
|
Truncation, response was cut off at 512 |
DNS_FLAG_DO_RECURSE = $0100;
|
Recursion desired |
DNS_FLAG_CAN_RECURSE = $0080;
|
Recursion available |
DNS field masks
DNS_OPCODE_*
DNS_OPCODE_MASK = $7800;
|
Opcode |
DNS_RESPONSE_MASK = $000F;
|
Response code |
DNS query code
DNS_QUERY*
DNS_QUERY = 0;
|
A standard query |
DNS_INV_QUERY = 1;
|
An inverse query |
DNS_COMP_QUERY_MULTI = 2;
|
A completion query, multiple reply (Obsolete) |
DNS_COMP_QUERY_SINGLE = 3;
|
A completion query, single reply (Obsolete) |
DNS response code
DNS_NO_*
DNS_NO_ERROR = 0;
|
|
DNS_FORMAT_ERROR = 1;
|
|
DNS_SERVER_FAILURE = 2;
|
|
DNS_NAME_ERROR = 3;
|
|
DNS_NOT_IMPLEMENTED = 4;
|
|
DNS_REFUSED = 5;
|
DNS record type
DNS_TYPE_*
DNS_TYPE_A = 1;
|
Host address resource record (RR) |
DNS_TYPE_NS = 2;
|
|
DNS_TYPE_MD = 3;
|
|
DNS_TYPE_MF = 4;
|
|
DNS_TYPE_CNAME = 5;
|
|
DNS_TYPE_SOA = 6;
|
|
DNS_TYPE_MB = 7;
|
|
DNS_TYPE_MG = 8;
|
|
DNS_TYPE_MR = 9;
|
|
DNS_TYPE_RT_NULL = 10;
|
|
DNS_TYPE_WKS = 11;
|
|
DNS_TYPE_PTR = 12;
|
A domain name ptr |
DNS_TYPE_HINFO = 13;
|
|
DNS_TYPE_MINFO = 14;
|
|
DNS_TYPE_MX = 15;
|
Mail exchange |
DNS address class
DNS_CLASS_*
DNS_CLASS_IN = 1;
|
ARPA internet class |
DNS_CLASS_CS = 2;
|
|
DNS_CLASS_WILD = 255;
|
Wildcard for several of the classifications |
DNS message compression
DNS_POINTER_*
DNS_POINTER_MASK = $C0;
|
Mask to indicate pointer to previously used name |
Type definitions
DNS specific types
PDNSHeader = ^TDNSHeader;
TDNSHeader = packed record
Note: All Network Order | |
Identifier:Word;
|
unique identifier |
Flags:Word;
|
QD/Opcode/AA/TC/RD/RA/RCODE |
QuestionCount:Word;
|
question section, number of entries |
AnswerCount:Word;
|
answers, how many |
AuthorityCount:Word;
|
count of name server RRs |
AdditionalCount:Word;
|
number of "additional" records |
DNS message
PDNSMessage = ^TDNSMessage;
TDNSMessage = packed record
DNS:TDNSHeader;
|
|
Data:array[0..(MAX_DNS_MESSAGE - DNS_HEADER_SIZE) - 1] of Byte;
|
DNS name
PDNSName = ^TDNSName;
TDNSName = array[0..MAX_DNS_NAME - 1] of Char;
DNS question
PDNSQuestion = ^TDNSQuestion;
TDNSQuestion = packed record
Note: All Network Order | |
Name:TDNSName;
|
variable length question name |
QuestionType:Word;
|
question type (eg DNS_TYPE_A) |
QuestionClass:Word;
|
question class (eg DNS_CLASS_IN) |
DNS resource
PDNSResource = ^TDNSResource;
TDNSResource = packed record
Note: All Network Order | |
Name:TDNSName;
|
variable length resource name |
RecordType:Word;
|
resource record type (eg DNS_TYPE_A) |
RecordClass:Word;
|
resource record class (eg DNS_CLASS_IN) |
Ttl:LongWord;
|
time-to-live, changed to 32 bits |
DataLength:Word;
|
length of data field |
RecordData:array[0..MAX_DNS_MESSAGE - 1] of Byte;
|
data field |
DNS client data
PDNSClientData = ^TDNSClientData;
TDNSClientData = record
Note: Used for TLS Data | |
Host Ent | |
HostEnt:THostEnt;
|
|
HostEntName:array[0..MAX_NAME_SIZE - 1] of Char;
|
|
HostAliasesPtr:PChar;
|
|
HostAliases:array[0..(MAX_NAME_SIZE * MAX_NAME_ALIASES) - 1] of Char;
|
|
HostAddrListPtr:PChar;
|
|
HostAddrList:array[0..MAX_HOST_ALIASES - 1] of TInAddr;
|
|
Net Ent | |
NetEnt:TNetEnt;
|
|
NetEntName:array[0..MAX_NAME_SIZE - 1] of Char;
|
|
NetAliasesPtr:PChar;
|
|
NetAliases:array[0..(MAX_NAME_SIZE * MAX_NAME_ALIASES) - 1] of Char;
|
|
Serv Ent | |
ServEnt:TServEnt;
|
|
ServEntName:array[0..MAX_NAME_SIZE - 1] of Char;
|
|
ServAliasesPtr:PChar;
|
|
ServAliases:array[0..(MAX_NAME_SIZE * MAX_NAME_ALIASES) - 1] of Char;
|
|
ServEntProto:array[0..MAX_NAME_SIZE - 1] of Char;
|
|
Proto Ent | |
ProtoEnt:TProtoEnt;
|
|
ProtoEntName:array[0..MAX_NAME_SIZE - 1] of Char;
|
|
ProtoAliasesPtr:PChar;
|
|
ProtoAliases:array[0..(MAX_NAME_SIZE * MAX_NAME_ALIASES) - 1] of Char;
|
Class definitions
DNS specific classes
TDNSClient = class(TNetworkClient)
|
Public variables
None defined
Function declarations
Initialization functions
procedure DNSInit;
Description: To be documented
Note | None documented |
---|
function DNSStart:LongWord;
Description: To be documented
Note | None documented |
---|
function DNSStop:LongWord;
Description: To be documented
Note | None documented |
---|
Return to Unit Reference