#include <controlsocket.h>
Public Member Functions | |
ControlSocket () | |
bool | sendCommand (ControlCommand cmd, QString *errmsg=0) |
bool | readReply (ControlReply &reply, QString *errmsg=0) |
bool | isConnected () |
Static Public Member Functions | |
static QString | toString (const QAbstractSocket::SocketError error) |
Protected Member Functions | |
void | customEvent (QEvent *event) |
bool | readLineData (QString &line, QString *errmsg=0) |
bool | readLine (QString &line, QString *errmsg=0) |
Definition at line 26 of file controlsocket.h.
ControlSocket::ControlSocket | ( | ) |
Default constructor.
Definition at line 29 of file controlsocket.cpp.
void ControlSocket::customEvent | ( | QEvent * | event | ) | [protected] |
Processes custom events sent to this object (e.g. SendCommandEvents) from other threads.
Definition at line 44 of file controlsocket.cpp.
References sendCommand(), and CustomEventType::SendCommandEvent.
bool ControlSocket::isConnected | ( | ) |
Returns true if the control socket is connected and ready to send or receive.
Definition at line 36 of file controlsocket.cpp.
Referenced by readLine(), readReply(), ControlConnection::send(), and sendCommand().
bool ControlSocket::readLine | ( | QString & | line, | |
QString * | errmsg = 0 | |||
) | [protected] |
Reads a line of data from the socket (blocking)
Definition at line 110 of file controlsocket.cpp.
References err(), isConnected(), READ_TIMEOUT, and readLineData().
Referenced by readReply().
bool ControlSocket::readLineData | ( | QString & | line, | |
QString * | errmsg = 0 | |||
) | [protected] |
Reads line data off the socket in chunks.
Definition at line 89 of file controlsocket.cpp.
References err().
Referenced by readLine().
bool ControlSocket::readReply | ( | ControlReply & | reply, | |
QString * | errmsg = 0 | |||
) |
Read a response from Tor
Definition at line 138 of file controlsocket.cpp.
References ControlReply::appendLine(), err(), isConnected(), and readLine().
Referenced by ControlConnection::onReadyRead().
bool ControlSocket::sendCommand | ( | ControlCommand | cmd, | |
QString * | errmsg = 0 | |||
) |
Send a command to Tor
Definition at line 67 of file controlsocket.cpp.
References tc::debug(), err(), isConnected(), and ControlCommand::toString().
Referenced by customEvent().
QString ControlSocket::toString | ( | const QAbstractSocket::SocketError | error | ) | [static] |
Returns the string description of error.
Definition at line 187 of file controlsocket.cpp.
Referenced by ControlConnection::onError().