diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index a2f7c2c522..ee18dc3b3d 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -13,6 +13,7 @@ #include "or.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "router.h" #include "routerlist.h" #include "crypto.h" diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 52b33197a2..4e58ddef94 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -11,6 +11,7 @@ #include "or.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "rendclient.h" #include "rendcommon.h" #include "routerlist.h" diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h new file mode 100644 index 0000000000..caca614c8c --- /dev/null +++ b/src/or/circuitlist.h @@ -0,0 +1,60 @@ +/* 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 circuitlist.h + * \brief Header file for circuitlist.c. + **/ + +#ifndef _TOR_CIRCUITLIST_H +#define _TOR_CIRCUITLIST_H + +circuit_t * _circuit_get_global_list(void); +const char *circuit_state_to_string(int state); +const char *circuit_purpose_to_controller_string(uint8_t purpose); +void circuit_dump_by_conn(connection_t *conn, int severity); +void circuit_set_p_circid_orconn(or_circuit_t *circ, circid_t id, + or_connection_t *conn); +void circuit_set_n_circid_orconn(circuit_t *circ, circid_t id, + or_connection_t *conn); +void circuit_set_state(circuit_t *circ, uint8_t state); +void circuit_close_all_marked(void); +int32_t circuit_initial_package_window(void); +origin_circuit_t *origin_circuit_new(void); +or_circuit_t *or_circuit_new(circid_t p_circ_id, or_connection_t *p_conn); +circuit_t *circuit_get_by_circid_orconn(circid_t circ_id, + or_connection_t *conn); +int circuit_id_in_use_on_orconn(circid_t circ_id, or_connection_t *conn); +circuit_t *circuit_get_by_edge_conn(edge_connection_t *conn); +void circuit_unlink_all_from_or_conn(or_connection_t *conn, int reason); +origin_circuit_t *circuit_get_by_global_id(uint32_t id); +origin_circuit_t *circuit_get_by_rend_query_and_purpose(const char *rend_query, + uint8_t purpose); +origin_circuit_t *circuit_get_next_by_pk_and_purpose(origin_circuit_t *start, + const char *digest, uint8_t purpose); +or_circuit_t *circuit_get_rendezvous(const char *cookie); +or_circuit_t *circuit_get_intro_point(const char *digest); +origin_circuit_t *circuit_find_to_cannibalize(uint8_t purpose, + extend_info_t *info, int flags); +void circuit_mark_all_unused_circs(void); +void circuit_expire_all_dirty_circs(void); +void _circuit_mark_for_close(circuit_t *circ, int reason, + int line, const char *file); +int circuit_get_cpath_len(origin_circuit_t *circ); +crypt_path_t *circuit_get_cpath_hop(origin_circuit_t *circ, int hopnum); +void circuit_get_all_pending_on_or_conn(smartlist_t *out, + or_connection_t *or_conn); +int circuit_count_pending_on_or_conn(or_connection_t *or_conn); + +#define circuit_mark_for_close(c, reason) \ + _circuit_mark_for_close((c), (reason), __LINE__, _SHORT_FILE_) + +void assert_cpath_layer_ok(const crypt_path_t *cp); +void assert_circuit_ok(const circuit_t *c); +void circuit_free_all(void); + +#endif + diff --git a/src/or/circuituse.c b/src/or/circuituse.c index e4e5d205ba..9e1c1860a9 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -11,6 +11,7 @@ #include "or.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "rendclient.h" #include "rendcommon.h" #include "rendservice.h" diff --git a/src/or/command.c b/src/or/command.c index 1ca82f7d21..1f084d032f 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -17,6 +17,7 @@ #include "or.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "router.h" #include "routerlist.h" diff --git a/src/or/config.c b/src/or/config.c index 9996d1cc54..e9c9cbd69a 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -13,6 +13,7 @@ #include "or.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "geoip.h" #include "rendclient.h" #include "rendservice.h" diff --git a/src/or/connection.c b/src/or/connection.c index c910c7c5d1..1ed3e3d093 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -13,6 +13,7 @@ #include "or.h" #include "buffers.h" #include "circuitbuild.h" +#include "circuitlist.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 84752f15b7..15cd8bf9bc 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -11,6 +11,7 @@ #include "or.h" #include "buffers.h" +#include "circuitlist.h" #include "dnsserv.h" #include "rendclient.h" #include "rendcommon.h" diff --git a/src/or/control.c b/src/or/control.c index ff6d4ce2a7..5e9e9a2eb2 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -13,6 +13,7 @@ #include "or.h" #include "buffers.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "dnsserv.h" #include "geoip.h" #include "router.h" diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 5231f11468..b9c51d4fcb 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -15,6 +15,7 @@ #include "or.h" #include "buffers.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "router.h" /** The maximum number of cpuworker processes we will keep around. */ diff --git a/src/or/dns.c b/src/or/dns.c index 8fd5cfa544..a40617cc69 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -12,6 +12,7 @@ **/ #include "or.h" +#include "circuitlist.h" #include "router.h" #include "ht.h" #ifdef HAVE_EVENT2_DNS_H diff --git a/src/or/main.c b/src/or/main.c index a907ddf8f7..97af4f5ae0 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -14,6 +14,7 @@ #include "or.h" #include "buffers.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "dnsserv.h" #include "geoip.h" #include "rendclient.h" diff --git a/src/or/onion.c b/src/or/onion.c index 8870874246..2d666475fe 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -11,6 +11,7 @@ **/ #include "or.h" +#include "circuitlist.h" /** Type for a linked list of circuits that are waiting for a free CPU worker * to process a waiting onion handshake. */ diff --git a/src/or/or.h b/src/or/or.h index 7afd7115e0..0b09036c1f 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -3055,52 +3055,6 @@ typedef struct { double close_ms; } circuit_build_times_t; -/********************************* circuitlist.c ***********************/ - -circuit_t * _circuit_get_global_list(void); -const char *circuit_state_to_string(int state); -const char *circuit_purpose_to_controller_string(uint8_t purpose); -void circuit_dump_by_conn(connection_t *conn, int severity); -void circuit_set_p_circid_orconn(or_circuit_t *circ, circid_t id, - or_connection_t *conn); -void circuit_set_n_circid_orconn(circuit_t *circ, circid_t id, - or_connection_t *conn); -void circuit_set_state(circuit_t *circ, uint8_t state); -void circuit_close_all_marked(void); -int32_t circuit_initial_package_window(void); -origin_circuit_t *origin_circuit_new(void); -or_circuit_t *or_circuit_new(circid_t p_circ_id, or_connection_t *p_conn); -circuit_t *circuit_get_by_circid_orconn(circid_t circ_id, - or_connection_t *conn); -int circuit_id_in_use_on_orconn(circid_t circ_id, or_connection_t *conn); -circuit_t *circuit_get_by_edge_conn(edge_connection_t *conn); -void circuit_unlink_all_from_or_conn(or_connection_t *conn, int reason); -origin_circuit_t *circuit_get_by_global_id(uint32_t id); -origin_circuit_t *circuit_get_by_rend_query_and_purpose(const char *rend_query, - uint8_t purpose); -origin_circuit_t *circuit_get_next_by_pk_and_purpose(origin_circuit_t *start, - const char *digest, uint8_t purpose); -or_circuit_t *circuit_get_rendezvous(const char *cookie); -or_circuit_t *circuit_get_intro_point(const char *digest); -origin_circuit_t *circuit_find_to_cannibalize(uint8_t purpose, - extend_info_t *info, int flags); -void circuit_mark_all_unused_circs(void); -void circuit_expire_all_dirty_circs(void); -void _circuit_mark_for_close(circuit_t *circ, int reason, - int line, const char *file); -int circuit_get_cpath_len(origin_circuit_t *circ); -crypt_path_t *circuit_get_cpath_hop(origin_circuit_t *circ, int hopnum); -void circuit_get_all_pending_on_or_conn(smartlist_t *out, - or_connection_t *or_conn); -int circuit_count_pending_on_or_conn(or_connection_t *or_conn); - -#define circuit_mark_for_close(c, reason) \ - _circuit_mark_for_close((c), (reason), __LINE__, _SHORT_FILE_) - -void assert_cpath_layer_ok(const crypt_path_t *cp); -void assert_circuit_ok(const circuit_t *c); -void circuit_free_all(void); - /********************************* circuituse.c ************************/ void circuit_expire_building(time_t now); diff --git a/src/or/relay.c b/src/or/relay.c index eab084d8cc..87f453dac8 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -14,6 +14,7 @@ #include "or.h" #include "buffers.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "geoip.h" #include "mempool.h" #include "rendcommon.h" diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 076d353f36..472662e374 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -9,6 +9,7 @@ #include "or.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "rendclient.h" #include "rendcommon.h" #include "routerlist.h" diff --git a/src/or/rendmid.c b/src/or/rendmid.c index c9f4bf8b70..a248828a0a 100644 --- a/src/or/rendmid.c +++ b/src/or/rendmid.c @@ -8,6 +8,7 @@ **/ #include "or.h" +#include "circuitlist.h" /** Respond to an ESTABLISH_INTRO cell by checking the signed data and * setting the circuit's purpose and service pk digest. diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 0aa0aac32e..a1aa6340f4 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -9,6 +9,7 @@ #include "or.h" #include "circuitbuild.h" +#include "circuitlist.h" #include "rendclient.h" #include "rendcommon.h" #include "rendservice.h" diff --git a/src/or/rephist.c b/src/or/rephist.c index 25fda237af..4ece95e494 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -10,6 +10,7 @@ **/ #include "or.h" +#include "circuitlist.h" #include "router.h" #include "routerlist.h" #include "ht.h" diff --git a/src/or/router.c b/src/or/router.c index 53a4a7db4d..12cfc2d9f3 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -7,6 +7,7 @@ #define ROUTER_PRIVATE #include "or.h" +#include "circuitlist.h" #include "geoip.h" #include "router.h" #include "routerlist.h"