#include <controlsocket.h>
Public Member Functions | |
ControlSocket () | |
bool | connect (QHostAddress addr, quint16 port, QString *errmsg=0) |
bool | disconnect (QString *errmsg=0) |
bool | sendCommand (ControlCommand cmd, QString *errmsg=0) |
bool | readReply (ControlReply &reply, QString *errmsg=0) |
bool | isConnected () |
Protected Member Functions | |
bool | readLineData (QString &line, QString *errmsg=0) |
bool | readLine (QString &line, QString *errmsg=0) |
Private Types | |
enum | ProtocolVersion { VersionUnknown = -1, Version0 = 0, Version1 = 1 } |
Private Member Functions | |
ProtocolVersion | protocolVersion () |
Definition at line 38 of file controlsocket.h.
enum ControlSocket::ProtocolVersion [private] |
Specifies a version of Tor's Control Protocol
Definition at line 68 of file controlsocket.h.
ControlSocket::ControlSocket | ( | ) |
Default constructor and destructor
Definition at line 44 of file controlsocket.cpp.
bool ControlSocket::connect | ( | QHostAddress | addr, | |
quint16 | port, | |||
QString * | errmsg = 0 | |||
) |
Connect to Tor on the specified host and port
Definition at line 53 of file controlsocket.cpp.
References CONN_TIMEOUT, disconnect(), err(), protocolVersion(), and Version1.
Referenced by ControlConnection::connect().
bool ControlSocket::disconnect | ( | QString * | errmsg = 0 |
) |
Disconnect from Tor
Definition at line 83 of file controlsocket.cpp.
References CONN_TIMEOUT, err(), and isConnected().
Referenced by connect().
bool ControlSocket::sendCommand | ( | ControlCommand | cmd, | |
QString * | errmsg = 0 | |||
) |
Send a command to Tor
Definition at line 133 of file controlsocket.cpp.
References err(), isConnected(), and ControlCommand::toString().
Referenced by ControlConnection::eventFilter(), and ControlConnection::send().
bool ControlSocket::readReply | ( | ControlReply & | reply, | |
QString * | errmsg = 0 | |||
) |
Read a response from Tor
Definition at line 203 of file controlsocket.cpp.
References ControlReply::appendLine(), err(), isConnected(), and readLine().
Referenced by ControlConnection::onReadyRead().
bool ControlSocket::isConnected | ( | ) |
Returns true if the control socket is connected and ready to send or receive.
Definition at line 98 of file controlsocket.cpp.
Referenced by disconnect(), readLine(), readReply(), and sendCommand().
bool ControlSocket::readLineData | ( | QString & | line, | |
QString * | errmsg = 0 | |||
) | [protected] |
Reads line data off the socket in chunks.
Definition at line 154 of file controlsocket.cpp.
References err().
Referenced by readLine().
bool ControlSocket::readLine | ( | QString & | line, | |
QString * | errmsg = 0 | |||
) | [protected] |
Reads a line of data from the socket (blocking)
Definition at line 175 of file controlsocket.cpp.
References err(), isConnected(), READ_TIMEOUT, and readLineData().
Referenced by readReply().
ControlSocket::ProtocolVersion ControlSocket::protocolVersion | ( | ) | [private] |
Returns the version of Tor's control protocol being spoken on this socket.
Definition at line 105 of file controlsocket.cpp.
References Version0, Version1, and VersionUnknown.
Referenced by connect().