Sophie

Sophie

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

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: NetViewer.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>NetViewer.h</h1><a href="_net_viewer_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">** \file NetViewer.h</span>
<a name="l00013"></a>00013 <span class="comment">** \version $Id: NetViewer.h 4054 2009-08-17 02:25:08Z edmanm $</span>
<a name="l00014"></a>00014 <span class="comment">** \brief Displays a map of the Tor network and the user&#39;s circuits</span>
<a name="l00015"></a>00015 <span class="comment">*/</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef _NETVIEWER_H</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _NETVIEWER_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="config_8h.html">config.h</a>&quot;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &quot;ui_NetViewer.h&quot;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;<a class="code" href="_vidalia_window_8h.html">VidaliaWindow.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="_geo_ip_resolver_8h.html">GeoIpResolver.h</a>&quot;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#if defined(USE_MARBLE)</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="_tor_map_widget_8h.html">TorMapWidget.h</a>&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#else</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="_tor_map_image_view_8h.html">TorMapImageView.h</a>&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#endif</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;<a class="code" href="_tor_control_8h.html">TorControl.h</a>&quot;</span>
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;QMainWindow&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;QStringList&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;QEvent&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;QTimer&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;QHash&gt;</span>
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 <span class="keyword">class </span>QDateTime;
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="class_net_viewer.html">00042</a> <span class="keyword">class </span><a class="code" href="class_net_viewer.html">NetViewer</a> : <span class="keyword">public</span> <a class="code" href="class_vidalia_window.html">VidaliaWindow</a>
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044   Q_OBJECT
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="keyword">public</span>:<span class="comment"></span>
<a name="l00047"></a>00047 <span class="comment">  /** Default constructor */</span>
<a name="l00048"></a>00048   <a class="code" href="class_net_viewer.html#ad1d0ca5abfdb1d1a940e8ec31fef1661">NetViewer</a>(QWidget* parent = 0);
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 <span class="keyword">public</span> slots:<span class="comment"></span>
<a name="l00051"></a>00051 <span class="comment">  /** Displays the network map window. */</span>
<a name="l00052"></a>00052   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#ac8ae13125f5fae65d92b2015f5e12402">showWindow</a>();<span class="comment"></span>
<a name="l00053"></a>00053 <span class="comment">  /** Loads a list of current circuits and streams. */</span>
<a name="l00054"></a>00054   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a9986ea25487f67c51437e614cd7cd105">loadConnections</a>();<span class="comment"></span>
<a name="l00055"></a>00055 <span class="comment">  /** Adds &lt;b&gt;circuit&lt;/b&gt; to the list and the map */</span>
<a name="l00056"></a>00056   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#afc6d6a94e4f463a516ced4267bf31fb8">addCircuit</a>(<span class="keyword">const</span> <a class="code" href="class_circuit.html">Circuit</a> &amp;circuit);<span class="comment"></span>
<a name="l00057"></a>00057 <span class="comment">  /** Adds &lt;b&gt;stream&lt;/b&gt; to the list of circuits, under the appropriate</span>
<a name="l00058"></a>00058 <span class="comment">   * circuit. */</span>
<a name="l00059"></a>00059   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a751dcf0bfc08d4665e6e4616e8319117">addStream</a>(<span class="keyword">const</span> <a class="code" href="class_stream.html">Stream</a> &amp;stream);
<a name="l00060"></a>00060 <span class="comment"></span>
<a name="l00061"></a>00061 <span class="comment">  /** Called when a NEWDESC event arrives. Retrieves new router descriptors</span>
<a name="l00062"></a>00062 <span class="comment">   * for the router identities given in &lt;b&gt;ids&lt;/b&gt; and updates the router list</span>
<a name="l00063"></a>00063 <span class="comment">   * and network map.</span>
<a name="l00064"></a>00064 <span class="comment">   */</span>
<a name="l00065"></a>00065   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#ab5c243bf39e784335463c07412861208">newDescriptors</a>(<span class="keyword">const</span> QStringList &amp;ids);
<a name="l00066"></a>00066 <span class="comment"></span>
<a name="l00067"></a>00067 <span class="comment">  /** Called when Tor has mapped the address &lt;b&gt;from&lt;/b&gt; to the address</span>
<a name="l00068"></a>00068 <span class="comment">   * &lt;b&gt;to&lt;/b&gt;. &lt;b&gt;expires&lt;/b&gt; indicates the time at which when the address</span>
<a name="l00069"></a>00069 <span class="comment">   * mapping will no longer be considered valid.</span>
<a name="l00070"></a>00070 <span class="comment">   */</span>
<a name="l00071"></a>00071   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a709160288054a93ee1337267c1b40e4a">addressMapped</a>(<span class="keyword">const</span> QString &amp;from, <span class="keyword">const</span> QString &amp;to,
<a name="l00072"></a>00072                      <span class="keyword">const</span> QDateTime &amp;expires);
<a name="l00073"></a>00073 <span class="comment"></span>
<a name="l00074"></a>00074 <span class="comment">  /** Clears all known information */</span>
<a name="l00075"></a>00075   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a03991203ec27b231415734522cf3596e">clear</a>();
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 <span class="keyword">protected</span>:<span class="comment"></span>
<a name="l00078"></a>00078 <span class="comment">  /** Called when the user changes the UI translation. */</span>
<a name="l00079"></a>00079   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#af4b7d40c730d94bbd21a3243aa7280af">retranslateUi</a>();
<a name="l00080"></a>00080 
<a name="l00081"></a>00081 <span class="keyword">private</span> slots:<span class="comment"></span>
<a name="l00082"></a>00082 <span class="comment">  /** Called when the user selects the &quot;Help&quot; action on the toolbar. */</span>
<a name="l00083"></a>00083   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a5deaeec411346de13eaf325c6f49daa1">help</a>();<span class="comment"></span>
<a name="l00084"></a>00084 <span class="comment">  /** Called when the user selects the &quot;Refresh&quot; action on the toolbar */</span>
<a name="l00085"></a>00085   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a8c2d673a8f10e1c422101086c25271ee">refresh</a>();<span class="comment"></span>
<a name="l00086"></a>00086 <span class="comment">  /** Called when the user selects a circuit on the circuit list */</span>
<a name="l00087"></a>00087   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#afc09031d4b84b823f213b78aa102669f">circuitSelected</a>(<span class="keyword">const</span> <a class="code" href="class_circuit.html">Circuit</a> &amp;circuit);<span class="comment"></span>
<a name="l00088"></a>00088 <span class="comment">  /** Called when an IP has been resolved to geographic information. */</span>
<a name="l00089"></a>00089   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a3cbf9f1953bf0c1abaa6781a7de68476">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="l00090"></a>00090 <span class="comment">  /** Called when the user selects one or more routers in the list. */</span>
<a name="l00091"></a>00091   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a66c6c7a9b0222dbb0c980d6792bd95bd">routerSelected</a>(<span class="keyword">const</span> QList&lt;RouterDescriptor&gt; &amp;routers);<span class="comment"></span>
<a name="l00092"></a>00092 <span class="comment">  /** Handles when we get connected to Tor network */</span>
<a name="l00093"></a>00093   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a7cf1d01c9d9117ae828e57ea596078dd">onAuthenticated</a>();<span class="comment"></span>
<a name="l00094"></a>00094 <span class="comment">  /** Handles when we get disconnected from Tor network */</span>
<a name="l00095"></a>00095   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a2559af44cd76fc4628728d7fc835e85a">onDisconnected</a>();<span class="comment"></span>
<a name="l00096"></a>00096 <span class="comment">  /** Resolves IP addresses in the resolve queue to geographic information. */</span>
<a name="l00097"></a>00097   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a5055d97ac042d2cafd6bb3b36a8d69fd">resolve</a>();<span class="comment"></span>
<a name="l00098"></a>00098 <span class="comment">  /** Called when the user selects a router on the network map. Displays a </span>
<a name="l00099"></a>00099 <span class="comment">   * dialog with detailed information for the router specified by</span>
<a name="l00100"></a>00100 <span class="comment">   * &lt;b&gt;id&lt;/b&gt;.*/</span>
<a name="l00101"></a>00101   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a4d88759346d479e9c8abdeb04f23b52e">displayRouterInfo</a>(<span class="keyword">const</span> QString &amp;<span class="keywordtype">id</span>);<span class="comment"></span>
<a name="l00102"></a>00102 <span class="comment">  /** Called when the user clicks the &quot;Zoom In&quot; button. */</span>
<a name="l00103"></a>00103   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#ae0181ea07d0b7c70f86f671ed73a4689">zoomIn</a>();<span class="comment"></span>
<a name="l00104"></a>00104 <span class="comment">  /** Called when the user clicks the &quot;Zoom Out&quot; button. */</span>
<a name="l00105"></a>00105   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a1fed32d4085f58f95536f77d9c758af8">zoomOut</a>();<span class="comment"></span>
<a name="l00106"></a>00106 <span class="comment">  /** Called when the user clicks &quot;Full Screen&quot; or presses Escape on the map.</span>
<a name="l00107"></a>00107 <span class="comment">   * Toggles the map between normal and a full screen viewing modes. */</span>
<a name="l00108"></a>00108   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#acc056faebc021de5c67ba5d7684140e3">toggleFullScreen</a>();
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 <span class="keyword">private</span>:<span class="comment"></span>
<a name="l00111"></a>00111 <span class="comment">  /** Adds an IP address to the resolve queue and updates the queue timers. */</span>
<a name="l00112"></a>00112   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a965c1c2a4d9baab50253c8a6c9cb6a3e">addToResolveQueue</a>(<span class="keyword">const</span> QHostAddress &amp;ip, <span class="keyword">const</span> QString &amp;<span class="keywordtype">id</span>);<span class="comment"></span>
<a name="l00113"></a>00113 <span class="comment">  /** Retrieves a list of all running routers from Tor and their descriptors,</span>
<a name="l00114"></a>00114 <span class="comment">   * and adds them to the RouterListWidget. */</span>
<a name="l00115"></a>00115   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#a12a32fc2f915d54865e792335f49d496">loadNetworkStatus</a>();<span class="comment"></span>
<a name="l00116"></a>00116 <span class="comment">  /** Loads a list of address mappings from Tor. */</span>
<a name="l00117"></a>00117   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#ad4bff74ed78c73163abbc2a2d1385484">loadAddressMap</a>();<span class="comment"></span>
<a name="l00118"></a>00118 <span class="comment">  /** Adds a router to our list of servers and retrieves geographic location</span>
<a name="l00119"></a>00119 <span class="comment">   * information for the server. */</span>
<a name="l00120"></a>00120   <span class="keywordtype">void</span> <a class="code" href="class_net_viewer.html#af830ab3a6452a74e4b323492d54a709c">addRouter</a>(<span class="keyword">const</span> <a class="code" href="class_router_descriptor.html">RouterDescriptor</a> &amp;rd);
<a name="l00121"></a>00121 <span class="comment"></span>
<a name="l00122"></a>00122 <span class="comment">  /** TorControl object used to talk to Tor. */</span>
<a name="l00123"></a><a class="code" href="class_net_viewer.html#a364fc90e5497271c8e93655f1f54329e">00123</a>   <a class="code" href="class_tor_control.html">TorControl</a>* <a class="code" href="class_net_viewer.html#a364fc90e5497271c8e93655f1f54329e">_torControl</a>;<span class="comment"></span>
<a name="l00124"></a>00124 <span class="comment">  /** Timer that fires once an hour to update the router list. */</span>
<a name="l00125"></a><a class="code" href="class_net_viewer.html#a07c4dc0a139c7d4a382ad06b97f220d0">00125</a>   QTimer <a class="code" href="class_net_viewer.html#a07c4dc0a139c7d4a382ad06b97f220d0">_refreshTimer</a>;<span class="comment"></span>
<a name="l00126"></a>00126 <span class="comment">  /** GeoIpResolver used to geolocate routers by IP address. */</span>
<a name="l00127"></a><a class="code" href="class_net_viewer.html#a288067cdbae084a8490adb059adf8b85">00127</a>   <a class="code" href="class_geo_ip_resolver.html">GeoIpResolver</a> <a class="code" href="class_net_viewer.html#a288067cdbae084a8490adb059adf8b85">_geoip</a>;<span class="comment"></span>
<a name="l00128"></a>00128 <span class="comment">  /** Queue for IPs pending resolution to geographic information. */</span>
<a name="l00129"></a><a class="code" href="class_net_viewer.html#a0ceba335e7eb56875c1f3fb59d646334">00129</a>   QList&lt;QHostAddress&gt; <a class="code" href="class_net_viewer.html#a0ceba335e7eb56875c1f3fb59d646334">_resolveQueue</a>;<span class="comment"></span>
<a name="l00130"></a>00130 <span class="comment">  /** Maps pending GeoIP requests to server IDs. */</span>
<a name="l00131"></a><a class="code" href="class_net_viewer.html#aecff4f08a117d47ccefd2a3c95abdd8d">00131</a>   QHash&lt;QString, QString&gt; <a class="code" href="class_net_viewer.html#aecff4f08a117d47ccefd2a3c95abdd8d">_resolveMap</a>;<span class="comment"></span>
<a name="l00132"></a>00132 <span class="comment">  /** Stores a list of address mappings from Tor. */</span>
<a name="l00133"></a><a class="code" href="class_net_viewer.html#a47fe551cd0db9aaddab6e8ffbb67f7ea">00133</a>   <a class="code" href="class_address_map.html">AddressMap</a> <a class="code" href="class_net_viewer.html#a47fe551cd0db9aaddab6e8ffbb67f7ea">_addressMap</a>;<span class="comment"></span>
<a name="l00134"></a>00134 <span class="comment">  /** Timer used to delay GeoIP requests for MIN_RESOLVE_QUEUE_DELAY</span>
<a name="l00135"></a>00135 <span class="comment">   * milliseconds after we&#39;ve inserted the last item into the queue. */</span>
<a name="l00136"></a><a class="code" href="class_net_viewer.html#a67bc5955adb4d0489f6543a79633748b">00136</a>   QTimer <a class="code" href="class_net_viewer.html#a67bc5955adb4d0489f6543a79633748b">_minResolveQueueTimer</a>;<span class="comment"></span>
<a name="l00137"></a>00137 <span class="comment">  /** Timer used to limit the delay of GeoIP requests to</span>
<a name="l00138"></a>00138 <span class="comment">   * MAX_RESOLVE_QUEUE_DELAY milliseconds after inserting the first item </span>
<a name="l00139"></a>00139 <span class="comment">   * into the queue. */</span>
<a name="l00140"></a><a class="code" href="class_net_viewer.html#aa98ce54d7106f5013d3265f9c5f012dd">00140</a>   QTimer <a class="code" href="class_net_viewer.html#aa98ce54d7106f5013d3265f9c5f012dd">_maxResolveQueueTimer</a>;
<a name="l00141"></a>00141  <span class="comment"></span>
<a name="l00142"></a>00142 <span class="comment">  /** Widget that displays the Tor network map. */</span>
<a name="l00143"></a>00143 <span class="preprocessor">#if defined(USE_MARBLE)</span>
<a name="l00144"></a>00144 <span class="preprocessor"></span>  <a class="code" href="class_tor_map_widget.html">TorMapWidget</a>* <a class="code" href="class_net_viewer.html#aca441c0f084c7e3f17756bd0eca2a091">_map</a>;
<a name="l00145"></a>00145 <span class="preprocessor">#else</span>
<a name="l00146"></a><a class="code" href="class_net_viewer.html#aca441c0f084c7e3f17756bd0eca2a091">00146</a> <span class="preprocessor"></span>  <a class="code" href="class_tor_map_image_view.html">TorMapImageView</a>* <a class="code" href="class_net_viewer.html#aca441c0f084c7e3f17756bd0eca2a091">_map</a>;
<a name="l00147"></a>00147 <span class="preprocessor">#endif</span>
<a name="l00148"></a>00148 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00149"></a>00149 <span class="comment">  /** Qt Designer generated object **/</span>
<a name="l00150"></a><a class="code" href="class_net_viewer.html#a78a6382f956c9bb177925c8213a1a9a7">00150</a>   Ui::NetViewer <a class="code" href="class_net_viewer.html#a78a6382f956c9bb177925c8213a1a9a7">ui</a>;
<a name="l00151"></a>00151 };
<a name="l00152"></a>00152 
<a name="l00153"></a>00153 <span class="preprocessor">#endif</span>
<a name="l00154"></a>00154 <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>