Q3Dns Class ReferenceThe Q3Dns class provides asynchronous DNS lookups. Далее... #include <Q3Dns> Данный класс является частью библиотеки поддержки Qt 3. Он предоставлен для поддержки ранее написанного кода. Мы настоятельно не рекомендуем использовать этот класс в новом коде. Для получения дополнительной информации смотрите Портирование на Qt 4. Унаследован от: QObject. Открытые типы
Открытые функции
Сигналы
Дополнительные унаследованные члены
Подробное описаниеThe Q3Dns class provides asynchronous DNS lookups. 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. Q3Dns 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); Q3Socket provides much easier to use TCP connection facilities. The aim of Q3Dns 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 Q3Dns 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 Q3Socket. Описание типов-членовenum Q3Dns::RecordTypeThis enum type defines the record types Q3Dns 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. Описание функций-членовQ3Dns::Q3Dns ()Constructs a DNS query object with invalid settings for both the label and the search type. Q3Dns::Q3Dns ( const QString & label, RecordType rr = A )Constructs a DNS query object that will return record type rr information about label. 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. Q3Dns::Q3Dns ( const QHostAddress & address, RecordType rr = Ptr )Constructs a DNS query object that will return record type rr information about 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. rr defaults to Ptr, that maps addresses to hostnames. Q3Dns::~Q3Dns () [virtual]Destroys the DNS query object and frees its allocated resources. Q3ValueList<QHostAddress> Q3Dns::addresses () constReturns a list of the addresses for this name if this Q3Dns object has a recordType() of Q3Dns::A or Q3Dns::Aaaa and the answer is available; otherwise returns an empty list. As a special case, if label() is a valid numeric IP address, this function returns that address. Обратите внимание на то, что если вы хотите перебирать список, вы должны перебирать копию, например Q3ValueList<QHostAddress> list = myDns.addresses(); Q3ValueList<QHostAddress>::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; } QString Q3Dns::canonicalName () constReturns the canonical name for this DNS node. (This works regardless of what recordType() is set to.) 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 Q3Dns is "trolltech.com", then the canonical name for all of "lillian", "l", "lillian.troll.no." and "l.trolltech.com" is "lillian.troll.no.". QStringList Q3Dns::hostNames () constReturns a list of host names if the record type is Ptr. Обратите внимание на то, что если вы хотите перебирать список, вы должны перебирать копию, например QStringList list = myDns.hostNames(); QStringList::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; } bool Q3Dns::isWorking () constReturns true if Q3Dns is doing a lookup for this object (i.e. if it does not already have the necessary information); otherwise returns false. Q3Dns emits the resultsReady() signal when the status changes to false. QString Q3Dns::label () constReturns the domain name for which this object returns information. Смотрите также setLabel(). Q3ValueList<MailServer> Q3Dns::mailServers () constReturns a list of mail servers if the record type is Mx. The class Q3Dns::MailServer contains the following public variables: Обратите внимание на то, что если вы хотите перебирать список, вы должны перебирать копию, например Q3ValueList<Q3Dns::MailServer> list = myDns.mailServers(); Q3ValueList<Q3Dns::MailServer>::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; } QStringList Q3Dns::qualifiedNames () constReturns a list of the fully qualified names label() maps to. Обратите внимание на то, что если вы хотите перебирать список, вы должны перебирать копию, например QStringList list = myDns.qualifiedNames(); QStringList::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; } RecordType Q3Dns::recordType () constReturns the record type of this DNS query object. See also setRecordType() and RecordType. void Q3Dns::resultsReady () [signal]This signal is emitted when results are available for one of the qualifiedNames(). Q3ValueList<Server> Q3Dns::servers () constReturns a list of servers if the record type is Srv. The class Q3Dns::Server contains the following public variables:
Обратите внимание на то, что если вы хотите перебирать список, вы должны перебирать копию, например Q3ValueList<Q3Dns::Server> list = myDns.servers(); Q3ValueList<Q3Dns::Server>::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; } void Q3Dns::setLabel ( const QString & label ) [virtual]Sets this DNS query object to query for information about label. 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. Смотрите также label(). void Q3Dns::setLabel ( const QHostAddress & address ) [virtual]Это перегруженная функция. 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). void Q3Dns::setRecordType ( RecordType rr = A ) [virtual]Sets this object to query for record type rr records. 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() and RecordType. QStringList Q3Dns::texts () constReturns a list of texts if the record type is Txt. Обратите внимание на то, что если вы хотите перебирать список, вы должны перебирать копию, например QStringList list = myDns.texts(); QStringList::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; } |
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |