Vidalia
0.3.1
Main Page
Namespaces
Classes
Files
File List
File Members
src
common
TorSocket.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 you
4
** did not receive the LICENSE file with this file, you may obtain it from the
5
** 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 TorSocket.h
13
** \brief A QTcpSocket that makes requests over Tor
14
*/
15
16
#ifndef _TORSOCKET_H
17
#define _TORSOCKET_H
18
19
#include <QTcpSocket>
20
#include <QHostAddress>
21
22
23
class
TorSocket
:
public
QTcpSocket
24
{
25
Q_OBJECT
26
27
public
:
28
/** Constructor. */
29
TorSocket
(
const
QHostAddress &socksAddr,
30
quint16 socksPort, QObject *parent = 0);
31
32
/** Connects to the specified hostname and port via Tor. */
33
void
connectToRemoteHost
(
const
QString &remoteHost, quint16 remotePort);
34
35
signals:
36
/** Emitted when a connection has been established through Tor to the remote
37
* host specified in a prior call to connectToHost(). */
38
void
connectedToRemoteHost
();
39
/** Emitted when a connection error has occurred. */
40
void
socketError
(QString errmsg);
41
42
private
slots:
43
/** Called when the socket is connected to the proxy and sends our
44
* half of a Socks4a handshake. */
45
void
connectedToProxy
();
46
/** Handles the server's response part of a Socks4a handshake. */
47
void
onHandshakeResponse
();
48
/** Called when a connection error has occurred. */
49
void
onError
(QAbstractSocket::SocketError
error
);
50
51
private
:
52
/** Sends the client part of a Socks4a handshake with a proxy server. */
53
void
sendSocksHandshake
(
const
QString &remoteHost, quint16 remotePort);
54
55
QHostAddress
_socksAddr
;
/**< Address of Tor's SOCKS listener. */
56
QString
_remoteHost
;
/**< Remote hostname. */
57
quint16
_socksPort
;
/**< Port of Tor's SOCKS listener. */
58
quint16
_remotePort
;
/**< Remote host port. */
59
};
60
61
#endif
62
Generated on Mon Jan 14 2013 08:44:27 for Vidalia by
1.8.3