Tor 0.4.9.0-alpha-dev
control.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-2021, The Tor Project, Inc. */
5/* See LICENSE for licensing information */
6
7/**
8 * \file control.h
9 * \brief Header file for control.c.
10 **/
11
12#ifndef TOR_CONTROL_H
13#define TOR_CONTROL_H
14
17
18#define CONTROL_CONN_STATE_MIN_ 1
19/** State for a control connection: Authenticated and accepting v1 commands. */
20#define CONTROL_CONN_STATE_OPEN 1
21/** State for a control connection: Waiting for authentication; speaking
22 * protocol v1. */
23#define CONTROL_CONN_STATE_NEEDAUTH 2
24#define CONTROL_CONN_STATE_MAX_ 2
25
27
28/** Log information about the connection <b>conn</b>, protecting it as with
29 * CONN_LOG_PROTECT. Example:
30 *
31 * LOG_FN_CONN(conn, (LOG_DEBUG, "Socket %d wants to write", conn->s));
32 **/
33#define LOG_FN_CONN(conn, args) \
34 CONN_LOG_PROTECT(conn, log_fn args)
35
36#define CC_LOCAL_FD_IS_OWNER (1u<<0)
37#define CC_LOCAL_FD_IS_AUTHENTICATED (1u<<1)
38int control_connection_add_local_fd(tor_socket_t sock, unsigned flags);
39
43
45
47void enable_control_logging(void);
48
49void monitor_owning_controller_process(const char *process_spec);
50
51const char *rend_auth_type_to_string(rend_auth_type_t auth_type);
52void control_free_all(void);
53
54#ifdef CONTROL_MODULE_PRIVATE
55struct signal_name_t {
56 int sig;
57 const char *signal_name;
58};
59extern const struct signal_name_t signal_table[];
60int get_cached_network_liveness(void);
61void set_cached_network_liveness(int liveness);
62#endif /* defined(CONTROL_MODULE_PRIVATE) */
63
64#ifdef CONTROL_PRIVATE
65STATIC char *control_split_incoming_command(char *incoming_cmd,
66 size_t *data_len,
67 char **current_cmd_out);
68#endif
69
70#endif /* !defined(TOR_CONTROL_H) */
STATIC char * control_split_incoming_command(char *incoming_cmd, size_t *data_len, char **current_cmd_out)
Definition: control.c:303
void control_ports_write_to_file(void)
Definition: control.c:134
const char * rend_auth_type_to_string(rend_auth_type_t auth_type)
int control_connection_add_local_fd(tor_socket_t sock, unsigned flags)
Definition: control.c:95
void disable_control_logging(void)
const control_connection_t * CONST_TO_CONTROL_CONN(const connection_t *)
Definition: control.c:84
void control_free_all(void)
Definition: control.c:620
int connection_control_reached_eof(control_connection_t *conn)
Definition: control.c:209
void enable_control_logging(void)
void connection_control_closed(control_connection_t *conn)
Definition: control.c:231
void monitor_owning_controller_process(const char *process_spec)
Definition: control.c:571
int connection_control_finished_flushing(control_connection_t *conn)
Definition: control.c:201
control_connection_t * TO_CONTROL_CONN(connection_t *)
Definition: control.c:71
int connection_control_process_inbuf(control_connection_t *conn)
Definition: control.c:418
#define tor_socket_t
Definition: nettypes.h:36
rend_auth_type_t
Definition: or.h:356
#define STATIC
Definition: testsupport.h:32