TorControlConnection

Low-level handling for Tor control connection. Speaks the SMTP-like protocol as defined in torspec/control-spec.txt

Synopsis

Declared in <torcontrol.h>

class TorControlConnection;

Type Aliases

NameDescription
ReplyHandlerCB Callback type invoked with the connection and the reply it received.

Member Functions

NameDescription
TorControlConnection [constructor]Create a new TorControlConnection.
~TorControlConnection [destructor]Destroy the connection, closing the socket if still open.
Command Send a command, register a handler for the reply. A trailing CRLF is automatically added. Return true on success.
Connect Connect to a Tor control port. tor_control_center is address of the form host:port. Return true on success.
Disconnect Disconnect from Tor control port.
IsConnected Check if the connection is established.
ReceiveAndProcess Read available data from socket and process complete replies. Dispatches to registered reply handlers.
WaitForData Wait for data to be available on the socket.