11 #ifndef TOR_ROUTERLIST_H
12 #define TOR_ROUTERLIST_H
19 ROUTER_ADDED_SUCCESSFULLY = 1,
25 ROUTER_IS_ALREADY_KNOWN = -2,
28 ROUTER_NOT_IN_CONSENSUS = -3,
32 ROUTER_NOT_IN_CONSENSUS_OR_NETWORKSTATUS = -4,
34 ROUTER_AUTHDIR_REJECTS = -5,
37 ROUTER_WAS_NOT_WANTED = -6,
40 ROUTER_WAS_TOO_OLD = -7,
42 ROUTER_CERTS_EXPIRED = -8,
45 ROUTER_AUTHDIR_BUG_ANNOTATIONS = -10
49 #define DIR_503_TIMEOUT (60*60)
53 int router_or_conn_should_skip_reachable_address_check(
56 int router_dir_conn_should_skip_reachable_address_check(
61 bool router_can_choose_node(
const node_t *node,
int flags);
73 (
const char *digest));
75 (
const char *digest));
80 #define routerinfo_free(router) \
81 FREE_AND_NULL(routerinfo_t, routerinfo_free_, (router))
83 #define extrainfo_free(ei) FREE_AND_NULL(extrainfo_t, extrainfo_free_, (ei))
85 #define routerlist_free(rl) FREE_AND_NULL(routerlist_t, routerlist_free_, (rl))
94 digest256map_t *result256,
95 int purpose,
const char *prefix);
107 return s == ROUTER_ADDED_SUCCESSFULLY;
118 return (s == ROUTER_WAS_TOO_OLD ||
119 s == ROUTER_IS_ALREADY_KNOWN ||
120 s == ROUTER_NOT_IN_CONSENSUS ||
121 s == ROUTER_NOT_IN_CONSENSUS_OR_NETWORKSTATUS ||
122 s == ROUTER_CERTS_EXPIRED);
128 return (s == ROUTER_AUTHDIR_REJECTS);
134 return (s == ROUTER_AUTHDIR_REJECTS ||
135 s == ROUTER_BAD_EI ||
136 s == ROUTER_WAS_TOO_OLD ||
137 s == ROUTER_CERTS_EXPIRED);
145 int from_cache,
int from_fetch);
153 int descriptor_digests,
154 const char *prepend_annotations);
158 int descriptor_digests);
176 int routerinfo_has_curve25519_onion_key(
const routerinfo_t *ri);
177 int routerstatus_version_supports_extend2_cells(
const routerstatus_t *rs,
178 int allow_unknown_versions);
194 char *nickname_qualifier_out,
197 const char *identity_digest,
198 const char *nickname);
200 #ifdef ROUTERLIST_PRIVATE
208 int lo,
int hi,
int pds_flags));
STATIC void initiate_descriptor_downloads(const routerstatus_t *source, int purpose, smartlist_t *digests, int lo, int hi, int pds_flags)
int router_descriptor_is_older_than(const routerinfo_t *router, int seconds)
STATIC was_router_added_t extrainfo_insert(routerlist_t *rl, extrainfo_t *ei, int warn_if_incompatible)
void routerinfo_free_(routerinfo_t *router)
void routerlist_free_all(void)
void list_pending_microdesc_downloads(digest256map_t *result)
void update_consensus_router_descriptor_downloads(time_t now, int is_vote, networkstatus_t *consensus)
int router_exit_policy_rejects_all(const routerinfo_t *router)
void routerlist_free_(routerlist_t *rl)
int hex_digest_nickname_matches(const char *hexdigest, const char *identity_digest, const char *nickname)
void launch_descriptor_downloads(int purpose, smartlist_t *downloadable, const routerstatus_t *source, time_t now)
void router_load_extrainfo_from_string(const char *s, const char *eos, saved_location_t saved_location, smartlist_t *requested_fingerprints, int descriptor_digests)
static int WRA_WAS_ADDED(was_router_added_t s)
int routerinfo_incompatible_with_extrainfo(const crypto_pk_t *ri, extrainfo_t *ei, signed_descriptor_t *sd, const char **msg)
void router_reset_status_download_failures(void)
void dump_routerlist_mem_usage(int severity)
int hex_digest_nickname_decode(const char *hexdigest, char *digest_out, char *nickname_qualifier_out, char *nickname_out)
uint32_t router_get_advertised_bandwidth(const routerinfo_t *router)
void routerlist_retry_directory_downloads(time_t now)
void router_add_running_nodes_to_smartlist(smartlist_t *sl, int flags)
static int WRA_WAS_OUTDATED(was_router_added_t s)
void routerlist_assert_ok(const routerlist_t *rl)
int router_load_single_router(const char *s, uint8_t purpose, int cache, const char **msg)
routerinfo_t * router_get_mutable_by_digest(const char *digest)
int router_reload_router_list(void)
static int WRA_WAS_REJECTED(was_router_added_t s)
void refresh_all_country_info(void)
void update_router_descriptor_downloads(time_t now)
void routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int make_old, time_t now)
routerlist_t * router_get_routerlist(void)
was_router_added_t router_add_extrainfo_to_routerlist(extrainfo_t *ei, const char **msg, int from_cache, int from_fetch)
void extrainfo_free_(extrainfo_t *extrainfo)
int hexdigest_to_digest(const char *hexdigest, char *digest)
void list_pending_downloads(digestmap_t *result, digest256map_t *result256, int purpose, const char *prefix)
int routers_have_same_or_addrs(const routerinfo_t *r1, const routerinfo_t *r2)
const routerinfo_t * router_get_by_id_digest(const char *digest)
const char * signed_descriptor_get_annotations(const signed_descriptor_t *desc)
signed_descriptor_t * router_get_by_descriptor_digest(const char *digest)
void routers_sort_by_identity(smartlist_t *routers)
was_router_added_t router_add_to_routerlist(routerinfo_t *router, const char **msg, int from_cache, int from_fetch)
signed_descriptor_t * extrainfo_get_by_descriptor_digest(const char *digest)
void update_extrainfo_downloads(time_t now)
int router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2)
void routerlist_descriptors_added(smartlist_t *sl, int from_cache)
void routerlist_remove_old_routers(void)
void routerlist_reset_warnings(void)
uint32_t router_get_advertised_bandwidth_capped(const routerinfo_t *router)
static int WRA_NEVER_DOWNLOADABLE(was_router_added_t s)
void router_reset_descriptor_download_failures(void)
int router_load_routers_from_string(const char *s, const char *eos, saved_location_t saved_location, smartlist_t *requested_fingerprints, int descriptor_digests, const char *prepend_annotations)
signed_descriptor_t * router_get_by_extrainfo_digest(const char *digest)
const char * signed_descriptor_get_body(const signed_descriptor_t *desc)
const routerinfo_t * routerlist_find_my_routerinfo(void)
const char * esc_router_info(const routerinfo_t *router)
void update_all_descriptor_downloads(time_t now)
Macros to implement mocking and selective exposure for the test code.
#define MOCK_DECL(rv, funcname, arglist)