tor  0.4.2.1-alpha-dev
control_cmd.h
Go to the documentation of this file.
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
12 #ifndef TOR_CONTROL_CMD_H
13 #define TOR_CONTROL_CMD_H
14 
15 #include "lib/malloc/malloc.h"
16 
18  uint32_t cmd_data_len,
19  char *args);
20 void control_cmd_free_all(void);
21 
25 
26 #define control_cmd_args_free(v) \
27  FREE_AND_NULL(control_cmd_args_t, control_cmd_args_free_, (v))
28 
36 typedef struct control_cmd_syntax_t {
41  unsigned int min_args;
46  unsigned int max_args;
58  const char **allowed_keywords;
63  unsigned kvline_flags;
76 
77 #ifdef CONTROL_CMD_PRIVATE
79 
80 /* ADD_ONION secret key to create an ephemeral service. The command supports
81  * multiple versions so this union stores the key and passes it to the HS
82  * subsystem depending on the requested version. */
83 typedef union add_onion_secret_key_t {
84  /* Hidden service v2 secret key. */
85  crypto_pk_t *v2;
86  /* Hidden service v3 secret key. */
88 } add_onion_secret_key_t;
89 
90 STATIC int add_onion_helper_keyarg(const char *arg, int discard_pk,
91  const char **key_new_alg_out,
92  char **key_new_blob_out,
93  add_onion_secret_key_t *decoded_key,
94  int *hs_version,
95  control_connection_t *conn);
96 
98  int *created, control_connection_t *conn);
99 
101  const char *command,
102  const control_cmd_syntax_t *syntax,
103  size_t body_len,
104  const char *body,
105  char **error_out);
106 
107 #endif /* defined(CONTROL_CMD_PRIVATE) */
108 
109 #ifdef CONTROL_MODULE_PRIVATE
111 #endif /* defined(CONTROL_MODULE_PRIVATE) */
112 
113 #endif /* !defined(TOR_CONTROL_CMD_H) */
const char ** allowed_keywords
Definition: control_cmd.h:58
struct control_cmd_syntax_t control_cmd_syntax_t
smartlist_t * get_detached_onion_services(void)
Definition: control_cmd.c:1642
struct smartlist_t * args
Headers for util_malloc.c.
void control_cmd_args_wipe(control_cmd_args_t *args)
Definition: control_cmd.c:86
unsigned int max_args
Definition: control_cmd.h:46
int handle_control_command(control_connection_t *conn, uint32_t cmd_data_len, char *args)
Definition: control_cmd.c:2370
Header for crypto_ed25519.c.
STATIC rend_authorized_client_t * add_onion_helper_clientauth(const char *arg, int *created, control_connection_t *conn)
Definition: control_cmd.c:2066
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)
Definition: control_cmd.c:1932
unsigned int min_args
Definition: control_cmd.h:41
void control_cmd_args_free_(control_cmd_args_t *args)
Definition: control_cmd.c:69
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)
Definition: control_cmd.c:158