Vidalia  0.3.1
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
ServerSettings Class Reference

#include <ServerSettings.h>

Inheritance diagram for ServerSettings:
AbstractTorSettings VSettings

Public Member Functions

 ServerSettings (TorControl *torControl)
 
bool apply (QString *errmsg=0)
 
void setServerEnabled (bool enable)
 
bool isServerEnabled ()
 
void setBridgeEnabled (bool enable)
 
bool isBridgeEnabled ()
 
void setNonExitEnabled (bool enable)
 
bool isNonExitEnabled ()
 
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 setPublishServerDescriptor (bool publish)
 
bool publishServerDescriptor () const
 
void configurePortForwarding ()
 
void cleanupPortForwarding ()
 
bool isUpnpEnabled ()
 
void setUpnpEnabled (bool enabled)
 
- 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
 

Protected Member Functions

virtual QVariant torValue (const QString &key) const
 
- Protected Member Functions inherited from AbstractTorSettings
virtual QVariant value (const QString &key) const
 
virtual QVariant localValue (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
 

Private Member Functions

QHash< QString, QString > confValues ()
 

Additional Inherited Members

- Static Public Member Functions inherited from VSettings
static QString settingsFile ()
 
static bool settingsFileExists ()
 
static void reset ()
 

Detailed Description

Definition at line 23 of file ServerSettings.h.

Constructor & Destructor Documentation

§ ServerSettings()

ServerSettings::ServerSettings ( TorControl torControl)

Member Function Documentation

§ apply()

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

Applies changese to Tor.

Applies the current server 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 141 of file ServerSettings.cpp.

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

Referenced by ServerPage::apply().

§ cleanupPortForwarding()

void ServerSettings::cleanupPortForwarding ( )

Definition at line 202 of file ServerSettings.cpp.

References UPNPControl::cleanup(), and QVariant.

Referenced by MainWindow::aboutToQuit().

§ configurePortForwarding()

void ServerSettings::configurePortForwarding ( )

Configure port forwarding.

Configure UPnP device to forward DirPort and ORPort. If enable is true, will forward ORPort and DirPort; otherwise will remove exising port mappings

Definition at line 179 of file ServerSettings.cpp.

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

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

§ confValues()

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

§ getBandwidthAvgRate()

quint32 ServerSettings::getBandwidthAvgRate ( )

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

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

Definition at line 366 of file ServerSettings.cpp.

References SETTING_BANDWIDTH_RATE, and AbstractTorSettings::value().

Referenced by ServerPage::loadBandwidthLimits().

§ getBandwidthBurstRate()

quint32 ServerSettings::getBandwidthBurstRate ( )

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

Returns the maximum bandwidth burst rate (in KB/s) for this server.

Definition at line 380 of file ServerSettings.cpp.

References SETTING_BANDWIDTH_BURST, and AbstractTorSettings::value().

Referenced by ServerPage::loadBandwidthLimits().

§ getContactInfo()

QString ServerSettings::getContactInfo ( )

Gets the server operator's contact information.

Gets the server's contact information.

Definition at line 331 of file ServerSettings.cpp.

References SETTING_CONTACT, and AbstractTorSettings::value().

Referenced by ServerPage::load().

§ getDirPort()

quint16 ServerSettings::getDirPort ( )

Gets the server's DirPort value.

Gets the server's current DirPort.

Definition at line 300 of file ServerSettings.cpp.

References SETTING_DIRPORT, and AbstractTorSettings::value().

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

§ getExitPolicy()

ExitPolicy ServerSettings::getExitPolicy ( )

Gets the exit policy for this server.

Returns the exit policy for this server.

Definition at line 352 of file ServerSettings.cpp.

References SETTING_EXITPOLICY, and AbstractTorSettings::value().

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

§ getNickname()

QString ServerSettings::getNickname ( )

Gets the server's nickname.

Definition at line 314 of file ServerSettings.cpp.

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

Referenced by ServerPage::load().

§ getORPort()

quint16 ServerSettings::getORPort ( )

Gets the server's ORPort value.

Gets the server's current ORPort setting.

Definition at line 286 of file ServerSettings.cpp.

References SETTING_ORPORT, and AbstractTorSettings::value().

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

§ isBridgeEnabled()

bool ServerSettings::isBridgeEnabled ( )

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

Definition at line 257 of file ServerSettings.cpp.

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

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

§ isDirectoryMirror()

bool ServerSettings::isDirectoryMirror ( )

Returns true if the server will mirror the directory.

Returns whether this server will act as a directory mirror or not.

Definition at line 338 of file ServerSettings.cpp.

References AbstractTorSettings::localValue(), and SETTING_DIRMIRROR.

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

§ isNonExitEnabled()

bool ServerSettings::isNonExitEnabled ( )

Returns true if Tor is configured to act as a non-exit node.

Definition at line 272 of file ServerSettings.cpp.

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

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

§ isServerEnabled()

bool ServerSettings::isServerEnabled ( )

Returns true if Tor is running as a server.

Returns true if Tor is currently configured to run as a Tor server. If Tor is running, we will check whether it has an ORPort defined. Otherwise, we will use our saved settings.

Definition at line 237 of file ServerSettings.cpp.

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

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

§ isUpnpEnabled()

bool ServerSettings::isUpnpEnabled ( )

Returns true if UPnP support is enabled.

Returns true if UPnP support is available and enabled.

Definition at line 415 of file ServerSettings.cpp.

References AbstractTorSettings::localValue(), and SETTING_ENABLE_UPNP.

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

§ publishServerDescriptor()

bool ServerSettings::publishServerDescriptor ( ) const

Returns true if the user's server descriptor will be published to the appropriate authorities.

Definition at line 408 of file ServerSettings.cpp.

References SETTING_PUBLISH_SERVER_DESCRIPTOR, and AbstractTorSettings::value().

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

§ setBandwidthAvgRate()

void ServerSettings::setBandwidthAvgRate ( quint32  rate)

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

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

Definition at line 373 of file ServerSettings.cpp.

References quint32, SETTING_BANDWIDTH_RATE, and AbstractTorSettings::setValue().

Referenced by ServerPage::saveBandwidthLimits().

§ setBandwidthBurstRate()

void ServerSettings::setBandwidthBurstRate ( quint32  rate)

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

Sets the maximum bandwidth burst rate (in KB/s) for this server.

Definition at line 387 of file ServerSettings.cpp.

References SETTING_BANDWIDTH_BURST, and AbstractTorSettings::setValue().

Referenced by ServerPage::saveBandwidthLimits().

§ setBridgeEnabled()

void ServerSettings::setBridgeEnabled ( bool  enabled)

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

Definition at line 250 of file ServerSettings.cpp.

References SETTING_BRIDGE_RELAY, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ setContactInfo()

void ServerSettings::setContactInfo ( QString  contact)

Sets the server operator's contact information.

Sets the server's contact information.

Definition at line 324 of file ServerSettings.cpp.

References SETTING_CONTACT, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ setDirectoryMirror()

void ServerSettings::setDirectoryMirror ( bool  mirror)

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

Sets whether this server will act as a directory mirror.

Definition at line 345 of file ServerSettings.cpp.

References SETTING_DIRMIRROR, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ setDirPort()

void ServerSettings::setDirPort ( quint16  dirPort)

Sets the server's DirPort value.

Sets the server's current DirPort.

Definition at line 293 of file ServerSettings.cpp.

References SETTING_DIRPORT, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ setExitPolicy()

void ServerSettings::setExitPolicy ( ExitPolicy exitPolicy)

Sets the exit policy for this server.

Definition at line 359 of file ServerSettings.cpp.

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

Referenced by ServerPage::saveExitPolicies().

§ setNickname()

void ServerSettings::setNickname ( QString  nickname)

Sets the server's nickname.

Definition at line 307 of file ServerSettings.cpp.

References SETTING_NICKNAME, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ setNonExitEnabled()

void ServerSettings::setNonExitEnabled ( bool  enabled)

Sets to enabled whether Tor should be a non-exit node when acting as a server.

Definition at line 265 of file ServerSettings.cpp.

References SETTING_NONEXIT_RELAY, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ setORPort()

void ServerSettings::setORPort ( quint16  orPort)

Sets the server's ORPort value.

Sets the server's ORPort.

Definition at line 279 of file ServerSettings.cpp.

References SETTING_ORPORT, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ setPublishServerDescriptor()

void ServerSettings::setPublishServerDescriptor ( bool  publish)

Sets whether the user's server descriptor will be published or not. Currently this only affects publishing of bridge descriptors. If the user is running a normal relay, its descriptor will always be published regardless of this setting.

Definition at line 397 of file ServerSettings.cpp.

References SETTING_PUBLISH_SERVER_DESCRIPTOR, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ setServerEnabled()

void ServerSettings::setServerEnabled ( bool  enable)

Enables running Tor as a server.

Enables or disables running Tor as a server.

Parameters
enableWhether to enable or disable the Tor server.

Definition at line 228 of file ServerSettings.cpp.

References SETTING_ENABLED, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ setUpnpEnabled()

void ServerSettings::setUpnpEnabled ( bool  enabled)

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

Sets whether Vidalia should try to configure port forwarding using UPnP. If Vidalia was compiled without UPnP support, this method has no effect.

Definition at line 427 of file ServerSettings.cpp.

References SETTING_ENABLE_UPNP, and AbstractTorSettings::setValue().

Referenced by ServerPage::save().

§ torValue()

QVariant ServerSettings::torValue ( const QString &  key) const
protectedvirtual

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 213 of file ServerSettings.cpp.

References getTorVersion(), 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: