Tor  0.4.4.0-alpha-dev
Data Structures | Macros | Typedefs | Functions | Variables
control_cmd.c File Reference

Implement various commands for Tor's control-socket interface. More...

#include "core/or/or.h"
#include "app/config/config.h"
#include "lib/confmgt/confmgt.h"
#include "app/main/main.h"
#include "core/mainloop/connection.h"
#include "core/or/circuitbuild.h"
#include "core/or/circuitlist.h"
#include "core/or/circuituse.h"
#include "core/or/connection_edge.h"
#include "feature/client/addressmap.h"
#include "feature/client/dnsserv.h"
#include "feature/client/entrynodes.h"
#include "feature/control/control.h"
#include "feature/control/control_auth.h"
#include "feature/control/control_cmd.h"
#include "feature/control/control_hs.h"
#include "feature/control/control_events.h"
#include "feature/control/control_getinfo.h"
#include "feature/control/control_proto.h"
#include "feature/hs/hs_control.h"
#include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerinfo.h"
#include "feature/nodelist/routerlist.h"
#include "feature/rend/rendclient.h"
#include "feature/rend/rendcommon.h"
#include "feature/rend/rendparse.h"
#include "feature/rend/rendservice.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/encoding/confline.h"
#include "lib/encoding/kvline.h"
#include "core/or/cpath_build_state_st.h"
#include "core/or/entry_connection_st.h"
#include "core/or/origin_circuit_st.h"
#include "core/or/socks_request_st.h"
#include "feature/control/control_cmd_args_st.h"
#include "feature/control/control_connection_st.h"
#include "feature/nodelist/node_st.h"
#include "feature/nodelist/routerinfo_st.h"
#include "feature/rend/rend_authorized_client_st.h"
#include "feature/rend/rend_encoded_v2_service_descriptor_st.h"
#include "feature/rend/rend_service_descriptor_st.h"

Go to the source code of this file.

Data Structures

struct  control_cmd_def_t
 

Macros

#define CONTROL_MODULE_PRIVATE
 
#define CONTROL_CMD_PRIVATE
 
#define CONTROL_EVENTS_PRIVATE
 
#define STATE_IS_OPEN(s)   ((s) == CONTROL_CONN_STATE_OPEN)
 
#define SEND_ERRMSG(code, msg)
 
#define SEND_ERRMSG(code, msg)   control_printf_endreply(conn, code, msg ": %s", errstring);
 
#define CMD_FL_WIPE   (1u<<0)
 
#define ONE_LINE(name, flags)
 
#define MULTLINE(name, flags)
 
#define OBSOLETE(name)
 

Typedefs

typedef int(* handler_fn_t) (control_connection_t *conn, const control_cmd_args_t *args)
 

Functions

static int control_setconf_helper (control_connection_t *conn, const control_cmd_args_t *args, int use_defaults)
 
void control_cmd_args_free_ (control_cmd_args_t *args)
 
void control_cmd_args_wipe (control_cmd_args_t *args)
 
static bool string_array_contains_keyword (const char **array, const char *kwd)
 
static int kvline_check_keyword_args (const control_cmd_args_t *result, const control_cmd_syntax_t *syntax, char **error_out)
 
STATIC control_cmd_args_tcontrol_cmd_parse_args (const char *command, const control_cmd_syntax_t *syntax, size_t body_len, const char *body, char **error_out)
 
static bool config_lines_contain_flag (const config_line_t *lines, const char *flag)
 
