[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove a few more unused functions.



commit 289653c3921e2153ff0450d3f6b0fdf4e075d6ce
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Mar 1 21:57:52 2013 -0500

    Remove a few more unused functions.
---
 src/or/router.c     |   17 --------------
 src/or/router.h     |    2 -
 src/or/routerlist.c |   62 ---------------------------------------------------
 src/or/routerlist.h |    2 -
 4 files changed, 0 insertions(+), 83 deletions(-)

diff --git a/src/or/router.c b/src/or/router.c
index 95aa70a..0c3b671 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -2966,23 +2966,6 @@ router_get_verbose_nickname(char *buf, const routerinfo_t *router)
   strlcpy(buf+1+HEX_DIGEST_LEN+1, router->nickname, MAX_NICKNAME_LEN+1);
 }
 
-/** Set <b>buf</b> (which must have MAX_VERBOSE_NICKNAME_LEN+1 bytes) to the
- * verbose representation of the identity of <b>router</b>.  The format is:
- *  A dollar sign.
- *  The upper-case hexadecimal encoding of the SHA1 hash of router's identity.
- *  A "=" if the router is named; a "~" if it is not.
- *  The router's nickname.
- **/
-void
-routerstatus_get_verbose_nickname(char *buf, const routerstatus_t *router)
-{
-  buf[0] = '$';
-  base16_encode(buf+1, HEX_DIGEST_LEN+1, router->identity_digest,
-                DIGEST_LEN);
-  buf[1+HEX_DIGEST_LEN] = router->is_named ? '=' : '~';
-  strlcpy(buf+1+HEX_DIGEST_LEN+1, router->nickname, MAX_NICKNAME_LEN+1);
-}
-
 /** Forget that we have issued any router-related warnings, so that we'll
  * warn again if we see the same errors. */
 void
diff --git a/src/or/router.h b/src/or/router.h
index fd2076a..96749b5 100644
--- a/src/or/router.h
+++ b/src/or/router.h
@@ -132,8 +132,6 @@ const char *routerstatus_describe(const routerstatus_t *ri);
 const char *extend_info_describe(const extend_info_t *ei);
 
 void router_get_verbose_nickname(char *buf, const routerinfo_t *router);
-void routerstatus_get_verbose_nickname(char *buf,
-                                       const routerstatus_t *router);
 void router_reset_warnings(void);
 void router_reset_reachability(void);
 void router_free_all(void);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 2f08167..f98ba64 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -54,8 +54,6 @@ static const routerstatus_t *router_pick_dirserver_generic(
                               smartlist_t *sourcelist,
                               dirinfo_type_t type, int flags);
 static void mark_all_dirservers_up(smartlist_t *server_list);
-static int router_nickname_matches(const routerinfo_t *router,
-                                   const char *nickname);
 static void dir_server_free(dir_server_t *ds);
 static int signed_desc_digest_is_recognized(signed_descriptor_t *desc);
 static const char *signed_descriptor_get_body_impl(
@@ -1462,30 +1460,6 @@ routerlist_add_node_and_family(smartlist_t *sl, const routerinfo_t *router)
   nodelist_add_node_and_family(sl, node);
 }
 
-/** Return 1 iff any member of the (possibly NULL) comma-separated list
- * <b>list</b> is an acceptable nickname or hexdigest for <b>router</b>.  Else
- * return 0.
- */
-int
-router_nickname_is_in_list(const routerinfo_t *router, const char *list)
-{
-  smartlist_t *nickname_list;
-  int v = 0;
-
-  if (!list)
-    return 0; /* definitely not */
-  tor_assert(router);
-
-  nickname_list = smartlist_new();
-  smartlist_split_string(nickname_list, list, ",",
-    SPLIT_SKIP_SPACE|SPLIT_STRIP_SPACE|SPLIT_IGNORE_BLANK, 0);
-  SMARTLIST_FOREACH(nickname_list, const char *, cp,
-                    if (router_nickname_matches(router, cp)) {v=1;break;});
-  SMARTLIST_FOREACH(nickname_list, char *, cp, tor_free(cp));
-  smartlist_free(nickname_list);
-  return v;
-}
-
 /** Add every suitable node from our nodelist to <b>sl</b>, so that
  * we can pick a node for a circuit.
  */
@@ -2299,31 +2273,6 @@ router_is_named(const routerinfo_t *router)
           tor_memeq(digest, router->cache_info.identity_digest, DIGEST_LEN));
 }
 
-/** Return true iff the digest of <b>router</b>'s identity key,
- * encoded in hexadecimal, matches <b>hexdigest</b> (which is
- * optionally prefixed with a single dollar sign).  Return false if
- * <b>hexdigest</b> is malformed, or it doesn't match.  */
-static INLINE int
-router_hex_digest_matches(const routerinfo_t *router, const char *hexdigest)
-{
-  return hex_digest_nickname_matches(hexdigest,
-                                     router->cache_info.identity_digest,
-                                     router->nickname,
-                                     router_is_named(router));
-}
-
-/** Return true if <b>router</b>'s nickname matches <b>nickname</b>
- * (case-insensitive), or if <b>router's</b> identity key digest
- * matches a hexadecimal value stored in <b>nickname</b>.  Return
- * false otherwise. */
-static int
-router_nickname_matches(const routerinfo_t *router, const char *nickname)
-{
-  if (nickname[0]!='$' && !strcasecmp(router->nickname, nickname))
-    return 1;
-  return router_hex_digest_matches(router, nickname);
-}
-
 /** Return true iff <b>digest</b> is the digest of the identity key of a
  * trusted directory matching at least one bit of <b>type</b>.  If <b>type</b>
  * is zero, any authority is okay. */
@@ -4052,17 +4001,6 @@ clear_dir_servers(void)
   router_dir_info_changed();
 }
 
-/** Return 1 if any trusted dir server supports v1 directories,
- * else return 0. */
-int
-any_trusted_dir_is_v1_authority(void)
-{
-  if (trusted_dir_servers)
-    return get_n_authorities(V1_DIRINFO) > 0;
-
-  return 0;
-}
-
 /** For every current directory connection whose purpose is <b>purpose</b>,
  * and where the resource being downloaded begins with <b>prefix</b>, split
  * rest of the resource into base16 fingerprints (or base64 fingerprints if
diff --git a/src/or/routerlist.h b/src/or/routerlist.h
index 1849fff..28b2f58 100644
--- a/src/or/routerlist.h
+++ b/src/or/routerlist.h
@@ -42,7 +42,6 @@ int router_get_my_share_of_directory_requests(double *v2_share_out,
                                               double *v3_share_out);
 void router_reset_status_download_failures(void);
 int routers_have_same_or_addrs(const routerinfo_t *r1, const routerinfo_t *r2);
-int router_nickname_is_in_list(const routerinfo_t *router, const char *list);
 const routerinfo_t *routerlist_find_my_routerinfo(void);
 uint32_t router_get_advertised_bandwidth(const routerinfo_t *router);
 uint32_t router_get_advertised_bandwidth_capped(const routerinfo_t *router);
@@ -146,7 +145,6 @@ void dir_server_add(dir_server_t *ent);
 
 void authority_cert_free(authority_cert_t *cert);
 void clear_dir_servers(void);
-int any_trusted_dir_is_v1_authority(void);
 void update_consensus_router_descriptor_downloads(time_t now, int is_vote,
                                                   networkstatus_t *consensus);
 void update_router_descriptor_downloads(time_t now);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits