Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > os > by-pkgid > 9c481c872fb0ae0cbadccdc2f4a18ab6 > files > 213

libasync-devel-0.17.0-5.fc14.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Async: Async::DnsLookup Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceAsync.html">Async</a>::<a class="el" href="classAsync_1_1DnsLookup.html">DnsLookup</a>
  </div>
</div>
<div class="contents">
<h1>Async::DnsLookup Class Reference</h1><!-- doxytag: class="Async::DnsLookup" -->
<p>A class for performing asynchronous DNS lookups.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="AsyncDnsLookup_8h_source.html">AsyncDnsLookup.h</a>&gt;</code></p>

<p><a href="classAsync_1_1DnsLookup-members.html">List of all members.</a></p>
<h2>Public Member Functions</h2>
<ul>
<li><a class="el" href="classAsync_1_1DnsLookup.html#a4cd8bdfd33a2dd3920722a929d7ef9b2">DnsLookup</a> (const std::string &amp;label)
<dl class="el"><dd class="mdescRight">Constructor.  <a href="#a4cd8bdfd33a2dd3920722a929d7ef9b2"></a><br/></dl><li><a class="el" href="classAsync_1_1DnsLookup.html#a1a37a3467eb386864bb39d4a12003779">~DnsLookup</a> (void)
<dl class="el"><dd class="mdescRight">Destructor.  <a href="#a1a37a3467eb386864bb39d4a12003779"></a><br/></dl><li>const std::string &amp; <a class="el" href="classAsync_1_1DnsLookup.html#a3f0db56e2659e247a3d2782ee870292e">label</a> (void) const 
<dl class="el"><dd class="mdescRight">Return the associated label.  <a href="#a3f0db56e2659e247a3d2782ee870292e"></a><br/></dl><li>std::vector&lt; <a class="el" href="classAsync_1_1IpAddress.html">IpAddress</a> &gt; <a class="el" href="classAsync_1_1DnsLookup.html#a4ebe7a7c9f981e12fb2ac70f3f655938">addresses</a> (void)
<dl class="el"><dd class="mdescRight">Return the addresses for the host in the query.  <a href="#a4ebe7a7c9f981e12fb2ac70f3f655938"></a><br/></dl></ul>
<h2>Public Attributes</h2>
<ul>
<li>SigC::Signal1&lt; void, <a class="el" href="classAsync_1_1DnsLookup.html">DnsLookup</a> &amp; &gt; <a class="el" href="classAsync_1_1DnsLookup.html#a1459ef33fe23f1e8e64e301c68ccf4ce">resultsReady</a>
<dl class="el"><dd class="mdescRight">A signal to indicate that the query has been completed.  <a href="#a1459ef33fe23f1e8e64e301c68ccf4ce"></a><br/></dl></ul>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>A class for performing asynchronous DNS lookups. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Tobias Blomberg </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>2003-04-12</dd></dl>
<p>Use this class to make DNS lookups. Right now it only supports looking up hostnames to find out what IP-addresses it maps to. An example usage can be seen below.</p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">#include &lt;iostream&gt;</span>
<span class="preprocessor">#include &lt;<a class="code" href="AsyncCppApplication_8h.html" title="The core class for writing asyncronous cpp applications.">AsyncCppApplication.h</a>&gt;</span>
<span class="preprocessor">#include &lt;<a class="code" href="AsyncDnsLookup_8h.html" title="Contains a class for executing DNS queries.">AsyncDnsLookup.h</a>&gt;</span>

<span class="keyword">using namespace </span>std;
<span class="keyword">using namespace </span>Async;

<span class="keyword">class </span>MyClass : <span class="keyword">public</span> SigC::Object
{
  <span class="keyword">public</span>:
    MyClass(<span class="keywordtype">void</span>)
    {
      cout &lt;&lt; <span class="stringliteral">&quot;Starting query of www.ibm.com...\n&quot;</span>;
      dns_lookup = <span class="keyword">new</span> <a class="code" href="classAsync_1_1DnsLookup.html#a4cd8bdfd33a2dd3920722a929d7ef9b2" title="Constructor.">DnsLookup</a>(<span class="stringliteral">&quot;www.ibm.com&quot;</span>);
      dns_lookup-&gt;resultsReady.connect(slot(*<span class="keyword">this</span>, &amp;MyClass::onResultsReady));
    }
    
    ~MyClass(<span class="keywordtype">void</span>)
    {
      <span class="keyword">delete</span> dns_lookup;
    }
    
    <span class="keywordtype">void</span> onResultsReady(<a class="code" href="classAsync_1_1DnsLookup.html#a4cd8bdfd33a2dd3920722a929d7ef9b2" title="Constructor.">DnsLookup</a>&amp; dns)
    {
      cout &lt;&lt; <span class="stringliteral">&quot;Results received:\n&quot;</span>;
      vector&lt;IpAddress&gt; <a class="code" href="classAsync_1_1DnsLookup.html#a4ebe7a7c9f981e12fb2ac70f3f655938" title="Return the addresses for the host in the query.">addresses</a> = dns.addresses();
      vector&lt;IpAddress&gt;::iterator it;
      <span class="keywordflow">for</span> (it = addresses.begin(); it != addresses.end(); ++it)
      {
        cout &lt;&lt; *it &lt;&lt; endl;
      }
      
      <span class="keyword">delete</span> dns_lookup;
      dns_lookup = 0;
      
      <a class="code" href="classAsync_1_1Application.html#aa6d446d6b333e0a1e5cc1400c07aa898" title="Get the one and only application instance.">Application::app</a>().quit();
    }
    
  <span class="keyword">private</span>:
    <a class="code" href="classAsync_1_1DnsLookup.html#a4cd8bdfd33a2dd3920722a929d7ef9b2" title="Constructor.">DnsLookup</a> *dns_lookup;
  
};

<span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)
{
  CppApplication app;
  MyClass dns;
  app.exec();
}
</pre></div> <dl><dt><b>Examples: </b></dt><dd>
<p><a class="el" href="AsyncDnsLookup__demo_8cpp-example.html#_a0">AsyncDnsLookup_demo.cpp</a>.</p>
</dd>
</dl>
<p>Definition at line <a class="el" href="AsyncDnsLookup_8h_source.html#l00120">120</a> of file <a class="el" href="AsyncDnsLookup_8h_source.html">AsyncDnsLookup.h</a>.</p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a4cd8bdfd33a2dd3920722a929d7ef9b2"></a><!-- doxytag: member="Async::DnsLookup::DnsLookup" ref="a4cd8bdfd33a2dd3920722a929d7ef9b2" args="(const std::string &amp;label)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Async::DnsLookup::DnsLookup </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>label</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Constructor. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>label</em>&nbsp;</td><td>The label (hostname) to lookup </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a1a37a3467eb386864bb39d4a12003779"></a><!-- doxytag: member="Async::DnsLookup::~DnsLookup" ref="a1a37a3467eb386864bb39d4a12003779" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Async::DnsLookup::~DnsLookup </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a4ebe7a7c9f981e12fb2ac70f3f655938"></a><!-- doxytag: member="Async::DnsLookup::addresses" ref="a4ebe7a7c9f981e12fb2ac70f3f655938" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;<a class="el" href="classAsync_1_1IpAddress.html">IpAddress</a>&gt; Async::DnsLookup::addresses </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the addresses for the host in the query. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Return a stl vector which contains all the addresses associated with the hostname in the query. </dd></dl>
<dl class="pre"><dt><b>Precondition:</b></dt><dd>The result is not available before the resultsReay signal has been emitted</dd></dl>
<p>Use this function to retrieve all the IP-addresses associated with the hostname in the query. If the list is empty, the query has failed. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="AsyncDnsLookup__demo_8cpp-example.html#a1">AsyncDnsLookup_demo.cpp</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a3f0db56e2659e247a3d2782ee870292e"></a><!-- doxytag: member="Async::DnsLookup::label" ref="a3f0db56e2659e247a3d2782ee870292e" args="(void) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const std::string&amp; Async::DnsLookup::label </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the associated label. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns the label associated with this DNS lookup </dd></dl>

<p>Definition at line <a class="el" href="AsyncDnsLookup_8h_source.html#l00138">138</a> of file <a class="el" href="AsyncDnsLookup_8h_source.html">AsyncDnsLookup.h</a>.</p>

</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a1459ef33fe23f1e8e64e301c68ccf4ce"></a><!-- doxytag: member="Async::DnsLookup::resultsReady" ref="a1459ef33fe23f1e8e64e301c68ccf4ce" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SigC::Signal1&lt;void, <a class="el" href="classAsync_1_1DnsLookup.html">DnsLookup</a>&amp;&gt; <a class="el" href="classAsync_1_1DnsLookup.html#a1459ef33fe23f1e8e64e301c68ccf4ce">Async::DnsLookup::resultsReady</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A signal to indicate that the query has been completed. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>dns</em>&nbsp;</td><td>A reference to the DNS object associated with the query </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="AsyncDnsLookup_8h_source.html#l00156">156</a> of file <a class="el" href="AsyncDnsLookup_8h_source.html">AsyncDnsLookup.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="AsyncDnsLookup_8h_source.html">AsyncDnsLookup.h</a></li>
</ul>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address>
</body>
</html>