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-2010, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
9 * \brief Header file for control.c.
12 #ifndef _TOR_CONTROL_H
13 #define _TOR_CONTROL_H
15 void control_update_global_event_mask(void);
16 void control_adjust_event_log_severity(void);
18 /** Log information about the connection <b>conn</b>, protecting it as with
19 * CONN_LOG_PROTECT. Example:
21 * LOG_FN_CONN(conn, (LOG_DEBUG, "Socket %d wants to write", conn->s));
23 #define LOG_FN_CONN(conn, args) \
24 CONN_LOG_PROTECT(conn, log_fn args)
26 int connection_control_finished_flushing(control_connection_t
*conn
);
27 int connection_control_reached_eof(control_connection_t
*conn
);
28 int connection_control_process_inbuf(control_connection_t
*conn
);
30 #define EVENT_AUTHDIR_NEWDESCS 0x000D
31 #define EVENT_NS 0x000F
32 int control_event_is_interesting(int event
);
34 int control_event_circuit_status(origin_circuit_t
*circ
,
35 circuit_status_event_t e
, int reason
);
36 int control_event_stream_status(edge_connection_t
*conn
,
37 stream_status_event_t e
,
39 int control_event_or_conn_status(or_connection_t
*conn
,
40 or_conn_status_event_t e
, int reason
);
41 int control_event_bandwidth_used(uint32_t n_read
, uint32_t n_written
);
42 int control_event_stream_bandwidth(edge_connection_t
*edge_conn
);
43 int control_event_stream_bandwidth_used(void);
44 void control_event_logmsg(int severity
, unsigned int domain
, const char *msg
);
45 int control_event_descriptors_changed(smartlist_t
*routers
);
46 int control_event_address_mapped(const char *from
, const char *to
,
47 time_t expires
, const char *error
);
48 int control_event_or_authdir_new_descriptor(const char *action
,
52 int control_event_my_descriptor_changed(void);
53 int control_event_networkstatus_changed(smartlist_t
*statuses
);
55 int control_event_newconsensus(const networkstatus_t
*consensus
);
56 int control_event_networkstatus_changed_single(routerstatus_t
*rs
);
57 int control_event_general_status(int severity
, const char *format
, ...)
59 int control_event_client_status(int severity
, const char *format
, ...)
61 int control_event_server_status(int severity
, const char *format
, ...)
63 int control_event_guard(const char *nickname
, const char *digest
,
65 int control_event_buildtimeout_set(const circuit_build_times_t
*cbt
,
66 buildtimeout_set_event_t type
);
68 int init_cookie_authentication(int enabled
);
69 smartlist_t
*decode_hashed_passwords(config_line_t
*passwords
);
70 void disable_control_logging(void);
71 void enable_control_logging(void);
73 void control_event_bootstrap(bootstrap_status_t status
, int progress
);
74 void control_event_bootstrap_problem(const char *warn
, int reason
);
76 void control_event_clients_seen(const char *controller_str
);
78 #ifdef CONTROL_PRIVATE
79 /* Used only by control.c and test.c */
80 size_t write_escaped_data(const char *data
, size_t len
, char **out
);
81 size_t read_escaped_data(const char *data
, size_t len
, char **out
);