Bitcoin Core  27.99.0
P2P Digital Currency
Functions
torcontrol_tests.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <map>
#include <string>
#include <utility>
Include dependency graph for torcontrol_tests.cpp:

Go to the source code of this file.

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...
 
static void CheckSplitTorReplyLine (std::string input, std::string command, std::string args)
 
 BOOST_AUTO_TEST_CASE (util_SplitTorReplyLine)
 
static void CheckParseTorReplyMapping (std::string input, std::map< std::string, std::string > expected)
 
 BOOST_AUTO_TEST_CASE (util_ParseTorReplyMapping)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( util_ParseTorReplyMapping  )

Definition at line 73 of file torcontrol_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( util_SplitTorReplyLine  )

Definition at line 26 of file torcontrol_tests.cpp.

Here is the call graph for this function:

◆ CheckParseTorReplyMapping()

static void CheckParseTorReplyMapping ( std::string  input,
std::map< std::string, std::string >  expected 
)
static

Definition at line 59 of file torcontrol_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckSplitTorReplyLine()

static void CheckSplitTorReplyLine ( std::string  input,
std::string  command,
std::string  args 
)
static

Definition at line 19 of file torcontrol_tests.cpp.

Here is the call graph for this function:
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 implementers MAY use the following rules to be compatible with buggy Tor implementations and with future ones that implement the spec as intended:

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

Definition at line 224 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 205 of file torcontrol.cpp.

Here is the caller graph for this function: