Vidalia 0.3.1
NetworkSettings.h
Go to the documentation of this file.
1/*
2** This file is part of Vidalia, and is subject to the license terms in the
3** LICENSE file, found in the top level directory of this distribution. If you
4** did not receive the LICENSE file with this file, you may obtain it from the
5** Vidalia source package distributed by the Vidalia Project at
6** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7** including this file, may be copied, modified, propagated, or distributed
8** except according to the terms described in the LICENSE file.
9*/
10
11/*
12** \file NetworkSettings.h
13** \brief Settings for configuring an HTTP/HTTPS proxy or bridges
14*/
15
16#ifndef _NETWORKSETTINGS_H
17#define _NETWORKSETTINGS_H
18
19#include "AbstractTorSettings.h"
20
21#include <QList>
22#include <QStringList>
23
24
26{
27 Q_OBJECT
28
29public:
31 {
33 NoProxy = -1, /**< Have Tor connect directly to the Internet. */
34 Socks4Proxy = 0, /**< Use a SOCKS 4 proxy for OR connections. */
35 Socks5Proxy = 1, /**< Use a SOCKS 5 proxy for OR connections. */
36 HttpHttpsProxy = 2, /**< Use HTTP proxy for both dir and OR connections. */
37 ProxyTypeMax = 2
38 };
39
40public:
41 /** Default constructor. */
43
44 /** Applies the current network configuration settings to Tor. If
45 * * <b>errmsg</b> is specified and an error occurs while applying the
46 * settings, it will be set to a string describing the error. */
47 bool apply(QString *errmsg = 0);
48
49 /** Returns true if we need to set ReachableAddresses because we're behind a
50 * restrictive firewall that limits the ports Tor can connect to. */
51 bool getFascistFirewall();
52 /** Sets to <b>fascistFirewall</b> whether Tor should only create outgoing
53 * connections to the list of ports specified to setReachablePorts().
54 * \sa setReachablePorts() */
55 void setFascistFirewall(bool fascistFirewall);
56
57 /** Returns a list of ports to be specified in ReachableAddresses. */
58 QList<quint16> getReachablePorts();
59 /** Sets the list of ports that will be specified in ReachableAddresses to
60 * <b>reachablePorts</b>. */
61 void setReachablePorts(const QList<quint16> &reachablePorts);
62
63 /** Returns the proxy type Tor is using, or NoProxy if it makes direct
64 * connections. */
66 /** Set the type of proxy Tor should use to <b>type</b>. */
67 void setProxyType(ProxyType type);
68
69 /** Returns the address of the proxy server Tor makes connections through. */
70 QString getProxyAddress();
71 /** Sets the proxy address and port to <b>addr</b>. */
72 void setProxyAddress(const QString &addr);
73
74 /** Returns the username used to login to the proxy server. */
75 QString getProxyUsername();
76 /** Sets the proxy server username to <b>user</b>. */
77 void setProxyUsername(const QString &user);
78
79 /** Returns the password used to login to the proxy server. */
80 QString getProxyPassword();
81 /** Sets the proxy server password to <b>pass</b>. */
82 void setProxyPassword(const QString &pass);
83
84 /** Returns true if Tor should try to use bridge nodes to access the Tor
85 * network. */
86 bool getUseBridges();
87 /** Sets to <b>useBridges</b> whether Tor should try to use bridge nodes
88 * to access the Tor network. */
89 void setUseBridges(bool useBridges);
90
91 /** Returns a list of bridge nodes Tor should use. */
92 QStringList getBridgeList();
93 /** Sets to <b>bridgeList</b> the list of bridge nodes Tor should use. */
94 void setBridgeList(const QStringList &bridgeList);
95
96 /** Returns true if Tor is configured to try to tunnel its directory
97 * connections through a one-hop circuit. */
98 bool getTunnelDirConns();
99
100private:
101 /** Converts the ProxyType <b>type</b> to a string to store in the
102 * configuration file. */
103 QString proxyTypeToString(ProxyType type);
104
105 /** Converts the proxy type string <b>type</b> to its ProxyType counterpart. */
106 ProxyType proxyTypeFromString(const QString &type);
107};
108
109#endif
110
TorControl * torControl() const
QString getProxyAddress()
QList< quint16 > getReachablePorts()
ProxyType getProxyType()
QStringList getBridgeList()
void setProxyUsername(const QString &user)
void setReachablePorts(const QList< quint16 > &reachablePorts)
NetworkSettings(TorControl *torControl)
QString getProxyUsername()
bool apply(QString *errmsg=0)
void setBridgeList(const QStringList &bridgeList)
QString proxyTypeToString(ProxyType type)
void setUseBridges(bool useBridges)
ProxyType proxyTypeFromString(const QString &type)
QString getProxyPassword()
void setProxyAddress(const QString &addr)
void setFascistFirewall(bool fascistFirewall)
void setProxyPassword(const QString &pass)
void setProxyType(ProxyType type)