TorProcess Class Reference

#include <torprocess.h>

List of all members.

Signals

void log (const QString &severity, const QString &message)
void startFailed (const QString &errorMessage)

Public Member Functions

 TorProcess (QObject *parent=0)
void start (const QString &app, const QStringList &args)
bool stop (QString *errmsg=0)
quint64 pid ()
void openStdout ()
void closeStdout ()

Static Public Member Functions

static QString version (const QString &exe)

Private Slots

void onReadyRead ()
void onError (QProcess::ProcessError error)

Private Member Functions

QString formatArguments (const QStringList &args)


Detailed Description

Definition at line 23 of file torprocess.h.


Constructor & Destructor Documentation

TorProcess::TorProcess ( QObject *  parent = 0  ) 

Default constructor.

Default constructor

Definition at line 30 of file torprocess.cpp.

References tc::error(), onError(), onReadyRead(), and openStdout().


Member Function Documentation

void TorProcess::start ( const QString &  app,
const QStringList &  args 
)

Start the Tor process

Attempts to start the Tor process using the location, executable, and command-line arguments specified in Vidalia's settings. If Tor starts, the signal started() will be emitted. If Tor fails to start, startFailed(errmsg) will be emitted, with an appropriate error message.

Definition at line 56 of file torprocess.cpp.

References tc::debug(), formatArguments(), and i().

Referenced by TorControl::start().

bool TorProcess::stop ( QString *  errmsg = 0  ) 

Stop the Tor process

Stops the Tor process

Definition at line 85 of file torprocess.cpp.

References tc::debug(), tc::error(), and pid().

Referenced by TorControl::stop().

quint64 TorProcess::pid (  ) 

Return the Tor process's PID (workaround for some Windows funkiness)

Return the process ID for the current process.

Definition at line 117 of file torprocess.cpp.

Referenced by stop().

void TorProcess::openStdout (  ) 

Enable reading log messages from stdout.

Opens logging on stdout. When this is open, the log() signal will be emitted when Tor prints a message to stdout.

Definition at line 129 of file torprocess.cpp.

Referenced by TorControl::onDisconnected(), and TorProcess().

void TorProcess::closeStdout (  ) 

Disable reading log messages from stdout.

Closes logging on stdout. When this is closed, the log() signal will not be emitted when Tor prints a message to stdout.

Definition at line 138 of file torprocess.cpp.

References onReadyRead().

Referenced by TorControl::onAuthenticated().

QString TorProcess::version ( const QString &  exe  )  [static]

Returns the version reported by the Tor executable specified in exe, or a default-constructed QString on failure.

Definition at line 184 of file torprocess.cpp.

void TorProcess::log ( const QString &  severity,
const QString &  message 
) [signal]

Emitted when Tor prints a log message to the console

Referenced by onReadyRead().

void TorProcess::startFailed ( const QString &  errorMessage  )  [signal]

Emitted when Tor fails to start, perhaps because the path to Tor was bogus.

Referenced by onError().

void TorProcess::onReadyRead (  )  [private, slot]

Called when there is data to be read from stdout

Definition at line 148 of file torprocess.cpp.

References i(), and log().

Referenced by closeStdout(), and TorProcess().

void TorProcess::onError ( QProcess::ProcessError  error  )  [private, slot]

Called when an error occurs in the process.

Called when the process encounters an error. If the error tells us that the process failed to start, then we will emit the startFailed() signal and an error message indicating why.

Definition at line 170 of file torprocess.cpp.

References tc::error(), and startFailed().

Referenced by TorProcess().

QString TorProcess::formatArguments ( const QStringList &  args  )  [private]

Formats the Tor process arguments for logging.

Definition at line 42 of file torprocess.cpp.

References string_escape().

Referenced by start().


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

Generated on Sat Aug 16 17:38:37 2008 for Vidalia by  doxygen 1.5.6