ServerSettings Class Reference

#include <serversettings.h>

Inheritance diagram for ServerSettings:

AbstractTorSettings VSettings List of all members.

Public Member Functions

 ServerSettings (TorControl *torControl)
bool apply (QString *errmsg=0)
void setServerEnabled (bool enable)
bool isServerEnabled ()
void setBridgeEnabled (bool enable)
bool isBridgeEnabled ()
void setORPort (quint16 orPort)
quint16 getORPort ()
void setDirPort (quint16 dirPort)
quint16 getDirPort ()
void setNickname (QString nickname)
QString getNickname ()
void setContactInfo (QString info)
QString getContactInfo ()
void setDirectoryMirror (bool mirror)
bool isDirectoryMirror ()
void setExitPolicy (ExitPolicy &policy)
ExitPolicy getExitPolicy ()
void setBandwidthAvgRate (quint32 rate)
quint32 getBandwidthAvgRate ()
void setBandwidthBurstRate (quint32 rate)
quint32 getBandwidthBurstRate ()
void configurePortForwarding ()
void cleanupPortForwarding ()
bool isUpnpEnabled ()
void setUpnpEnabled (bool enabled)

Protected Member Functions

virtual QVariant torValue (const QString &key) const

Private Member Functions

QHash< QString, QString > confValues ()

Detailed Description

Definition at line 24 of file serversettings.h.


Constructor & Destructor Documentation

ServerSettings::ServerSettings ( TorControl torControl  ) 

Constructor

Definition at line 55 of file serversettings.cpp.

References ExitPolicy::Default, VSettings::setDefault(), SETTING_BANDWIDTH_BURST, SETTING_BANDWIDTH_RATE, SETTING_BRIDGE_RELAY, SETTING_CONTACT, SETTING_DIRMIRROR, SETTING_DIRPORT, SETTING_ENABLE_UPNP, SETTING_ENABLED, SETTING_EXITPOLICY, SETTING_NICKNAME, SETTING_ORPORT, SETTING_RELAY_BANDWIDTH_BURST, and SETTING_RELAY_BANDWIDTH_RATE.


Member Function Documentation

bool ServerSettings::apply ( QString *  errmsg = 0  )  [virtual]

Applies changese to Tor.

Implements AbstractTorSettings.

Definition at line 132 of file serversettings.cpp.

References configurePortForwarding(), confValues(), TorControl::getTorVersion(), isServerEnabled(), TorControl::resetConf(), TorControl::setConf(), SETTING_BANDWIDTH_BURST, SETTING_BANDWIDTH_RATE, SETTING_BRIDGE_RELAY, SETTING_CONTACT, SETTING_DIRPORT, SETTING_EXITPOLICY, SETTING_NICKNAME, SETTING_ORPORT, SETTING_RELAY_BANDWIDTH_BURST, SETTING_RELAY_BANDWIDTH_RATE, and AbstractTorSettings::torControl().

Referenced by ServerPage::apply().

void ServerSettings::cleanupPortForwarding (  ) 

Definition at line 192 of file serversettings.cpp.

References UPNPControl::cleanup().

Referenced by MainWindow::shutdown().

void ServerSettings::configurePortForwarding (  ) 

Configure port forwarding.

Definition at line 169 of file serversettings.cpp.

References getDirPort(), getORPort(), UPNPControl::instance(), isDirectoryMirror(), isServerEnabled(), isUpnpEnabled(), and UPNPControl::setDesiredState().

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

QHash< QString, QString > ServerSettings::confValues (  )  [private]

Returns Tor-recognizable configuration keys and current values.

Definition at line 81 of file serversettings.cpp.

References VSettings::defaultValue(), TorControl::getTorVersion(), isBridgeEnabled(), isDirectoryMirror(), isServerEnabled(), AbstractTorSettings::localValue(), scrub_email_addr(), SETTING_BANDWIDTH_BURST, SETTING_BANDWIDTH_RATE, SETTING_BRIDGE_RELAY, SETTING_CONTACT, SETTING_DIRPORT, SETTING_EXITPOLICY, SETTING_NICKNAME, SETTING_ORPORT, SETTING_RELAY_BANDWIDTH_BURST, SETTING_RELAY_BANDWIDTH_RATE, and AbstractTorSettings::torControl().

Referenced by apply().

quint32 ServerSettings::getBandwidthAvgRate (  ) 

Gets the long-term average bandwidth rate (in KB/s) of this server.

Definition at line 341 of file serversettings.cpp.

References SETTING_BANDWIDTH_RATE, and AbstractTorSettings::value().

Referenced by ServerPage::loadBandwidthLimits().

quint32 ServerSettings::getBandwidthBurstRate (  ) 

Gets the maximum burst rate (in B/s) of this server.

Definition at line 355 of file serversettings.cpp.

References SETTING_BANDWIDTH_BURST, and AbstractTorSettings::value().

Referenced by ServerPage::loadBandwidthLimits().

QString ServerSettings::getContactInfo (  ) 

Gets the server operator's contact information.

Definition at line 306 of file serversettings.cpp.

References SETTING_CONTACT, and AbstractTorSettings::value().

Referenced by ServerPage::load().

quint16 ServerSettings::getDirPort (  ) 

Gets the server's DirPort value.

Definition at line 275 of file serversettings.cpp.

References SETTING_DIRPORT, and AbstractTorSettings::value().

Referenced by configurePortForwarding(), and ServerPage::load().

ExitPolicy ServerSettings::getExitPolicy (  ) 

Gets the exit policy for this server.

Definition at line 327 of file serversettings.cpp.

References SETTING_EXITPOLICY, and AbstractTorSettings::value().

Referenced by ServerPage::loadExitPolicies().

QString ServerSettings::getNickname (  ) 

Gets the server's nickname.

Definition at line 289 of file serversettings.cpp.

References ensure_valid_chars(), MAX_NICKNAME_LEN, SETTING_NICKNAME, VALID_NICKNAME_CHARS, and AbstractTorSettings::value().

Referenced by ServerPage::load().

quint16 ServerSettings::getORPort (  ) 

Gets the server's ORPort value.

Definition at line 261 of file serversettings.cpp.

References SETTING_ORPORT, and AbstractTorSettings::value().

Referenced by configurePortForwarding(), and ServerPage::load().

bool ServerSettings::isBridgeEnabled (  ) 

Returns true if Tor is configured to act as a bridge node.

Definition at line 247 of file serversettings.cpp.

References isServerEnabled(), SETTING_BRIDGE_RELAY, and AbstractTorSettings::value().

Referenced by confValues(), and ServerPage::load().

bool ServerSettings::isDirectoryMirror (  ) 

Returns true if the server will mirror the directory.

Definition at line 313 of file serversettings.cpp.

References AbstractTorSettings::localValue(), and SETTING_DIRMIRROR.

Referenced by configurePortForwarding(), confValues(), and ServerPage::load().

bool ServerSettings::isServerEnabled (  ) 

Returns true if Tor is running as a server.

Definition at line 227 of file serversettings.cpp.

References AbstractTorSettings::changedSinceLastApply(), AbstractTorSettings::localValue(), SETTING_ENABLED, SETTING_ORPORT, and AbstractTorSettings::torControl().

Referenced by apply(), configurePortForwarding(), confValues(), isBridgeEnabled(), ServerPage::load(), and MainWindow::stop().

bool ServerSettings::isUpnpEnabled (  ) 

Returns true if UPnP support is enabled.

Definition at line 369 of file serversettings.cpp.

References AbstractTorSettings::localValue(), and SETTING_ENABLE_UPNP.

Referenced by configurePortForwarding(), and ServerPage::load().

void ServerSettings::setBandwidthAvgRate ( quint32  rate  ) 

Sets the long-term average bandwidth rate (in KB/s) of this server.

Definition at line 348 of file serversettings.cpp.

References SETTING_BANDWIDTH_RATE, and AbstractTorSettings::setValue().

Referenced by ServerPage::saveBandwidthLimits().

void ServerSettings::setBandwidthBurstRate ( quint32  rate  ) 

Sets the maximum burst rate (in B/s) of this server.

Definition at line 362 of file serversettings.cpp.

References SETTING_BANDWIDTH_BURST, and AbstractTorSettings::setValue().

Referenced by ServerPage::saveBandwidthLimits().

void ServerSettings::setBridgeEnabled ( bool  enable  ) 

Sets to enabled whether Tor should be a bridge node when acting as a server.

Definition at line 240 of file serversettings.cpp.

References SETTING_BRIDGE_RELAY, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

void ServerSettings::setContactInfo ( QString  info  ) 

Sets the server operator's contact information.

Definition at line 299 of file serversettings.cpp.

References SETTING_CONTACT, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

void ServerSettings::setDirectoryMirror ( bool  mirror  ) 

Enables or disables the server to act as a directory mirror.

Definition at line 320 of file serversettings.cpp.

References SETTING_DIRMIRROR, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

void ServerSettings::setDirPort ( quint16  dirPort  ) 

Sets the server's DirPort value.

Definition at line 268 of file serversettings.cpp.

References SETTING_DIRPORT, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

void ServerSettings::setExitPolicy ( ExitPolicy policy  ) 

Sets the exit policy for this server.

Definition at line 334 of file serversettings.cpp.

References SETTING_EXITPOLICY, AbstractTorSettings::setValue(), and ExitPolicy::toString().

Referenced by ServerPage::saveExitPolicies().

void ServerSettings::setNickname ( QString  nickname  ) 

Sets the server's nickname.

Definition at line 282 of file serversettings.cpp.

References SETTING_NICKNAME, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

void ServerSettings::setORPort ( quint16  orPort  ) 

Sets the server's ORPort value.

Definition at line 254 of file serversettings.cpp.

References SETTING_ORPORT, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

void ServerSettings::setServerEnabled ( bool  enable  ) 

Enables running Tor as a server.

Definition at line 218 of file serversettings.cpp.

References SETTING_ENABLED, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

void ServerSettings::setUpnpEnabled ( bool  enabled  ) 

Sets whether Vidalia should try to configure port forwarding using UPnP.

Definition at line 381 of file serversettings.cpp.

References SETTING_ENABLE_UPNP, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

QVariant ServerSettings::torValue ( const QString &  key  )  const [protected, virtual]

Virtual method called when we retrieve a server-related setting from Tor. Currently this just translates BandwidthFoo to RelayBandwidthFoo when appropriate.

Reimplemented from AbstractTorSettings.

Definition at line 203 of file serversettings.cpp.

References SETTING_BANDWIDTH_BURST, SETTING_BANDWIDTH_RATE, SETTING_RELAY_BANDWIDTH_BURST, SETTING_RELAY_BANDWIDTH_RATE, AbstractTorSettings::torControl(), and AbstractTorSettings::torValue().


The documentation for this class was generated from the following files:
Generated on Tue Jul 7 16:58:27 2009 for Vidalia by  doxygen 1.4.7