Difference between revisions of "Unit DNS"

From Ultibo.org
Jump to: navigation, search
Line 426: Line 426:
  
  
'''DNS client'''
+
'''DNS specific classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code> TDNSClient = class(TNetworkClient)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
|-
+
| <code>constructor Create(AProtocol:TNetworkProtocol);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FTlsIndex:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetClientData:PDNSClientData;</code>
+
| &nbsp;
+
|-
+
| <code>function CreateClientData:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddressEntryToHostEnt(AddressEntry:TIPAddressEntry; const AName:String; ACount:Integer):PHostEnt;</code>
+
| &nbsp;
+
|-
+
| <code>function HostEntryToHostEnt(HostEntry:TIPHostEntry):PHostEnt;</code>
+
| &nbsp;
+
|-
+
| <code>function NetworkEntryToNetEnt(NetworkEntry:TIPNetworkEntry):PNetEnt;</code>
+
| &nbsp;
+
|-
+
| <code>function ServEntryToServEnt(ServEntry:TIPServEntry):PServEnt;</code>
+
| &nbsp;
+
|-
+
| <code>function ProtoEntryToProtoEnt(ProtoEntry:TIPProtoEntry):PProtoEnt;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function InAddrToName(const AAddress:TInAddr):String;</code>
+
| &nbsp;
+
|-
+
| <code>function NameToInAddr(const AName:String):TInAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function In6AddrToName(const AAddress:TIn6Addr):String;</code>
+
| &nbsp;
+
|-
+
| <code>function NameToIn6Addr(const AName:String):TIn6Addr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetDNSMessageSize(AMessage:PDNSMessage):Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetDNSNameSize(AMessage:PDNSMessage; AOffset:Word):Word;</code>
+
| &nbsp;
+
|-
+
| <code>function GetDNSQuestionSize(AMessage:PDNSMessage; AOffset:Word):Word;</code>
+
| &nbsp;
+
|-
+
| <code>function GetDNSResourceSize(AMessage:PDNSMessage; AOffset:Word):Word;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetDNSQuestionOffset(AMessage:PDNSMessage; ACount:Word):Word;</code>
+
| &nbsp;
+
|-
+
| <code>function GetDNSAnswerOffset(AMessage:PDNSMessage; ACount:Word):Word;</code>
+
| &nbsp;
+
|-
+
| <code>function GetDNSAuthorityOffset(AMessage:PDNSMessage; ACount:Word):Word;</code>
+
| &nbsp;
+
|-
+
| <code>function GetDNSAdditionalOffset(AMessage:PDNSMessage; ACount:Word):Word;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function CreateDNSQuery(AMessage:PDNSMessage; AIdentifier:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function CheckDNSResponse(AMessage:PDNSMessage; AIdentifier:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function HandleDNSResponse(AMessage:PDNSMessage; AIdentifier:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendDNSQuery(ASocket:TProtocolSocket; const AServer:TInAddr; AData:Pointer; ALength,AType,AClass,AIdentifier:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function RecvDNSResponse(ASocket:TProtocolSocket; AType,AClass,AIdentifier:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function InsertDNSName(AMessage:PDNSMessage; AOffset:Word; AName:Pointer; ALength:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ExtractDNSName(AMessage:PDNSMessage; AOffset:Word; AName:Pointer; var ALength:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ExtractDNSRData(AMessage:PDNSMessage; AOffset:Word; AData:Pointer; var ALength:Word; AType,AClass:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function InsertDNSQuestion(AMessage:PDNSMessage; ACount:Word; AData:Pointer; ALength,AType,AClass:Word):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ExtractDNSAnswer(AMessage:PDNSMessage; ACount:Word; AName,AData:Pointer; var ANameLength,ADataLength,AType,AClass:Word; var ATtl:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ExtractDNSAuthority(AMessage:PDNSMessage; ACount:Word; AName,AData:Pointer; var ANameLength,ADataLength,AType,AClass:Word; var ATtl:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ExtractDNSAdditional(AMessage:PDNSMessage; ACount:Word; AName,AData:Pointer; var ANameLength,ADataLength,AType,AClass:Word; var ATtl:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function GetHostByAddr(AAddr:Pointer; ALength,AFamily:Integer):PHostEnt;</code>
+
| &nbsp;
+
|-
+
| <code>function GetHostByName(AName:PChar):PHostEnt;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetHostName(AName:PChar; ALength:Integer):Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetServByPort(APort:Integer; AProto:PChar):PServEnt;</code>
+
| &nbsp;
+
|-
+
| <code>function GetServByName(AName,AProto:PChar):PServEnt;</code>
+
| &nbsp;
+
|-
+
| <code>function GetProtoByNumber(AProto:Integer):PProtoEnt;</code>
+
| &nbsp;
+
|-
+
| <code>function GetProtoByName(AName:PChar):PProtoEnt;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetNetByAddr(AAddr:Pointer; ALength,AStruct:Integer):PNetEnt;</code>
+
| &nbsp;
+
|-
+
| <code>function GetNetByName(AName:PChar):PNetEnt;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartClient:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
| <code>function StopClient:Boolean; override;</code>
+
| [[TDNSClient|<code>TDNSClient = class(TNetworkClient)</code>]]
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
 
<br />
 
<br />
  

Revision as of 05:50, 2 May 2018

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_*


[Expand]
DNS flag DNS_FLAG_*


[Expand]
DNS field masks DNS_OPCODE_*


[Expand]
DNS query code DNS_QUERY*


[Expand]
DNS response code DNS_NO_*


[Expand]
DNS record type DNS_TYPE_*


[Expand]
DNS address class DNS_CLASS_*


[Expand]
DNS message compression DNS_POINTER_*


Type definitions



DNS specific types

[Expand]

PDNSHeader = ^TDNSHeader;

TDNSHeader = packed record

DNS message

[Expand]

PDNSMessage = ^TDNSMessage;

TDNSMessage = packed record

DNS name

[Expand]

PDNSName = ^TDNSName;

TDNSName = array[0..MAX_DNS_NAME - 1] of Char;

DNS question

[Expand]

PDNSQuestion = ^TDNSQuestion;

TDNSQuestion = packed record

DNS resource

[Expand]

PDNSResource = ^TDNSResource;

TDNSResource = packed record

DNS client data

[Expand]

PDNSClientData = ^TDNSClientData;

TDNSClientData = record


Class definitions



DNS specific classes

TDNSClient = class(TNetworkClient)


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