BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
Classes | Functions | Variables
torcontrol.cpp File Reference
#include <torcontrol.h>
#include <utilstrencodings.h>
#include <netbase.h>
#include <net.h>
#include <util.h>
#include <crypto/hmac_sha256.h>
#include <vector>
#include <deque>
#include <set>
#include <stdlib.h>
#include <boost/bind.hpp>
#include <boost/signals2/signal.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include <event2/util.h>
#include <event2/event.h>
#include <event2/thread.h>
Include dependency graph for torcontrol.cpp:

Go to the source code of this file.

Classes

class  TorControlReply
 Reply from Tor, can be single or multi-line. More...
 
class  TorControlConnection
 Low-level handling for Tor control connection. More...
 
class  TorController
 Controller that connects to Tor control socket, authenticate, then create and maintain an ephemeral hidden service. More...
 

Functions

std::pair< std::string, std::string > SplitTorReplyLine (const std::string &s)
 
std::map< std::string, std::string > ParseTorReplyMapping (const std::string &s)
 Parse reply arguments in the form 'METHODS=COOKIE,SAFECOOKIE COOKIEFILE=".../control_auth_cookie"'. More...
 
void StartTorControl ()
 
void InterruptTorControl ()
 
void StopTorControl ()
 

Variables

const std::string DEFAULT_TOR_CONTROL = "127.0.0.1:9051"
 Default control port. More...
 

Function Documentation

◆ InterruptTorControl()

void InterruptTorControl ( )

Definition at line 759 of file torcontrol.cpp.

Here is the caller graph for this function:

◆ ParseTorReplyMapping()

std::map<std::string,std::string> ParseTorReplyMapping ( const std::string &  s)

Parse reply arguments in the form 'METHODS=COOKIE,SAFECOOKIE COOKIEFILE=".../control_auth_cookie"'.

Returns a map of keys to values, or an empty map if there was an error. Grammar is implicitly defined in https://spec.torproject.org/control-spec by the server reply formats for PROTOCOLINFO (S3.21), AUTHCHALLENGE (S3.24), and ADD_ONION (S3.27). See also sections 2.1 and 2.3.

Unescape value. Per https://spec.torproject.org/control-spec section 2.1.1:

For future-proofing, controller implementors MAY use the following rules to be compatible with buggy Tor implementations and with future ones that implement the spec as intended:

Read
and \0 ... \377 as C escapes. Treat a backslash followed by any other character as that character.

Definition at line 272 of file torcontrol.cpp.

Here is the caller graph for this function:

◆ SplitTorReplyLine()

std::pair<std::string,std::string> SplitTorReplyLine ( const std::string &  s)

Definition at line 253 of file torcontrol.cpp.

Here is the caller graph for this function:

◆ StartTorControl()

void StartTorControl ( )

Definition at line 742 of file torcontrol.cpp.

◆ StopTorControl()

void StopTorControl ( )

Definition at line 767 of file torcontrol.cpp.

Variable Documentation

◆ DEFAULT_TOR_CONTROL

const std::string DEFAULT_TOR_CONTROL = "127.0.0.1:9051"

Default control port.

Functionality for communicating with Tor.

Definition at line 31 of file torcontrol.cpp.