diff options
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/src/or/router.c b/src/or/router.c index eabd9c3f5..8f56eddef 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -232,7 +232,8 @@ get_server_identity_key(void) return server_identitykey; } -/** Return true iff the server identity key has been set. */ +/** Return true iff we are a server and the server identity key + * has been set. */ int server_identity_key_is_set(void) { @@ -932,7 +933,6 @@ init_keys(void) /* 6b. [authdirserver only] add own key to approved directories. */ crypto_pk_get_digest(get_server_identity_key(), digest); type = ((options->V1AuthoritativeDir ? V1_DIRINFO : NO_DIRINFO) | - (options->V2AuthoritativeDir ? V2_DIRINFO : NO_DIRINFO) | (options->V3AuthoritativeDir ? (V3_DIRINFO|MICRODESC_DIRINFO|EXTRAINFO_DIRINFO) : NO_DIRINFO) | (options->BridgeAuthoritativeDir ? BRIDGE_DIRINFO : NO_DIRINFO) | @@ -1259,14 +1259,6 @@ authdir_mode_v1(const or_options_t *options) { return authdir_mode(options) && options->V1AuthoritativeDir != 0; } -/** Return true iff we believe ourselves to be a v2 authoritative - * directory server. - */ -int -authdir_mode_v2(const or_options_t *options) -{ - return authdir_mode(options) && options->V2AuthoritativeDir != 0; -} /** Return true iff we believe ourselves to be a v3 authoritative * directory server. */ @@ -1275,12 +1267,11 @@ authdir_mode_v3(const or_options_t *options) { return authdir_mode(options) && options->V3AuthoritativeDir != 0; } -/** Return true iff we are a v1, v2, or v3 directory authority. */ +/** Return true iff we are a v1 or v3 directory authority. */ int authdir_mode_any_main(const or_options_t *options) { return options->V1AuthoritativeDir || - options->V2AuthoritativeDir || options->V3AuthoritativeDir; } /** Return true if we believe ourselves to be any kind of @@ -2249,7 +2240,7 @@ router_guess_address_from_dir_headers(uint32_t *guess) * string describing the version of Tor and the operating system we're * currently running on. */ -void +STATIC void get_platform_str(char *platform, size_t len) { tor_snprintf(platform, len, "Tor %s on %s", @@ -2925,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 |