#include <controlcommand.h>
Public Member Functions | |
ControlCommand () | |
ControlCommand (QString keyword) | |
ControlCommand (QString keyword, QString arg) | |
ControlCommand (QString keyword, QStringList args) | |
QString | keyword () const |
void | setKeyword (QString keyword) |
void | addArgument (QString arg) |
void | appendData (QString data) |
QString | toString () |
Private Member Functions | |
QString | escape (QString str) |
Private Attributes | |
QString | _keyword |
QStringList | _arguments |
QStringList | _data |
Definition at line 34 of file controlcommand.h.
ControlCommand::ControlCommand | ( | ) |
Default constructor.
Definition at line 32 of file controlcommand.cpp.
ControlCommand::ControlCommand | ( | QString | keyword | ) |
Creates a command using the specified keyword.
Definition at line 37 of file controlcommand.cpp.
References _keyword.
ControlCommand::ControlCommand | ( | QString | keyword, | |
QString | arg | |||
) |
Creates a control command using the specified keyword and argument.
Definition at line 43 of file controlcommand.cpp.
References _keyword, and addArgument().
ControlCommand::ControlCommand | ( | QString | keyword, | |
QStringList | args | |||
) |
Creates a control command using the specified keyword and list of arguments.
Definition at line 51 of file controlcommand.cpp.
References _arguments, and _keyword.
QString ControlCommand::keyword | ( | ) | const [inline] |
Returns the keyword for this control command.
Definition at line 43 of file controlcommand.h.
References _keyword.
Referenced by ControlConnection::send().
void ControlCommand::setKeyword | ( | QString | keyword | ) |
Set the keyword for this control command
Sets the keyword for this command.
Definition at line 59 of file controlcommand.cpp.
References _keyword.
void ControlCommand::addArgument | ( | QString | arg | ) |
Add an argument to this control command
Adds an argument to this command's argument list.
Definition at line 66 of file controlcommand.cpp.
References _arguments.
Referenced by TorControl::closeCircuit(), TorControl::closeStream(), ControlCommand(), TorControl::getAddressMap(), TorControl::getConf(), TorControl::getDescriptorListById(), TorControl::getDescriptorListByName(), TorControl::getInfo(), TorControl::resetConf(), TorControl::setConf(), TorControl::setEvents(), and TorControl::signal().
void ControlCommand::appendData | ( | QString | data | ) |
Append a data line for this control command
Adds data to the end of this command.
Definition at line 73 of file controlcommand.cpp.
References _data.
QString ControlCommand::toString | ( | ) |
Format this control command into a format conforming to Tor's v1 protocol specification.
Formats a command according to Tor's Control Protocol V1. The proper format of a command is as follows:
Command = Keyword Arguments CRLF / "+" Keyword Arguments CRLF Data Keyword = 1*ALPHA Arguments = *(SP / VCHAR)
Definition at line 101 of file controlcommand.cpp.
References _arguments, _data, _keyword, escape(), and i().
Referenced by ControlSocket::sendCommand().
QString ControlCommand::escape | ( | QString | str | ) | [private] |
Escape special characters in the supplied string
Escapes any special characters in this command.
Definition at line 80 of file controlcommand.cpp.
Referenced by toString().
QString ControlCommand::_keyword [private] |
Definition at line 62 of file controlcommand.h.
Referenced by ControlCommand(), keyword(), setKeyword(), and toString().
QStringList ControlCommand::_arguments [private] |
Definition at line 63 of file controlcommand.h.
Referenced by addArgument(), ControlCommand(), and toString().
QStringList ControlCommand::_data [private] |