|
|
Line 282: |
Line 282: |
| |- | | |- |
| | | | | |
− | | style="width: 90%;"| | + | | style="width: 50%;"| |
| |- | | |- |
| |} | | |} |
Revision as of 00:54, 18 January 2017
Return to Unit Reference
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
[Expand]
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
|
[Expand]
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
|
[Expand]
DNS field masks constants DNS_OPCODE_*
DNS_OPCODE_MASK = $7800;
|
Opcode
|
DNS_RESPONSE_MASK = $000F;
|
Response code
|
[Expand]
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)
|
[Expand]
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;
|
|
[Expand]
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
|
[Expand]
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
|
[Expand]
DNS message compression constants DNS_POINTER_*
DNS_POINTER_MASK = $C0;
|
Mask to indicate pointer to previously used name
|
Type definitions
DNS specific types
[Expand]
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
[Expand]
PDNSMessage = ^TDNSMessage;
TDNSMessage = packed record
DNS:TDNSHeader;
|
|
Data:array[0..(MAX_DNS_MESSAGE - DNS_HEADER_SIZE) - 1] of Byte;
|
|
DNA name
[Expand]
PDNSName = ^TDNSName;
TDNSName = array[0..MAX_DNS_NAME - 1] of Char;
DNS question
[Expand]
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
[Expand]
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
|
DNA client data
[Expand]
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
To be documented
Public variables
None defined
Function declarations
Initialization functions
[Expand]
procedure DNSInit;
Description: To be documented
[Expand]
function DNSStart:LongWord;
Description: To be documented
[Expand]
function DNSStop:LongWord;
Description: To be documented
Return to Unit Reference