Sophie

Sophie

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

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: Circuit.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_67a2ce25601334632bdc5ef4a72c0f17.html">torcontrol</a>
  </div>
</div>
<div class="contents">
<h1>Circuit.h</h1><a href="_circuit_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 </span>
<a name="l00004"></a>00004 <span class="comment">**  you did not receive the LICENSE file with this file, you may obtain it</span>
<a name="l00005"></a>00005 <span class="comment">**  from the 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</span>
<a name="l00008"></a>00008 <span class="comment">**  the 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 Circuit.h</span>
<a name="l00013"></a>00013 <span class="comment">** \version $Id: Circuit.h 4054 2009-08-17 02:25:08Z edmanm $</span>
<a name="l00014"></a>00014 <span class="comment">** \brief Object representing a Tor circuit</span>
<a name="l00015"></a>00015 <span class="comment">*/</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef _CIRCUIT_H</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _CIRCUIT_H</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;QCoreApplication&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;QStringList&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;QMetaType&gt;</span>
<a name="l00023"></a>00023 <span class="comment"></span>
<a name="l00024"></a>00024 <span class="comment">/** Circuit IDs contains 1-16 alphanumeric ASCII characters. */</span>
<a name="l00025"></a><a class="code" href="_circuit_8h.html#a8b7b0182a6d1ff0aab7ab31df9c3f83d">00025</a> <span class="keyword">typedef</span> QString <a class="code" href="_circuit_8h.html#a8b7b0182a6d1ff0aab7ab31df9c3f83d">CircuitId</a>;
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 
<a name="l00028"></a><a class="code" href="class_circuit.html">00028</a> <span class="keyword">class </span><a class="code" href="class_circuit.html">Circuit</a>
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030   Q_DECLARE_TR_FUNCTIONS(<a class="code" href="class_circuit.html">Circuit</a>)
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="keyword">public</span>:<span class="comment"></span>
<a name="l00033"></a>00033 <span class="comment">  /** Circuit status events */</span>
<a name="l00034"></a><a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0a">00034</a>   <span class="keyword">enum</span> <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0a">Status</a> {
<a name="l00035"></a><a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa8fc7fad3a4f3f006c763f50919d0921a">00035</a>     <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa8fc7fad3a4f3f006c763f50919d0921a">Unknown</a>,   <span class="comment">/**&lt; Unknown circuit status */</span>
<a name="l00036"></a><a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa3159446c00c57be721566ad88ad6e517">00036</a>     <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa3159446c00c57be721566ad88ad6e517">Launched</a>,  <span class="comment">/**&lt; Circuit ID assigned to new circuit */</span>
<a name="l00037"></a><a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aad2f6d14053da3729ae9063cfa8125037">00037</a>     <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aad2f6d14053da3729ae9063cfa8125037">Built</a>,     <span class="comment">/**&lt; All hops finished */</span>
<a name="l00038"></a><a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aaff3f0927c5139d09f47cbda207b4049e">00038</a>     <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aaff3f0927c5139d09f47cbda207b4049e">Extended</a>,  <span class="comment">/**&lt; Circuit extended by one hop */</span>
<a name="l00039"></a><a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa28e1a44a072277cd8ff8610a66e1ef90">00039</a>     <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa28e1a44a072277cd8ff8610a66e1ef90">Failed</a>,    <span class="comment">/**&lt; Circuit closed (was not built) */</span>
<a name="l00040"></a><a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa870aea6e455b0bfec4f9ff3764c9623f">00040</a>     <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa870aea6e455b0bfec4f9ff3764c9623f">Closed</a>     <span class="comment">/**&lt; Circuit closed (was built) */</span>
<a name="l00041"></a>00041   };
<a name="l00042"></a>00042 <span class="comment"></span>
<a name="l00043"></a>00043 <span class="comment">  /** Default constructor. */</span>
<a name="l00044"></a>00044   <a class="code" href="class_circuit.html#a6a9c21735a28f1222797d71ece99521c">Circuit</a>();<span class="comment"></span>
<a name="l00045"></a>00045 <span class="comment">  /** Constructor. */</span>  
<a name="l00046"></a>00046   <a class="code" href="class_circuit.html#a6a9c21735a28f1222797d71ece99521c">Circuit</a>(<span class="keyword">const</span> <a class="code" href="_circuit_8h.html#a8b7b0182a6d1ff0aab7ab31df9c3f83d">CircuitId</a> &amp;circuit);
<a name="l00047"></a>00047   <span class="comment"></span>
<a name="l00048"></a>00048 <span class="comment">  /** Returns true if this circuit is valid. */</span>
<a name="l00049"></a><a class="code" href="class_circuit.html#ae723c9138712a7b0b9b99e156583f9c5">00049</a>   <span class="keywordtype">bool</span> <a class="code" href="class_circuit.html#ae723c9138712a7b0b9b99e156583f9c5">isValid</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_circuit.html#a8b4f6ac4382c7beb4e431fd9977912b5">_isValid</a>; }
<a name="l00050"></a>00050   <span class="comment"></span>
<a name="l00051"></a>00051 <span class="comment">  /** Returns the ID for this circuit */</span>
<a name="l00052"></a><a class="code" href="class_circuit.html#a3083f9c330227c6f46b3ab32e071f7be">00052</a>   <a class="code" href="_circuit_8h.html#a8b7b0182a6d1ff0aab7ab31df9c3f83d">CircuitId</a> <a class="code" href="class_circuit.html#a3083f9c330227c6f46b3ab32e071f7be">id</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_circuit.html#ab3fa1786f61e0ca83f6d0209ae85b305">_circId</a>; }<span class="comment"></span>
<a name="l00053"></a>00053 <span class="comment">  /** Returns the status of this circuit */</span>
<a name="l00054"></a><a class="code" href="class_circuit.html#a33c78724c92b50c7aa28b247a88a79f4">00054</a>   <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0a">Status</a> <a class="code" href="class_circuit.html#a33c78724c92b50c7aa28b247a88a79f4">status</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_circuit.html#a470c834decedb2ae3f15b8774bae36b3">_status</a>; }<span class="comment"></span>
<a name="l00055"></a>00055 <span class="comment">  /** Returns a string representation of the status of this circuit. */</span>
<a name="l00056"></a>00056   QString <a class="code" href="class_circuit.html#a559fa04641a22358b18e63e6c876eef1">statusString</a>() <span class="keyword">const</span>;<span class="comment"></span>
<a name="l00057"></a>00057 <span class="comment">  /** Returns the length of the circuit&#39;s path. */</span>
<a name="l00058"></a><a class="code" href="class_circuit.html#a9659daf54fc25df9d178c0bb38871095">00058</a>   uint <a class="code" href="class_circuit.html#a9659daf54fc25df9d178c0bb38871095">length</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_circuit.html#a2ef793cb7c1f1133d4a558a430998a94">_ids</a>.size(); }<span class="comment"></span>
<a name="l00059"></a>00059 <span class="comment">  /** Returns the circuit&#39;s path as an ordered list of router nicknames. */</span>
<a name="l00060"></a><a class="code" href="class_circuit.html#aed1d77e44aedbe8da26959fb56e76602">00060</a>   QStringList <a class="code" href="class_circuit.html#aed1d77e44aedbe8da26959fb56e76602">routerNames</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_circuit.html#a6b25d5c485ecbc67e31dfb8e8048c739">_names</a>; }<span class="comment"></span>
<a name="l00061"></a>00061 <span class="comment">  /** Returns the circuit&#39;s path as an ordered list of router fingerprints. */</span>
<a name="l00062"></a><a class="code" href="class_circuit.html#a42535367967ed99c8b9b312dad11067d">00062</a>   QStringList <a class="code" href="class_circuit.html#a42535367967ed99c8b9b312dad11067d">routerIDs</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="class_circuit.html#a2ef793cb7c1f1133d4a558a430998a94">_ids</a>; }
<a name="l00063"></a>00063 <span class="comment"></span>
<a name="l00064"></a>00064 <span class="comment">  /** Converts a string description of a circuit&#39;s status to an enum value */</span>
<a name="l00065"></a>00065   <span class="keyword">static</span> <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0a">Status</a> <a class="code" href="class_circuit.html#aa4a57b1e38c6502fc48e9a1d34092e5f">toStatus</a>(<span class="keyword">const</span> QString &amp;strStatus);
<a name="l00066"></a>00066 <span class="comment"></span>
<a name="l00067"></a>00067 <span class="comment">  /** Returns true iff &lt;b&gt;circId&lt;/b&gt; consists of only between 1 and 16</span>
<a name="l00068"></a>00068 <span class="comment">   * (inclusive) ASCII-encoded letters and numbers. */</span>
<a name="l00069"></a>00069   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="class_circuit.html#a440c821a5d795deb029848a064d9f3fd">isValidCircuitId</a>(<span class="keyword">const</span> <a class="code" href="_circuit_8h.html#a8b7b0182a6d1ff0aab7ab31df9c3f83d">CircuitId</a> &amp;circId);
<a name="l00070"></a>00070 
<a name="l00071"></a>00071 <span class="keyword">private</span>:
<a name="l00072"></a><a class="code" href="class_circuit.html#ab3fa1786f61e0ca83f6d0209ae85b305">00072</a>   <a class="code" href="_circuit_8h.html#a8b7b0182a6d1ff0aab7ab31df9c3f83d">CircuitId</a> <a class="code" href="class_circuit.html#ab3fa1786f61e0ca83f6d0209ae85b305">_circId</a>; <span class="comment">/**&lt; Circuit ID. */</span>
<a name="l00073"></a><a class="code" href="class_circuit.html#a470c834decedb2ae3f15b8774bae36b3">00073</a>   <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0a">Status</a> <a class="code" href="class_circuit.html#a470c834decedb2ae3f15b8774bae36b3">_status</a>;  <span class="comment">/**&lt; Circuit status. */</span>
<a name="l00074"></a><a class="code" href="class_circuit.html#a6b25d5c485ecbc67e31dfb8e8048c739">00074</a>   QStringList <a class="code" href="class_circuit.html#a6b25d5c485ecbc67e31dfb8e8048c739">_names</a>;  <span class="comment">/**&lt; Nicknames of the routers in the circuit. */</span>
<a name="l00075"></a><a class="code" href="class_circuit.html#a2ef793cb7c1f1133d4a558a430998a94">00075</a>   QStringList <a class="code" href="class_circuit.html#a2ef793cb7c1f1133d4a558a430998a94">_ids</a>;    <span class="comment">/**&lt; IDs of the routers in the circuit. */</span>
<a name="l00076"></a><a class="code" href="class_circuit.html#a8b4f6ac4382c7beb4e431fd9977912b5">00076</a>   <span class="keywordtype">bool</span> <a class="code" href="class_circuit.html#a8b4f6ac4382c7beb4e431fd9977912b5">_isValid</a>;
<a name="l00077"></a>00077 };
<a name="l00078"></a>00078 
<a name="l00079"></a>00079 <a class="code" href="_bootstrap_status_8h.html#afaaf387126a2702e569ea02dabb890d0">Q_DECLARE_METATYPE</a>(<a class="code" href="class_circuit.html">Circuit</a>);
<a name="l00080"></a>00080 <span class="comment"></span>
<a name="l00081"></a>00081 <span class="comment">/** A collection of circuits. */</span>
<a name="l00082"></a><a class="code" href="_circuit_8h.html#a5c7c01bcee10c15862fdf844c3d1538c">00082</a> <span class="keyword">typedef</span> QList&lt;Circuit&gt; <a class="code" href="_circuit_8h.html#a5c7c01bcee10c15862fdf844c3d1538c">CircuitList</a>;
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 <span class="preprocessor">#endif</span>
<a name="l00085"></a>00085 <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>