diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-02-07 12:22:56 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-02-07 12:22:56 -0500 |
commit | f1682a615f9af50f4380bf1bb44070f299422a0a (patch) | |
tree | 950ff987bed7c36dad216fa89bba09ae50df4fe5 /src/or/nodelist.c | |
parent | 040b478692c2355515eec626044ea2e3c37ca9c5 (diff) | |
parent | 57da1a5057a3d95a9093384a3797d5a404863c5a (diff) | |
download | tor-f1682a615f9af50f4380bf1bb44070f299422a0a.tar.gz tor-f1682a615f9af50f4380bf1bb44070f299422a0a.zip |
Merge remote-tracking branch 'houqp/hs_control_fix'
Diffstat (limited to 'src/or/nodelist.c')
-rw-r--r-- | src/or/nodelist.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 395ea3346a..402fb2e96a 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -646,7 +646,7 @@ node_get_purpose(const node_t *node) /** Compute the verbose ("extended") nickname of <b>node</b> and store it * into the MAX_VERBOSE_NICKNAME_LEN+1 character buffer at - * <b>verbose_nickname_out</b> */ + * <b>verbose_name_out</b> */ void node_get_verbose_nickname(const node_t *node, char *verbose_name_out) @@ -662,6 +662,25 @@ node_get_verbose_nickname(const node_t *node, strlcpy(verbose_name_out+1+HEX_DIGEST_LEN+1, nickname, MAX_NICKNAME_LEN+1); } +/** Compute the verbose ("extended") nickname of node with + * given <b>id_digest</b> and store it into the MAX_VERBOSE_NICKNAME_LEN+1 + * character buffer at <b>verbose_name_out</b> + * + * If node_get_by_id() returns NULL, base 16 encoding of + * <b>id_digest</b> is returned instead. */ +void +node_get_verbose_nickname_by_id(const char *id_digest, + char *verbose_name_out) +{ + const node_t *node = node_get_by_id(id_digest); + if (!node) { + verbose_name_out[0] = '$'; + base16_encode(verbose_name_out+1, HEX_DIGEST_LEN+1, id_digest, DIGEST_LEN); + } else { + node_get_verbose_nickname(node, verbose_name_out); + } +} + /** Return true iff it seems that <b>node</b> allows circuits to exit * through it directlry from the client. */ int |