Difference between revisions of "Unit DNS"
From Ultibo.org
Line 5: | Line 5: | ||
---- | ---- | ||
− | + | 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 constants''' <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 constants''' <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 constants''' <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 constants''' <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 constants''' <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 constants''' <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 constants''' <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 === |
Revision as of 03:07, 9 December 2016
Return to Unit Reference
Description
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 constants
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 constants
DNS_OPCODE_*
DNS_OPCODE_MASK = $7800;
|
Opcode |
DNS_RESPONSE_MASK = $000F;
|
Response code |
DNS query code constants
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 constants
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 constants
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 constants
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 constants
DNS_POINTER_*
DNS_POINTER_MASK = $C0;
|
Mask to indicate pointer to previously used name |
Type definitions
To be documented
Public variables
To be documented
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