1 /* Copyright (c) 2001 Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2011, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
9 * \brief Header file for router.c.
15 crypto_pk_env_t
*get_onion_key(void);
16 time_t get_onion_key_set_at(void);
17 void set_server_identity_key(crypto_pk_env_t
*k
);
18 crypto_pk_env_t
*get_server_identity_key(void);
19 int server_identity_key_is_set(void);
20 void set_client_identity_key(crypto_pk_env_t
*k
);
21 crypto_pk_env_t
*get_tlsclient_identity_key(void);
22 int client_identity_key_is_set(void);
23 authority_cert_t
*get_my_v3_authority_cert(void);
24 crypto_pk_env_t
*get_my_v3_authority_signing_key(void);
25 authority_cert_t
*get_my_v3_legacy_cert(void);
26 crypto_pk_env_t
*get_my_v3_legacy_signing_key(void);
27 void dup_onion_keys(crypto_pk_env_t
**key
, crypto_pk_env_t
**last
);
28 void rotate_onion_key(void);
29 crypto_pk_env_t
*init_key_from_file(const char *fname
, int generate
,
31 void v3_authority_check_key_expiry(void);
35 int check_whether_orport_reachable(void);
36 int check_whether_dirport_reachable(void);
37 void consider_testing_reachability(int test_or
, int test_dir
);
38 void router_orport_found_reachable(void);
39 void router_dirport_found_reachable(void);
40 void router_perform_bandwidth_test(int num_circs
, time_t now
);
42 int authdir_mode(or_options_t
*options
);
43 int authdir_mode_v1(or_options_t
*options
);
44 int authdir_mode_v2(or_options_t
*options
);
45 int authdir_mode_v3(or_options_t
*options
);
46 int authdir_mode_any_main(or_options_t
*options
);
47 int authdir_mode_any_nonhidserv(or_options_t
*options
);
48 int authdir_mode_handles_descs(or_options_t
*options
, int purpose
);
49 int authdir_mode_publishes_statuses(or_options_t
*options
);
50 int authdir_mode_tests_reachability(or_options_t
*options
);
51 int authdir_mode_bridge(or_options_t
*options
);
53 uint16_t router_get_advertised_or_port(or_options_t
*options
);
54 uint16_t router_get_advertised_dir_port(or_options_t
*options
);
56 int server_mode(or_options_t
*options
);
57 int public_server_mode(or_options_t
*options
);
58 int advertised_server_mode(void);
59 int proxy_mode(or_options_t
*options
);
60 void consider_publishable_server(int force
);
61 int should_refuse_unknown_exits(or_options_t
*options
);
63 void router_upload_dir_desc_to_dirservers(int force
);
64 void mark_my_descriptor_dirty_if_older_than(time_t when
);
65 void mark_my_descriptor_dirty(const char *reason
);
66 void check_descriptor_bandwidth_changed(time_t now
);
67 void check_descriptor_ipaddress_changed(time_t now
);
68 void router_new_address_suggestion(const char *suggestion
,
69 const dir_connection_t
*d_conn
);
70 int router_compare_to_my_exit_policy(edge_connection_t
*conn
);
71 int router_my_exit_policy_is_reject_star(void);
72 routerinfo_t
*router_get_my_routerinfo(void);
73 extrainfo_t
*router_get_my_extrainfo(void);
74 const char *router_get_my_descriptor(void);
75 int router_digest_is_me(const char *digest
);
76 int router_extrainfo_digest_is_me(const char *digest
);
77 int router_is_me(routerinfo_t
*router
);
78 int router_fingerprint_is_me(const char *fp
);
79 int router_pick_published_address(or_options_t
*options
, uint32_t *addr
);
80 int router_rebuild_descriptor(int force
);
81 int router_dump_router_to_string(char *s
, size_t maxlen
, routerinfo_t
*router
,
82 crypto_pk_env_t
*ident_key
);
83 int extrainfo_dump_to_string(char **s
, extrainfo_t
*extrainfo
,
84 crypto_pk_env_t
*ident_key
);
85 int is_legal_nickname(const char *s
);
86 int is_legal_nickname_or_hexdigest(const char *s
);
87 int is_legal_hexdigest(const char *s
);
88 void router_get_verbose_nickname(char *buf
, const routerinfo_t
*router
);
89 void routerstatus_get_verbose_nickname(char *buf
,
90 const routerstatus_t
*router
);
91 void router_reset_warnings(void);
92 void router_reset_reachability(void);
93 void router_free_all(void);
95 const char *router_purpose_to_string(uint8_t p
);
96 uint8_t router_purpose_from_string(const char *s
);
99 /* Used only by router.c and test.c */
100 void get_platform_str(char *platform
, size_t len
);