⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qdns.html

📁 QT 下载资料仅供参考
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/network/qdns.cpp:1448 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QDns Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QDns Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1><p>The QDns class provides asynchronous DNS lookups.<a href="#details">More...</a><p><tt>#include &lt;<a href="qdns-h.html">qdns.h</a>&gt;</tt><p>Inherits <a href="qobject.html">QObject</a>.<p><a href="qdns-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn>enum <a href="#RecordType-enum"><b>RecordType</b></a> { None, A, Aaaa, Mx, Srv, Cname, Ptr, Txt }</div></li><li><div class=fn><a href="#QDns"><b>QDns</b></a> ()</div></li><li><div class=fn><a href="#QDns-2"><b>QDns</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;label, RecordType&nbsp;rr = A )</div></li><li><div class=fn><a href="#QDns-3"><b>QDns</b></a> ( const&nbsp;QHostAddress&nbsp;&amp;&nbsp;address, RecordType&nbsp;rr = Ptr )</div></li><li><div class=fn>virtual <a href="#~QDns"><b>~QDns</b></a> ()</div></li><li><div class=fn>virtual void <a href="#setLabel"><b>setLabel</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;label )</div></li><li><div class=fn>virtual void <a href="#setLabel-2"><b>setLabel</b></a> ( const&nbsp;QHostAddress&nbsp;&amp;&nbsp;address )</div></li><li><div class=fn>QString <a href="#label"><b>label</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setRecordType"><b>setRecordType</b></a> ( RecordType&nbsp;rr = A )</div></li><li><div class=fn>RecordType <a href="#recordType"><b>recordType</b></a> () const</div></li><li><div class=fn>bool <a href="#isWorking"><b>isWorking</b></a> () const</div></li><li><div class=fn>QValueList&lt;QHostAddress&gt; <a href="#addresses"><b>addresses</b></a> () const</div></li><li><div class=fn>QValueList&lt;MailServer&gt; <a href="#mailServers"><b>mailServers</b></a> () const</div></li><li><div class=fn>QValueList&lt;Server&gt; <a href="#servers"><b>servers</b></a> () const</div></li><li><div class=fn>QStringList <a href="#hostNames"><b>hostNames</b></a> () const</div></li><li><div class=fn>QStringList <a href="#texts"><b>texts</b></a> () const</div></li><li><div class=fn>QString <a href="#canonicalName"><b>canonicalName</b></a> () const</div></li><li><div class=fn>QStringList <a href="#qualifiedNames"><b>qualifiedNames</b></a> () const</div></li></ul><h2>Signals</h2><ul><li><div class=fn>void <a href="#resultsReady"><b>resultsReady</b></a> ()</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2> The QDns class provides asynchronous DNS lookups.<p> <p> Both Windows and Unix provide synchronous DNS lookups; Windowsprovides some asynchronous support too.  At the time of writing neitheroperating system provides asynchronous support for anything other thanhostname-to-address mapping.<p> QDns rectifies this shortcoming, by providing asynchronous caching lookupsfor the record types that we expect modern GUI applications to need in thenear future.<p> The class is <em>not</em> straightforward to use (although it is much simpler thanthe native APIs); <a href="qsocket.html">QSocket</a> provides much easier to use TCP connectionfacilities. The aim of QDns is to provide a correct and small API to theDNS and nothing more.  (We use "correctness" to mean that the DNSinformation is correctly cached, and correctly timed out.)<p> The API comprises a constructor, functions to set the DNS node(the domain in DNS terminology) and record type (<a href="#setLabel">setLabel</a>() and<a href="#setRecordType">setRecordType</a>()), the corresponding get functions, an <a href="#isWorking">isWorking</a>() functionto determine whether QDns is working or reading, a <a href="#resultsReady">resultsReady</a>()signal and query functions for the result.<p> There is one query function for each RecordType, namely <a href="#addresses">addresses</a>(),<a href="#mailServers">mailServers</a>(), <a href="#servers">servers</a>(), <a href="#hostNames">hostNames</a>() and <a href="#texts">texts</a>(). There are also twogeneric query functions: <a href="#canonicalName">canonicalName</a>() returns the name you'll presumablyend up using (the exact meaning of this depends on the record type) and<a href="#qualifiedNames">qualifiedNames</a>() returns a list of the fully qualified names <a href="#label">label</a>() mapsto.<p> <p>See also <a href="qsocket.html">QSocket</a> and <a href="io.html">Input/Output and Networking</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="RecordType-enum"></a>QDns::RecordType</h3> <p> This enum type defines the record types QDns can handle.  The DNSprovides many more; these are the ones we've judged to be in currentuse, useful for GUI programs and important enough to support rightaway:<ul><li><tt>QDns::None</tt> - No information.  This exists only so that QDns canhave a default.<li><tt>QDns::A</tt> - IPv4 addresses.  By far the most common type.<li><tt>QDns::Aaaa</tt> - IPv6 addresses.  So far mostly unused.<li><tt>QDns::Mx</tt> - Mail eXchanger names.  Used for mail delivery.<li><tt>QDns::Srv</tt> - SeRVer names.  Generic record type for findingservers.  So far mostly unused.<li><tt>QDns::Cname</tt> - Canonical names.  Maps from nicknames to the truename (the canonical name) for a host.<li><tt>QDns::Ptr</tt> - name PoinTeRs.  Maps from IPv4 or IPv6 addresses to hostnames.<li><tt>QDns::Txt</tt> - arbitrary TeXT for domains.</ul><p> We expect that some support for the<a href="http://www.dns.net/dnsrd/rfc/rfc2535.html">RFC-2535</a>extensions will be added in future versions.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QDns"></a>QDns::QDns ()</h3>Constructs a DNS query object with invalid settings for both thelabel and the search type.<h3 class=fn><a name="QDns-2"></a>QDns::QDns ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;label, <a href="qdns.html#RecordType-enum">RecordType</a>&nbsp;rr = A )</h3>Constructs a DNS query object that will return record type <em>rr</em>information about <em>label</em>.<p> The DNS lookup is started the next time the application enters the eventloop. When the result is found the signal <a href="#resultsReady">resultsReady</a>() is emitted.<p> <em>rr</em> defaults to <a href="#RecordType-enum">A</a>, IPv4 addresses.<h3 class=fn><a name="QDns-3"></a>QDns::QDns ( const&nbsp;<a href="qhostaddress.html">QHostAddress</a>&nbsp;&amp;&nbsp;address, <a href="qdns.html#RecordType-enum">RecordType</a>&nbsp;rr = Ptr )</h3>Constructs a DNS query object that will return record type <em>rr</em> informationabout host address <em>address</em>.  The label is set to the IN-ADDR.ARPA domainname. This is useful in combination with the Ptr record type (e.g. if youwant to look up a hostname for a given address).<p> The DNS lookup is started the next time the application enters the eventloop. When the result is found the signal <a href="#resultsReady">resultsReady</a>() is emitted.<p> <em>rr</em> defaults to <a href="#RecordType-enum">Ptr</a>, that maps addresses to hostnames.<h3 class=fn><a name="~QDns"></a>QDns::~QDns ()<tt> [virtual]</tt></h3> Destroys the DNS query object and frees its allocated resources. <h3 class=fn><a href="qvaluelist.html">QValueList</a>&lt;QHostAddress&gt; <a name="addresses"></a>QDns::addresses () const</h3>Returns a list of the addresses for this name if this QDns objecthas a <a href="#recordType">recordType</a>() of <a href="#RecordType-enum">QDns::A</a> or <a href="#RecordType-enum">QDns::Aaaa</a> and the answer isavailable; otherwise returns an empty list.<p> As a special case, if <a href="#label">label</a>() is a valid numeric IP address, this functionreturns that address.<p> Note that if you want to iterate over the list, you shoulditerate over a copy, e.g.<pre>    <a href="qvaluelist.html">QValueList</a>&lt;QHostAddress&gt; list = myDns.addresses();    QValueList&lt;QHostAddress&gt;::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();    while( it != list.<a href="qvaluelist.html#end">end</a>() ) {        myProcessing( *it );        ++it;    }    </pre> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -