]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Create router.h
authorSebastian Hahn <sebastian@torproject.org>
Wed, 21 Jul 2010 14:17:10 +0000 (16:17 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Tue, 27 Jul 2010 05:56:25 +0000 (07:56 +0200)
24 files changed:
src/or/circuitbuild.c
src/or/circuituse.c
src/or/command.c
src/or/config.c
src/or/connection.c
src/or/connection_edge.c
src/or/connection_or.c
src/or/control.c
src/or/cpuworker.c
src/or/directory.c
src/or/dirserv.c
src/or/dirvote.c
src/or/dns.c
src/or/hibernate.c
src/or/main.c
src/or/networkstatus.c
src/or/or.h
src/or/rendservice.c
src/or/rephist.c
src/or/router.c
src/or/router.h [new file with mode: 0644]
src/or/routerlist.c
src/or/routerparse.c
src/test/test_dir.c

index 792260f9aafef0b39edbc808510b3a66803391f0..0a25c034e492ee00792118abddf3cbf3d2f63f48 100644 (file)
@@ -12,6 +12,7 @@
 #define CIRCUIT_PRIVATE
 
 #include "or.h"
+#include "router.h"
 #include "crypto.h"
 #undef log
 #include <math.h>
index 50800aec5d52c03e2123fa4f54eb40743a47bb58..7a7cc4d30fd0ce6b5f7cbf86a409aea12cd94071 100644 (file)
@@ -10,6 +10,7 @@
  **/
 
 #include "or.h"
+#include "router.h"
 
 /********* START VARIABLES **********/
 
index 8d838a0a2357cd1d9256f90d6820d30e7fe8e708..e367dd739dd7393074d0d3c297dbebc48a6ca281 100644 (file)
@@ -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;
index 89032d67b07055d3782a9a6f62f5ffc6ea5596ac..48fa11ecab0042bd2b866b6c4522efa99be8472f 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "or.h"
 #include "geoip.h"
+#include "router.h"
 #ifdef MS_WINDOWS
 #include <shlobj.h>
 #endif
index e0b1907a0843310c05ad285b91a6d8f3a7c5b3f8..c0e4f387bd8ccc89e36367725cbd0102717dd1b8 100644 (file)
@@ -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,
index 941f7b7e56986264c29c41e719d36ab74ed2a678..35d01ea56bdd1b8c9ddea107fca604bf33841d5a 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "or.h"
 #include "dnsserv.h"
+#include "router.h"
 
 #ifdef HAVE_LINUX_TYPES_H
 #include <linux/types.h>
index 8e9992c86812b44cc0773092505298883c1edb07..e4fe58a2f9b7fc9aca874895eb22f290aa6c872e 100644 (file)
@@ -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);
index f01be85b77930d246c7aaf2ade619b7037869a4c..59d0a681d515df0028b103f1ed1b6f176297d929 100644 (file)
@@ -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. */
index fde149978cce7e45d5b4679515fb0c28b481a3c5..b3514af608d85733d6443c86e2cc0782081d7614 100644 (file)
@@ -13,6 +13,7 @@
  **/
 
 #include "or.h"
+#include "router.h"
 
 /** The maximum number of cpuworker processes we will keep around. */
 #define MAX_CPUWORKERS 16
index 90a6fd1283b79fbaf656f5264139b56c7198971c..993044416693933d13fd94bae52295da848b93c4 100644 (file)
@@ -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
index 7389425e29b8ae8050756570bbc82f6d8150847c..dbff93205f5e4a1afe6d29b725642c983235f035 100644 (file)
@@ -5,6 +5,7 @@
 
 #define DIRSERV_PRIVATE
 #include "or.h"
+#include "router.h"
 
 /**
  * \file dirserv.c
index d5610131a9b98d1b9c5d1ee6e4340384892197d3..637ad54e0b9d30551575ff4d74806e363c75b111 100644 (file)
@@ -5,6 +5,7 @@
 
 #define DIRVOTE_PRIVATE
 #include "or.h"
+#include "router.h"
 
 /**
  * \file dirvote.c
index fa26cf062aa4e981669a2fe61b24f29ef36dc887..8fd5cfa5444bd6d83d552fa2fe29fc1ae61e6d9a 100644 (file)
@@ -12,6 +12,7 @@
  **/
 
 #include "or.h"
+#include "router.h"
 #include "ht.h"
 #ifdef HAVE_EVENT2_DNS_H
 #include <event2/event.h>
index 6b512eacf202120afe251ed33b8be4ec1422b7c4..245c6d4efbbd249056e65e3f745351790fbd13aa 100644 (file)
@@ -22,6 +22,7 @@ hibernating, phase 2:
 */
 
 #include "or.h"
+#include "router.h"
 
 /** Possible values of hibernate_state */
 typedef enum {
index 41385447aeac1a57fa7545aad90859203a5b2bc5..d21de19f032d316886f50da56ecb18373a4a221e 100644 (file)
@@ -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>
index 232e02ae0d982a77dfd3396fc68309849e96e472..724730cbd00117241a72338e662c33a4ab00aea0 100644 (file)
@@ -11,6 +11,7 @@
  */
 
 #include "or.h"
+#include "router.h"
 
 /* For tracking v2 networkstatus documents.  Only caches do this now. */
 
index ecb04d885fc7049770c9d21e5639383cb1267da0..5eac3290bb60edd08fe66c1f12cf0f05a1d8a5eb 100644 (file)
@@ -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. */
index 7795db0d7024f74831a115f12e18bbe602bb8c01..30df64e05f5feb033bbe9d07aa3aa70785cbbeb5 100644 (file)
@@ -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);
index 0e55db2d636e8ce6f1be98c9cbc8e0ec6f9494e8..00a2cabe256176ecca55cf9d88d2cba4c3e00151 100644 (file)
@@ -10,6 +10,7 @@
  **/
 
 #include "or.h"
+#include "router.h"
 #include "ht.h"
 
 static void bw_arrays_init(void);
index 7d239d6022bbd44546f93933d711c529a2d54133..20316815b2d24bd44cfcf82494158f42767ff4df 100644 (file)
@@ -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 (file)
index 0000000..c8a8506
--- /dev/null
@@ -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
+
index cd5bdcf7183c43564420d0b20199f12654d3a440..7d9e48c1da10836cb533b51bca61e5f045de8ae9 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "or.h"
 #include "geoip.h"
+#include "router.h"
 
 // #define DEBUG_ROUTERLIST
 
index 293e8c5d98c6e2efeeb1de844661ffc49d7f35bb..3da1915ccc53001b7dc017359dd86e1762bd1c73 100644 (file)
@@ -10,6 +10,7 @@
  **/
 
 #include "or.h"
+#include "router.h"
 #include "memarea.h"
 #undef log
 #include <math.h>
index a746beda2cc1fb2598dfb346ad993c1a4f2852e9..f99352a9b7c2b8a1bd995c0c9e8857821bf246a7 100644 (file)
@@ -8,6 +8,7 @@
 #define DIRVOTE_PRIVATE
 #define ROUTER_PRIVATE
 #include "or.h"
+#include "router.h"
 #include "test.h"
 
 static void