Browse Source

remove some functions that are not used; #if0 out some files that are not likely to be used.

svn:r5471
Nick Mathewson 18 years ago
parent
commit
9cec3a13f5

+ 0 - 11
src/common/container.c

@@ -77,17 +77,6 @@ smartlist_clear(smartlist_t *sl)
   sl->num_used = 0;
 }
 
-/** Set the list's new length to <b>len</b> (which must be \<= the list's
- * current size). Remove the last smartlist_len(sl)-len elements from the
- * list.
- */
-void
-smartlist_truncate(smartlist_t *sl, int len)
-{
-  tor_assert(len <= sl->num_used);
-  sl->num_used = len;
-}
-
 /** Append element to the end of the list. */
 void
 smartlist_add(smartlist_t *sl, void *element)

+ 0 - 1
src/common/container.h

@@ -25,7 +25,6 @@ smartlist_t *smartlist_create(void);
 void smartlist_free(smartlist_t *sl);
 void smartlist_set_capacity(smartlist_t *sl, int n);
 void smartlist_clear(smartlist_t *sl);
-void smartlist_truncate(smartlist_t *sl, int n);
 void smartlist_add(smartlist_t *sl, void *element);
 void smartlist_add_all(smartlist_t *sl, const smartlist_t *s2);
 void smartlist_remove(smartlist_t *sl, void *element);

+ 0 - 9
src/common/crypto.c

@@ -1205,15 +1205,6 @@ crypto_cipher_decrypt(crypto_cipher_env_t *env, char *to,
   return 0;
 }
 
-/** Move the position of the cipher stream backwards by <b>delta</b> bytes.
- * Return 0 on success, -1 on failure.
- */
-int
-crypto_cipher_rewind(crypto_cipher_env_t *env, long delta)
-{
-  return crypto_cipher_advance(env, -delta);
-}
-
 /** Move the position of the cipher stream forwards by <b>delta</b> bytes.
  * Return 0 on success, -1 on failure.
  */

+ 0 - 1
src/common/crypto.h

@@ -120,7 +120,6 @@ int crypto_cipher_decrypt(crypto_cipher_env_t *env, char *to,
                           const char *from, size_t fromlen);
 
 /* only implemented for CRYPTO_CIPHER_AES_CTR */
-int crypto_cipher_rewind(crypto_cipher_env_t *env, long delta);
 int crypto_cipher_advance(crypto_cipher_env_t *env, long delta);
 
 /* SHA-1 */

+ 3 - 0
src/common/log.c

@@ -324,7 +324,9 @@ close_logs(void)
   }
 }
 
+#if 0
 /** Close and re-open all log files; used to rotate logs on SIGHUP. */
+/* Nobody uses this. Remove it? XXXX */
 void
 reset_logs(void)
 {
@@ -340,6 +342,7 @@ reset_logs(void)
     lf = lf->next;
   }
 }
+#endif
 
 /** Remove and free the log entry <b>victim</b> from the linked-list
  * logfiles (it must be present in the list when this function is

+ 0 - 1
src/common/log.h

@@ -103,7 +103,6 @@ int add_callback_log(int loglevelMin, int loglevelMax, log_callback cb);
 int get_min_log_level(void);
 void switch_logs_debug(void);
 void close_logs(void);
-void reset_logs(void);
 void add_temp_log(void);
 void close_temp_logs(void);
 void mark_logs_temp(void);

+ 0 - 34
src/or/connection_or.c

@@ -377,40 +377,6 @@ connection_or_get_by_identity_digest(const char *digest)
   return best;
 }
 
-/** "update an OR connection nickname on the fly"
- * Actually, nobody calls this. Should we remove it? */
-void
-connection_or_update_nickname(connection_t *conn)
-{
-  routerinfo_t *r;
-  const char *n;
-
-  tor_assert(conn);
-  tor_assert(conn->type == CONN_TYPE_OR);
-  n = dirserv_get_nickname_by_digest(conn->identity_digest);
-  if (n) {
-    if (!conn->nickname || strcmp(conn->nickname, n)) {
-      tor_free(conn->nickname);
-      conn->nickname = tor_strdup(n);
-    }
-    return;
-  }
-  r = router_get_by_digest(conn->identity_digest);
-  if (r && r->is_verified) {
-    if (!conn->nickname || strcmp(conn->nickname, r->nickname)) {
-      tor_free(conn->nickname);
-      conn->nickname = tor_strdup(r->nickname);
-    }
-    return;
-  }
-  if (conn->nickname[0] != '$') {
-    tor_free(conn->nickname);
-    conn->nickname = tor_malloc(HEX_DIGEST_LEN+1);
-    base16_encode(conn->nickname, HEX_DIGEST_LEN+1,
-                  conn->identity_digest, DIGEST_LEN);
-  }
-}
-
 /** Launch a new OR connection to <b>addr</b>:<b>port</b> and expect to
  * handshake with an OR with identity digest <b>id_digest</b>.
  *

+ 0 - 6
src/or/or.h

@@ -1676,7 +1676,6 @@ int connection_tls_start_handshake(connection_t *conn, int receiving);
 int connection_tls_continue_handshake(connection_t *conn);
 
 void connection_or_write_cell_to_buf(const cell_t *cell, connection_t *conn);
-void connection_or_update_nickname(connection_t *conn);
 
 /********************************* control.c ***************************/
 
@@ -1708,8 +1707,6 @@ typedef enum or_conn_status_event_t {
 
 void control_update_global_event_mask(void);
 void control_adjust_event_log_severity(void);
-void disable_control_logging(void);
-void enable_control_logging(void);
 
 /** Execute the statement <b>stmt</b>, which may log events concerning the
  * connection <b>conn</b>.  To prevent infinite loops, disable log messages
@@ -2060,7 +2057,6 @@ typedef enum {
 
 void set_onion_key(crypto_pk_env_t *k);
 crypto_pk_env_t *get_onion_key(void);
-crypto_pk_env_t *get_previous_onion_key(void);
 time_t get_onion_key_set_at(void);
 void set_identity_key(crypto_pk_env_t *k);
 crypto_pk_env_t *get_identity_key(void);
@@ -2260,7 +2256,6 @@ int router_parse_routerlist_from_directory(const char *s,
 int router_parse_runningrouters(const char *str);
 int router_parse_directory(const char *str);
 routerinfo_t *router_parse_entry_from_string(const char *s, const char *end);
-int router_add_exit_policy_from_string(routerinfo_t *router, const char *s);
 addr_policy_t *router_parse_addr_policy_from_string(const char *s,
                                                     int assume_action);
 version_status_t tor_version_is_obsolete(const char *myversion,
@@ -2270,7 +2265,6 @@ int tor_version_parse(const char *s, tor_version_t *out);
 int tor_version_as_new_as(const char *platform, const char *cutoff);
 int tor_version_compare(tor_version_t *a, tor_version_t *b);
 void assert_addr_policy_ok(addr_policy_t *t);
-void sort_routerstatus_entries(smartlist_t *sl);
 
 networkstatus_t *networkstatus_parse_from_string(const char *s);
 

+ 0 - 10
src/or/router.c

@@ -53,16 +53,6 @@ get_onion_key(void)
   return onionkey;
 }
 
-/** Return the onion key that was current before the most recent onion
- * key rotation.  If no rotation has been performed since this process
- * started, return NULL.
- */
-crypto_pk_env_t *
-get_previous_onion_key(void)
-{
-  return lastonionkey;
-}
-
 /** Store a copy of the current onion key into *<b>key</b>, and a copy
  * of the most recent onion key into *<b>last</b>.
  */

+ 6 - 0
src/or/routerlist.c

@@ -507,9 +507,11 @@ router_reset_status_download_failures(void)
   mark_all_trusteddirservers_up();
 }
 
+#if 0
 /** Return 0 if \\exists an authoritative dirserver that's currently
  * thought to be running, else return 1.
  */
+/* XXXX Nobody calls this function. Should it go away? */
 int
 all_trusted_directory_servers_down(void)
 {
@@ -519,6 +521,7 @@ all_trusted_directory_servers_down(void)
                     if (dir->is_running) return 0);
   return 1;
 }
+#endif
 
 /** Add all the family of <b>router</b> to the smartlist <b>sl</b>.
  * This is used to make sure we don't pick siblings in a single path.
@@ -1082,7 +1085,9 @@ signed_descriptor_from_routerinfo(routerinfo_t *ri)
   return sd;
 }
 
+#if 0
 /** Allocate a fresh copy of <b>router</b> */
+/* XXX Nobody uses this. Remove it? */
 routerinfo_t *
 routerinfo_copy(const routerinfo_t *router)
 {
@@ -1116,6 +1121,7 @@ routerinfo_copy(const routerinfo_t *router)
   }
   return r;
 }
+#endif
 
 /** Free all storage held by a routerlist <b>rl</b> */
 void

+ 0 - 23
src/or/routerparse.c

@@ -1079,12 +1079,6 @@ _compare_routerstatus_entries(const void **_a, const void **_b)
   return memcmp(a->identity_digest, b->identity_digest, DIGEST_LEN);
 }
 
-void
-sort_routerstatus_entries(smartlist_t *sl)
-{
-  smartlist_sort(sl, _compare_routerstatus_entries);
-}
-
 /** Given a versioned (v2 or later) network-status object in <b>s</b>, try to
  * parse it and return the result.  Return NULL on failure.  Check the
  * signature of the network status, but do not (yet) check the signing key for
@@ -1319,23 +1313,6 @@ router_parse_addr_policy_from_string(const char *s, int assume_action)
   return r;
 }
 
-/** Given an exit policicy stored in <b>s</b>, parse it and add it to the end
- * of the exit policy of <b>router</b>.  Return 0 on success, -1 on failure.
- */
-int
-router_add_exit_policy_from_string(routerinfo_t *router, const char *s)
-{
-  addr_policy_t *newe, *tmpe;
-  newe = router_parse_addr_policy_from_string(s, -1);
-  if (!newe)
-    return -1;
-  for (tmpe = router->exit_policy; tmpe; tmpe=tmpe->next)
-    ;
-  tmpe->next = newe;
-
-  return 0;
-}
-
 /** Add an exit policy stored in the token <b>tok</b> to the router info in
  * <b>router</b>.  Return 0 on success, -1 on failure. */
 static int