Vidalia  0.2.21
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
TorSettings Class Reference

#include <TorSettings.h>

Inheritance diagram for TorSettings:
AbstractTorSettings VSettings

Public Types

enum  AuthenticationMethod { NullAuth, CookieAuth, PasswordAuth, UnknownAuth }
 

Public Member Functions

 TorSettings (TorControl *torControl=0)
 
bool apply (QString *errmsg=0)
 
QString getExecutable () const
 
void setExecutable (const QString &torExecutable)
 
QString getDataDirectory () const
 
void setDataDirectory (const QString &dataDir)
 
QString getTorrc () const
 
void setTorrc (const QString &torrc)
 
QHostAddress getControlAddress () const
 
void setControlAddress (const QHostAddress &addr)
 
quint16 getControlPort () const
 
void setControlPort (quint16 port)
 
QString getSocketPath () const
 
ControlMethod::Method getControlMethod () const
 
bool autoControlPort () const
 
void setAutoControlPort (const bool auto)
 
void setControlMethod (ControlMethod::Method method)
 
void setSocketPath (const QString &path)
 
QString getControlPassword () const
 
void setControlPassword (const QString &password)
 
bool useRandomPassword () const
 
void setUseRandomPassword (bool useRandomPassword)
 
AuthenticationMethod getAuthenticationMethod () const
 
void setAuthenticationMethod (AuthenticationMethod method)
 
QList< quint16 > getWarnPlaintextPorts () const
 
void setWarnPlaintextPorts (const QList< quint16 > &ports)
 
QList< quint16 > getRejectPlaintextPorts () const
 
void setRejectPlaintextPorts (const QList< quint16 > &ports)
 
bool bootstrap () const
 
void setBootstrap (bool enabled)
 
QString bootstrapFrom () const
 
void setBootstrapFrom (const QString &from)
 
- 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
 

Static Public Member Functions

static QString randomPassword ()
 
static QString hashPassword (const QString &password)
 

Private Member Functions

AuthenticationMethod toAuthenticationMethod (const QString &authMethod) const
 
QString toString (AuthenticationMethod type) const
 

Additional Inherited Members

- 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
 

Detailed Description

Manages Tor-specific settings, such as location, command-line arguments, and control interface information.

Definition at line 26 of file TorSettings.h.

Member Enumeration Documentation

Available Tor authentication methods.

Enumerator:
NullAuth 

No authentication.

CookieAuth 

Use a "magic" cookie for authentication.

PasswordAuth 

Use a hashed password for authentication.

UnknownAuth 

Unknown authentication method.

Definition at line 32 of file TorSettings.h.

Constructor & Destructor Documentation

TorSettings::TorSettings ( TorControl torControl = 0)

Member Function Documentation

bool TorSettings::apply ( QString *  errmsg = 0)
virtual
bool TorSettings::autoControlPort ( ) const

Returns true if Vidalia will get the ControlPort automatically from Tor

Definition at line 463 of file TorSettings.cpp.

References SETTING_AUTOCONTROL, and AbstractTorSettings::value().

Referenced by AdvancedPage::load(), MainWindow::start(), MainWindow::started(), and MainWindow::updateBrowserEnv().

bool TorSettings::bootstrap ( ) const

Returns true if Vidalia needs to bootstrap the torrc file

Definition at line 445 of file TorSettings.cpp.

References SETTING_BOOTSTRAP, and AbstractTorSettings::value().

Referenced by MainWindow::start().

QString TorSettings::bootstrapFrom ( ) const

Returns the path of the bootstrap torrc file

Definition at line 457 of file TorSettings.cpp.

References SETTING_BOOTSTRAP_FROM, toString(), and AbstractTorSettings::value().

Referenced by MainWindow::start().

TorSettings::AuthenticationMethod TorSettings::getAuthenticationMethod ( ) const
QHostAddress TorSettings::getControlAddress ( ) const

Get Tor's control interface address.

Get the address or hostname used to connect to Tor

Definition at line 201 of file TorSettings.cpp.

References AbstractTorSettings::localValue(), and SETTING_CONTROL_ADDR.

Referenced by MainWindow::connectFailed(), AdvancedPage::load(), MainWindow::start(), and MainWindow::started().

ControlMethod::Method TorSettings::getControlMethod ( ) const
QString TorSettings::getControlPassword ( ) const

Returns the plaintext (i.e., not hashed) control password used when authenticating to Tor.

Definition at line 259 of file TorSettings.cpp.

References AbstractTorSettings::localValue(), and SETTING_CONTROL_PASSWORD.

