Create router.h

This commit is contained in:
Sebastian Hahn 2010-07-21 16:17:10 +02:00
parent ff4030f621
commit c53b6cc831
24 changed files with 117 additions and 81 deletions

View File

@ -12,6 +12,7 @@
#define CIRCUIT_PRIVATE
#include "or.h"
#include "router.h"
#include "crypto.h"
#undef log
#include <math.h>

View File

@ -10,6 +10,7 @@
**/
#include "or.h"
#include "router.h"
/********* START VARIABLES **********/

View 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;

View File

@ -13,6 +13,7 @@
#include "or.h"
#include "geoip.h"
#include "router.h"
#ifdef MS_WINDOWS
#include <shlobj.h>
#endif

View 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,

View File

@ -11,6 +11,7 @@
#include "or.h"
#include "dnsserv.h"
#include "router.h"
#ifdef HAVE_LINUX_TYPES_H
#include <linux/types.h>

View 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);

View 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. */

View 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

View 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

View File

@ -5,6 +5,7 @@
#define DIRSERV_PRIVATE
#include "or.h"
#include "router.h"
/**
* \file dirserv.c

View File

@ -5,6 +5,7 @@
#define DIRVOTE_PRIVATE
#include "or.h"
#include "router.h"
/**
* \file dirvote.c

View File

@ -12,6 +12,7 @@
**/
#include "or.h"
#include "router.h"
#include "ht.h"
#ifdef HAVE_EVENT2_DNS_H
#include <event2/event.h>

View File

@ -22,6 +22,7 @@ hibernating, phase 2:
*/
#include "or.h"
#include "router.h"
/** Possible values of hibernate_state */
typedef enum {

View 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>

View File

@ -11,6 +11,7 @@
*/
#include "or.h"
#include "router.h"
/* For tracking v2 networkstatus documents. Only caches do this now. */

View 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. */

View 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);

View File

@ -10,6 +10,7 @@
**/
#include "or.h"
#include "router.h"
#include "ht.h"
static void bw_arrays_init(void);

View File

@ -8,6 +8,7 @@
#include "or.h"
#include "geoip.h"
#include "router.h"
/**
* \file router.c

95
src/or/router.h Normal file
View File

@ -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

View File

@ -13,6 +13,7 @@
#include "or.h"
#include "geoip.h"
#include "router.h"
// #define DEBUG_ROUTERLIST

View File

@ -10,6 +10,7 @@
**/
#include "or.h"
#include "router.h"
#include "memarea.h"
#undef log
#include <math.h>

View File

@ -8,6 +8,7 @@
#define DIRVOTE_PRIVATE
#define ROUTER_PRIVATE
#include "or.h"
#include "router.h"
#include "test.h"
static void