Vidalia  0.3.1
Signals | Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | List of all members
TorProcess Class Reference

#include <TorProcess.h>

Inheritance diagram for TorProcess:

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 22 of file TorProcess.h.

Constructor & Destructor Documentation

§ TorProcess()

TorProcess::TorProcess ( QObject *  parent = 0)

Default constructor.

Default constructor

Definition at line 30 of file TorProcess.cpp.

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

Member Function Documentation

§ closeStdout()

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::closeTorStdout().

§ formatArguments()

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().

§ log

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

Emitted when Tor prints a log message to the console

Referenced by onReadyRead().

§ onError

void TorProcess::onError ( QProcess::ProcessError  error)
privateslot

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::DebugMessage::arg(), tc::error(), and startFailed().

Referenced by TorProcess().

§ onReadyRead

void TorProcess::onReadyRead ( )
privateslot

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().

§ openStdout()

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().

§ pid()

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().

§ start()

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::DebugMessage::arg(), tc::debug(), formatArguments(), and i().

Referenced by TorControl::start().

§ startFailed

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

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

Referenced by onError().

§ stop()

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

Stop the Tor process

Stops the Tor process

Definition at line 85 of file TorProcess.cpp.

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

Referenced by TorControl::stop().

§ version()

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.


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