diff options
author | Linus Nordberg <linus@torproject.org> | 2012-08-23 12:23:00 +0200 |
---|---|---|
committer | Linus Nordberg <linus@torproject.org> | 2012-08-23 22:13:12 +0200 |
commit | 3410a46ebc7870c1ded14ef34a8e96f0a48b3994 (patch) | |
tree | 71ce013845d4f55893da3508e904d2c256badb25 /src/or/nodelist.h | |
parent | 5b0ed1e344f47a584d529221fb9d39e54715732c (diff) | |
download | tor-3410a46ebc7870c1ded14ef34a8e96f0a48b3994.tar.gz tor-3410a46ebc7870c1ded14ef34a8e96f0a48b3994.zip |
Move ipv6_preferred from routerinfo_t to node_t.
Move extend_info_from_router() from circuitbuild.c to router.c and
make it static.
Add get_configured_bridge_by_orports_digest() and have
get_configured_bridge_by_routerinfo() and
node_is_a_configured_bridge() use it. We now consider all OR ports of
a bridge when looking for it.
Move node_get_*_orport to nodelist.c.
Fix a cut'n'paste error in header of nodelist.h.
Add node_assert_ok().
Add router_get_all_orports(). It's duplicating code from
node_get_all_orports(). Worth fixing at the cost of complicating the
API slightly?
Diffstat (limited to 'src/or/nodelist.h')
-rw-r--r-- | src/or/nodelist.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/or/nodelist.h b/src/or/nodelist.h index 6c1d541483..c93b67a252 100644 --- a/src/or/nodelist.h +++ b/src/or/nodelist.h @@ -5,13 +5,23 @@ /* See LICENSE for licensing information */ /** - * \file microdesc.h - * \brief Header file for microdesc.c. + * \file nodelist.h + * \brief Header file for nodelist.c. **/ #ifndef _TOR_NODELIST_H #define _TOR_NODELIST_H +/* XXX duplicating code from tor_assert(). */ +#define node_assert_ok(n) STMT_BEGIN \ + if (PREDICT_UNLIKELY((n)->ri == NULL && (n)->rs == NULL)) { \ + log_err(LD_BUG, "%s:%d: %s: Node is invalid; aborting.", \ + _SHORT_FILE_, __LINE__, __func__); \ + fprintf(stderr, "%s:%d: %s: Node is invalid; aborting.\n", \ + _SHORT_FILE_, __LINE__, __func__); \ + abort(); \ + } STMT_END + node_t *node_get_mutable_by_id(const char *identity_digest); const node_t *node_get_by_id(const char *identity_digest); const node_t *node_get_by_hex_id(const char *identity_digest); @@ -38,10 +48,9 @@ int node_get_purpose(const node_t *node); int node_is_me(const node_t *node); int node_exit_policy_rejects_all(const node_t *node); smartlist_t *node_get_all_orports(const node_t *node); -void node_get_prim_orport(const node_t *node, tor_addr_port_t *addr_port_out); -void node_get_pref_orport(const node_t *node, tor_addr_port_t *addr_port_out); -void node_get_pref_ipv6_orport(const node_t *node, - tor_addr_port_t *addr_port_out); +void node_get_prim_orport(const node_t *node, tor_addr_port_t *ap_out); +void node_get_pref_orport(const node_t *node, tor_addr_port_t *ap_out); +void node_get_pref_ipv6_orport(const node_t *node, tor_addr_port_t *ap_out); uint32_t node_get_prim_addr_ipv4h(const node_t *node); int node_allows_single_hop_exits(const node_t *node); const char *node_get_nickname(const node_t *node); @@ -50,6 +59,7 @@ void node_get_address_string(const node_t *node, char *cp, size_t len); long node_get_declared_uptime(const node_t *node); time_t node_get_published_on(const node_t *node); const smartlist_t *node_get_declared_family(const node_t *node); +int node_ipv6_preferred(const node_t *node); smartlist_t *nodelist_get_list(void); |