#include <torservice.h>
Signals | |
void | started () |
void | finished () |
void | startFailed (QString error) |
Public Member Functions | |
TorService (const QString &torPath, const QString &torrc, QObject *parent=0) | |
~TorService () | |
bool | isInstalled () |
bool | isRunning () |
void | start () |
void | stop () |
bool | install () |
bool | remove () |
Static Public Member Functions | |
static bool | isSupported () |
Private Member Functions | |
void | close () |
void | initialize () |
DWORD | status () |
Private Attributes | |
QString | _torPath |
QString | _torrc |
SC_HANDLE | _manager |
SC_HANDLE | _service |
Definition at line 47 of file torservice.h.
TorService::TorService | ( | const QString & | torPath, | |
const QString & | torrc, | |||
QObject * | parent = 0 | |||
) |
Default ctor.
Definition at line 43 of file torservice.cpp.
References _manager, _service, _torPath, _torrc, and initialize().
TorService::~TorService | ( | ) |
bool TorService::isSupported | ( | ) | [static] |
Returns true if services are supported.
Definition at line 33 of file torservice.cpp.
Referenced by AdvancedPage::AdvancedPage(), initialize(), install(), remove(), start(), TorControl::start(), and status().
bool TorService::isInstalled | ( | ) |
bool TorService::isRunning | ( | ) |
Returns true if the Tor service is running.
Definition at line 109 of file torservice.cpp.
References status().
void TorService::start | ( | ) |
Starts the Tor service. Emits started on success.
Definition at line 120 of file torservice.cpp.
References _service, initialize(), install(), isInstalled(), isRunning(), isSupported(), started(), and startFailed().
Referenced by TorControl::start().
void TorService::stop | ( | ) |
Stops the Tor service. Emits finished on success.
Definition at line 159 of file torservice.cpp.
References _service, finished(), isRunning(), and status().
Referenced by remove().
bool TorService::install | ( | ) |
Installs the Tor service.
Definition at line 182 of file torservice.cpp.
References _manager, _service, _torPath, _torrc, initialize(), isInstalled(), and isSupported().
Referenced by start().
bool TorService::remove | ( | ) |
Removes the Tor service.
Definition at line 210 of file torservice.cpp.
References _service, close(), isInstalled(), isSupported(), and stop().
void TorService::started | ( | ) | [signal] |
Called when the service gets started.
Referenced by start().
void TorService::finished | ( | ) | [signal] |
Called when the service gets stopped.
Referenced by stop().
void TorService::startFailed | ( | QString | error | ) | [signal] |
Called when there is an error in starting the service.
Referenced by start().
void TorService::close | ( | ) | [private] |
Closes the service and the service manager.
Definition at line 66 of file torservice.cpp.
References _manager, and _service.
Referenced by remove(), and ~TorService().
void TorService::initialize | ( | ) | [private] |
Initializes the service and the service manager.
Definition at line 83 of file torservice.cpp.
References _manager, _service, and isSupported().
Referenced by install(), start(), and TorService().
DWORD TorService::status | ( | ) | [private] |
Gets the status of the Tor service.
Definition at line 234 of file torservice.cpp.
References _manager, _service, and isSupported().
Referenced by isRunning(), and stop().
QString TorService::_torPath [private] |
Path to the tor executable.
Definition at line 88 of file torservice.h.
Referenced by install(), and TorService().
QString TorService::_torrc [private] |
Path to the torrc.
Definition at line 90 of file torservice.h.
Referenced by install(), and TorService().
SC_HANDLE TorService::_manager [private] |
Gets the status of the Tor service.
Definition at line 93 of file torservice.h.
Referenced by close(), initialize(), install(), status(), and TorService().
SC_HANDLE TorService::_service [private] |
Handle to a service manager object.
Definition at line 94 of file torservice.h.
Referenced by close(), initialize(), install(), isInstalled(), remove(), start(), status(), stop(), and TorService().