Back to index

tor  0.2.3.19-rc
nodelist.h
Go to the documentation of this file.
00001 /* Copyright (c) 2001 Matej Pfajfar.
00002  * Copyright (c) 2001-2004, Roger Dingledine.
00003  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
00004  * Copyright (c) 2007-2012, The Tor Project, Inc. */
00005 /* See LICENSE for licensing information */
00006 
00012 #ifndef _TOR_NODELIST_H
00013 #define _TOR_NODELIST_H
00014 
00015 node_t *node_get_mutable_by_id(const char *identity_digest);
00016 const node_t *node_get_by_id(const char *identity_digest);
00017 const node_t *node_get_by_hex_id(const char *identity_digest);
00018 node_t *nodelist_add_routerinfo(routerinfo_t *ri);
00019 node_t *nodelist_add_microdesc(microdesc_t *md);
00020 void nodelist_set_consensus(networkstatus_t *ns);
00021 
00022 void nodelist_remove_microdesc(const char *identity_digest, microdesc_t *md);
00023 void nodelist_remove_routerinfo(routerinfo_t *ri);
00024 void nodelist_purge(void);
00025 
00026 void nodelist_free_all(void);
00027 void nodelist_assert_ok(void);
00028 
00029 const node_t *node_get_by_nickname(const char *nickname, int warn_if_unnamed);
00030 void node_get_verbose_nickname(const node_t *node,
00031                                char *verbose_name_out);
00032 int node_is_named(const node_t *node);
00033 int node_is_dir(const node_t *node);
00034 int node_has_descriptor(const node_t *node);
00035 int node_get_purpose(const node_t *node);
00036 #define node_is_bridge(node) \
00037   (node_get_purpose((node)) == ROUTER_PURPOSE_BRIDGE)
00038 int node_is_me(const node_t *node);
00039 int node_exit_policy_rejects_all(const node_t *node);
00040 smartlist_t *node_get_all_orports(const node_t *node);
00041 void node_get_prim_orport(const node_t *node, tor_addr_port_t *addr_port_out);
00042 void node_get_pref_orport(const node_t *node, tor_addr_port_t *addr_port_out);
00043 void node_get_pref_ipv6_orport(const node_t *node,
00044                                tor_addr_port_t *addr_port_out);
00045 uint32_t node_get_prim_addr_ipv4h(const node_t *node);
00046 int node_allows_single_hop_exits(const node_t *node);
00047 const char *node_get_nickname(const node_t *node);
00048 const char *node_get_platform(const node_t *node);
00049 void node_get_address_string(const node_t *node, char *cp, size_t len);
00050 long node_get_declared_uptime(const node_t *node);
00051 time_t node_get_published_on(const node_t *node);
00052 const smartlist_t *node_get_declared_family(const node_t *node);
00053 
00054 smartlist_t *nodelist_get_list(void);
00055 
00056 /* Temporary during transition to multiple addresses.  */
00057 void node_get_addr(const node_t *node, tor_addr_t *addr_out);
00058 #define node_get_addr_ipv4h(n) node_get_prim_addr_ipv4h((n))
00059 
00060 /* XXXX These need to move out of routerlist.c */
00061 void nodelist_refresh_countries(void);
00062 void node_set_country(node_t *node);
00063 void nodelist_add_node_and_family(smartlist_t *nodes, const node_t *node);
00064 int nodes_in_same_family(const node_t *node1, const node_t *node2);
00065 
00066 #endif
00067