Vidalia  0.3.1
Public Types | Public Member Functions | Private Member Functions | List of all members
NetworkSettings Class Reference

#include <NetworkSettings.h>

Inheritance diagram for NetworkSettings:
AbstractTorSettings VSettings

Public Types

enum  ProxyType {
  ProxyTypeMin = -1, NoProxy = -1, Socks4Proxy = 0, Socks5Proxy = 1,
  HttpHttpsProxy = 2, ProxyTypeMax = 2
}
 

Public Member Functions

 NetworkSettings (TorControl *torControl)
 
bool apply (QString *errmsg=0)
 
bool getFascistFirewall ()
 
void setFascistFirewall (bool fascistFirewall)
 
QList< quint16 > getReachablePorts ()
 
void setReachablePorts (const QList< quint16 > &reachablePorts)
 
ProxyType getProxyType ()
 
void setProxyType (ProxyType type)
 
QString getProxyAddress ()
 
void setProxyAddress (const QString &addr)
 
QString getProxyUsername ()
 
void setProxyUsername (const QString &user)
 
QString getProxyPassword ()
 
void setProxyPassword (const QString &pass)
 
bool getUseBridges ()
 
void setUseBridges (bool useBridges)
 
QStringList getBridgeList ()
 
void setBridgeList (const QStringList &bridgeList)
 
bool getTunnelDirConns ()
 
- Public Member Functions inherited from AbstractTorSettings
 AbstractTorSettings (const QString &group, TorControl *torControl=0)
 
void setChanged (bool changed)
 
virtual bool changedSinceLastApply () const
 
virtual void revert ()
 
- Public Member Functions inherited from VSettings
 VSettings (const QString group=QString())
 
virtual QVariant value (const QString &key, const QVariant &defaultVal=QVariant()) const
 

Private Member Functions

QString proxyTypeToString (ProxyType type)
 
ProxyType proxyTypeFromString (const QString &type)
 

Additional Inherited Members

- Static Public Member Functions inherited from VSettings
static QString settingsFile ()
 
static bool settingsFileExists ()
 
static void reset ()
 
- Protected Member Functions inherited from AbstractTorSettings
virtual QVariant value (const QString &key) const
 
virtual QVariant localValue (const QString &key) const
 
virtual QVariant torValue (const QString &key) const
 
virtual void setValue (const QString &key, const QVariant &value)
 
bool isEmptyValue (const QVariant &value) const
 
TorControltorControl () const
 
- Protected Member Functions inherited from VSettings
void setDefault (const QString &key, const QVariant &val)
 
QVariant defaultValue (const QString &key) const
 
QMap< QString, QVariantallSettings () const
 

Detailed Description

Definition at line 25 of file NetworkSettings.h.

Member Enumeration Documentation

◆ ProxyType

Enumerator
ProxyTypeMin 
NoProxy 

Have Tor connect directly to the Internet.

Socks4Proxy 

Use a SOCKS 4 proxy for OR connections.

Socks5Proxy 

Use a SOCKS 5 proxy for OR connections.

HttpHttpsProxy 

Use HTTP proxy for both dir and OR connections.

ProxyTypeMax 

Definition at line 30 of file NetworkSettings.h.

Constructor & Destructor Documentation

◆ NetworkSettings()

NetworkSettings::NetworkSettings ( TorControl torControl)

Member Function Documentation

◆ apply()

bool NetworkSettings::apply ( QString *  errmsg = 0)
virtual

Applies the current network configuration settings to Tor. If

  • errmsg is specified and an error occurs while applying the settings, it will be set to a string describing the error.

Applies the current network configuration settings to Tor. If errmsg is specified and an error occurs while applying the settings, it will be set to a string describing the error.

Implements AbstractTorSettings.

Definition at line 63 of file NetworkSettings.cpp.

References getFascistFirewall(), getProxyType(), TorControl::getTorVersion(), getUseBridges(), HttpHttpsProxy, AbstractTorSettings::localValue(), NoProxy, quint32, TorControl::setConf(), SETTING_BRIDGE_LIST, SETTING_HTTPS_PROXY, SETTING_HTTPS_PROXY_AUTH, SETTING_PREFER_TUNNELED_DIR_CONNS, SETTING_PROXY_ADDRESS, SETTING_PROXY_PASSWORD, SETTING_PROXY_USERNAME, SETTING_REACHABLE_ADDRESSES, SETTING_SOCKS4_PROXY, SETTING_SOCKS5_PASSWORD, SETTING_SOCKS5_PROXY, SETTING_SOCKS5_USERNAME, SETTING_TUNNEL_DIR_CONNS, SETTING_UPDATE_BRIDGES, SETTING_USE_BRIDGES, Socks4Proxy, Socks5Proxy, and AbstractTorSettings::torControl().

Referenced by NetworkPage::apply().

◆ getBridgeList()

QStringList NetworkSettings::getBridgeList ( )

Returns a list of bridge nodes Tor should use.

Definition at line 267 of file NetworkSettings.cpp.

References SETTING_BRIDGE_LIST, and AbstractTorSettings::value().

Referenced by NetworkPage::load().

◆ getFascistFirewall()

bool NetworkSettings::getFascistFirewall ( )

Returns true if we need to set ReachableAddresses because we're behind a restrictive firewall that limits the ports Tor can connect to.

Definition at line 141 of file NetworkSettings.cpp.

References AbstractTorSettings::localValue(), and SETTING_FASCIST_FIREWALL.

Referenced by apply(), and NetworkPage::load().

◆ getProxyAddress()

QString NetworkSettings::getProxyAddress ( )

Returns the address of the proxy server Tor makes connections through.

Definition at line 209 of file NetworkSettings.cpp.

References SETTING_PROXY_ADDRESS, and AbstractTorSettings::value().

