TorSettings Class Reference

#include <torsettings.h>

Inheritance diagram for TorSettings:

VidaliaSettings

List of all members.

Public Types

enum  AuthenticationMethod { NullAuth, CookieAuth, PasswordAuth, UnknownAuth }

Public Member Functions

 TorSettings ()
QString getExecutable ()
void setExecutable (QString torExecutable)
QString getDataDirectory ()
void setDataDirectory (QString dataDir)
QStringList getArguments ()
QString getTorrc ()
void setTorrc (QString torrc)
QHostAddress getControlAddress ()
void setControlAddress (QHostAddress addr)
quint16 getControlPort ()
void setControlPort (quint16 port)
QString getControlPassword ()
void setControlPassword (QString password)
bool useRandomPassword ()
void setUseRandomPassword (bool useRandomPassword)
AuthenticationMethod getAuthenticationMethod ()
void setAuthenticationMethod (AuthenticationMethod method)
QString getUser ()
void setUser (QString user)
QString getGroup ()
void setGroup (QString group)

Private Member Functions

QString toString (AuthenticationMethod type)
QString generateRandomPassword ()
QString hashPassword (QString password)


Detailed Description

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

Definition at line 37 of file torsettings.h.


Member Enumeration Documentation

enum TorSettings::AuthenticationMethod

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 41 of file torsettings.h.


Constructor & Destructor Documentation

TorSettings::TorSettings (  ) 

Default constructor.

Default constructor

Definition at line 72 of file torsettings.cpp.

References DEFAULT_AUTH_METHOD, VidaliaSettings::setDefault(), SETTING_AUTH_METHOD, SETTING_CONTROL_ADDR, SETTING_CONTROL_PASSWORD, SETTING_CONTROL_PORT, SETTING_DATA_DIRECTORY, SETTING_TOR_EXECUTABLE, SETTING_TOR_GROUP, SETTING_TOR_USER, SETTING_TORRC, SETTING_USE_RANDOM_PASSWORD, toString(), and win32_program_files_folder().


Member Function Documentation

QString TorSettings::getExecutable (  ) 

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 112 of file torsettings.cpp.

References SETTING_TOR_EXECUTABLE, toString(), and VidaliaSettings::value().

Referenced by hashPassword(), GeneralPage::load(), and TorControl::start().

