Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
The TQDns class provides asynchronous DNS lookups. More...
#include <qdns.h>
Inherits TQObject.
Both Windows and Unix provide synchronous DNS lookups; Windows provides some asynchronous support too. At the time of writing neither operating system provides asynchronous support for anything other than hostname-to-address mapping.
TQDns rectifies this shortcoming, by providing asynchronous caching lookups for the record types that we expect modern GUI applications to need in the near future.
The class is not straightforward to use (although it is much simpler than the native APIs); TQSocket provides much easier to use TCP connection facilities. The aim of TQDns is to provide a correct and small API to the DNS and nothing more. (We use "correctness" to mean that the DNS information is correctly cached, and correctly timed out.)
The API comprises a constructor, functions to set the DNS node (the domain in DNS terminology) and record type (setLabel() and setRecordType()), the corresponding get functions, an isWorking() function to determine whether TQDns is working or reading, a resultsReady() signal and query functions for the result.
There is one query function for each RecordType, namely addresses(), mailServers(), servers(), hostNames() and texts(). There are also two generic query functions: canonicalName() returns the name you'll presumably end up using (the exact meaning of this depends on the record type) and qualifiedNames() returns a list of the fully qualified names label() maps to.
See also TQSocket and Input/Output and Networking.
This enum type defines the record types TQDns can handle. The DNS provides many more; these are the ones we've judged to be in current use, useful for GUI programs and important enough to support right away:
We expect that some support for the RFC-2535 extensions will be added in future versions.
The DNS lookup is started the next time the application enters the event loop. When the result is found the signal resultsReady() is emitted.
rr defaults to A, IPv4 addresses.
The DNS lookup is started the next time the application enters the event loop. When the result is found the signal resultsReady() is emitted.
rr defaults to Ptr, that maps addresses to hostnames.
As a special case, if label() is a valid numeric IP address, this function returns that address.
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
TQValueList<TQHostAddress> list = myDns.addresses(); TQValueList<TQHostAddress>::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; }
If the canonical name isn't known, this function returns a null string.
The canonical name of a DNS node is its full name, or the full name of the target of its CNAME. For example, if l.trolltech.com is a CNAME to lillian.troll.no, and the search path for TQDns is "trolltech.com", then the canonical name for all of "lillian", "l", "lillian.troll.no." and "l.trolltech.com" is "lillian.troll.no.".
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
TQStringList list = myDns.hostNames(); TQStringList::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; }
TQDns emits the resultsReady() signal when the status changes to FALSE.
Example: network/mail/smtp.cpp.
Returns the domain name for which this object returns information.
See also setLabel().
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
TQValueList<TQDns::MailServer> list = myDns.mailServers(); TQValueList<TQDns::MailServer>::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; }
Example: network/mail/smtp.cpp.
Returns a list of the fully qualified names label() maps to.
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
TQStringList list = myDns.qualifiedNames(); TQStringList::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; }
Returns the record type of this DNS query object.
See also setRecordType() and RecordType.
This signal is emitted when results are available for one of the qualifiedNames().
Example: network/mail/smtp.cpp.
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
TQValueList<TQDns::Server> list = myDns.servers(); TQValueList<TQDns::Server>::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; }
This does not change the recordType(), but its isWorking() status will probably change as a result.
The DNS lookup is started the next time the application enters the event loop. When the result is found the signal resultsReady() is emitted.
Sets this DNS query object to query for information about the host address address. The label is set to the IN-ADDR.ARPA domain name. This is useful in combination with the Ptr record type (e.g. if you want to look up a hostname for a given address).
The DNS lookup is started the next time the application enters the event loop. When the result is found the signal resultsReady() is emitted.
See also RecordType.
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
TQStringList list = myDns.texts(); TQStringList::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; }
This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.
Copyright © 2007 Trolltech | Trademarks | TQt 3.3.8
|