diff options
-rw-r--r-- | src/or/circuitbuild.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_edge.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/dirserv.c | 1 | ||||
-rw-r--r-- | src/or/dirvote.c | 1 | ||||
-rw-r--r-- | src/or/dns.c | 1 | ||||
-rw-r--r-- | src/or/hibernate.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 | 81 | ||||
-rw-r--r-- | src/or/rendservice.c | 1 | ||||
-rw-r--r-- | src/or/rephist.c | 1 | ||||
-rw-r--r-- | src/or/router.c | 1 | ||||
-rw-r--r-- | src/or/router.h | 95 | ||||
-rw-r--r-- | src/or/routerlist.c | 1 | ||||
-rw-r--r-- | src/or/routerparse.c | 1 | ||||
-rw-r--r-- | src/test/test_dir.c | 1 |
24 files changed, 117 insertions, 81 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 792260f9a..0a25c034e 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -12,6 +12,7 @@ #define CIRCUIT_PRIVATE #include "or.h" +#include "router.h" #include "crypto.h" #undef log #include <math.h> diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 50800aec5..7a7cc4d30 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -10,6 +10,7 @@ **/ #include "or.h" +#include "router.h" /********* START VARIABLES **********/ diff --git a/src/or/command.c b/src/or/command.c index 8d838a0a2..e367dd739 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -16,6 +16,7 @@ */ #include "or.h" +#include "router.h" /** How many CELL_PADDING cells have we received, ever? */ uint64_t stats_n_padding_cells_processed = 0; diff --git a/src/or/config.c b/src/or/config.c index 89032d67b..48fa11eca 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -13,6 +13,7 @@ #include "or.h" #include "geoip.h" +#include "router.h" #ifdef MS_WINDOWS #include <shlobj.h> #endif diff --git a/src/or/connection.c b/src/or/connection.c index e0b1907a0..c0e4f387b 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -13,6 +13,7 @@ #include "or.h" #include "dnsserv.h" #include "geoip.h" +#include "router.h" static connection_t *connection_create_listener( struct sockaddr *listensockaddr, diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 941f7b7e5..35d01ea56 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -11,6 +11,7 @@ #include "or.h" #include "dnsserv.h" +#include "router.h" #ifdef HAVE_LINUX_TYPES_H #include <linux/types.h> diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 8e9992c86..e4fe58a2f 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -12,6 +12,7 @@ #include "or.h" #include "geoip.h" +#include "router.h" static int connection_tls_finish_handshake(or_connection_t *conn); static int connection_or_process_cells_from_inbuf(or_connection_t *conn); diff --git a/src/or/control.c b/src/or/control.c index f01be85b7..59d0a681d 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -13,6 +13,7 @@ #include "or.h" #include "dnsserv.h" #include "geoip.h" +#include "router.h" /** Yield true iff <b>s</b> is the state of a control_connection_t that has * finished authentication and is accepting commands. */ diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index fde149978..b3514af60 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -13,6 +13,7 @@ **/ #include "or.h" +#include "router.h" /** The maximum number of cpuworker processes we will keep around. */ #define MAX_CPUWORKERS 16 diff --git a/src/or/directory.c b/src/or/directory.c index 90a6fd128..993044416 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -5,6 +5,7 @@ #include "or.h" #include "geoip.h" +#include "router.h" #if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) #ifndef OPENBSD diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 7389425e2..dbff93205 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -5,6 +5,7 @@ #define DIRSERV_PRIVATE #include "or.h" +#include "router.h" /** * \file dirserv.c diff --git a/src/or/dirvote.c b/src/or/dirvote.c index d5610131a..637ad54e0 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -5,6 +5,7 @@ #define DIRVOTE_PRIVATE #include "or.h" +#include "router.h" /** * \file dirvote.c diff --git a/src/or/dns.c b/src/or/dns.c index fa26cf062..8fd5cfa54 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -12,6 +12,7 @@ **/ #include "or.h" +#include "router.h" #include "ht.h" #ifdef HAVE_EVENT2_DNS_H #include <event2/event.h> diff --git a/src/or/hibernate.c b/src/or/hibernate.c index 6b512eacf..245c6d4ef 100644 --- a/src/or/hibernate.c +++ b/src/or/hibernate.c @@ -22,6 +22,7 @@ hibernating, phase 2: */ #include "or.h" +#include "router.h" /** Possible values of hibernate_state */ typedef enum { diff --git a/src/or/main.c b/src/or/main.c index 41385447a..d21de19f0 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -14,6 +14,7 @@ #include "or.h" #include "dnsserv.h" #include "geoip.h" +#include "router.h" #ifdef USE_DMALLOC #include <dmalloc.h> #include <openssl/crypto.h> diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 232e02ae0..724730cbd 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -11,6 +11,7 @@ */ #include "or.h" +#include "router.h" /* For tracking v2 networkstatus documents. Only caches do this now. */ diff --git a/src/or/or.h b/src/or/or.h index ecb04d885..5eac3290b 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -4769,87 +4769,6 @@ int rend_mid_establish_rendezvous(or_circuit_t *circ, const char *request, int rend_mid_rendezvous(or_circuit_t *circ, const char *request, size_t request_len); -/********************************* router.c ***************************/ - -crypto_pk_env_t *get_onion_key(void); -time_t get_onion_key_set_at(void); -void set_identity_key(crypto_pk_env_t *k); -crypto_pk_env_t *get_identity_key(void); -int identity_key_is_set(void); -authority_cert_t *get_my_v3_authority_cert(void); -crypto_pk_env_t *get_my_v3_authority_signing_key(void); -authority_cert_t *get_my_v3_legacy_cert(void); -crypto_pk_env_t *get_my_v3_legacy_signing_key(void); -void dup_onion_keys(crypto_pk_env_t **key, crypto_pk_env_t **last); -void rotate_onion_key(void); -crypto_pk_env_t *init_key_from_file(const char *fname, int generate, - int severity); -void v3_authority_check_key_expiry(void); - -int init_keys(void); - -int check_whether_orport_reachable(void); -int check_whether_dirport_reachable(void); -void consider_testing_reachability(int test_or, int test_dir); -void router_orport_found_reachable(void); -void router_dirport_found_reachable(void); -void router_perform_bandwidth_test(int num_circs, time_t now); - -int authdir_mode(or_options_t *options); -int authdir_mode_v1(or_options_t *options); -int authdir_mode_v2(or_options_t *options); -int authdir_mode_v3(or_options_t *options); -int authdir_mode_any_main(or_options_t *options); -int authdir_mode_any_nonhidserv(or_options_t *options); -int authdir_mode_handles_descs(or_options_t *options, int purpose); -int authdir_mode_publishes_statuses(or_options_t *options); -int authdir_mode_tests_reachability(or_options_t *options); -int authdir_mode_bridge(or_options_t *options); - -int server_mode(or_options_t *options); -int advertised_server_mode(void); -int proxy_mode(or_options_t *options); -void consider_publishable_server(int force); - -void router_upload_dir_desc_to_dirservers(int force); -void mark_my_descriptor_dirty_if_older_than(time_t when); -void mark_my_descriptor_dirty(void); -void check_descriptor_bandwidth_changed(time_t now); -void check_descriptor_ipaddress_changed(time_t now); -void router_new_address_suggestion(const char *suggestion, - const dir_connection_t *d_conn); -int router_compare_to_my_exit_policy(edge_connection_t *conn); -routerinfo_t *router_get_my_routerinfo(void); -extrainfo_t *router_get_my_extrainfo(void); -const char *router_get_my_descriptor(void); -int router_digest_is_me(const char *digest); -int router_extrainfo_digest_is_me(const char *digest); -int router_is_me(routerinfo_t *router); -int router_fingerprint_is_me(const char *fp); -int router_pick_published_address(or_options_t *options, uint32_t *addr); -int router_rebuild_descriptor(int force); -int router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, - crypto_pk_env_t *ident_key); -int extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo, - crypto_pk_env_t *ident_key); -int is_legal_nickname(const char *s); -int is_legal_nickname_or_hexdigest(const char *s); -int is_legal_hexdigest(const char *s); -void router_get_verbose_nickname(char *buf, const routerinfo_t *router); -void routerstatus_get_verbose_nickname(char *buf, - const routerstatus_t *router); -void router_reset_warnings(void); -void router_reset_reachability(void); -void router_free_all(void); - -const char *router_purpose_to_string(uint8_t p); -uint8_t router_purpose_from_string(const char *s); - -#ifdef ROUTER_PRIVATE -/* Used only by router.c and test.c */ -void get_platform_str(char *platform, size_t len); -#endif - /********************************* routerlist.c ***************************/ /** Represents information about a single trusted directory server. */ diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 7795db0d7..30df64e05 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -8,6 +8,7 @@ **/ #include "or.h" +#include "router.h" static origin_circuit_t *find_intro_circuit(rend_intro_point_t *intro, const char *pk_digest); diff --git a/src/or/rephist.c b/src/or/rephist.c index 0e55db2d6..00a2cabe2 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -10,6 +10,7 @@ **/ #include "or.h" +#include "router.h" #include "ht.h" static void bw_arrays_init(void); diff --git a/src/or/router.c b/src/or/router.c index 7d239d602..20316815b 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -8,6 +8,7 @@ #include "or.h" #include "geoip.h" +#include "router.h" /** * \file router.c diff --git a/src/or/router.h b/src/or/router.h new file mode 100644 index 000000000..c8a8506c4 --- /dev/null +++ b/src/or/router.h @@ -0,0 +1,95 @@ +/* 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 router.h + * \brief Header file for router functions + **/ + +#ifndef _TOR_ROUTER_H +#define _TOR_ROUTER_H + +crypto_pk_env_t *get_onion_key(void); +time_t get_onion_key_set_at(void); +void set_identity_key(crypto_pk_env_t *k); +crypto_pk_env_t *get_identity_key(void); +int identity_key_is_set(void); +authority_cert_t *get_my_v3_authority_cert(void); +crypto_pk_env_t *get_my_v3_authority_signing_key(void); +authority_cert_t *get_my_v3_legacy_cert(void); +crypto_pk_env_t *get_my_v3_legacy_signing_key(void); +void dup_onion_keys(crypto_pk_env_t **key, crypto_pk_env_t **last); +void rotate_onion_key(void); +crypto_pk_env_t *init_key_from_file(const char *fname, int generate, + int severity); +void v3_authority_check_key_expiry(void); + +int init_keys(void); + +int check_whether_orport_reachable(void); +int check_whether_dirport_reachable(void); +void consider_testing_reachability(int test_or, int test_dir); +void router_orport_found_reachable(void); +void router_dirport_found_reachable(void); +void router_perform_bandwidth_test(int num_circs, time_t now); + +int authdir_mode(or_options_t *options); +int authdir_mode_v1(or_options_t *options); +int authdir_mode_v2(or_options_t *options); +int authdir_mode_v3(or_options_t *options); +int authdir_mode_any_main(or_options_t *options); +int authdir_mode_any_nonhidserv(or_options_t *options); +int authdir_mode_handles_descs(or_options_t *options, int purpose); +int authdir_mode_publishes_statuses(or_options_t *options); +int authdir_mode_tests_reachability(or_options_t *options); +int authdir_mode_bridge(or_options_t *options); + +int server_mode(or_options_t *options); +int advertised_server_mode(void); +int proxy_mode(or_options_t *options); +void consider_publishable_server(int force); + +void router_upload_dir_desc_to_dirservers(int force); +void mark_my_descriptor_dirty_if_older_than(time_t when); +void mark_my_descriptor_dirty(void); +void check_descriptor_bandwidth_changed(time_t now); +void check_descriptor_ipaddress_changed(time_t now); +void router_new_address_suggestion(const char *suggestion, + const dir_connection_t *d_conn); +int router_compare_to_my_exit_policy(edge_connection_t *conn); +routerinfo_t *router_get_my_routerinfo(void); +extrainfo_t *router_get_my_extrainfo(void); +const char *router_get_my_descriptor(void); +int router_digest_is_me(const char *digest); +int router_extrainfo_digest_is_me(const char *digest); +int router_is_me(routerinfo_t *router); +int router_fingerprint_is_me(const char *fp); +int router_pick_published_address(or_options_t *options, uint32_t *addr); +int router_rebuild_descriptor(int force); +int router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, + crypto_pk_env_t *ident_key); +int extrainfo_dump_to_string(char *s, size_t maxlen, extrainfo_t *extrainfo, + crypto_pk_env_t *ident_key); +int is_legal_nickname(const char *s); +int is_legal_nickname_or_hexdigest(const char *s); +int is_legal_hexdigest(const char *s); +void router_get_verbose_nickname(char *buf, const routerinfo_t *router); +void routerstatus_get_verbose_nickname(char *buf, + const routerstatus_t *router); +void router_reset_warnings(void); +void router_reset_reachability(void); +void router_free_all(void); + +const char *router_purpose_to_string(uint8_t p); +uint8_t router_purpose_from_string(const char *s); + +#ifdef ROUTER_PRIVATE +/* Used only by router.c and test.c */ +void get_platform_str(char *platform, size_t len); +#endif + +#endif + diff --git a/src/or/routerlist.c b/src/or/routerlist.c index cd5bdcf71..7d9e48c1d 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -13,6 +13,7 @@ #include "or.h" #include "geoip.h" +#include "router.h" // #define DEBUG_ROUTERLIST diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 293e8c5d9..3da1915cc 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -10,6 +10,7 @@ **/ #include "or.h" +#include "router.h" #include "memarea.h" #undef log #include <math.h> diff --git a/src/test/test_dir.c b/src/test/test_dir.c index a746beda2..f99352a9b 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -8,6 +8,7 @@ #define DIRVOTE_PRIVATE #define ROUTER_PRIVATE #include "or.h" +#include "router.h" #include "test.h" static void |