From 9cec3a13f510f09f328f824796676f24a99ccf35 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 30 Nov 2005 06:27:59 +0000 Subject: [PATCH] remove some functions that are not used; #if0 out some files that are not likely to be used. svn:r5471 --- src/common/container.c | 11 ----------- src/common/container.h | 1 - src/common/crypto.c | 9 --------- src/common/crypto.h | 1 - src/common/log.c | 3 +++ src/common/log.h | 1 - src/or/connection_or.c | 34 ---------------------------------- src/or/or.h | 6 ------ src/or/router.c | 10 ---------- src/or/routerlist.c | 6 ++++++ src/or/routerparse.c | 23 ----------------------- 11 files changed, 9 insertions(+), 96 deletions(-) diff --git a/src/common/container.c b/src/common/container.c index 09951bae4d..6053f37ae1 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -77,17 +77,6 @@ smartlist_clear(smartlist_t *sl) sl->num_used = 0; } -/** Set the list's new length to len (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) diff --git a/src/common/container.h b/src/common/container.h index 443a2ebcbc..93942ed972 100644 --- a/src/common/container.h +++ b/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); diff --git a/src/common/crypto.c b/src/common/crypto.c index 4ebeb949e2..41ef3396a9 100644 --- a/src/common/crypto.c +++ b/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 delta 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 delta bytes. * Return 0 on success, -1 on failure. */ diff --git a/src/common/crypto.h b/src/common/crypto.h index 6b128fda63..edcb771449 100644 --- a/src/common/crypto.h +++ b/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 */ diff --git a/src/common/log.c b/src/common/log.c index 3cb7b764cb..6f6c403f53 100644 --- a/src/common/log.c +++ b/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 victim from the linked-list * logfiles (it must be present in the list when this function is diff --git a/src/common/log.h b/src/common/log.h index 40d66aab2a..1269469046 100644 --- a/src/common/log.h +++ b/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); diff --git a/src/or/connection_or.c b/src/or/connection_or.c index b29a4ae738..a092d3c9ed 100644 --- a/src/or/connection_or.c +++ b/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 addr:port and expect to * handshake with an OR with identity digest id_digest. * diff --git a/src/or/or.h b/src/or/or.h index 268b150157..7212a65305 100644 --- a/src/or/or.h +++ b/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 stmt, which may log events concerning the * connection conn. 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); diff --git a/src/or/router.c b/src/or/router.c index 0fcf13737c..7298c872db 100644 --- a/src/or/router.c +++ b/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 *key, and a copy * of the most recent onion key into *last. */ diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 70c28ee6a2..913f844dce 100644 --- a/src/or/routerlist.c +++ b/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 router to the smartlist sl. * 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 router */ +/* 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 rl */ void diff --git a/src/or/routerparse.c b/src/or/routerparse.c index d7c5c02486..e380f6f0e2 100644 --- a/src/or/routerparse.c +++ b/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 s, 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 s, parse it and add it to the end - * of the exit policy of router. 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 tok to the router info in * router. Return 0 on success, -1 on failure. */ static int