Referenced by apply(), MainWindow::authenticate(), AdvancedPage::load(), and MainWindow::start().

quint16 TorSettings::getControlPort ( ) const

Get the control port.

Get the control port used to connect to Tor

Definition at line 216 of file TorSettings.cpp.

References SETTING_CONTROL_PORT, and AbstractTorSettings::value().

Referenced by MainWindow::connectFailed(), AdvancedPage::load(), MainWindow::start(), and MainWindow::started().

QString TorSettings::getDataDirectory ( ) const
QString TorSettings::getExecutable ( ) const

Gets the name and path of Tor's executable.

Returns a fully-qualified path to Tor's executable, including the executable name.

Definition at line 164 of file TorSettings.cpp.

References VSettings::defaultValue(), AbstractTorSettings::localValue(), and SETTING_TOR_EXECUTABLE.

Referenced by GeneralPage::load(), and MainWindow::start().

QList< quint16 > TorSettings::getRejectPlaintextPorts ( ) const

Returns the current list of ports that will cause Tor to reject the connection when the user tries to connect to one of them.

Definition at line 348 of file TorSettings.cpp.

References SETTING_REJECT_PLAINTEXT_PORTS, and AbstractTorSettings::value().

Referenced by MainWindow::warnDangerousPort().

QString TorSettings::getSocketPath ( ) const

Get the path for ControlSocket

Definition at line 230 of file TorSettings.cpp.

References SETTING_SOCKET_PATH, and AbstractTorSettings::value().

Referenced by AdvancedPage::load(), MainWindow::start(), and MainWindow::started().

QString TorSettings::getTorrc ( ) const

Gets the torrc to use when starting Tor.

Returns the torrc that will be used when starting Tor.

Definition at line 181 of file TorSettings.cpp.

References TorControl::getInfo(), TorControl::isConnected(), AbstractTorSettings::localValue(), SETTING_TORRC, AbstractTorSettings::torControl(), and toString().

Referenced by AdvancedPage::load(), AdvancedPage::save(), and MainWindow::start().

QList< quint16 > TorSettings::getWarnPlaintextPorts ( ) const

Returns the current list of ports that will cause Tor to issue a warning when the user tries to connect to one of them.

Definition at line 321 of file TorSettings.cpp.

References SETTING_WARN_PLAINTEXT_PORTS, and AbstractTorSettings::value().

Referenced by MainWindow::warnDangerousPort().

QString TorSettings::hashPassword ( const QString &  password)
static

Returns the hash of password as given by the command "tor &ndash;hash-password foo".

Definition at line 412 of file TorSettings.cpp.

References base16_encode(), crypto_rand_bytes(), and crypto_secret_to_key().

Referenced by apply(), and MainWindow::start().

QString TorSettings::randomPassword ( )
static

Generates a random control password consisting of PASSWORD_LEN characters.

Definition at line 404 of file TorSettings.cpp.

References crypto_rand_string(), and PASSWORD_LEN.

Referenced by apply(), and MainWindow::start().

void TorSettings::setAuthenticationMethod ( AuthenticationMethod  method)

Sets the authentication method used when starting Tor to method.

Definition at line 313 of file TorSettings.cpp.

References SETTING_AUTH_METHOD, AbstractTorSettings::setValue(), and toString().

Referenced by MainWindow::authenticationFailed(), and AdvancedPage::save().

void TorSettings::setAutoControlPort ( const bool  auto)

Sets whether Vidalia should get the ControlPort from Tor

Definition at line 469 of file TorSettings.cpp.

References SETTING_AUTOCONTROL, and AbstractTorSettings::setValue().

Referenced by AdvancedPage::save(), and MainWindow::start().

void TorSettings::setBootstrap ( bool  enabled)

Enables or disables bootstrap

Definition at line 439 of file TorSettings.cpp.

References SETTING_BOOTSTRAP, and AbstractTorSettings::setValue().

Referenced by MainWindow::start().

void TorSettings::setBootstrapFrom ( const QString &  from)

Sets the location of the bootstrap torrc file

Definition at line 451 of file TorSettings.cpp.

References SETTING_BOOTSTRAP_FROM, and AbstractTorSettings::setValue().

void TorSettings::setControlAddress ( const QHostAddress &  addr)

Set Tor's control interface address.

Set the address or hostname used to connect to Tor

Definition at line 209 of file TorSettings.cpp.

References SETTING_CONTROL_ADDR, and AbstractTorSettings::setValue().

Referenced by AdvancedPage::save().

void TorSettings::setControlMethod ( ControlMethod::Method  method)

Set the control method

