Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > by-pkgid > 9601c7beb4ff23e834bfa171795ed560 > files > 219

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: NetworkSettings.cpp 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_738aec08306f4b898e01f7a551299457.html">config</a>
  </div>
</div>
<div class="contents">
<h1>NetworkSettings.cpp</h1><a href="_network_settings_8cpp.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 NetworkSettings.cpp</span>
<a name="l00013"></a>00013 <span class="comment">** \version $Id: NetworkSettings.cpp 4140 2009-10-03 21:49:21Z edmanm $</span>
<a name="l00014"></a>00014 <span class="comment">** \brief Settings for configuring an HTTP/HTTPS proxy or bridges</span>
<a name="l00015"></a>00015 <span class="comment">*/</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#include &quot;<a class="code" href="_network_settings_8h.html">NetworkSettings.h</a>&quot;</span>
<a name="l00018"></a>00018 
<a name="l00019"></a><a class="code" href="_network_settings_8cpp.html#a7f604d831a85a25dcebd37e49db92f25">00019</a> <span class="preprocessor">#define SETTING_FASCIST_FIREWALL    &quot;FascistFirewall&quot;</span>
<a name="l00020"></a><a class="code" href="_network_settings_8cpp.html#a47847d5a92694aaa4d6f1b66c3bc09b7">00020</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_REACHABLE_ADDRESSES &quot;ReachableAddresses&quot;</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00022"></a>00022 <span class="comment">/* Vidalia-specific proxy options */</span>
<a name="l00023"></a><a class="code" href="_network_settings_8cpp.html#a7efe93803fe87b60c4f076d893ec6d32">00023</a> <span class="preprocessor">#define SETTING_PROXY_TYPE          &quot;ProxyType&quot;</span>
<a name="l00024"></a><a class="code" href="_network_settings_8cpp.html#a11498ae4a97cb610927bbab7f189b7a3">00024</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_PROXY_ADDRESS       &quot;ProxyAddress&quot;</span>
<a name="l00025"></a><a class="code" href="_network_settings_8cpp.html#ab4d6c0f972aade74385e4fc49be36a12">00025</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_PROXY_USERNAME      &quot;ProxyUsername&quot;</span>
<a name="l00026"></a><a class="code" href="_network_settings_8cpp.html#a9e124667d13255130907ab2df5c430ec">00026</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_PROXY_PASSWORD      &quot;ProxyPassword&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00028"></a>00028 <span class="comment">/* Tor&#39;s proxy options */</span>
<a name="l00029"></a><a class="code" href="_network_settings_8cpp.html#a278bffa95c4ef60881699deeb0b5de09">00029</a> <span class="preprocessor">#define SETTING_HTTP_PROXY          &quot;HttpProxy&quot;</span>
<a name="l00030"></a><a class="code" href="_network_settings_8cpp.html#aa02bea03a5f54e5c750c510fb2cd5f79">00030</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_HTTP_PROXY_AUTH     &quot;HttpProxyAuthenticator&quot;</span>
<a name="l00031"></a><a class="code" href="_network_settings_8cpp.html#a4b46ad83eef8101182e94263510acb3e">00031</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_HTTPS_PROXY         &quot;HttpsProxy&quot;</span>
<a name="l00032"></a><a class="code" href="_network_settings_8cpp.html#aa7bda3d8580fb5b326ead7e4316de540">00032</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_HTTPS_PROXY_AUTH    &quot;HttpsProxyAuthenticator&quot;</span>
<a name="l00033"></a><a class="code" href="_network_settings_8cpp.html#a23bdc5269309c692b394862389587f43">00033</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_SOCKS4_PROXY        &quot;Socks4Proxy&quot;</span>
<a name="l00034"></a><a class="code" href="_network_settings_8cpp.html#a97e569a74fda673b1a323fc6e459be61">00034</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_SOCKS5_PROXY        &quot;Socks5Proxy&quot;</span>
<a name="l00035"></a><a class="code" href="_network_settings_8cpp.html#ae62d4ab6c1547adf490578e9cb11c76d">00035</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_SOCKS5_USERNAME     &quot;Socks5ProxyUsername&quot;</span>
<a name="l00036"></a><a class="code" href="_network_settings_8cpp.html#a49562cd5f3e8fb757d47ead9c8c50dd8">00036</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_SOCKS5_PASSWORD     &quot;Socks5ProxyPassword&quot;</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a><a class="code" href="_network_settings_8cpp.html#a6e659c4e51938ee3980de50348446c7d">00038</a> <span class="preprocessor">#define SETTING_USE_BRIDGES         &quot;UseBridges&quot;</span>
<a name="l00039"></a><a class="code" href="_network_settings_8cpp.html#a124adeb8e91445a9ce67c9ac7ce64346">00039</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_BRIDGE_LIST         &quot;Bridge&quot;</span>
<a name="l00040"></a><a class="code" href="_network_settings_8cpp.html#a85ba47ce7bac882ba5150c08ba6a86b6">00040</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_UPDATE_BRIDGES      &quot;UpdateBridgesFromAuthority&quot;</span>
<a name="l00041"></a><a class="code" href="_network_settings_8cpp.html#a0f2ece23b61521bb71eee94bac943722">00041</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_TUNNEL_DIR_CONNS    &quot;TunnelDirConns&quot;</span>
<a name="l00042"></a><a class="code" href="_network_settings_8cpp.html#a77e1b38ab2712ce4f303b626438d3b76">00042</a> <span class="preprocessor"></span><span class="preprocessor">#define SETTING_PREFER_TUNNELED_DIR_CONNS &quot;PreferTunneledDirConns&quot;</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span>
<a name="l00044"></a>00044 <span class="comment"></span>
<a name="l00045"></a>00045 <span class="comment">/** Default constructor */</span>
<a name="l00046"></a><a class="code" href="class_network_settings.html#a5563eac6a53715addf204d5d52e7cd1c">00046</a> <a class="code" href="class_network_settings.html#a5563eac6a53715addf204d5d52e7cd1c">NetworkSettings::NetworkSettings</a>(<a class="code" href="class_tor_control.html">TorControl</a> *torControl)
<a name="l00047"></a>00047 : <a class="code" href="class_abstract_tor_settings.html">AbstractTorSettings</a>(<span class="stringliteral">&quot;Network&quot;</span>, torControl)
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049   <a class="code" href="class_v_settings.html#aebcf7105467fb91077fbb4470fcf9624">setDefault</a>(<a class="code" href="_network_settings_8cpp.html#a7efe93803fe87b60c4f076d893ec6d32">SETTING_PROXY_TYPE</a>,        <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188eda8016bee11a07a8b24b6f6c06c194edfa">NoProxy</a>);
<a name="l00050"></a>00050   <a class="code" href="class_v_settings.html#aebcf7105467fb91077fbb4470fcf9624">setDefault</a>(<a class="code" href="_network_settings_8cpp.html#a11498ae4a97cb610927bbab7f189b7a3">SETTING_PROXY_ADDRESS</a>,     <span class="stringliteral">&quot;&quot;</span>);
<a name="l00051"></a>00051   <a class="code" href="class_v_settings.html#aebcf7105467fb91077fbb4470fcf9624">setDefault</a>(<a class="code" href="_network_settings_8cpp.html#ab4d6c0f972aade74385e4fc49be36a12">SETTING_PROXY_USERNAME</a>,    <span class="stringliteral">&quot;&quot;</span>);
<a name="l00052"></a>00052   <a class="code" href="class_v_settings.html#aebcf7105467fb91077fbb4470fcf9624">setDefault</a>(<a class="code" href="_network_settings_8cpp.html#a9e124667d13255130907ab2df5c430ec">SETTING_PROXY_PASSWORD</a>,    <span class="stringliteral">&quot;&quot;</span>);
<a name="l00053"></a>00053   <a class="code" href="class_v_settings.html#aebcf7105467fb91077fbb4470fcf9624">setDefault</a>(<a class="code" href="_network_settings_8cpp.html#a6e659c4e51938ee3980de50348446c7d">SETTING_USE_BRIDGES</a>,       <span class="keyword">false</span>);
<a name="l00054"></a>00054   <a class="code" href="class_v_settings.html#aebcf7105467fb91077fbb4470fcf9624">setDefault</a>(<a class="code" href="_network_settings_8cpp.html#a124adeb8e91445a9ce67c9ac7ce64346">SETTING_BRIDGE_LIST</a>,       QStringList());
<a name="l00055"></a>00055   <a class="code" href="class_v_settings.html#aebcf7105467fb91077fbb4470fcf9624">setDefault</a>(<a class="code" href="_network_settings_8cpp.html#a7f604d831a85a25dcebd37e49db92f25">SETTING_FASCIST_FIREWALL</a>,  <span class="keyword">false</span>);
<a name="l00056"></a>00056   <a class="code" href="class_v_settings.html#aebcf7105467fb91077fbb4470fcf9624">setDefault</a>(<a class="code" href="_network_settings_8cpp.html#a0f2ece23b61521bb71eee94bac943722">SETTING_TUNNEL_DIR_CONNS</a>,  <span class="keyword">true</span>);
<a name="l00057"></a>00057   <a class="code" href="class_v_settings.html#aebcf7105467fb91077fbb4470fcf9624">setDefault</a>(<a class="code" href="_network_settings_8cpp.html#a47847d5a92694aaa4d6f1b66c3bc09b7">SETTING_REACHABLE_ADDRESSES</a>,
<a name="l00058"></a>00058     QStringList() &lt;&lt; <span class="stringliteral">&quot;*:80&quot;</span> &lt;&lt; <span class="stringliteral">&quot;*:443&quot;</span>);
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060 <span class="comment"></span>
<a name="l00061"></a>00061 <span class="comment">/** Applies the current network configuration settings to Tor. If</span>
<a name="l00062"></a>00062 <span class="comment"> * &lt;b&gt;errmsg&lt;/b&gt; is specified and an error occurs while applying the settings,</span>
<a name="l00063"></a>00063 <span class="comment"> * it will be set to a string describing the error. */</span>
<a name="l00064"></a>00064 <span class="keywordtype">bool</span>
<a name="l00065"></a><a class="code" href="class_network_settings.html#a5cfe489933fe086357839a490ad7d7a9">00065</a> <a class="code" href="class_network_settings.html#a5cfe489933fe086357839a490ad7d7a9">NetworkSettings::apply</a>(QString *errmsg)
<a name="l00066"></a>00066 {
<a name="l00067"></a>00067   QMultiHash&lt;QString, QString&gt; conf;
<a name="l00068"></a>00068   quint32 torVersion = <a class="code" href="class_abstract_tor_settings.html#a1fd0bb636bfa8131f6261b1bc11aeee4">torControl</a>()-&gt;<a class="code" href="class_tor_control.html#acd37862e652425dec4329acef6df4f3e">getTorVersion</a>();
<a name="l00069"></a>00069 
<a name="l00070"></a>00070   conf.insert(<a class="code" href="_network_settings_8cpp.html#a47847d5a92694aaa4d6f1b66c3bc09b7">SETTING_REACHABLE_ADDRESSES</a>,
<a name="l00071"></a>00071     (<a class="code" href="class_network_settings.html#a2174af01ed475ccd2d8bdcdbc5ab8224">getFascistFirewall</a>() ? 
<a name="l00072"></a>00072       <a class="code" href="class_abstract_tor_settings.html#a169f730fd477acb8f61cb5cf1026204f">localValue</a>(<a class="code" href="_network_settings_8cpp.html#a47847d5a92694aaa4d6f1b66c3bc09b7">SETTING_REACHABLE_ADDRESSES</a>).toStringList().join(<span class="stringliteral">&quot;,&quot;</span>) : <span class="stringliteral">&quot;&quot;</span>));
<a name="l00073"></a>00073  
<a name="l00074"></a>00074   QString socks4, socks5, http, https;
<a name="l00075"></a>00075   QString addr, user, pass, auth;
<a name="l00076"></a>00076 
<a name="l00077"></a>00077   addr = <a class="code" href="class_abstract_tor_settings.html#a169f730fd477acb8f61cb5cf1026204f">localValue</a>(<a class="code" href="_network_settings_8cpp.html#a11498ae4a97cb610927bbab7f189b7a3">SETTING_PROXY_ADDRESS</a>).toString();
<a name="l00078"></a>00078   user = <a class="code" href="class_abstract_tor_settings.html#a169f730fd477acb8f61cb5cf1026204f">localValue</a>(<a class="code" href="_network_settings_8cpp.html#ab4d6c0f972aade74385e4fc49be36a12">SETTING_PROXY_USERNAME</a>).toString();
<a name="l00079"></a>00079   pass = <a class="code" href="class_abstract_tor_settings.html#a169f730fd477acb8f61cb5cf1026204f">localValue</a>(<a class="code" href="_network_settings_8cpp.html#a9e124667d13255130907ab2df5c430ec">SETTING_PROXY_PASSWORD</a>).toString();
<a name="l00080"></a>00080 
<a name="l00081"></a>00081   <span class="keywordflow">if</span> (!user.isEmpty() || !pass.isEmpty())
<a name="l00082"></a>00082     auth = QString(<span class="stringliteral">&quot;%1:%2&quot;</span>).arg(user).arg(pass);
<a name="l00083"></a>00083  
<a name="l00084"></a>00084   <span class="keywordflow">switch</span> (<a class="code" href="class_network_settings.html#a3b01aabfccb63628991fa53892b92e6a">getProxyType</a>()) {
<a name="l00085"></a>00085     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188eda8016bee11a07a8b24b6f6c06c194edfa">NoProxy</a>:
<a name="l00086"></a>00086       <span class="keywordflow">break</span>;
<a name="l00087"></a>00087     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188edaae81f36418020be4547de76aadf6887d">Socks4Proxy</a>:
<a name="l00088"></a>00088       socks4 = addr;
<a name="l00089"></a>00089       <span class="keywordflow">break</span>;
<a name="l00090"></a>00090     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188edabbb2566f258235e8985048d1e141afbf">Socks5Proxy</a>:
<a name="l00091"></a>00091       socks5 = addr;
<a name="l00092"></a>00092       <span class="keywordflow">break</span>;
<a name="l00093"></a>00093     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188edad56662fa91458c01fb20aac4db49dca9">HttpProxy</a>:
<a name="l00094"></a>00094       http = addr;
<a name="l00095"></a>00095       <span class="keywordflow">break</span>;
<a name="l00096"></a>00096     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188eda18b8cb860d63626dea1a3ec5d0bb87bb">HttpHttpsProxy</a>:
<a name="l00097"></a>00097       http = addr;
<a name="l00098"></a>00098       https = http;
<a name="l00099"></a>00099       <span class="keywordflow">break</span>;
<a name="l00100"></a>00100   }
<a name="l00101"></a>00101 
<a name="l00102"></a>00102   <span class="keywordflow">if</span> (torVersion &gt;= 0x020201) {
<a name="l00103"></a>00103     <span class="comment">/* SOCKS support was implemented in 0.2.2.1 */</span>
<a name="l00104"></a>00104     conf.insert(<a class="code" href="_network_settings_8cpp.html#a23bdc5269309c692b394862389587f43">SETTING_SOCKS4_PROXY</a>, socks4);
<a name="l00105"></a>00105     conf.insert(<a class="code" href="_network_settings_8cpp.html#a97e569a74fda673b1a323fc6e459be61">SETTING_SOCKS5_PROXY</a>, socks5);
<a name="l00106"></a>00106     conf.insert(<a class="code" href="_network_settings_8cpp.html#ae62d4ab6c1547adf490578e9cb11c76d">SETTING_SOCKS5_USERNAME</a>, user);
<a name="l00107"></a>00107     conf.insert(<a class="code" href="_network_settings_8cpp.html#a49562cd5f3e8fb757d47ead9c8c50dd8">SETTING_SOCKS5_PASSWORD</a>, pass);
<a name="l00108"></a>00108   }
<a name="l00109"></a>00109 
<a name="l00110"></a>00110   conf.insert(<a class="code" href="_network_settings_8cpp.html#a278bffa95c4ef60881699deeb0b5de09">SETTING_HTTP_PROXY</a>, http);
<a name="l00111"></a>00111   conf.insert(<a class="code" href="_network_settings_8cpp.html#a4b46ad83eef8101182e94263510acb3e">SETTING_HTTPS_PROXY</a>, https);
<a name="l00112"></a>00112   conf.insert(<a class="code" href="_network_settings_8cpp.html#aa02bea03a5f54e5c750c510fb2cd5f79">SETTING_HTTP_PROXY_AUTH</a>, auth);
<a name="l00113"></a>00113   conf.insert(<a class="code" href="_network_settings_8cpp.html#aa7bda3d8580fb5b326ead7e4316de540">SETTING_HTTPS_PROXY_AUTH</a>, auth);
<a name="l00114"></a>00114 
<a name="l00115"></a>00115   <span class="keywordflow">if</span> (<a class="code" href="class_network_settings.html#a0134b7a3b1f92f1d923d5866aa19aa33">getUseBridges</a>()) {
<a name="l00116"></a>00116     <span class="comment">/* We want to always enable TunnelDirConns and friends when using</span>
<a name="l00117"></a>00117 <span class="comment">     * bridge relays. */</span>
<a name="l00118"></a>00118     conf.insert(<a class="code" href="_network_settings_8cpp.html#a0f2ece23b61521bb71eee94bac943722">SETTING_TUNNEL_DIR_CONNS</a>, <span class="stringliteral">&quot;1&quot;</span>);
<a name="l00119"></a>00119     conf.insert(<a class="code" href="_network_settings_8cpp.html#a77e1b38ab2712ce4f303b626438d3b76">SETTING_PREFER_TUNNELED_DIR_CONNS</a>, <span class="stringliteral">&quot;1&quot;</span>);
<a name="l00120"></a>00120   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (torVersion &lt;= 0x020021) {
<a name="l00121"></a>00121     <span class="comment">/* TunnelDirConns is enabled by default on Tor &gt;= 0.2.0.22-rc, so don&#39;t</span>
<a name="l00122"></a>00122 <span class="comment">     * disable it if our Tor is recent enough. */</span>
<a name="l00123"></a>00123     conf.insert(<a class="code" href="_network_settings_8cpp.html#a0f2ece23b61521bb71eee94bac943722">SETTING_TUNNEL_DIR_CONNS</a>, <span class="stringliteral">&quot;0&quot;</span>);
<a name="l00124"></a>00124     conf.insert(<a class="code" href="_network_settings_8cpp.html#a77e1b38ab2712ce4f303b626438d3b76">SETTING_PREFER_TUNNELED_DIR_CONNS</a>, <span class="stringliteral">&quot;0&quot;</span>);
<a name="l00125"></a>00125   }
<a name="l00126"></a>00126 
<a name="l00127"></a>00127   <span class="keywordflow">if</span> (torVersion &gt;= 0x020003) {
<a name="l00128"></a>00128     <span class="comment">/* Do the bridge stuff only on Tor &gt;= 0.2.0.3-alpha */</span>
<a name="l00129"></a>00129     QStringList bridges = <a class="code" href="class_abstract_tor_settings.html#a169f730fd477acb8f61cb5cf1026204f">localValue</a>(<a class="code" href="_network_settings_8cpp.html#a124adeb8e91445a9ce67c9ac7ce64346">SETTING_BRIDGE_LIST</a>).toStringList();
<a name="l00130"></a>00130     <span class="keywordflow">if</span> (<a class="code" href="class_network_settings.html#a0134b7a3b1f92f1d923d5866aa19aa33">getUseBridges</a>() &amp;&amp; !bridges.isEmpty()) {
<a name="l00131"></a>00131       conf.insert(<a class="code" href="_network_settings_8cpp.html#a6e659c4e51938ee3980de50348446c7d">SETTING_USE_BRIDGES</a>, <span class="stringliteral">&quot;1&quot;</span>);
<a name="l00132"></a>00132       conf.insert(<a class="code" href="_network_settings_8cpp.html#a85ba47ce7bac882ba5150c08ba6a86b6">SETTING_UPDATE_BRIDGES</a>, <span class="stringliteral">&quot;1&quot;</span>);
<a name="l00133"></a>00133       <span class="keywordflow">foreach</span> (QString bridge, bridges) {
<a name="l00134"></a>00134         conf.insert(<a class="code" href="_network_settings_8cpp.html#a124adeb8e91445a9ce67c9ac7ce64346">SETTING_BRIDGE_LIST</a>, bridge);
<a name="l00135"></a>00135       }
<a name="l00136"></a>00136     } <span class="keywordflow">else</span> {
<a name="l00137"></a>00137       conf.insert(<a class="code" href="_network_settings_8cpp.html#a6e659c4e51938ee3980de50348446c7d">SETTING_USE_BRIDGES</a>, <span class="stringliteral">&quot;0&quot;</span>);
<a name="l00138"></a>00138       conf.insert(<a class="code" href="_network_settings_8cpp.html#a124adeb8e91445a9ce67c9ac7ce64346">SETTING_BRIDGE_LIST</a>, <span class="stringliteral">&quot;&quot;</span>);
<a name="l00139"></a>00139       conf.insert(<a class="code" href="_network_settings_8cpp.html#a85ba47ce7bac882ba5150c08ba6a86b6">SETTING_UPDATE_BRIDGES</a>, <span class="stringliteral">&quot;0&quot;</span>);
<a name="l00140"></a>00140     }
<a name="l00141"></a>00141   }
<a name="l00142"></a>00142   <span class="keywordflow">return</span> <a class="code" href="class_abstract_tor_settings.html#a1fd0bb636bfa8131f6261b1bc11aeee4">torControl</a>()-&gt;<a class="code" href="class_tor_control.html#acd33beb0663b2a464a101c4efb425708">setConf</a>(conf, errmsg);
<a name="l00143"></a>00143 }
<a name="l00144"></a>00144 <span class="comment"></span>
<a name="l00145"></a>00145 <span class="comment">/** Returns true if we need to set ReachableAddresses because we&#39;re behind a</span>
<a name="l00146"></a>00146 <span class="comment"> * restrictive firewall that limits the ports Tor can connect to. */</span>
<a name="l00147"></a>00147 <span class="keywordtype">bool</span>
<a name="l00148"></a><a class="code" href="class_network_settings.html#a2174af01ed475ccd2d8bdcdbc5ab8224">00148</a> <a class="code" href="class_network_settings.html#a2174af01ed475ccd2d8bdcdbc5ab8224">NetworkSettings::getFascistFirewall</a>()
<a name="l00149"></a>00149 {
<a name="l00150"></a>00150   <span class="keywordflow">return</span> <a class="code" href="class_abstract_tor_settings.html#a169f730fd477acb8f61cb5cf1026204f">localValue</a>(<a class="code" href="_network_settings_8cpp.html#a7f604d831a85a25dcebd37e49db92f25">SETTING_FASCIST_FIREWALL</a>).toBool();
<a name="l00151"></a>00151 }
<a name="l00152"></a>00152 <span class="comment"></span>
<a name="l00153"></a>00153 <span class="comment">/** Sets to &lt;b&gt;fascistFirewall&lt;/b&gt; whether Tor should only create outgoing</span>
<a name="l00154"></a>00154 <span class="comment"> * connections to the list of ports specified in setReachablePorts().</span>
<a name="l00155"></a>00155 <span class="comment"> * \sa setReachablePorts() */</span>
<a name="l00156"></a>00156 <span class="keywordtype">void</span>
<a name="l00157"></a><a class="code" href="class_network_settings.html#acd47f94ca232e19847cebf7b2c327999">00157</a> <a class="code" href="class_network_settings.html#acd47f94ca232e19847cebf7b2c327999">NetworkSettings::setFascistFirewall</a>(<span class="keywordtype">bool</span> fascistFirewall)
<a name="l00158"></a>00158 {
<a name="l00159"></a>00159   <a class="code" href="class_abstract_tor_settings.html#a29b7abc52f7dfcb1453aafa28f902789">setValue</a>(<a class="code" href="_network_settings_8cpp.html#a7f604d831a85a25dcebd37e49db92f25">SETTING_FASCIST_FIREWALL</a>, fascistFirewall);
<a name="l00160"></a>00160 }
<a name="l00161"></a>00161 <span class="comment"></span>
<a name="l00162"></a>00162 <span class="comment">/** Returns a list of ports to be specified in ReachableAddresses. */</span>
<a name="l00163"></a>00163 QList&lt;quint16&gt;
<a name="l00164"></a><a class="code" href="class_network_settings.html#a25a3bf9cbf78838b76acc745304bff3e">00164</a> <a class="code" href="class_network_settings.html#a25a3bf9cbf78838b76acc745304bff3e">NetworkSettings::getReachablePorts</a>()
<a name="l00165"></a>00165 {
<a name="l00166"></a>00166   QList&lt;quint16&gt; reachablePorts;
<a name="l00167"></a>00167   QStringList lineList;
<a name="l00168"></a>00168   <span class="keywordtype">bool</span> ok;
<a name="l00169"></a>00169 
<a name="l00170"></a>00170   lineList = <a class="code" href="class_abstract_tor_settings.html#a6c2c0255bf7d89a14f1ad9ebdd6bf2ef">value</a>(<a class="code" href="_network_settings_8cpp.html#a47847d5a92694aaa4d6f1b66c3bc09b7">SETTING_REACHABLE_ADDRESSES</a>).toStringList();
<a name="l00171"></a>00171   <span class="keywordflow">foreach</span> (QString line, lineList) {
<a name="l00172"></a>00172     <span class="keywordflow">foreach</span> (QString address, line.split(<span class="stringliteral">&quot;,&quot;</span>, QString::SkipEmptyParts)) {
<a name="l00173"></a>00173       QStringList parts = address.split(<span class="stringliteral">&quot;:&quot;</span>);
<a name="l00174"></a>00174       <span class="keywordflow">if</span> (parts.size() &gt;= 2) {
<a name="l00175"></a>00175         quint16 port = parts.at(1).toUInt(&amp;ok);
<a name="l00176"></a>00176         <span class="keywordflow">if</span> (ok)
<a name="l00177"></a>00177           reachablePorts &lt;&lt; port;
<a name="l00178"></a>00178       }
<a name="l00179"></a>00179     }
<a name="l00180"></a>00180   }
<a name="l00181"></a>00181   <span class="keywordflow">return</span> reachablePorts;
<a name="l00182"></a>00182 }
<a name="l00183"></a>00183 <span class="comment"></span>
<a name="l00184"></a>00184 <span class="comment">/** Sets the list of ports that will be specified in ReachableAddresses to</span>
<a name="l00185"></a>00185 <span class="comment"> * &lt;b&gt;reachablePorts&lt;/b&gt;. */</span>
<a name="l00186"></a>00186 <span class="keywordtype">void</span>
<a name="l00187"></a><a class="code" href="class_network_settings.html#a4dc84084b9adf7d18f8c40b457a9fce1">00187</a> <a class="code" href="class_network_settings.html#a4dc84084b9adf7d18f8c40b457a9fce1">NetworkSettings::setReachablePorts</a>(<span class="keyword">const</span> QList&lt;quint16&gt; &amp;reachablePorts)
<a name="l00188"></a>00188 {
<a name="l00189"></a>00189   <span class="keywordflow">if</span> (!reachablePorts.isEmpty()) {
<a name="l00190"></a>00190     QStringList portList;
<a name="l00191"></a>00191     <span class="keywordflow">foreach</span> (quint16 port, reachablePorts) {
<a name="l00192"></a>00192       portList &lt;&lt; <span class="stringliteral">&quot;*:&quot;</span> + QString::number(port);
<a name="l00193"></a>00193     }
<a name="l00194"></a>00194     <a class="code" href="class_abstract_tor_settings.html#a29b7abc52f7dfcb1453aafa28f902789">setValue</a>(<a class="code" href="_network_settings_8cpp.html#a47847d5a92694aaa4d6f1b66c3bc09b7">SETTING_REACHABLE_ADDRESSES</a>, portList);
<a name="l00195"></a>00195   }
<a name="l00196"></a>00196 }
<a name="l00197"></a>00197 <span class="comment"></span>
<a name="l00198"></a>00198 <span class="comment">/** Returns the proxy type Tor is using, or NoProxy if it makes direct</span>
<a name="l00199"></a>00199 <span class="comment"> * connections. */</span> 
<a name="l00200"></a>00200 <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188ed">NetworkSettings::ProxyType</a>
<a name="l00201"></a><a class="code" href="class_network_settings.html#a3b01aabfccb63628991fa53892b92e6a">00201</a> <a class="code" href="class_network_settings.html#a3b01aabfccb63628991fa53892b92e6a">NetworkSettings::getProxyType</a>()
<a name="l00202"></a>00202 {
<a name="l00203"></a>00203   QString type = <a class="code" href="class_abstract_tor_settings.html#a6c2c0255bf7d89a14f1ad9ebdd6bf2ef">value</a>(<a class="code" href="_network_settings_8cpp.html#a7efe93803fe87b60c4f076d893ec6d32">SETTING_PROXY_TYPE</a>).toString();
<a name="l00204"></a>00204   <span class="keywordflow">return</span> <a class="code" href="class_network_settings.html#a9d4dc3be450cc12eb8386bbd49ea99ab">proxyTypeFromString</a>(type);
<a name="l00205"></a>00205 }
<a name="l00206"></a>00206 <span class="comment"></span>
<a name="l00207"></a>00207 <span class="comment">/** Set the type of proxy Tor should use to &lt;b&gt;type&lt;/b&gt;. */</span>
<a name="l00208"></a>00208 <span class="keywordtype">void</span>
<a name="l00209"></a><a class="code" href="class_network_settings.html#ae4d73a95169ce0d97c6c921a37d1192f">00209</a> <a class="code" href="class_network_settings.html#ae4d73a95169ce0d97c6c921a37d1192f">NetworkSettings::setProxyType</a>(<a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188ed">ProxyType</a> type)
<a name="l00210"></a>00210 {
<a name="l00211"></a>00211   <a class="code" href="class_abstract_tor_settings.html#a29b7abc52f7dfcb1453aafa28f902789">setValue</a>(<a class="code" href="_network_settings_8cpp.html#a7efe93803fe87b60c4f076d893ec6d32">SETTING_PROXY_TYPE</a>, <a class="code" href="class_network_settings.html#a78573ac3a57ebcf990253ac005e71b48">proxyTypeToString</a>(type));
<a name="l00212"></a>00212 }
<a name="l00213"></a>00213 <span class="comment"></span>
<a name="l00214"></a>00214 <span class="comment">/** Returns the address of the proxy server Tor makes connections through. */</span>
<a name="l00215"></a>00215 QString
<a name="l00216"></a><a class="code" href="class_network_settings.html#a164b86e903ecee31fa3d5e76e28c9373">00216</a> <a class="code" href="class_network_settings.html#a164b86e903ecee31fa3d5e76e28c9373">NetworkSettings::getProxyAddress</a>()
<a name="l00217"></a>00217 {
<a name="l00218"></a>00218   <span class="keywordflow">return</span> <a class="code" href="class_abstract_tor_settings.html#a6c2c0255bf7d89a14f1ad9ebdd6bf2ef">value</a>(<a class="code" href="_network_settings_8cpp.html#a11498ae4a97cb610927bbab7f189b7a3">SETTING_PROXY_ADDRESS</a>).toString();
<a name="l00219"></a>00219 }
<a name="l00220"></a>00220 <span class="comment"></span>
<a name="l00221"></a>00221 <span class="comment">/** Sets the proxy address and port to &lt;b&gt;addr&lt;/b&gt;. */</span>
<a name="l00222"></a>00222 <span class="keywordtype">void</span>
<a name="l00223"></a><a class="code" href="class_network_settings.html#acc05b7d7bc14c1e9ad0a91683baacefc">00223</a> <a class="code" href="class_network_settings.html#acc05b7d7bc14c1e9ad0a91683baacefc">NetworkSettings::setProxyAddress</a>(<span class="keyword">const</span> QString &amp;addr)
<a name="l00224"></a>00224 {
<a name="l00225"></a>00225   <a class="code" href="class_abstract_tor_settings.html#a29b7abc52f7dfcb1453aafa28f902789">setValue</a>(<a class="code" href="_network_settings_8cpp.html#a11498ae4a97cb610927bbab7f189b7a3">SETTING_PROXY_ADDRESS</a>, addr);
<a name="l00226"></a>00226 }
<a name="l00227"></a>00227 <span class="comment"></span>
<a name="l00228"></a>00228 <span class="comment">/** Returns the username used to login to the proxy server. */</span>
<a name="l00229"></a>00229 QString
<a name="l00230"></a><a class="code" href="class_network_settings.html#a587246b09f4a3d4185b08f7b2410de97">00230</a> <a class="code" href="class_network_settings.html#a587246b09f4a3d4185b08f7b2410de97">NetworkSettings::getProxyUsername</a>()
<a name="l00231"></a>00231 {
<a name="l00232"></a>00232   <span class="keywordflow">return</span> <a class="code" href="class_abstract_tor_settings.html#a6c2c0255bf7d89a14f1ad9ebdd6bf2ef">value</a>(<a class="code" href="_network_settings_8cpp.html#ab4d6c0f972aade74385e4fc49be36a12">SETTING_PROXY_USERNAME</a>).toString();
<a name="l00233"></a>00233 }
<a name="l00234"></a>00234 <span class="comment"></span>
<a name="l00235"></a>00235 <span class="comment">/** Sets the proxy server username to &lt;b&gt;user&lt;/b&gt;. */</span> 
<a name="l00236"></a>00236 <span class="keywordtype">void</span>
<a name="l00237"></a><a class="code" href="class_network_settings.html#a444fb3c8e2998fc54b1256985e9737c5">00237</a> <a class="code" href="class_network_settings.html#a444fb3c8e2998fc54b1256985e9737c5">NetworkSettings::setProxyUsername</a>(<span class="keyword">const</span> QString &amp;user)
<a name="l00238"></a>00238 {
<a name="l00239"></a>00239   <a class="code" href="class_abstract_tor_settings.html#a29b7abc52f7dfcb1453aafa28f902789">setValue</a>(<a class="code" href="_network_settings_8cpp.html#ab4d6c0f972aade74385e4fc49be36a12">SETTING_PROXY_USERNAME</a>, user);
<a name="l00240"></a>00240 }
<a name="l00241"></a>00241 <span class="comment"></span>
<a name="l00242"></a>00242 <span class="comment">/** Returns the password used to login to the proxy server. */</span>
<a name="l00243"></a>00243 QString
<a name="l00244"></a><a class="code" href="class_network_settings.html#abc8f9bb63d97bc74e5b40d5be91d249b">00244</a> <a class="code" href="class_network_settings.html#abc8f9bb63d97bc74e5b40d5be91d249b">NetworkSettings::getProxyPassword</a>()
<a name="l00245"></a>00245 {
<a name="l00246"></a>00246   <span class="keywordflow">return</span> <a class="code" href="class_abstract_tor_settings.html#a6c2c0255bf7d89a14f1ad9ebdd6bf2ef">value</a>(<a class="code" href="_network_settings_8cpp.html#a9e124667d13255130907ab2df5c430ec">SETTING_PROXY_PASSWORD</a>).toString();
<a name="l00247"></a>00247 }
<a name="l00248"></a>00248 <span class="comment"></span>
<a name="l00249"></a>00249 <span class="comment">/** Sets the proxy server password to &lt;b&gt;pass&lt;/b&gt;. */</span> 
<a name="l00250"></a>00250 <span class="keywordtype">void</span>
<a name="l00251"></a><a class="code" href="class_network_settings.html#ad41947311b37876a8ab7390c96577ca1">00251</a> <a class="code" href="class_network_settings.html#ad41947311b37876a8ab7390c96577ca1">NetworkSettings::setProxyPassword</a>(<span class="keyword">const</span> QString &amp;pass)
<a name="l00252"></a>00252 {
<a name="l00253"></a>00253   <a class="code" href="class_abstract_tor_settings.html#a29b7abc52f7dfcb1453aafa28f902789">setValue</a>(<a class="code" href="_network_settings_8cpp.html#a9e124667d13255130907ab2df5c430ec">SETTING_PROXY_PASSWORD</a>, pass);
<a name="l00254"></a>00254 }
<a name="l00255"></a>00255 <span class="comment"></span>
<a name="l00256"></a>00256 <span class="comment">/** Returns true if Tor should try to use bridge nodes to access the Tor</span>
<a name="l00257"></a>00257 <span class="comment"> * network. */</span>
<a name="l00258"></a>00258 <span class="keywordtype">bool</span>
<a name="l00259"></a><a class="code" href="class_network_settings.html#a0134b7a3b1f92f1d923d5866aa19aa33">00259</a> <a class="code" href="class_network_settings.html#a0134b7a3b1f92f1d923d5866aa19aa33">NetworkSettings::getUseBridges</a>()
<a name="l00260"></a>00260 {
<a name="l00261"></a>00261   <span class="keywordflow">return</span> <a class="code" href="class_abstract_tor_settings.html#a6c2c0255bf7d89a14f1ad9ebdd6bf2ef">value</a>(<a class="code" href="_network_settings_8cpp.html#a6e659c4e51938ee3980de50348446c7d">SETTING_USE_BRIDGES</a>).toBool();
<a name="l00262"></a>00262 }
<a name="l00263"></a>00263 <span class="comment"></span>
<a name="l00264"></a>00264 <span class="comment">/** Sets to &lt;b&gt;useBridges&lt;/b&gt; whether Tor should try to use bridge nodes</span>
<a name="l00265"></a>00265 <span class="comment"> * to access the Tor network. */</span>
<a name="l00266"></a>00266 <span class="keywordtype">void</span>
<a name="l00267"></a><a class="code" href="class_network_settings.html#a82d762b9ab3f4dbc8b344cf5adeadfa2">00267</a> <a class="code" href="class_network_settings.html#a82d762b9ab3f4dbc8b344cf5adeadfa2">NetworkSettings::setUseBridges</a>(<span class="keywordtype">bool</span> useBridges)
<a name="l00268"></a>00268 {
<a name="l00269"></a>00269   <a class="code" href="class_abstract_tor_settings.html#a29b7abc52f7dfcb1453aafa28f902789">setValue</a>(<a class="code" href="_network_settings_8cpp.html#a6e659c4e51938ee3980de50348446c7d">SETTING_USE_BRIDGES</a>, useBridges);
<a name="l00270"></a>00270 }
<a name="l00271"></a>00271 <span class="comment"></span>
<a name="l00272"></a>00272 <span class="comment">/** Returns a list of bridge nodes Tor should use. */</span>
<a name="l00273"></a>00273 QStringList
<a name="l00274"></a><a class="code" href="class_network_settings.html#a3fdeb020e11705d0bea8a79857ea2741">00274</a> <a class="code" href="class_network_settings.html#a3fdeb020e11705d0bea8a79857ea2741">NetworkSettings::getBridgeList</a>()
<a name="l00275"></a>00275 {
<a name="l00276"></a>00276   <span class="keywordflow">return</span> <a class="code" href="class_abstract_tor_settings.html#a6c2c0255bf7d89a14f1ad9ebdd6bf2ef">value</a>(<a class="code" href="_network_settings_8cpp.html#a124adeb8e91445a9ce67c9ac7ce64346">SETTING_BRIDGE_LIST</a>).toStringList();
<a name="l00277"></a>00277 }
<a name="l00278"></a>00278 <span class="comment"></span>
<a name="l00279"></a>00279 <span class="comment">/** Sets to &lt;b&gt;bridgeList&lt;/b&gt; the list of bridge nodes Tor should use. */</span>
<a name="l00280"></a>00280 <span class="keywordtype">void</span>
<a name="l00281"></a><a class="code" href="class_network_settings.html#a6097f3473caa35ef08097db577984520">00281</a> <a class="code" href="class_network_settings.html#a6097f3473caa35ef08097db577984520">NetworkSettings::setBridgeList</a>(<span class="keyword">const</span> QStringList &amp;bridgeList)
<a name="l00282"></a>00282 {
<a name="l00283"></a>00283   <a class="code" href="class_abstract_tor_settings.html#a29b7abc52f7dfcb1453aafa28f902789">setValue</a>(<a class="code" href="_network_settings_8cpp.html#a124adeb8e91445a9ce67c9ac7ce64346">SETTING_BRIDGE_LIST</a>, bridgeList);
<a name="l00284"></a>00284 }
<a name="l00285"></a>00285 <span class="comment"></span>
<a name="l00286"></a>00286 <span class="comment">/** Returns true if Tor is configured to try to tunnel its directory</span>
<a name="l00287"></a>00287 <span class="comment"> * connections through a one-hop circuit. */</span>
<a name="l00288"></a>00288 <span class="keywordtype">bool</span>
<a name="l00289"></a><a class="code" href="class_network_settings.html#a8514746f2519a0e2f1e9b6c68c4e1e35">00289</a> <a class="code" href="class_network_settings.html#a8514746f2519a0e2f1e9b6c68c4e1e35">NetworkSettings::getTunnelDirConns</a>()
<a name="l00290"></a>00290 {
<a name="l00291"></a>00291   <span class="keywordflow">return</span> <a class="code" href="class_abstract_tor_settings.html#a6c2c0255bf7d89a14f1ad9ebdd6bf2ef">value</a>(<a class="code" href="_network_settings_8cpp.html#a0f2ece23b61521bb71eee94bac943722">SETTING_TUNNEL_DIR_CONNS</a>).toBool();
<a name="l00292"></a>00292 }
<a name="l00293"></a>00293 <span class="comment"></span>
<a name="l00294"></a>00294 <span class="comment">/** Converts the ProxyType &lt;b&gt;type&lt;/b&gt; to a string to store in the</span>
<a name="l00295"></a>00295 <span class="comment"> * configuration file. */</span>
<a name="l00296"></a>00296 QString
<a name="l00297"></a><a class="code" href="class_network_settings.html#a78573ac3a57ebcf990253ac005e71b48">00297</a> <a class="code" href="class_network_settings.html#a78573ac3a57ebcf990253ac005e71b48">NetworkSettings::proxyTypeToString</a>(<a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188ed">ProxyType</a> type)
<a name="l00298"></a>00298 {
<a name="l00299"></a>00299   QString ret;
<a name="l00300"></a>00300 
<a name="l00301"></a>00301   <span class="keywordflow">switch</span> (type) {
<a name="l00302"></a>00302     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188edaae81f36418020be4547de76aadf6887d">Socks4Proxy</a>:
<a name="l00303"></a>00303       ret = <span class="stringliteral">&quot;socks4&quot;</span>;
<a name="l00304"></a>00304       <span class="keywordflow">break</span>;
<a name="l00305"></a>00305     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188edabbb2566f258235e8985048d1e141afbf">Socks5Proxy</a>:
<a name="l00306"></a>00306       ret = <span class="stringliteral">&quot;socks5&quot;</span>;
<a name="l00307"></a>00307       <span class="keywordflow">break</span>;
<a name="l00308"></a>00308     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188edad56662fa91458c01fb20aac4db49dca9">HttpProxy</a>:
<a name="l00309"></a>00309       ret = <span class="stringliteral">&quot;http&quot;</span>;
<a name="l00310"></a>00310       <span class="keywordflow">break</span>;
<a name="l00311"></a>00311     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188eda18b8cb860d63626dea1a3ec5d0bb87bb">HttpHttpsProxy</a>:
<a name="l00312"></a>00312       ret = <span class="stringliteral">&quot;httphttps&quot;</span>;
<a name="l00313"></a>00313       <span class="keywordflow">break</span>;
<a name="l00314"></a>00314     <span class="keywordflow">case</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188eda8016bee11a07a8b24b6f6c06c194edfa">NoProxy</a>:
<a name="l00315"></a>00315     <span class="keywordflow">default</span>:
<a name="l00316"></a>00316       ret = <span class="stringliteral">&quot;none&quot;</span>;
<a name="l00317"></a>00317       <span class="keywordflow">break</span>;
<a name="l00318"></a>00318   }
<a name="l00319"></a>00319 
<a name="l00320"></a>00320   <span class="keywordflow">return</span> ret;
<a name="l00321"></a>00321 }
<a name="l00322"></a>00322 <span class="comment"></span>
<a name="l00323"></a>00323 <span class="comment">/** Converts the proxy type string &lt;b&gt;type&lt;/b&gt; to its ProxyType counterpart. */</span>
<a name="l00324"></a>00324 <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188ed">NetworkSettings::ProxyType</a>
<a name="l00325"></a><a class="code" href="class_network_settings.html#a9d4dc3be450cc12eb8386bbd49ea99ab">00325</a> <a class="code" href="class_network_settings.html#a9d4dc3be450cc12eb8386bbd49ea99ab">NetworkSettings::proxyTypeFromString</a>(<span class="keyword">const</span> QString &amp;type)
<a name="l00326"></a>00326 {
<a name="l00327"></a>00327   QString str = type.toLower();
<a name="l00328"></a>00328   
<a name="l00329"></a>00329   <span class="keywordflow">if</span> (str == <span class="stringliteral">&quot;socks4&quot;</span>)
<a name="l00330"></a>00330     <span class="keywordflow">return</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188edaae81f36418020be4547de76aadf6887d">Socks4Proxy</a>;
<a name="l00331"></a>00331   <span class="keywordflow">if</span> (str == <span class="stringliteral">&quot;socks5&quot;</span>)
<a name="l00332"></a>00332     <span class="keywordflow">return</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188edabbb2566f258235e8985048d1e141afbf">Socks5Proxy</a>;
<a name="l00333"></a>00333   <span class="keywordflow">if</span> (str == <span class="stringliteral">&quot;http&quot;</span>)
<a name="l00334"></a>00334     <span class="keywordflow">return</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188edad56662fa91458c01fb20aac4db49dca9">HttpProxy</a>;
<a name="l00335"></a>00335   <span class="keywordflow">if</span> (str == <span class="stringliteral">&quot;httphttps&quot;</span>)
<a name="l00336"></a>00336     <span class="keywordflow">return</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188eda18b8cb860d63626dea1a3ec5d0bb87bb">HttpHttpsProxy</a>;
<a name="l00337"></a>00337 
<a name="l00338"></a>00338   <span class="keywordflow">return</span> <a class="code" href="class_network_settings.html#ad716228c2e5cb51a41889702589188eda8016bee11a07a8b24b6f6c06c194edfa">NoProxy</a>;
<a name="l00339"></a>00339 }
<a name="l00340"></a>00340 
</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>