Vidalia
0.3.1
Main Page
Namespaces
Classes
Files
File List
File Members
src
torcontrol
TorProcess.h
Go to the documentation of this file.
1
/*
2
** This file is part of Vidalia, and is subject to the license terms in the
3
** LICENSE file, found in the top level directory of this distribution. If
4
** you did not receive the LICENSE file with this file, you may obtain it
5
** from the Vidalia source package distributed by the Vidalia Project at
6
** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7
** including this file, may be copied, modified, propagated, or distributed
8
** except according to the terms described in the LICENSE file.
9
*/
10
11
/*
12
** \file TorProcess.h
13
** \brief Starts and stops a Tor process
14
*/
15
16
#ifndef _TORPROCESS_H
17
#define _TORPROCESS_H
18
19
#include <QProcess>
20
21
22
class
TorProcess
:
public
QProcess
23
{
24
Q_OBJECT
25
26
public
:
27
/** Default constructor. */
28
TorProcess
(QObject *parent = 0);
29
30
/** Start the Tor process */
31
void
start
(
const
QString &app,
const
QStringList &args);
32
/** Stop the Tor process */
33
bool
stop
(QString *errmsg = 0);
34
35
/** Return the Tor process's PID (workaround for some Windows funkiness) */
36
quint64
pid
();
37
38
/** Enable reading log messages from stdout. */
39
void
openStdout
();
40
/** Disable reading log messages from stdout. */
41
void
closeStdout
();
42
43
/** Returns the version reported by the Tor executable specified in
44
* <b>exe</b>, or a default-constructed QString on failure. */
45
static
QString
version
(
const
QString &exe);
46
47
signals:
48
/** Emitted when Tor prints a log message to the console */
49
void
log
(
const
QString &severity,
const
QString &message);
50
/** Emitted when Tor fails to start, perhaps because the path to Tor was
51
* bogus. */
52
void
startFailed
(
const
QString &errorMessage);
53
54
private
slots:
55
/** Called when there is data to be read from stdout */
56
void
onReadyRead
();
57
/** Called when an error occurs in the process. */
58
void
onError
(QProcess::ProcessError
error
);
59
60
private
:
61
/** Formats the Tor process arguments for logging. */
62
QString
formatArguments
(
const
QStringList &args);
63
};
64
65
#endif
66
Generated on Mon Jan 14 2013 08:44:27 for Vidalia by
1.8.3