diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/circuitbuild.c | 1 | ||||
-rw-r--r-- | src/or/circuitbuild.h | 125 | ||||
-rw-r--r-- | src/or/circuitlist.c | 1 | ||||
-rw-r--r-- | src/or/circuituse.c | 1 | ||||
-rw-r--r-- | src/or/command.c | 1 | ||||
-rw-r--r-- | src/or/config.c | 1 | ||||
-rw-r--r-- | src/or/connection.c | 1 | ||||
-rw-r--r-- | src/or/connection_or.c | 1 | ||||
-rw-r--r-- | src/or/control.c | 1 | ||||
-rw-r--r-- | src/or/cpuworker.c | 1 | ||||
-rw-r--r-- | src/or/directory.c | 1 | ||||
-rw-r--r-- | src/or/main.c | 1 | ||||
-rw-r--r-- | src/or/networkstatus.c | 1 | ||||
-rw-r--r-- | src/or/or.h | 110 | ||||
-rw-r--r-- | src/or/relay.c | 1 | ||||
-rw-r--r-- | src/or/rendclient.c | 1 | ||||
-rw-r--r-- | src/or/rendcommon.c | 1 | ||||
-rw-r--r-- | src/or/rendservice.c | 1 | ||||
-rw-r--r-- | src/or/routerlist.c | 1 |
19 files changed, 143 insertions, 109 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 08aa2524f2..a2f7c2c522 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -12,6 +12,7 @@ #define CIRCUIT_PRIVATE #include "or.h" +#include "circuitbuild.h" #include "router.h" #include "routerlist.h" #include "crypto.h" diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h new file mode 100644 index 0000000000..e19f3d9407 --- /dev/null +++ b/src/or/circuitbuild.h @@ -0,0 +1,125 @@ +/* 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 geoip.h + * \brief Header file for circuitbuild.c. + **/ + +#ifndef _TOR_CIRCUITBUILD_H +#define _TOR_CIRCUITBUILD_H + +char *circuit_list_path(origin_circuit_t *circ, int verbose); +char *circuit_list_path_for_controller(origin_circuit_t *circ); +void circuit_log_path(int severity, unsigned int domain, + origin_circuit_t *circ); +void circuit_rep_hist_note_result(origin_circuit_t *circ); +origin_circuit_t *origin_circuit_init(uint8_t purpose, int flags); +origin_circuit_t *circuit_establish_circuit(uint8_t purpose, + extend_info_t *exit, + int flags); +int circuit_handle_first_hop(origin_circuit_t *circ); +void circuit_n_conn_done(or_connection_t *or_conn, int status); +int inform_testing_reachability(void); +int circuit_send_next_onion_skin(origin_circuit_t *circ); +void circuit_note_clock_jumped(int seconds_elapsed); +int circuit_extend(cell_t *cell, circuit_t *circ); +int circuit_init_cpath_crypto(crypt_path_t *cpath, const char *key_data, + int reverse); +int circuit_finish_handshake(origin_circuit_t *circ, uint8_t cell_type, + const char *reply); +int circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer); +int onionskin_answer(or_circuit_t *circ, uint8_t cell_type, + const char *payload, const char *keys); +int circuit_all_predicted_ports_handled(time_t now, int *need_uptime, + int *need_capacity); + +int circuit_append_new_exit(origin_circuit_t *circ, extend_info_t *info); +int circuit_extend_to_new_exit(origin_circuit_t *circ, extend_info_t *info); +void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop); +extend_info_t *extend_info_alloc(const char *nickname, const char *digest, + crypto_pk_env_t *onion_key, + const tor_addr_t *addr, uint16_t port); +extend_info_t *extend_info_from_router(routerinfo_t *r); +extend_info_t *extend_info_dup(extend_info_t *info); +void extend_info_free(extend_info_t *info); +routerinfo_t *build_state_get_exit_router(cpath_build_state_t *state); +const char *build_state_get_exit_nickname(cpath_build_state_t *state); + +void entry_guards_compute_status(void); +int entry_guard_register_connect_status(const char *digest, int succeeded, + int mark_relay_status, time_t now); +void entry_nodes_should_be_added(void); +int entry_list_is_constrained(or_options_t *options); +routerinfo_t *choose_random_entry(cpath_build_state_t *state); +int entry_guards_parse_state(or_state_t *state, int set, char **msg); +void entry_guards_update_state(or_state_t *state); +int getinfo_helper_entry_guards(control_connection_t *conn, + const char *question, char **answer, + const char **errmsg); + +void clear_bridge_list(void); +int routerinfo_is_a_configured_bridge(routerinfo_t *ri); +void +learned_router_identity(tor_addr_t *addr, uint16_t port, const char *digest); +void bridge_add_from_config(const tor_addr_t *addr, uint16_t port, + char *digest); +void retry_bridge_descriptor_fetch_directly(const char *digest); +void fetch_bridge_descriptors(time_t now); +void learned_bridge_descriptor(routerinfo_t *ri, int from_cache); +int any_bridge_descriptors_known(void); +int any_pending_bridge_descriptor_fetches(void); +int bridges_known_but_down(void); +void bridges_retry_all(void); + +void entry_guards_free_all(void); + +extern circuit_build_times_t circ_times; +void circuit_build_times_update_state(circuit_build_times_t *cbt, + or_state_t *state); +int circuit_build_times_parse_state(circuit_build_times_t *cbt, + or_state_t *state, char **msg); +void circuit_build_times_count_timeout(circuit_build_times_t *cbt, + int did_onehop); +int circuit_build_times_count_close(circuit_build_times_t *cbt, + int did_onehop, time_t start_time); +void circuit_build_times_set_timeout(circuit_build_times_t *cbt); +int circuit_build_times_add_time(circuit_build_times_t *cbt, + build_time_t time); +int circuit_build_times_needs_circuits(circuit_build_times_t *cbt); + +int circuit_build_times_needs_circuits_now(circuit_build_times_t *cbt); +void circuit_build_times_init(circuit_build_times_t *cbt); +void circuit_build_times_new_consensus_params(circuit_build_times_t *cbt, + networkstatus_t *ns); +double circuit_build_times_timeout_rate(const circuit_build_times_t *cbt); +double circuit_build_times_close_rate(const circuit_build_times_t *cbt); + +#ifdef CIRCUIT_PRIVATE +double circuit_build_times_calculate_timeout(circuit_build_times_t *cbt, + double quantile); +build_time_t circuit_build_times_generate_sample(circuit_build_times_t *cbt, + double q_lo, double q_hi); +void circuit_build_times_initial_alpha(circuit_build_times_t *cbt, + double quantile, double time_ms); +int circuit_build_times_update_alpha(circuit_build_times_t *cbt); +double circuit_build_times_cdf(circuit_build_times_t *cbt, double x); +void circuit_build_times_add_timeout_worker(circuit_build_times_t *cbt, + double quantile_cutoff); +void circuitbuild_running_unit_tests(void); +void circuit_build_times_reset(circuit_build_times_t *cbt); + +/* Network liveness functions */ +int circuit_build_times_network_check_changed(circuit_build_times_t *cbt); +#endif + +/* Network liveness functions */ +void circuit_build_times_network_is_live(circuit_build_times_t *cbt); +int circuit_build_times_network_check_live(circuit_build_times_t *cbt); +void circuit_build_times_network_circ_success(circuit_build_times_t *cbt); + +#endif + diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index b1272dd7f1..52b33197a2 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -10,6 +10,7 @@ **/ #include "or.h" +#include "circuitbuild.h" #include "rendclient.h" #include "rendcommon.h" #include "routerlist.h" diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 3bdd8acb14..e4e5d205ba 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -10,6 +10,7 @@ **/ #include "or.h" +#include "circuitbuild.h" #include "rendclient.h" #include "rendcommon.h" #include "rendservice.h" diff --git a/src/or/command.c b/src/or/command.c index 8ba45a3985..1ca82f7d21 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -16,6 +16,7 @@ */ #include "or.h" +#include "circuitbuild.h" #include "router.h" #include "routerlist.h" diff --git a/src/or/config.c b/src/or/config.c index 27bdf93679..9996d1cc54 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -12,6 +12,7 @@ #define CONFIG_PRIVATE #include "or.h" +#include "circuitbuild.h" #include "geoip.h" #include "rendclient.h" #include "rendservice.h" diff --git a/src/or/connection.c b/src/or/connection.c index 0f0d4e1520..c910c7c5d1 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -12,6 +12,7 @@ #include "or.h" #include "buffers.h" +#include "circuitbuild.h" #include "dnsserv.h" #include "geoip.h" #include "rendclient.h" diff --git a/src/or/connection_or.c b/src/or/connection_or.c index d7958cb4e4..4cec419903 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -12,6 +12,7 @@ #include "or.h" #include "buffers.h" +#include "circuitbuild.h" #include "geoip.h" #include "router.h" #include "routerlist.h" diff --git a/src/or/control.c b/src/or/control.c index 1c61a08c03..ff6d4ce2a7 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -12,6 +12,7 @@ #include "or.h" #include "buffers.h" +#include "circuitbuild.h" #include "dnsserv.h" #include "geoip.h" #include "router.h" diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index e5e4a3ea68..5231f11468 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -14,6 +14,7 @@ #include "or.h" #include "buffers.h" +#include "circuitbuild.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 591377acab..40f1a1e7f4 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -5,6 +5,7 @@ #include "or.h" #include "buffers.h" +#include "circuitbuild.h" #include "geoip.h" #include "rendclient.h" #include "rendcommon.h" diff --git a/src/or/main.c b/src/or/main.c index f206a463e0..a907ddf8f7 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -13,6 +13,7 @@ #define MAIN_PRIVATE #include "or.h" #include "buffers.h" +#include "circuitbuild.h" #include "dnsserv.h" #include "geoip.h" #include "rendclient.h" diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 92a41b9642..06472f2e60 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -11,6 +11,7 @@ */ #include "or.h" +#include "circuitbuild.h" #include "router.h" #include "routerlist.h" diff --git a/src/or/or.h b/src/or/or.h index e3d6543ff5..7afd7115e0 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2916,72 +2916,7 @@ struct socks_request_t { /** How many hops does a general-purpose circuit have by default? */ #define DEFAULT_ROUTE_LEN 3 -char *circuit_list_path(origin_circuit_t *circ, int verbose); -char *circuit_list_path_for_controller(origin_circuit_t *circ); -void circuit_log_path(int severity, unsigned int domain, - origin_circuit_t *circ); -void circuit_rep_hist_note_result(origin_circuit_t *circ); -origin_circuit_t *origin_circuit_init(uint8_t purpose, int flags); -origin_circuit_t *circuit_establish_circuit(uint8_t purpose, - extend_info_t *exit, - int flags); -int circuit_handle_first_hop(origin_circuit_t *circ); -void circuit_n_conn_done(or_connection_t *or_conn, int status); -int inform_testing_reachability(void); -int circuit_send_next_onion_skin(origin_circuit_t *circ); -void circuit_note_clock_jumped(int seconds_elapsed); -int circuit_extend(cell_t *cell, circuit_t *circ); -int circuit_init_cpath_crypto(crypt_path_t *cpath, const char *key_data, - int reverse); -int circuit_finish_handshake(origin_circuit_t *circ, uint8_t cell_type, - const char *reply); -int circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer); -int onionskin_answer(or_circuit_t *circ, uint8_t cell_type, - const char *payload, const char *keys); -int circuit_all_predicted_ports_handled(time_t now, int *need_uptime, - int *need_capacity); - -int circuit_append_new_exit(origin_circuit_t *circ, extend_info_t *info); -int circuit_extend_to_new_exit(origin_circuit_t *circ, extend_info_t *info); -void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop); -extend_info_t *extend_info_alloc(const char *nickname, const char *digest, - crypto_pk_env_t *onion_key, - const tor_addr_t *addr, uint16_t port); -extend_info_t *extend_info_from_router(routerinfo_t *r); -extend_info_t *extend_info_dup(extend_info_t *info); -void extend_info_free(extend_info_t *info); -routerinfo_t *build_state_get_exit_router(cpath_build_state_t *state); -const char *build_state_get_exit_nickname(cpath_build_state_t *state); - -void entry_guards_compute_status(void); -int entry_guard_register_connect_status(const char *digest, int succeeded, - int mark_relay_status, time_t now); -void entry_nodes_should_be_added(void); -int entry_list_is_constrained(or_options_t *options); -routerinfo_t *choose_random_entry(cpath_build_state_t *state); -int entry_guards_parse_state(or_state_t *state, int set, char **msg); -void entry_guards_update_state(or_state_t *state); -int getinfo_helper_entry_guards(control_connection_t *conn, - const char *question, char **answer, - const char **errmsg); - -void clear_bridge_list(void); -int routerinfo_is_a_configured_bridge(routerinfo_t *ri); -void -learned_router_identity(tor_addr_t *addr, uint16_t port, const char *digest); -void bridge_add_from_config(const tor_addr_t *addr, uint16_t port, - char *digest); -void retry_bridge_descriptor_fetch_directly(const char *digest); -void fetch_bridge_descriptors(time_t now); -void learned_bridge_descriptor(routerinfo_t *ri, int from_cache); -int any_bridge_descriptors_known(void); -int any_pending_bridge_descriptor_fetches(void); -int bridges_known_but_down(void); -void bridges_retry_all(void); - -void entry_guards_free_all(void); - -/* Circuit Build Timeout "public" functions and structures. */ +/* Circuit Build Timeout "public" structures. */ /** Total size of the circuit timeout history to accumulate. * 1000 is approx 2.5 days worth of continual-use circuits. */ @@ -3120,49 +3055,6 @@ typedef struct { double close_ms; } circuit_build_times_t; -extern circuit_build_times_t circ_times; -void circuit_build_times_update_state(circuit_build_times_t *cbt, - or_state_t *state); -int circuit_build_times_parse_state(circuit_build_times_t *cbt, - or_state_t *state, char **msg); -void circuit_build_times_count_timeout(circuit_build_times_t *cbt, - int did_onehop); -int circuit_build_times_count_close(circuit_build_times_t *cbt, - int did_onehop, time_t start_time); -void circuit_build_times_set_timeout(circuit_build_times_t *cbt); -int circuit_build_times_add_time(circuit_build_times_t *cbt, - build_time_t time); -int circuit_build_times_needs_circuits(circuit_build_times_t *cbt); -int circuit_build_times_needs_circuits_now(circuit_build_times_t *cbt); -void circuit_build_times_init(circuit_build_times_t *cbt); -void circuit_build_times_new_consensus_params(circuit_build_times_t *cbt, - networkstatus_t *ns); -double circuit_build_times_timeout_rate(const circuit_build_times_t *cbt); -double circuit_build_times_close_rate(const circuit_build_times_t *cbt); - -#ifdef CIRCUIT_PRIVATE -double circuit_build_times_calculate_timeout(circuit_build_times_t *cbt, - double quantile); -build_time_t circuit_build_times_generate_sample(circuit_build_times_t *cbt, - double q_lo, double q_hi); -void circuit_build_times_initial_alpha(circuit_build_times_t *cbt, - double quantile, double time_ms); -int circuit_build_times_update_alpha(circuit_build_times_t *cbt); -double circuit_build_times_cdf(circuit_build_times_t *cbt, double x); -void circuit_build_times_add_timeout_worker(circuit_build_times_t *cbt, - double quantile_cutoff); -void circuitbuild_running_unit_tests(void); -void circuit_build_times_reset(circuit_build_times_t *cbt); - -/* Network liveness functions */ -int circuit_build_times_network_check_changed(circuit_build_times_t *cbt); -#endif - -/* Network liveness functions */ -void circuit_build_times_network_is_live(circuit_build_times_t *cbt); -int circuit_build_times_network_check_live(circuit_build_times_t *cbt); -void circuit_build_times_network_circ_success(circuit_build_times_t *cbt); - /********************************* circuitlist.c ***********************/ circuit_t * _circuit_get_global_list(void); diff --git a/src/or/relay.c b/src/or/relay.c index c7d6edaed9..eab084d8cc 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -13,6 +13,7 @@ #include <math.h> #include "or.h" #include "buffers.h" +#include "circuitbuild.h" #include "geoip.h" #include "mempool.h" #include "rendcommon.h" diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 2313dcefd2..076d353f36 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -8,6 +8,7 @@ **/ #include "or.h" +#include "circuitbuild.h" #include "rendclient.h" #include "rendcommon.h" #include "routerlist.h" diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index 60f4d25c78..e8d101484b 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -9,6 +9,7 @@ **/ #include "or.h" +#include "circuitbuild.h" #include "rendclient.h" #include "rendcommon.h" #include "rendservice.h" diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 4fc031330b..0aa0aac32e 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -8,6 +8,7 @@ **/ #include "or.h" +#include "circuitbuild.h" #include "rendclient.h" #include "rendcommon.h" #include "rendservice.h" diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 6beecac406..76e9b1b3d5 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -12,6 +12,7 @@ **/ #include "or.h" +#include "circuitbuild.h" #include "geoip.h" #include "rendcommon.h" #include "rendservice.h" |