void TorSettings::setExecutable ( 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 119 of file torsettings.cpp.

References SETTING_TOR_EXECUTABLE, and VidaliaSettings::setValue().

Referenced by GeneralPage::save().

QString TorSettings::getDataDirectory (  ) 

Gets the location of Tor's data directory.

Definition at line 97 of file torsettings.cpp.

References SETTING_DATA_DIRECTORY, and VidaliaSettings::value().

Referenced by MainWindow::authenticate(), getArguments(), AdvancedPage::load(), and MainWindow::loadControlCookie().

void TorSettings::setDataDirectory ( 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 104 of file torsettings.cpp.

References SETTING_DATA_DIRECTORY, and VidaliaSettings::setValue().

Referenced by AdvancedPage::save().

QStringList TorSettings::getArguments (  ) 

Builds and formats a list of command-line arguments.

Returns a formatted QString of all currently set command-line arguments. If an argument's value contains a space, then it will be wrapped in quotes.

Definition at line 128 of file torsettings.cpp.

References CookieAuth, expand_filename(), generateRandomPassword(), getAuthenticationMethod(), getControlPassword(), getControlPort(), getDataDirectory(), getGroup(), getTorrc(), getUser(), hashPassword(), PasswordAuth, setControlPassword(), TOR_ARG_CONTROL_PORT, TOR_ARG_COOKIE_AUTH, TOR_ARG_DATA_DIRECTORY, TOR_ARG_GROUP, TOR_ARG_HASHED_PASSWORD, TOR_ARG_TORRC, TOR_ARG_USER, and useRandomPassword().

Referenced by TorControl::start().

QString TorSettings::getTorrc (  ) 

Gets the torrc to use when starting Tor.

Returns the torrc that will be used when starting Tor.

Definition at line 180 of file torsettings.cpp.

References SETTING_TORRC, toString(), and VidaliaSettings::value().

Referenced by getArguments(), AdvancedPage::load(), and TorControl::start().

void TorSettings::setTorrc ( QString  torrc  ) 

Sets the torrc to use when starting Tor.

Sets the torrc that will be used when starting Tor.

Parameters:
torrc The torrc to use.

Definition at line 189 of file torsettings.cpp.

References SETTING_TORRC, and VidaliaSettings::setValue().

Referenced by AdvancedPage::save().

QHostAddress TorSettings::getControlAddress (  ) 

Get Tor's control interface address.

Get the address or hostname used to connect to Tor

Definition at line 228 of file torsettings.cpp.

References SETTING_CONTROL_ADDR, and VidaliaSettings::value().

Referenced by TorControl::connect(), TorControl::isRunning(), and AdvancedPage::load().

void TorSettings::setControlAddress ( QHostAddress  addr  ) 

Set Tor's control interface address.

Set the address or hostname used to connect to Tor

Definition at line 236 of file torsettings.cpp.

References SETTING_CONTROL_ADDR, and VidaliaSettings::setValue().

Referenced by AdvancedPage::save().

quint16 TorSettings::getControlPort (  ) 

Get the control port.

Get the control port used to connect to Tor

Definition at line 243 of file torsettings.cpp.

References SETTING_CONTROL_PORT, and VidaliaSettings::value().

Referenced by TorControl::connect(), getArguments(), TorControl::isRunning(), and AdvancedPage::load().

void TorSettings::setControlPort ( quint16  port  ) 

Set the control port.

Set the control port used to connect to Tor

Definition at line 250 of file torsettings.cpp.

References SETTING_CONTROL_PORT, and VidaliaSettings::setValue().

Referenced by AdvancedPage::save().

QString TorSettings::getControlPassword (  ) 

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

Definition at line 258 of file torsettings.cpp.

References SETTING_CONTROL_PASSWORD, and VidaliaSettings::value().

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

void TorSettings::setControlPassword ( QString  password  ) 

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

Definition at line 266 of file torsettings.cpp.

References SETTING_CONTROL_PASSWORD, and VidaliaSettings::setValue().

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

bool TorSettings::useRandomPassword (  ) 

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

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

Definition at line 274 of file torsettings.cpp.

References SETTING_USE_RANDOM_PASSWORD, and VidaliaSettings::value().

Referenced by getArguments(), and AdvancedPage::load().

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 282 of file torsettings.cpp.

References SETTING_USE_RANDOM_PASSWORD, and VidaliaSettings::setValue().

Referenced by AdvancedPage::save().

TorSettings::AuthenticationMethod TorSettings::getAuthenticationMethod (  ) 

Returns the current authentication method used when connecting to Tor.

Returns the current authentication method used when connecting to Tor.

Definition at line 289 of file torsettings.cpp.

References CookieAuth, NullAuth, PasswordAuth, SETTING_AUTH_METHOD, toString(), UnknownAuth, and VidaliaSettings::value().

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

void TorSettings::setAuthenticationMethod ( AuthenticationMethod  method  ) 

Sets the authentication method used when starting Tor to method.

Sets the authentication method used when starting Tor to method.

Definition at line 306 of file torsettings.cpp.

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

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

QString TorSettings::getUser (  ) 

Get which user will be used to run Tor.

Returns the user used when running Tor. The user is specified as an argument to Tor, which will setuid to this user.

Definition at line 197 of file torsettings.cpp.

References SETTING_TOR_USER, and VidaliaSettings::value().

Referenced by getArguments(), and AdvancedPage::load().

void TorSettings::setUser ( QString  user  ) 

Set which user will be used to run Tor.

Sets the user used when running Tor. The user is specified as an argument to Tor, which will setuid to this user.

Definition at line 205 of file torsettings.cpp.

References SETTING_TOR_USER, and VidaliaSettings::setValue().

Referenced by AdvancedPage::save().

QString TorSettings::getGroup (  ) 

Get which group will be used to run Tor.

Returns the group used when running Tor. The group is specified as an argument to Tor, which will setgid to this group.

Definition at line 213 of file torsettings.cpp.

References SETTING_TOR_GROUP, and VidaliaSettings::value().

Referenced by getArguments(), and AdvancedPage::load().

void TorSettings::setGroup ( QString  group  ) 

Set which group will be used to run Tor.

Sets the group used when running Tor. The group is specified as an argument to Tor, which will setgid to this group.

Definition at line 221 of file torsettings.cpp.

References SETTING_TOR_GROUP, and VidaliaSettings::setValue().

Referenced by AdvancedPage::save().

QString TorSettings::toString ( AuthenticationMethod  method  )  [private]

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

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 315 of file torsettings.cpp.

References CookieAuth, NullAuth, and PasswordAuth.

Referenced by getAuthenticationMethod(), getExecutable(), getTorrc(), setAuthenticationMethod(), and TorSettings().

QString TorSettings::generateRandomPassword (  )  [private]

Generates a random control password consisting of PASSWORD_LEN characters.

Generates a random control password consisting of PASSWORD_LEN characters.

Definition at line 328 of file torsettings.cpp.

References crypto_rand_string(), and PASSWORD_LEN.

Referenced by getArguments().

QString TorSettings::hashPassword ( QString  password  )  [private]

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

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

Definition at line 336 of file torsettings.cpp.

References getExecutable().

Referenced by getArguments().


The documentation for this class was generated from the following files:
Generated on Wed Sep 5 15:49:29 2007 for Vidalia by  doxygen 1.5.3