Vidalia
0.3.1
|
#include <TorSocket.h>
Signals | |
void | connectedToRemoteHost () |
void | socketError (QString errmsg) |
Public Member Functions | |
TorSocket (const QHostAddress &socksAddr, quint16 socksPort, QObject *parent=0) | |
void | connectToRemoteHost (const QString &remoteHost, quint16 remotePort) |
Private Slots | |
void | connectedToProxy () |
void | onHandshakeResponse () |
void | onError (QAbstractSocket::SocketError error) |
Private Member Functions | |
void | sendSocksHandshake (const QString &remoteHost, quint16 remotePort) |
Private Attributes | |
QHostAddress | _socksAddr |
QString | _remoteHost |
quint16 | _socksPort |
quint16 | _remotePort |
Definition at line 23 of file TorSocket.h.
TorSocket::TorSocket | ( | const QHostAddress & | socksAddr, |
quint16 | socksPort, | ||
QObject * | parent = 0 |
||
) |
Constructor.
Definition at line 29 of file TorSocket.cpp.
References connect(), connectedToProxy(), tc::error(), onError(), and onHandshakeResponse().
|
privateslot |
Called when the socket is connected to the proxy and sends our half of a Socks4a handshake.
Definition at line 63 of file TorSocket.cpp.
References _remoteHost, _remotePort, and sendSocksHandshake().
Referenced by TorSocket().
|
signal |
Emitted when a connection has been established through Tor to the remote host specified in a prior call to connectToHost().
Referenced by onHandshakeResponse().
void TorSocket::connectToRemoteHost | ( | const QString & | remoteHost, |
quint16 | remotePort | ||
) |
Connects to the specified hostname and port via Tor.
Definition at line 45 of file TorSocket.cpp.
References _remoteHost, _remotePort, _socksAddr, and _socksPort.
|
privateslot |
Called when a connection error has occurred.
Definition at line 54 of file TorSocket.cpp.
References tc::error(), and socketError().
Referenced by TorSocket().
|
privateslot |
Handles the server's response part of a Socks4a handshake.
Handles the second half of the handshake, received from the SOCKS proxy server. The response should be formatted as follows:
0x00 (response version) STATUS (0x5A means success; other values mean failure) PORT (not set) ADDRESS (not set)
Definition at line 102 of file TorSocket.cpp.
References connectedToRemoteHost(), disconnect(), SOCKS_CONNECT_STATUS_OK, SOCKS_RESPONSE_LEN, and SOCKS_RESPONSE_VERSION.
Referenced by TorSocket().
|
private |
Sends the client part of a Socks4a handshake with a proxy server.
Sends the first part of a Socks4a handshake, using the remote hostname and port specified in the previous call to connectToHost(). The message should be formatted as follows:
0x04 (socks version) 0x01 (connect) PORT (two bytes, most significant byte first) 0x00 0x00 0x00 0x01 (fake IP address: tells proxy to use SOCKS4a) 0x00 (empty username field) HOSTNAME (target hostname) 0x00 (marks the end of the hostname field)
Definition at line 81 of file TorSocket.cpp.
References quint32, SOCKS_CONNECT, SOCKS_FAKE_IP, and SOCKS_VERSION.
Referenced by connectedToProxy().
|
signal |
Emitted when a connection error has occurred.
Referenced by onError().
|
private |
Remote hostname.
Definition at line 56 of file TorSocket.h.
Referenced by connectedToProxy(), and connectToRemoteHost().
|
private |
Remote host port.
Definition at line 58 of file TorSocket.h.
Referenced by connectedToProxy(), and connectToRemoteHost().
|
private |
Address of Tor's SOCKS listener.
Definition at line 55 of file TorSocket.h.
Referenced by connectToRemoteHost().
|
private |
Port of Tor's SOCKS listener.
Definition at line 57 of file TorSocket.h.
Referenced by connectToRemoteHost().