Indy 9 | Content | Index | Reference

TQueryResult
Hierarchy, Properties, Methods, See Also, Unit: IdDNSResolver
Implements a container for values returned in a response to a DNS query.

    TQueryResult = class(TCollection)

Unit
IdDNSResolver
Description
TQueryResult is a TCollection descendant that implements a container for values returned in a response to a DNS query. TQueryResult is the type used to represent the TIdDNSResolver.QueryResult property.

TQueryResult provides property that identify field values returned in the DNS response message packet, including QueryClass, QueryType, and DomainName. TQueryResult also implements the Items property to provide indexed access to resource records returned in the Answer, Authority, or Additional sections of the DNS response.

TQueryResult provides method maintain the TResultRecord collection of resource records for the DNS response, including Add and Clear.

TQueryResult.DomainName
TQueryResult
Represents the domain name to which a resource record pertains.

    property DomainName: String;

Description
DomainName is a read-only String property that represents the domain name to which a resource record pertains. DomainName is read when TIdDNSResolver parses the results from a DNS query into a TResultRecord.

TQueryResult.Items
TQueryResult
Provides indexed access to resource records in the DNS query response.

    property Items [Index: Integer]: TResultRecord;

Description
Items is an indexed TResultRecord property that provides access to the collection of resource records created when the resolver parses the DNS query response.

Items insures that read access to the collection always returns a TResultRecord instance. Applications can examine TResultRecord.RecType for the returned item to determine if another TResultRecord descendant can be used to access additional properties and methods for the resource record.

TQueryResult.QueryClass
TQueryResult
Represents the resource record class used in a DNS query.

    property QueryClass: Word;

Description
QueryClass is a read-only Word property that represents the QClass used for querying resource records for the specified DomainName. QueryClass is read from the header for the DNS response packet when TIdDNSResolver parses the query results.

Note: Currently, the TIdDNSResolver implementation does not support all aspects of the DNS protocol, and includes the following limitations:

- The DNS query class field is limited to examing resource records for the IN (Internet) class only. CS (CSNet), CH (CHAOS), and HS (Hesiod) are not supported at this time.

TQueryResult.QueryType
TQueryResult
Indicates the query OpCode used to perform a DNS query.

    property QueryType: Word;

Description
QueryType is a read-only Word property that represents the query OpCode used for querying resource records for the specified DomainName. QueryType is read from the header for the DNS response packet when TIdDNSResolver parses the query results.

Note: Currently, the TIdDNSResolver implementation does not support all aspects of the DNS protocol, and includes the following limitations:

- The DNS query type is limited to standard queries, where the DNS Header OPCODE is 0. Inverse queries (OPCODE=1) and Status queries (OPCODE=2) are not supported at this time.

TQueryResult.Add
TQueryResult
Creates resource records from raw data found in a DNS response.

    function Add(Answer: string; var APos: Integer): TResultRecord;

Parameters
Answer: string
Raw data for the values found in the DNS response.
var APos: Integer
Offset to data for the resource record
Return Value
TResultRecord - Resource record created to represent DNS response data.
Description
Add is a TResultRecord function that creates instances of resource records based on raw data found in a DNS response.

Add extracts the values used for Name, TTL, RData, RDataLength, RecType, and RecClass in the TResultRecord return value. Add also insures that the proper TResultRecord descendant is created to represent the resource record based on the the value in RecType. Add can create instances of TResultRecord descendants like TARecord, TNSRecord, TMXRecord, TNAMERecord, TSOARecord, THINFORecord, TTextRecord, TWKSRecord, TPTRRecord, and TMINFORecord. When an unsupported resource record type is encountered, Add creates a generic TResultRecord instance.

Add also call the TResultRecord.Parse method to read RData values in the resource record into their property counterparts.

Add updates the value in APos to indicate when values for the resource record have been read and processed.

Use Items to access resource records created for the query result.

TQueryResult.Clear
TQueryResult, See Also
Resets the container to its default state.

    procedure Clear; reintroduce;

Description
Clear is a procedure that resets the container to the default state. Clear calls the inherited Clear method, and also clears the query internal pointer list used to a handle compressed resource records.

TQueryResult.Create
TQueryResult
Constructor for the object instance.

    constructor Create(AResultRecord: TResultRecord);

Parameters
AResultRecord: TResultRecord
Collection that owns resource records for the object instance.
Description
Create is the constructor for the object instance. Create calls the inherited Create method using TResultRecord as the owner of the collectionm items created for the query response.

Create assigns the value in AResultRecord to the internal TResultRecord maintained by the object instance. Create also allocates resources using for the internal qwuery pointer list used to handle compressed resource records.

TQueryResult.destroy
TQueryResult, See Also
Frees an object instance.

    destructor destroy; override;

Description
Destroy is the destructor for the object instance. Destroy frees and releases resources allocted in the Create method, including the internal query pointer list used for handling compressed resource records.

Destroy calls the inherited Destroy method prior to exiting.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.