12 #ifndef TOR_NODELIST_H
13 #define TOR_NODELIST_H
18 #define node_assert_ok(n) STMT_BEGIN { \
19 tor_assert((n)->ri || (n)->rs); \
29 #define NNF_NO_WARN_UNNAMED (1u<<0)
40 uint16_t or_port, uint16_t dir_port);
51 (
const char *nickname,
unsigned flags));
53 char *verbose_name_out);
55 char *verbose_name_out);
60 int for_direct_connect);
62 #define node_is_bridge(node) \
63 (node_get_purpose((node)) == ROUTER_PURPOSE_BRIDGE)
79 bool compatible_with_us));
86 bool need_canonical_ipv6_conn);
91 void link_specifier_smartlist_free_(
smartlist_t *ls_list);
92 #define link_specifier_smartlist_free(ls_list) \
93 FREE_AND_NULL(smartlist_t, link_specifier_smartlist_free_, (ls_list))
95 int node_has_ipv6_addr(
const node_t *node);
96 int node_has_ipv6_orport(
const node_t *node);
97 int node_has_ipv6_dirport(
const node_t *node);
99 #define node_ipv6_preferred(node) node_ipv6_or_preferred(node)
126 int need_capacity,
int need_guard);
153 CONSENSUS_PATH_UNKNOWN = -1,
156 CONSENSUS_PATH_INTERNAL = 0,
159 CONSENSUS_PATH_EXIT = 1
168 #ifdef NODELIST_PRIVATE
177 #ifdef TOR_UNIT_TESTS
185 MOCK_DECL(
int, get_estimated_address_per_node, (
void));
const node_t * node_get_by_ed25519_id(const ed25519_public_key_t *ed_id)
STATIC void node_lookup_declared_family(smartlist_t *out, const node_t *node)
STATIC int node_in_nickname_smartlist(const smartlist_t *lst, const node_t *node)
node_t * node_get_mutable_by_ed25519_id(const ed25519_public_key_t *ed_id)
int node_ed25519_id_matches(const node_t *node, const ed25519_public_key_t *id)
STATIC bool node_has_declared_family(const node_t *node)
STATIC int node_nickname_matches(const node_t *node, const char *nickname)
STATIC int node_family_contains(const node_t *n1, const node_t *n2)
void node_get_pref_orport(const node_t *node, tor_addr_port_t *ap_out)
bool node_supports_establish_intro_dos_extension(const node_t *node)
void node_get_prim_orport(const node_t *node, tor_addr_port_t *ap_out)
int nodelist_probably_contains_address(const tor_addr_t *addr)
void node_get_verbose_nickname_by_id(const char *id_digest, char *verbose_name_out)
node_t * node_get_mutable_by_id(const char *identity_digest)
const struct curve25519_public_key_t * node_get_curve25519_onion_key(const node_t *node)
const char * node_get_platform(const node_t *node)
void nodelist_free_all(void)
void node_get_address_string(const node_t *node, char *cp, size_t len)
void nodelist_refresh_countries(void)
void router_dir_info_changed(void)
int node_is_good_exit(const node_t *node)
const smartlist_t * nodelist_get_list(void)
int node_exit_policy_is_exact(const node_t *node, sa_family_t family)
int router_addrs_in_same_network(const tor_addr_t *a1, const tor_addr_t *a2)
bool node_supports_accepting_ipv6_extends(const node_t *node, bool need_canonical_ipv6_conn)
smartlist_t * node_get_all_orports(const node_t *node)
void node_get_pref_dirport(const node_t *node, tor_addr_port_t *ap_out)
int node_has_preferred_descriptor(const node_t *node, int for_direct_connect)
smartlist_t * nodelist_find_nodes_with_microdesc(const microdesc_t *md)
int node_is_me(const node_t *node)
const char * node_get_nickname(const node_t *node)
int node_has_any_descriptor(const node_t *node)
void nodelist_purge(void)
int node_is_dir(const node_t *node)
bool node_supports_v3_rendezvous_point(const node_t *node)
void node_get_prim_dirport(const node_t *node, tor_addr_port_t *ap_out)
bool node_supports_ed25519_link_authentication(const node_t *node, bool compatible_with_us)
bool node_supports_v3_hsdir(const node_t *node)
int node_ipv6_dir_preferred(const node_t *node)
int router_exit_policy_all_nodes_reject(const tor_addr_t *addr, uint16_t port, int need_uptime)
long node_get_declared_uptime(const node_t *node)
const node_t * node_get_by_nickname(const char *nickname, unsigned flags)
node_t * nodelist_set_routerinfo(routerinfo_t *ri, routerinfo_t **ri_old_out)
const struct ed25519_public_key_t * node_get_ed25519_id(const node_t *node)
int node_is_unreliable(const node_t *router, int need_uptime, int need_capacity, int need_guard)
consensus_path_type_t router_have_consensus_path(void)
void nodelist_add_addr_to_address_set(const tor_addr_t *addr, uint16_t or_port, uint16_t dir_port)
const node_t * router_find_exact_exit_enclave(const char *address, uint16_t port)
int node_allows_single_hop_exits(const node_t *node)
int node_get_purpose(const node_t *node)
void node_get_pref_ipv6_dirport(const node_t *node, tor_addr_port_t *ap_out)
void nodelist_set_consensus(const networkstatus_t *ns)
bool nodelist_reentry_contains(const tor_addr_t *addr, uint16_t port)
void nodelist_add_node_and_family(smartlist_t *nodes, const node_t *node)
void nodelist_remove_microdesc(const char *identity_digest, microdesc_t *md)
const node_t * node_get_by_id(const char *identity_digest)
void node_set_country(node_t *node)
const node_t * node_get_by_hex_id(const char *identity_digest, unsigned flags)
const uint8_t * node_get_rsa_id_digest(const node_t *node)
int node_ipv6_or_preferred(const node_t *node)
void nodelist_remove_routerinfo(routerinfo_t *ri)
void nodelist_ensure_freshness(const networkstatus_t *ns)
void node_get_addr(const node_t *node, tor_addr_t *addr_out)
const char * get_dir_info_status_string(void)
node_t * nodelist_add_microdesc(microdesc_t *md)
int count_loading_descriptors_progress(void)
void node_get_verbose_nickname(const node_t *node, char *verbose_name_out)
bool node_supports_initiating_ipv6_extends(const node_t *node)
void node_get_pref_ipv6_orport(const node_t *node, tor_addr_port_t *ap_out)
int nodes_in_same_family(const node_t *node1, const node_t *node2)
int node_has_curve25519_onion_key(const node_t *node)
int router_have_minimum_dir_info(void)
void nodelist_assert_ok(void)
int node_exit_policy_rejects_all(const node_t *node)
bool node_supports_ed25519_hs_intro(const node_t *node)
void router_set_status(const char *digest, int up)
#define MOCK_DECL(rv, funcname, arglist)