diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-08-22 19:04:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-08-22 19:13:40 -0400 |
commit | 80d3887360548b28fe2bd06501f0d51d0a1ba4f0 (patch) | |
tree | 39005c027d4c49d4860e5a6e4272a67bf0e716fe /src/or/nodelist.h | |
parent | d7a3e336ee505bcbeb30117d91067810ad096130 (diff) | |
download | tor-80d3887360548b28fe2bd06501f0d51d0a1ba4f0.tar.gz tor-80d3887360548b28fe2bd06501f0d51d0a1ba4f0.zip |
Refactor node lookup APIs to take flags
Right now there's a single warn_if_unnamed flag for
router_get_consensus_status_by_nickname() and
node_get_by_nickname(), that is nearly always 1. I've turned it
into an 'unsigned' bitfield, and inverted its sense. I've added the
flags argument to node_get_by_hex_id() too, though it does nothing
there right now.
I've removed the router_get_consensus_status_by_nickname() function,
since it was only used in once place.
This patch changes the warning behavior of GETINFO ns/name/<name>,
since all other name lookups from the controller currently warn.
Later I'm going to add more flags, for ed25519 support.
Diffstat (limited to 'src/or/nodelist.h')
-rw-r--r-- | src/or/nodelist.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/nodelist.h b/src/or/nodelist.h index c5805c55f1..79ff720c94 100644 --- a/src/or/nodelist.h +++ b/src/or/nodelist.h @@ -21,7 +21,11 @@ MOCK_DECL(const node_t *, node_get_by_id, (const char *identity_digest)); node_t *node_get_mutable_by_ed25519_id(const ed25519_public_key_t *ed_id); MOCK_DECL(const node_t *, node_get_by_ed25519_id, (const ed25519_public_key_t *ed_id)); -const node_t *node_get_by_hex_id(const char *identity_digest); + +#define NNF_NO_WARN_UNNAMED (1u<<0) + +const node_t *node_get_by_hex_id(const char *identity_digest, + unsigned flags); node_t *nodelist_set_routerinfo(routerinfo_t *ri, routerinfo_t **ri_old_out); node_t *nodelist_add_microdesc(microdesc_t *md); void nodelist_set_consensus(networkstatus_t *ns); @@ -35,7 +39,7 @@ void nodelist_free_all(void); void nodelist_assert_ok(void); MOCK_DECL(const node_t *, node_get_by_nickname, - (const char *nickname, int warn_if_unnamed)); + (const char *nickname, unsigned flags)); void node_get_verbose_nickname(const node_t *node, char *verbose_name_out); void node_get_verbose_nickname_by_id(const char *id_digest, |