static int handle_control_setconf (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_resetconf (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_getconf (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_loadconf (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_setevents (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_saveconf (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_signal (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_takeownership (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_dropownership (control_connection_t *conn, const control_cmd_args_t *args)
 
static origin_circuit_tget_circ (const char *id)
 
static entry_connection_tget_stream (const char *id)
 
static int address_is_invalid_mapaddress_target (const char *addr)
 
static int handle_control_mapaddress (control_connection_t *conn, const control_cmd_args_t *args)
 
static uint8_t circuit_purpose_from_string (const char *string)
 
static int handle_control_extendcircuit (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_setcircuitpurpose (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_attachstream (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_postdescriptor (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_redirectstream (control_connection_t *conn, const control_cmd_args_t *cmd_args)
 
static int handle_control_closestream (control_connection_t *conn, const control_cmd_args_t *cmd_args)
 
static int handle_control_closecircuit (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_resolve (control_connection_t *conn, const control_cmd_args_t *args)
 
static char * get_authmethods (const or_options_t *options)
 
static char * get_esc_cfile (const or_options_t *options)
 
static void add_authmethods (smartlist_t *reply)
 
static int handle_control_protocolinfo (control_connection_t *conn, const control_cmd_args_t *cmd_args)
 
static int handle_control_usefeature (control_connection_t *conn, const control_cmd_args_t *cmd_args)
 
static int handle_control_dropguards (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_hsfetch (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_control_hspost (control_connection_t *conn, const control_cmd_args_t *args)
 
static hs_service_add_ephemeral_status_t add_onion_helper_add_service (int hs_version, add_onion_secret_key_t *pk, smartlist_t *port_cfgs, int max_streams, int max_streams_close_circuit, int auth_type, smartlist_t *auth_clients, char **address_out)
 
smartlist_tget_detached_onion_services (void)
 
static int handle_control_add_onion (control_connection_t *conn, const control_cmd_args_t *args)
 
STATIC int add_onion_helper_keyarg (const char *arg, int discard_pk, const char **key_new_alg_out, char **key_new_blob_out, add_onion_secret_key_t *decoded_key, int *hs_version, control_connection_t *conn)
 
STATIC rend_authorized_client_tadd_onion_helper_clientauth (const char *arg, int *created, control_connection_t *conn)
 
static int handle_control_del_onion (control_connection_t *conn, const control_cmd_args_t *cmd_args)
 
static int handle_control_obsolete (control_connection_t *conn, const control_cmd_args_t *args)
 
static int handle_single_control_command (const control_cmd_def_t *def, control_connection_t *conn, uint32_t cmd_data_len, char *args)
 
int handle_control_command (control_connection_t *conn, uint32_t cmd_data_len, char *args)
 
void control_cmd_free_all (void)
 

Variables

static const control_cmd_syntax_t setconf_syntax
 
static const control_cmd_syntax_t resetconf_syntax
 
static const control_cmd_syntax_t getconf_syntax
 
static const control_cmd_syntax_t loadconf_syntax
 
static const control_cmd_syntax_t setevents_syntax
 
static const control_cmd_syntax_t saveconf_syntax
 
static const control_cmd_syntax_t signal_syntax
 
static const control_cmd_syntax_t takeownership_syntax
 
static const control_cmd_syntax_t dropownership_syntax
 
static const control_cmd_syntax_t mapaddress_syntax
 
static const control_cmd_syntax_t extendcircuit_syntax
 
static const control_cmd_syntax_t setcircuitpurpose_syntax
 
static const char * attachstream_keywords []
 
static const control_cmd_syntax_t attachstream_syntax
 
static const char * postdescriptor_keywords []
 
static const control_cmd_syntax_t postdescriptor_syntax
 
static const control_cmd_syntax_t redirectstream_syntax
 
static const control_cmd_syntax_t closestream_syntax
 
static const control_cmd_syntax_t closecircuit_syntax
 
static const control_cmd_syntax_t resolve_syntax
 
static const control_cmd_syntax_t protocolinfo_syntax
 
static const control_cmd_syntax_t usefeature_syntax
 
static const control_cmd_syntax_t dropguards_syntax
 
static const char * hsfetch_keywords []
 
static const control_cmd_syntax_t hsfetch_syntax
 
static const char * hspost_keywords []
 
static const control_cmd_syntax_t hspost_syntax
 
static smartlist_tdetached_onion_services = NULL
 
static const char * add_onion_keywords []
 
static const control_cmd_syntax_t add_onion_syntax
 
static const control_cmd_syntax_t del_onion_syntax
 
static const control_cmd_syntax_t obsolete_syntax
 
static const control_cmd_def_t CONTROL_COMMANDS []
 
static const size_t N_CONTROL_COMMANDS = ARRAY_LENGTH(CONTROL_COMMANDS)
 

Detailed Description

Implement various commands for Tor's control-socket interface.

Definition in file control_cmd.c.

Macro Definition Documentation

◆ CMD_FL_WIPE

#define CMD_FL_WIPE   (1u<<0)

Indicates that the command's arguments are sensitive, and should be memwiped after use.

Definition at line 2267 of file control_cmd.c.

◆ MULTLINE

#define MULTLINE (   name,
  flags 
)
Value:
{ "+"#name, \
handle_control_ ##name, \
flags, \
&name##_syntax \
}
const char * name
Definition: config.c:2441

Macro: declare a command with a multi-line argument and a given set of flags.

Definition at line 2285 of file control_cmd.c.

◆ OBSOLETE

#define OBSOLETE (   name)
Value:
{ #name, \
handle_control_obsolete, \
0, \
&obsolete_syntax, \
}
const char * name
Definition: config.c:2441

Macro: declare an obsolete command. (Obsolete commands give a different error than non-existent ones.)

Definition at line 2296 of file control_cmd.c.

◆ ONE_LINE

#define ONE_LINE (   name,
  flags 
)
Value:
{ \
#name, \
handle_control_ ##name, \
flags, \
&name##_syntax, \
}

Macro: declare a command with a one-line argument, a given set of flags, and a syntax definition.

Definition at line 2273 of file control_cmd.c.

◆ SEND_ERRMSG

#define SEND_ERRMSG (   code,
  msg 
)
Value:
control_printf_endreply(conn, code, msg "%s%s", \
errstring ? ": " : "", \
errstring ? errstring : "")
void control_printf_endreply(control_connection_t *conn, int code, const char *fmt,...)

◆ STATE_IS_OPEN

#define STATE_IS_OPEN (   s)    ((s) == CONTROL_CONN_STATE_OPEN)

Yield true iff s is the state of a control_connection_t that has finished authentication and is accepting commands.

Definition at line 64 of file control_cmd.c.

Typedef Documentation

◆ handler_fn_t

typedef int(* handler_fn_t) (control_connection_t *conn, const control_cmd_args_t *args)

Function pointer to a handler function for a controller command.

Definition at line 2238 of file control_cmd.c.

Function Documentation

◆ add_authmethods()

static void add_authmethods ( smartlist_t reply)
static

Compose the auth methods line of a PROTOCOLINFO reply.

Definition at line 1288 of file control_cmd.c.

◆ add_onion_helper_clientauth()

STATIC rend_authorized_client_t* add_onion_helper_clientauth ( const char *  arg,
int *  created,
control_connection_t conn 
)

Helper function to handle parsing a ClientAuth argument to the ADD_ONION command. Return a new rend_authorized_client_t, or NULL and an optional control protocol error message on failure. The caller is responsible for freeing the returned auth_client.

If 'created' is specified, it will be set to 1 when a new cookie has been generated.

Note: conn is only used for writing control replies. For testing purposes, it can be NULL if control_write_reply() is appropriately mocked.

Definition at line 2085 of file control_cmd.c.

◆ add_onion_helper_keyarg()

STATIC int add_onion_helper_keyarg ( const char *  arg,
int  discard_pk,
const char **  key_new_alg_out,
char **  key_new_blob_out,
add_onion_secret_key_t *  decoded_key,
int *  hs_version,
control_connection_t conn 
)

Helper function to handle parsing the KeyType:KeyBlob argument to the ADD_ONION command. Return a new crypto_pk_t and if a new key was generated and the private key not discarded, the algorithm and serialized private key, or NULL and an optional control protocol error message on failure. The caller is responsible for freeing the returned key_new_blob.

Note: The error messages returned are deliberately vague to avoid echoing key material.

Note: conn is only used for writing control replies. For testing purposes, it can be NULL if control_write_reply() is appropriately mocked.

Definition at line 1949 of file control_cmd.c.

◆ address_is_invalid_mapaddress_target()

static int address_is_invalid_mapaddress_target ( const char *  addr)
static

Return true iff addr is unusable as a mapaddress target because of containing funny characters.

Definition at line 617 of file control_cmd.c.

Referenced by handle_control_mapaddress().

◆ circuit_purpose_from_string()

static uint8_t circuit_purpose_from_string ( const char *  string)
static

Given a string, convert it to a circuit purpose.

Definition at line 703 of file control_cmd.c.

◆ config_lines_contain_flag()

static bool config_lines_contain_flag ( const config_line_t lines,
const char *  flag 
)
static

Return true iff lines contains flags as a no-value (keyword-only) entry.

Definition at line 241 of file control_cmd.c.

Referenced by handle_control_saveconf().

◆ control_cmd_args_free_()

void control_cmd_args_free_ ( control_cmd_args_t args)

Release all storage held in args

Definition at line 70 of file control_cmd.c.

◆ control_cmd_args_wipe()

void control_cmd_args_wipe ( control_cmd_args_t args)

Erase all memory held in args.

Definition at line 87 of file control_cmd.c.

◆ control_cmd_parse_args()

STATIC control_cmd_args_t* control_cmd_parse_args ( const char *  command,
const control_cmd_syntax_t syntax,
size_t  body_len,
const char *  body,
char **  error_out 
)

Helper: parse the arguments to a command according to syntax. On success, set *error_out to NULL and return a newly allocated control_cmd_args_t. On failure, set *error_out to newly allocated error string, and return NULL.

Definition at line 159 of file control_cmd.c.

Referenced by handle_single_control_command().

◆ control_setconf_helper()

static int control_setconf_helper ( control_connection_t conn,
const control_cmd_args_t args,
int  use_defaults 
)
static

Helper for setconf and resetconf. Acts like setconf, except it passes use_defaults on to options_trial_assign(). Modifies the contents of body.

Definition at line 568 of file control_cmd.c.

Referenced by handle_control_resetconf(), and handle_control_setconf().

◆ get_authmethods()

static char* get_authmethods ( const or_options_t options)
static

Return a comma-separated list of authentication methods for handle_control_protocolinfo(). Caller must free this string.

Definition at line 1246 of file control_cmd.c.

Referenced by add_authmethods().

◆ get_circ()

static origin_circuit_t* get_circ ( const char *  id)
static

Given a text circuit id, return the corresponding circuit.

Definition at line 537 of file control_cmd.c.

◆ get_detached_onion_services()

smartlist_t* get_detached_onion_services ( void  )

Return a list of detached onion services, or NULL if none exist.

Definition at line 1659 of file control_cmd.c.

Referenced by getinfo_helper_onions().

◆ get_esc_cfile()

static char* get_esc_cfile ( const or_options_t options)
static

Return escaped cookie filename. Caller must free this string. Return NULL if cookie authentication is disabled.

Definition at line 1271 of file control_cmd.c.

Referenced by add_authmethods().

◆ get_stream()

static entry_connection_t* get_stream ( const char *  id)
static

Given a text stream id, return the corresponding AP connection.

Definition at line 549 of file control_cmd.c.

Referenced by handle_control_redirectstream().

◆ handle_control_add_onion()

static int handle_control_add_onion ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a ADD_ONION command; parse the body, and set up the new ephemeral Onion Service.

Definition at line 1676 of file control_cmd.c.

◆ handle_control_attachstream()

static int handle_control_attachstream ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get an ATTACHSTREAM message. Try to attach the requested stream, and report success or failure.

Definition at line 932 of file control_cmd.c.

◆ handle_control_closecircuit()

static int handle_control_closecircuit ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a CLOSECIRCUIT command; try to close the named circuit and report success or failure.

Definition at line 1170 of file control_cmd.c.

◆ handle_control_closestream()

static int handle_control_closestream ( control_connection_t conn,
const control_cmd_args_t cmd_args 
)
static

Called when we get a CLOSESTREAM command; try to close the named stream and report success or failure.

Definition at line 1129 of file control_cmd.c.

◆ handle_control_command()

int handle_control_command ( control_connection_t conn,
uint32_t  cmd_data_len,
char *  args 
)

Run a given controller command, as selected by the current_cmd field of conn.

Definition at line 2394 of file control_cmd.c.

◆ handle_control_del_onion()

static int handle_control_del_onion ( control_connection_t conn,
const control_cmd_args_t cmd_args 
)
static

Called when we get a DEL_ONION command; parse the body, and remove the existing ephemeral Onion Service.

Definition at line 2141 of file control_cmd.c.

◆ handle_control_dropguards()

static int handle_control_dropguards ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Implementation for the DROPGUARDS command.

Definition at line 1380 of file control_cmd.c.

◆ handle_control_dropownership()

static int handle_control_dropownership ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a DROPOWNERSHIP command. Mark this connection as a non-owning connection, so that we will not exit if the connection closes.

Definition at line 520 of file control_cmd.c.

◆ handle_control_extendcircuit()

static int handle_control_extendcircuit ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get an EXTENDCIRCUIT message. Try to extend the listed circuit, and report success or failure.

Definition at line 726 of file control_cmd.c.

◆ handle_control_getconf()

static int handle_control_getconf ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we receive a GETCONF message. Parse the request, and reply with a CONFVALUE or an ERROR message

Definition at line 286 of file control_cmd.c.

◆ handle_control_hsfetch()

static int handle_control_hsfetch ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Implementation for the HSFETCH command.

Definition at line 1410 of file control_cmd.c.

◆ handle_control_hspost()

static int handle_control_hspost ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Implementation for the HSPOST command.

Definition at line 1516 of file control_cmd.c.

◆ handle_control_loadconf()

static int handle_control_loadconf ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a +LOADCONF message.

Definition at line 337 of file control_cmd.c.

◆ handle_control_mapaddress()

static int handle_control_mapaddress ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a MAPADDRESS command; try to bind all listed addresses, and report success or failure.

Definition at line 635 of file control_cmd.c.

◆ handle_control_obsolete()

static int handle_control_obsolete ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get an obsolete command: tell the controller that it is obsolete.

Definition at line 2224 of file control_cmd.c.

◆ handle_control_postdescriptor()

static int handle_control_postdescriptor ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a POSTDESCRIPTOR message. Try to learn the provided descriptor, and report success or failure.

Definition at line 1026 of file control_cmd.c.

◆ handle_control_protocolinfo()

static int handle_control_protocolinfo ( control_connection_t conn,
const control_cmd_args_t cmd_args 
)
static

Called when we get a PROTOCOLINFO command: send back a reply.

Definition at line 1305 of file control_cmd.c.

◆ handle_control_redirectstream()

static int handle_control_redirectstream ( control_connection_t conn,
const control_cmd_args_t cmd_args 
)
static

Called when we receive a REDIRECTSTERAM command. Try to change the target address of the named AP stream, and report success or failure.

Definition at line 1082 of file control_cmd.c.

◆ handle_control_resetconf()

static int handle_control_resetconf ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we receive a RESETCONF message: parse the body and try to update our configuration. Reply with a DONE or ERROR message. Modifies the contents of body.

Definition at line 273 of file control_cmd.c.

◆ handle_control_resolve()

static int handle_control_resolve ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a RESOLVE command: start trying to resolve the listed addresses.

Definition at line 1200 of file control_cmd.c.

◆ handle_control_saveconf()

static int handle_control_saveconf ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a SAVECONF command. Try to flush the current options to disk, and report success or failure.

Definition at line 435 of file control_cmd.c.

◆ handle_control_setcircuitpurpose()

static int handle_control_setcircuitpurpose ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a SETCIRCUITPURPOSE message. If we can find the circuit and it's a valid purpose, change it.

Definition at line 887 of file control_cmd.c.

◆ handle_control_setconf()

static int handle_control_setconf ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we receive a SETCONF message: parse the body and try to update our configuration. Reply with a DONE or ERROR message. Modifies the contents of body.

Definition at line 257 of file control_cmd.c.

◆ handle_control_setevents()

static int handle_control_setevents ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a SETEVENTS message: update conn->event_mask, and reply with DONE or ERROR.

Definition at line 385 of file control_cmd.c.

◆ handle_control_signal()

static int handle_control_signal ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a SIGNAL command. React to the provided signal, and report success or failure. (If the signal results in a shutdown, success may not be reported.)

Definition at line 458 of file control_cmd.c.

◆ handle_control_takeownership()

static int handle_control_takeownership ( control_connection_t conn,
const control_cmd_args_t args 
)
static

Called when we get a TAKEOWNERSHIP command. Mark this connection as an owning connection, so that we will exit if the connection closes.

Definition at line 497 of file control_cmd.c.

◆ handle_control_usefeature()

static int handle_control_usefeature ( control_connection_t conn,
const control_cmd_args_t cmd_args 
)
static

Called when we get a USEFEATURE command: parse the feature list, and set up the control_connection's options properly.

Definition at line 1349 of file control_cmd.c.

◆ handle_single_control_command()

static int handle_single_control_command ( const control_cmd_def_t def,
control_connection_t conn,
uint32_t  cmd_data_len,
char *  args 
)
static

Run a single control command, as defined by a control_cmd_def_t, with a given set of arguments.

Definition at line 2353 of file control_cmd.c.

Referenced by handle_control_command().

◆ kvline_check_keyword_args()

static int kvline_check_keyword_args ( const control_cmd_args_t result,
const control_cmd_syntax_t syntax,
char **  error_out 
)
static

Helper for argument parsing: check whether the keyword arguments just parsed in result were well-formed according to syntax.

On success, return 0. On failure, return -1 and set *error_out to a newly allocated error string.

Definition at line 124 of file control_cmd.c.

◆ string_array_contains_keyword()

static bool string_array_contains_keyword ( const char **  array,
const char *  kwd 
)
static

Return true iff any element of the NULL-terminated array matches kwd. Case-insensitive.

Definition at line 108 of file control_cmd.c.

Referenced by kvline_check_keyword_args().

Variable Documentation

◆ add_onion_keywords

const char* add_onion_keywords[]
static
Initial value:
= {
"Port", "Flags", "MaxStreams", "ClientAuth", NULL
}

Definition at line 1664 of file control_cmd.c.

◆ add_onion_syntax

const control_cmd_syntax_t add_onion_syntax
static
Initial value:
= {
.min_args = 1, .max_args = 1,
.accept_keywords = true,
.allowed_keywords = add_onion_keywords
}

Definition at line 1667 of file control_cmd.c.

◆ attachstream_keywords

const char* attachstream_keywords[]
static
Initial value:
= {
"HOP", NULL
}

Definition at line 920 of file control_cmd.c.

◆ attachstream_syntax

const control_cmd_syntax_t attachstream_syntax
static
Initial value:
= {
.min_args=2, .max_args=2,
.accept_keywords=true,
.allowed_keywords=attachstream_keywords
}

Definition at line 923 of file control_cmd.c.

◆ closecircuit_syntax

const control_cmd_syntax_t closecircuit_syntax
static
Initial value:
= {
.min_args=1, .max_args=1,
.accept_keywords=true,
.kvline_flags=KV_OMIT_VALS,
}

Definition at line 1159 of file control_cmd.c.

◆ closestream_syntax

const control_cmd_syntax_t closestream_syntax
static
Initial value:
= {
.min_args = 2,
.max_args = UINT_MAX,
}

Definition at line 1120 of file control_cmd.c.

◆ CONTROL_COMMANDS

const control_cmd_def_t CONTROL_COMMANDS[]
static

An array defining all the recognized controller commands.

Definition at line 2307 of file control_cmd.c.

Referenced by handle_control_command().

◆ del_onion_syntax

const control_cmd_syntax_t del_onion_syntax
static
Initial value:
= {
.min_args = 1, .max_args = 1,
}

Definition at line 2134 of file control_cmd.c.

◆ detached_onion_services

smartlist_t* detached_onion_services = NULL
static

The list of onion services that have been added via ADD_ONION that do not belong to any particular control connection.

Definition at line 1653 of file control_cmd.c.

Referenced by get_detached_onion_services().

◆ dropguards_syntax

const control_cmd_syntax_t dropguards_syntax
static
Initial value:
= {
.max_args = 0,
}

Definition at line 1374 of file control_cmd.c.

◆ dropownership_syntax

const control_cmd_syntax_t dropownership_syntax
static
Initial value:
= {
.max_args = UINT_MAX,
}

Definition at line 512 of file control_cmd.c.

◆ extendcircuit_syntax

const control_cmd_syntax_t extendcircuit_syntax
static
Initial value:
= {
.min_args=1,
.max_args=1,
.accept_keywords=true,
.kvline_flags=KV_OMIT_VALS
}

Definition at line 716 of file control_cmd.c.

◆ getconf_syntax

const control_cmd_syntax_t getconf_syntax
static
Initial value:
= {
.max_args=UINT_MAX
}

Definition at line 279 of file control_cmd.c.

◆ hsfetch_keywords

const char* hsfetch_keywords[]
static
Initial value:
= {
"SERVER", NULL,
}

Definition at line 1399 of file control_cmd.c.

◆ hsfetch_syntax

const control_cmd_syntax_t hsfetch_syntax
static
Initial value:
= {
.min_args = 1, .max_args = 1,
.accept_keywords = true,
.allowed_keywords = hsfetch_keywords,
}

Definition at line 1402 of file control_cmd.c.

◆ hspost_keywords

const char* hspost_keywords[]
static
Initial value:
= {
"SERVER", "HSADDRESS", NULL
}

Definition at line 1504 of file control_cmd.c.

◆ hspost_syntax

const control_cmd_syntax_t hspost_syntax
static
Initial value:
= {
.min_args = 0, .max_args = 0,
.accept_keywords = true,
.want_cmddata = true,
.allowed_keywords = hspost_keywords
}

Definition at line 1507 of file control_cmd.c.

◆ loadconf_syntax

const control_cmd_syntax_t loadconf_syntax
static
Initial value:
= {
.want_cmddata = true
}

Definition at line 331 of file control_cmd.c.

◆ mapaddress_syntax

const control_cmd_syntax_t mapaddress_syntax
static
Initial value:
= {
.max_args=0,
.accept_keywords=true,
}

Definition at line 625 of file control_cmd.c.

◆ N_CONTROL_COMMANDS

const size_t N_CONTROL_COMMANDS = ARRAY_LENGTH(CONTROL_COMMANDS)
static

The number of entries in CONTROL_COMMANDS.

Definition at line 2346 of file control_cmd.c.

Referenced by handle_control_command().

◆ obsolete_syntax

const control_cmd_syntax_t obsolete_syntax
static
Initial value:
= {
.max_args = UINT_MAX
}

Definition at line 2215 of file control_cmd.c.

◆ postdescriptor_keywords

const char* postdescriptor_keywords[]
static
Initial value:
= {
"cache", "purpose", NULL,
}

Definition at line 1012 of file control_cmd.c.

◆ postdescriptor_syntax

const control_cmd_syntax_t postdescriptor_syntax
static
Initial value:
= {
.max_args = 0,
.accept_keywords = true,
.allowed_keywords = postdescriptor_keywords,
.want_cmddata = true,
}

Definition at line 1016 of file control_cmd.c.

◆ protocolinfo_syntax

const control_cmd_syntax_t protocolinfo_syntax
static
Initial value:
= {
.max_args = UINT_MAX
}

Definition at line 1239 of file control_cmd.c.

◆ redirectstream_syntax

const control_cmd_syntax_t redirectstream_syntax
static
Initial value:
= {
.min_args = 2,
.max_args = UINT_MAX,
}

Definition at line 1074 of file control_cmd.c.

◆ resetconf_syntax

const control_cmd_syntax_t resetconf_syntax
static
Initial value:
= {
.max_args=0,
.accept_keywords=true,
.kvline_flags=KV_OMIT_VALS|KV_QUOTED,
}

Definition at line 263 of file control_cmd.c.

◆ resolve_syntax

const control_cmd_syntax_t resolve_syntax
static
Initial value:
= {
.max_args=0,
.accept_keywords=true,
.kvline_flags=KV_OMIT_VALS,
}

Definition at line 1191 of file control_cmd.c.

◆ saveconf_syntax

const control_cmd_syntax_t saveconf_syntax
static
Initial value:
= {
.max_args = 0,
.accept_keywords = true,
.kvline_flags=KV_OMIT_VALS,
}

Definition at line 426 of file control_cmd.c.

◆ setcircuitpurpose_syntax

const control_cmd_syntax_t setcircuitpurpose_syntax
static
Initial value:
= {
.max_args=1,
.accept_keywords=true,
}

Definition at line 879 of file control_cmd.c.

◆ setconf_syntax

const control_cmd_syntax_t setconf_syntax
static
Initial value:
= {
.max_args=0,
.accept_keywords=true,
.kvline_flags=KV_OMIT_VALS|KV_QUOTED,
}

Definition at line 247 of file control_cmd.c.

◆ setevents_syntax

const control_cmd_syntax_t setevents_syntax
static
Initial value:
= {
.max_args = UINT_MAX
}

Definition at line 378 of file control_cmd.c.

◆ signal_syntax

const control_cmd_syntax_t signal_syntax
static
Initial value:
= {
.min_args = 1,
.max_args = 1,
}

Definition at line 449 of file control_cmd.c.

◆ takeownership_syntax

const control_cmd_syntax_t takeownership_syntax
static
Initial value:
= {
.max_args = UINT_MAX,
}

Definition at line 489 of file control_cmd.c.

◆ usefeature_syntax

const control_cmd_syntax_t usefeature_syntax
static
Initial value:
= {
.max_args = UINT_MAX
}

Definition at line 1342 of file control_cmd.c.