Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > 9601c7beb4ff23e834bfa171795ed560 > files > 141

vidalia-0.2.9-1mdv2010.1.i586.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>Vidalia: GeoIpResolver.h Source File</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.3 -->
<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><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_b47abd1aad201a152869566145babb61.html">src</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_695ba8f8357372e02d38c40b3c6dbe81.html">vidalia</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_3776330d706700e272fa8df738fecea6.html">network</a>
  </div>
</div>
<div class="contents">
<h1>GeoIpResolver.h</h1><a href="_geo_ip_resolver_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">**  This file is part of Vidalia, and is subject to the license terms in the</span>
<a name="l00003"></a>00003 <span class="comment">**  LICENSE file, found in the top level directory of this distribution. If you</span>
<a name="l00004"></a>00004 <span class="comment">**  did not receive the LICENSE file with this file, you may obtain it from the</span>
<a name="l00005"></a>00005 <span class="comment">**  Vidalia source package distributed by the Vidalia Project at</span>
<a name="l00006"></a>00006 <span class="comment">**  http://www.vidalia-project.net/. No part of Vidalia, including this file,</span>
<a name="l00007"></a>00007 <span class="comment">**  may be copied, modified, propagated, or distributed except according to the</span>
<a name="l00008"></a>00008 <span class="comment">**  terms described in the LICENSE file.</span>
<a name="l00009"></a>00009 <span class="comment">*/</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="comment">/*</span>
<a name="l00012"></a>00012 <span class="comment">G** \file GeoIpResolver.h</span>
<a name="l00013"></a>00013 <span class="comment">** \version $Id: GeoIpResolver.h 3768 2009-05-13 19:07:26Z edmanm $</span>
<a name="l00014"></a>00014 <span class="comment">** \brief Requests GeoIP information and caches the result</span>
<a name="l00015"></a>00015 <span class="comment">*/</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef _GEOIPRESOLVER_H</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _GEOIPRESOLVER_H</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &quot;<a class="code" href="_geo_ip_cache_8h.html">GeoIpCache.h</a>&quot;</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;QObject&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;QList&gt;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &lt;QHash&gt;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;QHostAddress&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="keyword">class </span><a class="code" href="class_geo_ip.html">GeoIp</a>;
<a name="l00028"></a>00028 <span class="keyword">class </span><a class="code" href="class_geo_ip_request.html">GeoIpRequest</a>;
<a name="l00029"></a>00029 <span class="keyword">class </span><a class="code" href="class_geo_ip_response.html">GeoIpResponse</a>;
<a name="l00030"></a>00030 <span class="keyword">class </span>QString;
<a name="l00031"></a>00031 <span class="keyword">class </span>QAbstractSocket;
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 
<a name="l00034"></a><a class="code" href="class_geo_ip_resolver.html">00034</a> <span class="keyword">class </span><a class="code" href="class_geo_ip_resolver.html">GeoIpResolver</a> : <span class="keyword">public</span> QObject
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036   Q_OBJECT
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="keyword">public</span>:<span class="comment"></span>
<a name="l00039"></a>00039 <span class="comment">  /** Default constructor. */</span>
<a name="l00040"></a>00040   <a class="code" href="class_geo_ip_resolver.html#abf7cf6d938132f3a35575c44d14ff5b8">GeoIpResolver</a>(QObject *parent = 0);
<a name="l00041"></a>00041   <span class="comment"></span>
<a name="l00042"></a>00042 <span class="comment">  /** Sets the address and port of Tor, through which GeoIP requests will be</span>
<a name="l00043"></a>00043 <span class="comment">   * made. */</span>
<a name="l00044"></a>00044   <span class="keywordtype">void</span> <a class="code" href="class_geo_ip_resolver.html#abf4521e71431be4189f59148d248ba29">setSocksHost</a>(<span class="keyword">const</span> QHostAddress &amp;addr, quint16 port);<span class="comment"></span>
<a name="l00045"></a>00045 <span class="comment">  /** Resolves a single IP to a geographic location. */</span>
<a name="l00046"></a>00046   <span class="keywordtype">int</span> <a class="code" href="class_geo_ip_resolver.html#add5208876f34e8f938643e7ca57ea06b">resolve</a>(<span class="keyword">const</span> QHostAddress &amp;ip);<span class="comment"></span>
<a name="l00047"></a>00047 <span class="comment">  /** Resolves a list of IPs to a geographic location. */</span>
<a name="l00048"></a>00048   <span class="keywordtype">int</span> <a class="code" href="class_geo_ip_resolver.html#add5208876f34e8f938643e7ca57ea06b">resolve</a>(<span class="keyword">const</span> QList&lt;QHostAddress&gt; &amp;ips);<span class="comment"></span>
<a name="l00049"></a>00049 <span class="comment">  /** Resolves &lt;b&gt;ip&lt;/b&gt; to geographic information only if it is cached. */</span>
<a name="l00050"></a>00050   <span class="keywordtype">bool</span> <a class="code" href="class_geo_ip_resolver.html#a1e76963e27407d363a1fb9664f1ff4d3">resolveFromCache</a>(<span class="keyword">const</span> QHostAddress &amp;ip);<span class="comment"></span>
<a name="l00051"></a>00051 <span class="comment">  /** Resolves a list of IPs to a geographic location, but only those which</span>
<a name="l00052"></a>00052 <span class="comment">   * are cached. Returns a list of which IPs were not cached. */</span>
<a name="l00053"></a>00053   QList&lt;QHostAddress&gt; <a class="code" href="class_geo_ip_resolver.html#a1e76963e27407d363a1fb9664f1ff4d3">resolveFromCache</a>(<span class="keyword">const</span> QList&lt;QHostAddress&gt; &amp;ips);
<a name="l00054"></a>00054 
<a name="l00055"></a>00055 signals:<span class="comment"></span>
<a name="l00056"></a>00056 <span class="comment">  /** Emitted when a list of IPs have been resolved to lat/long. */</span>
<a name="l00057"></a>00057   <span class="keywordtype">void</span> <a class="code" href="class_geo_ip_resolver.html#a4cddbc6cabdab1735f151e2b872c76e3">resolved</a>(<span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> QList&lt;GeoIp&gt; &amp;geoips);<span class="comment"></span>
<a name="l00058"></a>00058 <span class="comment">  /** Emitted when a resolve has failed. */</span>
<a name="l00059"></a>00059   <span class="keywordtype">void</span> <a class="code" href="class_geo_ip_resolver.html#a44482361799530707dba6129ebc45016">resolveFailed</a>(<span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> QString &amp;errorString);
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 <span class="keyword">private</span> slots:<span class="comment"></span>
<a name="l00062"></a>00062 <span class="comment">  /** Called when the socket has connected to the Geo IP host. */</span>
<a name="l00063"></a>00063   <span class="keywordtype">void</span> <a class="code" href="class_geo_ip_resolver.html#a834f18cee3c4e64e3636c05ec6c8c03f">connected</a>();<span class="comment"></span>
<a name="l00064"></a>00064 <span class="comment">  /** Called when the socket has disconnected from the Geo IP host. */</span>
<a name="l00065"></a>00065   <span class="keywordtype">void</span> <a class="code" href="class_geo_ip_resolver.html#a81d13eaedb2e1fb76313592e79f59d58">disconnected</a>();<span class="comment"></span>
<a name="l00066"></a>00066 <span class="comment">  /** Called when an error has occurred getting the Geo IP information. */</span>
<a name="l00067"></a>00067   <span class="keywordtype">void</span> <a class="code" href="class_geo_ip_resolver.html#a8c74b0a2ed92d77ab98b39eb5f544a1c">socketError</a>(<span class="keyword">const</span> QString &amp;errorString);
<a name="l00068"></a>00068 
<a name="l00069"></a>00069 <span class="keyword">private</span>:<span class="comment"></span>
<a name="l00070"></a>00070 <span class="comment">  /** Creates an HTTP request for Geo IP information. */</span>
<a name="l00071"></a>00071   <a class="code" href="class_geo_ip_request.html">GeoIpRequest</a>* <a class="code" href="class_geo_ip_resolver.html#afdebd5035b5bf9fa4efdb3ad076cc0b9">createRequest</a>(<span class="keyword">const</span> QList&lt;QHostAddress&gt; &amp;ips);
<a name="l00072"></a>00072 
<a name="l00073"></a>00073   <span class="keywordtype">void</span> <a class="code" href="class_geo_ip_resolver.html#ac5e43ec05fead9a72aa0b08d507f261a">parseGeoIpResponse</a>(<span class="keyword">const</span> QByteArray &amp;response, <a class="code" href="class_geo_ip_request.html">GeoIpRequest</a> *request);
<a name="l00074"></a>00074 <span class="comment"></span>
<a name="l00075"></a>00075 <span class="comment">  /**&lt; Cached GeoIp objects. */</span>
<a name="l00076"></a>00076   <a class="code" href="class_geo_ip_cache.html">GeoIpCache</a>*  <a class="code" href="class_geo_ip_resolver.html#a63701c6bbd60966261eafa0849a910f5">_cache</a>;<span class="comment"></span>
<a name="l00077"></a><a class="code" href="class_geo_ip_resolver.html#a63701c6bbd60966261eafa0849a910f5">00077</a> <span class="comment">  /**&lt; List of sockets used for requests. */</span>
<a name="l00078"></a><a class="code" href="class_geo_ip_resolver.html#ae5176f7b232ce100762cb7b3899d8858">00078</a>   QHash&lt;QAbstractSocket *,GeoIpRequest*&gt; <a class="code" href="class_geo_ip_resolver.html#ae5176f7b232ce100762cb7b3899d8858">_requestList</a>;<span class="comment"></span>
<a name="l00079"></a>00079 <span class="comment">  /** Tor&#39;s SocksListenAddress. */</span>
<a name="l00080"></a><a class="code" href="class_geo_ip_resolver.html#a952025882771f558c979ba21cc545291">00080</a>   QHostAddress <a class="code" href="class_geo_ip_resolver.html#a952025882771f558c979ba21cc545291">_socksAddr</a>;<span class="comment"></span>
<a name="l00081"></a>00081 <span class="comment">  /** Tor&#39;s SocksPort. */</span>
<a name="l00082"></a><a class="code" href="class_geo_ip_resolver.html#af489be58a3c0d0fc222ceffa0cacbd60">00082</a>   quint16 <a class="code" href="class_geo_ip_resolver.html#af489be58a3c0d0fc222ceffa0cacbd60">_socksPort</a>;
<a name="l00083"></a>00083 };
<a name="l00084"></a>00084 
<a name="l00085"></a>00085 <span class="preprocessor">#endif</span>
<a name="l00086"></a>00086 <span class="preprocessor"></span>
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Mon Aug 30 22:58:54 2010 for Vidalia by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>