Definition at line 251 of file TorSettings.cpp.

References SETTING_CONTROL_METHOD, AbstractTorSettings::setValue(), and ControlMethod::toString().

Referenced by AdvancedPage::save().

void TorSettings::setControlPassword ( const QString &  password)

Sets the control password used when starting Tor with HashedControlPassword to password.

Definition at line 267 of file TorSettings.cpp.

References SETTING_CONTROL_PASSWORD, and AbstractTorSettings::setValue().

Referenced by MainWindow::authenticationFailed(), and AdvancedPage::save().

void TorSettings::setControlPort ( quint16  port)

Set the control port.

Set the control port used to connect to Tor

Definition at line 223 of file TorSettings.cpp.

References SETTING_CONTROL_PORT, and AbstractTorSettings::setValue().

Referenced by AdvancedPage::save().

void TorSettings::setDataDirectory ( const QString &  dataDirectory)

Sets the location to use for Tor's data directory.

Sets the location to use as Tor's data directory.

Definition at line 156 of file TorSettings.cpp.

References SETTING_DATA_DIRECTORY, and AbstractTorSettings::setValue().

Referenced by AdvancedPage::save(), and MainWindow::start().

void TorSettings::setExecutable ( const QString &  torExecutable)

Sets the name and path of Tor's executable.

Sets the location and name of Tor's executable to the given string.

Definition at line 174 of file TorSettings.cpp.

References SETTING_TOR_EXECUTABLE, and AbstractTorSettings::setValue().

Referenced by GeneralPage::save(), and MainWindow::start().

void TorSettings::setRejectPlaintextPorts ( const QList< quint16 > &  ports)

Sets the list of ports that will cause Tor to reject the connection when the user tries to connect to one of them.

Definition at line 363 of file TorSettings.cpp.

References SETTING_REJECT_PLAINTEXT_PORTS, and AbstractTorSettings::setValue().

Referenced by MainWindow::warnDangerousPort().

void TorSettings::setSocketPath ( const QString &  path)

Set the path for ControlSocket

Definition at line 237 of file TorSettings.cpp.

References SETTING_SOCKET_PATH, and AbstractTorSettings::setValue().

Referenced by AdvancedPage::save().

void TorSettings::setTorrc ( const QString &  torrc)

Sets the torrc to use when starting Tor.

Sets the torrc that will be used when starting Tor.

Parameters
torrcThe torrc to use.

Definition at line 194 of file TorSettings.cpp.

References SETTING_TORRC, and AbstractTorSettings::setValue().

Referenced by AdvancedPage::save(), and MainWindow::start().

void TorSettings::setUseRandomPassword ( bool  useRandomPassword)

Sets whether or not to generate and use a random control password each time Tor is started.

Definition at line 283 of file TorSettings.cpp.

References SETTING_USE_RANDOM_PASSWORD, and AbstractTorSettings::setValue().

Referenced by MainWindow::authenticationFailed(), and AdvancedPage::save().

void TorSettings::setWarnPlaintextPorts ( const QList< quint16 > &  ports)

Sets the list of ports that will cause Tor to issue a warning when the user tries to connect to one of them.

Definition at line 336 of file TorSettings.cpp.

References SETTING_WARN_PLAINTEXT_PORTS, and AbstractTorSettings::setValue().

Referenced by MainWindow::warnDangerousPort().

TorSettings::AuthenticationMethod TorSettings::toAuthenticationMethod ( const QString &  authMethod) const
private

Returns the AuthenticationMethod enum value for the string description of the authentication method given in authMethod.

Definition at line 390 of file TorSettings.cpp.

References CookieAuth, NullAuth, PasswordAuth, toString(), and UnknownAuth.

Referenced by apply(), and getAuthenticationMethod().

QString TorSettings::toString ( AuthenticationMethod  method) const
private

Returns the string description of the authentication method specified by method. The authentication method string is stored in Vidalia's configuration file.

Definition at line 376 of file TorSettings.cpp.

References CookieAuth, NullAuth, and PasswordAuth.

Referenced by apply(), bootstrapFrom(), getAuthenticationMethod(), getControlMethod(), getDataDirectory(), getTorrc(), setAuthenticationMethod(), toAuthenticationMethod(), and TorSettings().

bool TorSettings::useRandomPassword ( ) const

Returns true if a new, random control password is to be used each time Tor is started.

Definition at line 275 of file TorSettings.cpp.

References AbstractTorSettings::localValue(), and SETTING_USE_RANDOM_PASSWORD.

Referenced by apply(), AdvancedPage::load(), and MainWindow::start().


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