Referenced by NetworkPage::load().

◆ getProxyPassword()

QString NetworkSettings::getProxyPassword ( )

Returns the password used to login to the proxy server.

Definition at line 237 of file NetworkSettings.cpp.

References SETTING_PROXY_PASSWORD, and AbstractTorSettings::value().

Referenced by NetworkPage::load().

◆ getProxyType()

NetworkSettings::ProxyType NetworkSettings::getProxyType ( )

Returns the proxy type Tor is using, or NoProxy if it makes direct connections.

Definition at line 194 of file NetworkSettings.cpp.

References proxyTypeFromString(), SETTING_PROXY_TYPE, and AbstractTorSettings::value().

Referenced by apply(), and NetworkPage::load().

◆ getProxyUsername()

QString NetworkSettings::getProxyUsername ( )

Returns the username used to login to the proxy server.

Definition at line 223 of file NetworkSettings.cpp.

References SETTING_PROXY_USERNAME, and AbstractTorSettings::value().

Referenced by NetworkPage::load().

◆ getReachablePorts()

QList< quint16 > NetworkSettings::getReachablePorts ( )

Returns a list of ports to be specified in ReachableAddresses.

Definition at line 157 of file NetworkSettings.cpp.

References SETTING_REACHABLE_ADDRESSES, and AbstractTorSettings::value().

Referenced by NetworkPage::load().

◆ getTunnelDirConns()

bool NetworkSettings::getTunnelDirConns ( )

Returns true if Tor is configured to try to tunnel its directory connections through a one-hop circuit.

Definition at line 282 of file NetworkSettings.cpp.

References SETTING_TUNNEL_DIR_CONNS, and AbstractTorSettings::value().

◆ getUseBridges()

bool NetworkSettings::getUseBridges ( )

Returns true if Tor should try to use bridge nodes to access the Tor network.

Definition at line 252 of file NetworkSettings.cpp.

References SETTING_USE_BRIDGES, and AbstractTorSettings::value().

Referenced by apply(), and NetworkPage::load().

◆ proxyTypeFromString()

NetworkSettings::ProxyType NetworkSettings::proxyTypeFromString ( const QString &  type)
private

Converts the proxy type string type to its ProxyType counterpart.

Definition at line 315 of file NetworkSettings.cpp.

References HttpHttpsProxy, NoProxy, Socks4Proxy, and Socks5Proxy.

Referenced by getProxyType().

◆ proxyTypeToString()

QString NetworkSettings::proxyTypeToString ( ProxyType  type)
private

Converts the ProxyType type to a string to store in the configuration file.

Definition at line 290 of file NetworkSettings.cpp.

References HttpHttpsProxy, NoProxy, Socks4Proxy, and Socks5Proxy.

Referenced by setProxyType().

◆ setBridgeList()

void NetworkSettings::setBridgeList ( const QStringList &  bridgeList)

Sets to bridgeList the list of bridge nodes Tor should use.

Definition at line 274 of file NetworkSettings.cpp.

References SETTING_BRIDGE_LIST, and AbstractTorSettings::setValue().

Referenced by NetworkPage::save().

◆ setFascistFirewall()

void NetworkSettings::setFascistFirewall ( bool  fascistFirewall)

Sets to fascistFirewall whether Tor should only create outgoing connections to the list of ports specified to setReachablePorts().

See also
setReachablePorts()

Sets to fascistFirewall whether Tor should only create outgoing connections to the list of ports specified in setReachablePorts().

See also
setReachablePorts()

Definition at line 150 of file NetworkSettings.cpp.

References SETTING_FASCIST_FIREWALL, and AbstractTorSettings::setValue().

Referenced by NetworkPage::save().

◆ setProxyAddress()

void NetworkSettings::setProxyAddress ( const QString &  addr)

Sets the proxy address and port to addr.

Definition at line 216 of file NetworkSettings.cpp.

References SETTING_PROXY_ADDRESS, and AbstractTorSettings::setValue().

Referenced by NetworkPage::save().

◆ setProxyPassword()

void NetworkSettings::setProxyPassword ( const QString &  pass)

Sets the proxy server password to pass.

Definition at line 244 of file NetworkSettings.cpp.

References SETTING_PROXY_PASSWORD, and AbstractTorSettings::setValue().

Referenced by NetworkPage::save().

◆ setProxyType()

void NetworkSettings::setProxyType ( ProxyType  type)

Set the type of proxy Tor should use to type.

Definition at line 202 of file NetworkSettings.cpp.

References proxyTypeToString(), SETTING_PROXY_TYPE, and AbstractTorSettings::setValue().

Referenced by NetworkPage::save().

◆ setProxyUsername()

void NetworkSettings::setProxyUsername ( const QString &  user)

Sets the proxy server username to user.

Definition at line 230 of file NetworkSettings.cpp.

References SETTING_PROXY_USERNAME, and AbstractTorSettings::setValue().

Referenced by NetworkPage::save().

◆ setReachablePorts()

void NetworkSettings::setReachablePorts ( const QList< quint16 > &  reachablePorts)

Sets the list of ports that will be specified in ReachableAddresses to reachablePorts.

Definition at line 180 of file NetworkSettings.cpp.

References SETTING_REACHABLE_ADDRESSES, and AbstractTorSettings::setValue().

Referenced by NetworkPage::save().

◆ setUseBridges()

void NetworkSettings::setUseBridges ( bool  useBridges)

Sets to useBridges whether Tor should try to use bridge nodes to access the Tor network.

Definition at line 260 of file NetworkSettings.cpp.

References SETTING_USE_BRIDGES, and AbstractTorSettings::setValue().

Referenced by NetworkPage::save().


The documentation for this class was generated from the following files: