aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-07-22 11:35:09 +0200
committerSebastian Hahn <sebastian@torproject.org>2010-07-27 07:58:15 +0200
commit0bfa34e1f6dd97b9860083101479969a94ee2662 (patch)
tree1c59672e2cfec81ff34baf707e874bb488a3ebad /src
parent0d33120c26cc4e9c7705d003e215a53143b41df7 (diff)
downloadtor-0bfa34e1f6dd97b9860083101479969a94ee2662.tar
tor-0bfa34e1f6dd97b9860083101479969a94ee2662.tar.gz
Create control.h
Diffstat (limited to 'src')
-rw-r--r--src/or/buffers.c1
-rw-r--r--src/or/circuitbuild.c1
-rw-r--r--src/or/circuitlist.c1
-rw-r--r--src/or/circuituse.c1
-rw-r--r--src/or/command.c1
-rw-r--r--src/or/config.c1
-rw-r--r--src/or/connection.c1
-rw-r--r--src/or/connection_edge.c1
-rw-r--r--src/or/connection_or.c1
-rw-r--r--src/or/control.c1
-rw-r--r--src/or/control.h85
-rw-r--r--src/or/cpuworker.c1
-rw-r--r--src/or/directory.c1
-rw-r--r--src/or/dirserv.c1
-rw-r--r--src/or/dns.c1
-rw-r--r--src/or/dnsserv.c1
-rw-r--r--src/or/geoip.c1
-rw-r--r--src/or/main.c1
-rw-r--r--src/or/networkstatus.c1
-rw-r--r--src/or/or.h68
-rw-r--r--src/or/relay.c1
-rw-r--r--src/or/router.c1
-rw-r--r--src/or/routerlist.c1
-rw-r--r--src/test/test_util.c1
24 files changed, 107 insertions, 68 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index e0e0901b6..20e4d2020 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -16,6 +16,7 @@
#include "config.h"
#include "connection_edge.h"
#include "connection_or.h"
+#include "control.h"
#include "../common/util.h"
#include "../common/torlog.h"
#ifdef HAVE_UNISTD_H
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index d94aa31a0..a675d7dad 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -19,6 +19,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "connection_or.h"
+#include "control.h"
#include "router.h"
#include "routerlist.h"
#include "crypto.h"
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 80c3371ed..d2212dc28 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -17,6 +17,7 @@
#include "config.h"
#include "connection_edge.h"
#include "connection_or.h"
+#include "control.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "routerlist.h"
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index d8f1ec76b..07e3d0bc4 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -16,6 +16,7 @@
#include "config.h"
#include "connection.h"
#include "connection_edge.h"
+#include "control.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "rendservice.h"
diff --git a/src/or/command.c b/src/or/command.c
index 76b0d8771..e0fedbdc8 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -22,6 +22,7 @@
#include "connection.h"
#include "connection_or.h"
#include "config.h"
+#include "control.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/config.c b/src/or/config.c
index 07e62463e..2a1f2822f 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -17,6 +17,7 @@
#include "config.h"
#include "connection.h"
#include "connection_edge.h"
+#include "control.h"
#include "geoip.h"
#include "rendclient.h"
#include "rendservice.h"
diff --git a/src/or/connection.c b/src/or/connection.c
index 90f4c55c2..ae81ae041 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -19,6 +19,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "connection_or.h"
+#include "control.h"
#include "dnsserv.h"
#include "geoip.h"
#include "rendclient.h"
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 7fe73e1a7..023c8aeac 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -17,6 +17,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "connection_or.h"
+#include "control.h"
#include "dnsserv.h"
#include "rendclient.h"
#include "rendcommon.h"
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 1d3dc6878..213653f1d 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -17,6 +17,7 @@
#include "config.h"
#include "connection.h"
#include "connection_or.h"
+#include "control.h"
#include "geoip.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/control.c b/src/or/control.c
index 97d1b9d2d..77ca08516 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -18,6 +18,7 @@
#include "config.h"
#include "connection.h"
#include "connection_edge.h"
+#include "control.h"
#include "dnsserv.h"
#include "geoip.h"
#include "router.h"
diff --git a/src/or/control.h b/src/or/control.h
new file mode 100644
index 000000000..27ef5c37f
--- /dev/null
+++ b/src/or/control.h
@@ -0,0 +1,85 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2010, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file control.h
+ * \brief Header file for control.c.
+ **/
+
+#ifndef _TOR_CONTROL_H
+#define _TOR_CONTROL_H
+
+void control_update_global_event_mask(void);
+void control_adjust_event_log_severity(void);
+
+/** Log information about the connection <b>conn</b>, protecting it as with
+ * CONN_LOG_PROTECT. Example:
+ *
+ * LOG_FN_CONN(conn, (LOG_DEBUG, "Socket %d wants to write", conn->s));
+ **/
+#define LOG_FN_CONN(conn, args) \
+ CONN_LOG_PROTECT(conn, log_fn args)
+
+int connection_control_finished_flushing(control_connection_t *conn);
+int connection_control_reached_eof(control_connection_t *conn);
+int connection_control_process_inbuf(control_connection_t *conn);
+
+#define EVENT_AUTHDIR_NEWDESCS 0x000D
+#define EVENT_NS 0x000F
+int control_event_is_interesting(int event);
+
+int control_event_circuit_status(origin_circuit_t *circ,
+ circuit_status_event_t e, int reason);
+int control_event_stream_status(edge_connection_t *conn,
+ stream_status_event_t e,
+ int reason);
+int control_event_or_conn_status(or_connection_t *conn,
+ or_conn_status_event_t e, int reason);
+int control_event_bandwidth_used(uint32_t n_read, uint32_t n_written);
+int control_event_stream_bandwidth(edge_connection_t *edge_conn);
+int control_event_stream_bandwidth_used(void);
+void control_event_logmsg(int severity, unsigned int domain, const char *msg);
+int control_event_descriptors_changed(smartlist_t *routers);
+int control_event_address_mapped(const char *from, const char *to,
+ time_t expires, const char *error);
+int control_event_or_authdir_new_descriptor(const char *action,
+ const char *desc,
+ size_t desclen,
+ const char *msg);
+int control_event_my_descriptor_changed(void);
+int control_event_networkstatus_changed(smartlist_t *statuses);
+
+int control_event_newconsensus(const networkstatus_t *consensus);
+int control_event_networkstatus_changed_single(routerstatus_t *rs);
+int control_event_general_status(int severity, const char *format, ...)
+ CHECK_PRINTF(2,3);
+int control_event_client_status(int severity, const char *format, ...)
+ CHECK_PRINTF(2,3);
+int control_event_server_status(int severity, const char *format, ...)
+ CHECK_PRINTF(2,3);
+int control_event_guard(const char *nickname, const char *digest,
+ const char *status);
+int control_event_buildtimeout_set(const circuit_build_times_t *cbt,
+ buildtimeout_set_event_t type);
+
+int init_cookie_authentication(int enabled);
+smartlist_t *decode_hashed_passwords(config_line_t *passwords);
+void disable_control_logging(void);
+void enable_control_logging(void);
+
+void control_event_bootstrap(bootstrap_status_t status, int progress);
+void control_event_bootstrap_problem(const char *warn, int reason);
+
+void control_event_clients_seen(const char *controller_str);
+
+#ifdef CONTROL_PRIVATE
+/* Used only by control.c and test.c */
+size_t write_escaped_data(const char *data, size_t len, char **out);
+size_t read_escaped_data(const char *data, size_t len, char **out);
+#endif
+
+#endif
+
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 9f49e2e36..58257b781 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -18,6 +18,7 @@
#include "circuitlist.h"
#include "config.h"
#include "connection.h"
+#include "cpuworker.h"
#include "router.h"
/** The maximum number of cpuworker processes we will keep around. */
diff --git a/src/or/directory.c b/src/or/directory.c
index 7d8d7ab4f..5fdae4309 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -9,6 +9,7 @@
#include "config.h"
#include "connection.h"
#include "connection_edge.h"
+#include "control.h"
#include "geoip.h"
#include "rendclient.h"
#include "rendcommon.h"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 4a753af21..80423381e 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -9,6 +9,7 @@
#include "config.h"
#include "connection.h"
#include "connection_or.h"
+#include "control.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/dns.c b/src/or/dns.c
index 5520a493a..77dc97c8b 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -17,6 +17,7 @@
#include "config.h"
#include "connection.h"
#include "connection_edge.h"
+#include "control.h"
#include "router.h"
#include "ht.h"
#ifdef HAVE_EVENT2_DNS_H
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
index 4c471105c..317a0afb2 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -13,6 +13,7 @@
#include "config.h"
#include "connection.h"
#include "connection_edge.h"
+#include "control.h"
#ifdef HAVE_EVENT2_DNS_H
#include <event2/dns.h>
#include <event2/dns_compat.h>
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 16b3b14ed..eae927522 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -11,6 +11,7 @@
#include "or.h"
#include "ht.h"
#include "config.h"
+#include "control.h"
#include "dnsserv.h"
#include "geoip.h"
#include "routerlist.h"
diff --git a/src/or/main.c b/src/or/main.c
index 3b4c73448..63848639e 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -21,6 +21,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "connection_or.h"
+#include "control.h"
#include "dnsserv.h"
#include "geoip.h"
#include "rendclient.h"
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index c73a30bc3..21774976c 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -14,6 +14,7 @@
#include "circuitbuild.h"
#include "config.h"
#include "connection.h"
+#include "control.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/or.h b/src/or/or.h
index 236c24bcb..91509eab0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3128,9 +3128,6 @@ typedef enum buildtimeout_set_event_t {
BUILDTIMEOUT_SET_EVENT_RESUME = 4
} buildtimeout_set_event_t;
-void control_update_global_event_mask(void);
-void control_adjust_event_log_severity(void);
-
/** Execute the statement <b>stmt</b>, which may log events concerning the
* connection <b>conn</b>. To prevent infinite loops, disable log messages
* being sent to controllers if <b>conn</b> is a control connection.
@@ -3147,60 +3144,6 @@ void control_adjust_event_log_severity(void);
enable_control_logging(); \
STMT_END
-/** Log information about the connection <b>conn</b>, protecting it as with
- * CONN_LOG_PROTECT. Example:
- *
- * LOG_FN_CONN(conn, (LOG_DEBUG, "Socket %d wants to write", conn->s));
- **/
-#define LOG_FN_CONN(conn, args) \
- CONN_LOG_PROTECT(conn, log_fn args)
-
-int connection_control_finished_flushing(control_connection_t *conn);
-int connection_control_reached_eof(control_connection_t *conn);
-int connection_control_process_inbuf(control_connection_t *conn);
-
-#define EVENT_AUTHDIR_NEWDESCS 0x000D
-#define EVENT_NS 0x000F
-int control_event_is_interesting(int event);
-
-int control_event_circuit_status(origin_circuit_t *circ,
- circuit_status_event_t e, int reason);
-int control_event_stream_status(edge_connection_t *conn,
- stream_status_event_t e,
- int reason);
-int control_event_or_conn_status(or_connection_t *conn,
- or_conn_status_event_t e, int reason);
-int control_event_bandwidth_used(uint32_t n_read, uint32_t n_written);
-int control_event_stream_bandwidth(edge_connection_t *edge_conn);
-int control_event_stream_bandwidth_used(void);
-void control_event_logmsg(int severity, unsigned int domain, const char *msg);
-int control_event_descriptors_changed(smartlist_t *routers);
-int control_event_address_mapped(const char *from, const char *to,
- time_t expires, const char *error);
-int control_event_or_authdir_new_descriptor(const char *action,
- const char *desc,
- size_t desclen,
- const char *msg);
-int control_event_my_descriptor_changed(void);
-int control_event_networkstatus_changed(smartlist_t *statuses);
-int control_event_newconsensus(const networkstatus_t *consensus);
-int control_event_networkstatus_changed_single(routerstatus_t *rs);
-int control_event_general_status(int severity, const char *format, ...)
- CHECK_PRINTF(2,3);
-int control_event_client_status(int severity, const char *format, ...)
- CHECK_PRINTF(2,3);
-int control_event_server_status(int severity, const char *format, ...)
- CHECK_PRINTF(2,3);
-int control_event_guard(const char *nickname, const char *digest,
- const char *status);
-int control_event_buildtimeout_set(const circuit_build_times_t *cbt,
- buildtimeout_set_event_t type);
-
-int init_cookie_authentication(int enabled);
-smartlist_t *decode_hashed_passwords(config_line_t *passwords);
-void disable_control_logging(void);
-void enable_control_logging(void);
-
/** Enum describing various stages of bootstrapping, for use with controller
* bootstrap status events. The values range from 0 to 100. */
typedef enum {
@@ -3221,17 +3164,6 @@ typedef enum {
BOOTSTRAP_STATUS_DONE=100
} bootstrap_status_t;
-void control_event_bootstrap(bootstrap_status_t status, int progress);
-void control_event_bootstrap_problem(const char *warn, int reason);
-
-void control_event_clients_seen(const char *controller_str);
-
-#ifdef CONTROL_PRIVATE
-/* Used only by control.c and test.c */
-size_t write_escaped_data(const char *data, size_t len, char **out);
-size_t read_escaped_data(const char *data, size_t len, char **out);
-#endif
-
/********************************* cpuworker.c *****************************/
void cpu_init(void);
diff --git a/src/or/relay.c b/src/or/relay.c
index b9ba31775..5db5cfde8 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -19,6 +19,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "connection_or.h"
+#include "control.h"
#include "geoip.h"
#include "mempool.h"
#include "rendcommon.h"
diff --git a/src/or/router.c b/src/or/router.c
index 9cb7ad4f8..722bb4da5 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -11,6 +11,7 @@
#include "circuituse.h"
#include "config.h"
#include "connection.h"
+#include "control.h"
#include "geoip.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index df2960065..a28415289 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -15,6 +15,7 @@
#include "circuitbuild.h"
#include "config.h"
#include "connection.h"
+#include "control.h"
#include "geoip.h"
#include "rendcommon.h"
#include "rendservice.h"
diff --git a/src/test/test_util.c b/src/test/test_util.c
index fc31d055c..22f2707d7 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -8,6 +8,7 @@
#define MEMPOOL_PRIVATE
#include "or.h"
#include "config.h"
+#include "control.h"
#include "test.h"
#include "mempool.h"
#include "memarea.h"