aboutsummaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-02-03 12:28:42 -0500
committerNick Mathewson <nickm@torproject.org>2014-02-03 12:28:42 -0500
commitfee7f25ff845dc9a99dac59e67fdb9517750176c (patch)
tree8d77a633b56c05939cfff901a2f942da217ba99b /src/or/router.c
parent27d81c756b0e28266e75cf4cf897e486d11040b2 (diff)
parentebd99314cff907433eca835926a325c019f4b6c0 (diff)
downloadtor-fee7f25ff845dc9a99dac59e67fdb9517750176c.tar
tor-fee7f25ff845dc9a99dac59e67fdb9517750176c.tar.gz
Merge remote-tracking branch 'houqp/hs_control'
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/or/router.c b/src/or/router.c
index fd0df52dc..8f56eddef 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -2916,6 +2916,29 @@ node_describe(const node_t *node)
return node_get_description(buf, node);
}
+/** Return a human-readable description of the node whose identity is
+ * <b>identity_digest</b>. If node_get_by_id() returns NULL, base 16 encoding
+ * of <b>identity_digest</b> is returned instead.
+ *
+ * This function is not thread-safe. Each call to this function invalidates
+ * previous values returned by this function.
+ */
+const char *
+node_describe_by_id(const char *identity_digest)
+{
+ static char buf[NODE_DESC_BUF_LEN];
+ const node_t *node = NULL;
+
+ node = node_get_by_id(identity_digest);
+ if (!node) {
+ buf[0] = '$';
+ base16_encode(buf+1, HEX_DIGEST_LEN+1, identity_digest, DIGEST_LEN);
+ return buf;
+ } else {
+ return node_get_description(buf, node);
+ }
+}
+
/** Return a human-readable description of the routerstatus_t <b>rs</b>.
*
* This function is not thread-safe. Each call to this function invalidates