Remove bloom filters, order statistics, and bitarrays from container.h

This commit is contained in:
Nick Mathewson 2018-06-21 16:48:54 -04:00
parent 932b4d0a43
commit 50a5954003
21 changed files with 36 additions and 25 deletions

View File

@ -14,7 +14,7 @@
#include "common/address_set.h" #include "common/address_set.h"
#include "common/address.h" #include "common/address.h"
#include "common/compat.h" #include "common/compat.h"
#include "lib/container/container.h" #include "lib/container/bitarray.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "common/util.h" #include "common/util.h"
#include "siphash.h" #include "siphash.h"
@ -126,4 +126,3 @@ address_set_probably_contains(address_set_t *set,
} }
return matches == N_BITS_PER_ITEM; return matches == N_BITS_PER_ITEM;
} }

View File

@ -12,6 +12,7 @@
#include "common/torlog.h" #include "common/torlog.h"
#include "lib/err/backtrace.h" #include "lib/err/backtrace.h"
#include "lib/container/container.h" #include "lib/container/container.h"
#include "lib/malloc/util_malloc.h"
#ifdef __COVERITY__ #ifdef __COVERITY__
int bug_macro_deadcode_dummy__ = 0; int bug_macro_deadcode_dummy__ = 0;

View File

@ -8,8 +8,5 @@
#include "lib/container/smartlist.h" #include "lib/container/smartlist.h"
#include "lib/container/map.h" #include "lib/container/map.h"
#include "lib/container/bitarray.h"
#include "lib/container/bloomfilt.h"
#include "lib/container/order.h"
#endif /* !defined(TOR_CONTAINER_H) */ #endif /* !defined(TOR_CONTAINER_H) */

View File

@ -13,11 +13,10 @@
#ifndef TOR_CRYPTO_DIGEST_H #ifndef TOR_CRYPTO_DIGEST_H
#define TOR_CRYPTO_DIGEST_H #define TOR_CRYPTO_DIGEST_H
#include <stdio.h>
#include "lib/container/container.h" #include "lib/container/container.h"
#include "lib/cc/torint.h" #include "lib/cc/torint.h"
#include "lib/defs/digest_sizes.h" #include "lib/defs/digest_sizes.h"
#include "lib/malloc/util_malloc.h"
/** Length of a sha1 message digest when encoded in base32 with trailing = /** Length of a sha1 message digest when encoded in base32 with trailing =
* signs removed. */ * signs removed. */

View File

@ -1,3 +1,3 @@
noinst_HEADERS += \ noinst_HEADERS += \
digest_sizes.h src/lib/defs/digest_sizes.h

View File

@ -1,4 +1,3 @@
/* Copyright (c) 2001 Matej Pfajfar. /* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
@ -26,6 +25,8 @@
#include "or/confparse.h" #include "or/confparse.h"
#include "or/routerset.h" #include "or/routerset.h"
#include "lib/container/bitarray.h"
static uint64_t config_parse_memunit(const char *s, int *ok); static uint64_t config_parse_memunit(const char *s, int *ok);
static int config_parse_msec_interval(const char *s, int *ok); static int config_parse_msec_interval(const char *s, int *ok);
static int config_parse_interval(const char *s, int *ok); static int config_parse_interval(const char *s, int *ok);
@ -1186,4 +1187,3 @@ config_parse_interval(const char *s, int *ok)
} }
return (int)r; return (int)r;
} }

View File

@ -1412,4 +1412,3 @@ looks_like_a_consensus_diff(const char *document, size_t len)
return (len >= strlen(ns_diff_version) && return (len >= strlen(ns_diff_version) &&
fast_memeq(document, ns_diff_version, strlen(ns_diff_version))); fast_memeq(document, ns_diff_version, strlen(ns_diff_version)));
} }

View File

@ -15,6 +15,8 @@ char *consensus_diff_apply(const char *consensus,
int looks_like_a_consensus_diff(const char *document, size_t len); int looks_like_a_consensus_diff(const char *document, size_t len);
#ifdef CONSDIFF_PRIVATE #ifdef CONSDIFF_PRIVATE
#include "lib/container/bitarray.h"
struct memarea_t; struct memarea_t;
/** Line type used for constructing consensus diffs. Each of these lines /** Line type used for constructing consensus diffs. Each of these lines
@ -95,4 +97,3 @@ MOCK_DECL(STATIC int,
#endif /* defined(CONSDIFF_PRIVATE) */ #endif /* defined(CONSDIFF_PRIVATE) */
#endif /* !defined(TOR_CONSDIFF_H) */ #endif /* !defined(TOR_CONSDIFF_H) */

View File

@ -43,6 +43,8 @@
#include "or/vote_routerstatus_st.h" #include "or/vote_routerstatus_st.h"
#include "or/vote_timing_st.h" #include "or/vote_timing_st.h"
#include "lib/container/order.h"
/** /**
* \file dirvote.c * \file dirvote.c
* \brief Functions to compute directory consensus, and schedule voting. * \brief Functions to compute directory consensus, and schedule voting.

View File

@ -46,6 +46,8 @@
#include "or/tor_version_st.h" #include "or/tor_version_st.h"
#include "or/vote_routerstatus_st.h" #include "or/vote_routerstatus_st.h"
#include "lib/container/order.h"
/** /**
* \file dirserv.c * \file dirserv.c
* \brief Directory server core implementation. Manages directory * \brief Directory server core implementation. Manages directory
@ -3591,4 +3593,3 @@ dirserv_free_all(void)
dirserv_clear_measured_bw_cache(); dirserv_clear_measured_bw_cache();
} }

View File

@ -142,6 +142,8 @@
#include "or/node_st.h" #include "or/node_st.h"
#include "or/origin_circuit_st.h" #include "or/origin_circuit_st.h"
#include "lib/container/bloomfilt.h"
/** A list of existing guard selection contexts. */ /** A list of existing guard selection contexts. */
static smartlist_t *guard_contexts = NULL; static smartlist_t *guard_contexts = NULL;
/** The currently enabled guard selection context. */ /** The currently enabled guard selection context. */
@ -3687,4 +3689,3 @@ entry_guards_free_all(void)
} }
circuit_build_times_free_timeouts(get_circuit_build_times_mutable()); circuit_build_times_free_timeouts(get_circuit_build_times_mutable());
} }

View File

@ -38,6 +38,8 @@
#include "or/geoip.h" #include "or/geoip.h"
#include "or/routerlist.h" #include "or/routerlist.h"
#include "lib/container/order.h"
static void init_geoip_countries(void); static void init_geoip_countries(void);
/** An entry from the GeoIP IPv4 file: maps an IPv4 range to a country. */ /** An entry from the GeoIP IPv4 file: maps an IPv4 range to a country. */
@ -1884,4 +1886,3 @@ geoip_free_all(void)
memset(geoip_digest, 0, sizeof(geoip_digest)); memset(geoip_digest, 0, sizeof(geoip_digest));
memset(geoip6_digest, 0, sizeof(geoip6_digest)); memset(geoip6_digest, 0, sizeof(geoip6_digest));
} }

View File

@ -92,6 +92,9 @@
#include "or/networkstatus_st.h" #include "or/networkstatus_st.h"
#include "or/or_circuit_st.h" #include "or/or_circuit_st.h"
#include "lib/container/bloomfilt.h"
#include "lib/container/order.h"
static void bw_arrays_init(void); static void bw_arrays_init(void);
static void predicted_ports_alloc(void); static void predicted_ports_alloc(void);
@ -3208,4 +3211,3 @@ rep_hist_free_all(void)
tor_assert_nonfatal(rephist_total_alloc == 0); tor_assert_nonfatal(rephist_total_alloc == 0);
tor_assert_nonfatal_once(rephist_total_num == 0); tor_assert_nonfatal_once(rephist_total_num == 0);
} }

View File

@ -137,6 +137,8 @@
#include "or/routerlist_st.h" #include "or/routerlist_st.h"
#include "or/vote_routerstatus_st.h" #include "or/vote_routerstatus_st.h"
#include "lib/container/bloomfilt.h"
// #define DEBUG_ROUTERLIST // #define DEBUG_ROUTERLIST
/****************************************************************************/ /****************************************************************************/
@ -5836,4 +5838,3 @@ refresh_all_country_info(void)
nodelist_refresh_countries(); nodelist_refresh_countries();
} }

View File

@ -98,6 +98,8 @@
#include "or/vote_microdesc_hash_st.h" #include "or/vote_microdesc_hash_st.h"
#include "or/vote_routerstatus_st.h" #include "or/vote_routerstatus_st.h"
#include "lib/container/bloomfilt.h"
#undef log #undef log
#include <math.h> #include <math.h>
@ -5684,4 +5686,3 @@ routerparse_free_all(void)
{ {
dump_desc_fifo_cleanup(); dump_desc_fifo_cleanup();
} }

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2001 Matej Pfajfar. /* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine. n * Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
* Copyright (c) 2007-2018, The Tor Project, Inc. */ * Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */ /* See LICENSE for licensing information */
@ -460,4 +460,3 @@ routerset_free_(routerset_t *routerset)
bitarray_free(routerset->countries); bitarray_free(routerset->countries);
tor_free(routerset); tor_free(routerset);
} }

View File

@ -45,6 +45,8 @@ void routerset_free_(routerset_t *routerset);
int routerset_len(const routerset_t *set); int routerset_len(const routerset_t *set);
#ifdef ROUTERSET_PRIVATE #ifdef ROUTERSET_PRIVATE
#include "lib/container/bitarray.h"
STATIC char * routerset_get_countryname(const char *c); STATIC char * routerset_get_countryname(const char *c);
STATIC int routerset_contains(const routerset_t *set, const tor_addr_t *addr, STATIC int routerset_contains(const routerset_t *set, const tor_addr_t *addr,
uint16_t orport, uint16_t orport,
@ -85,4 +87,3 @@ struct routerset_t {
}; };
#endif /* defined(ROUTERSET_PRIVATE) */ #endif /* defined(ROUTERSET_PRIVATE) */
#endif /* !defined(TOR_ROUTERSET_H) */ #endif /* !defined(TOR_ROUTERSET_H) */

View File

@ -29,6 +29,8 @@
#include "or/cell_st.h" #include "or/cell_st.h"
#include "or/or_circuit_st.h" #include "or/or_circuit_st.h"
#include "lib/container/bloomfilt.h"
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID) #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID)
static uint64_t nanostart; static uint64_t nanostart;
static inline uint64_t static inline uint64_t
@ -741,4 +743,3 @@ main(int argc, const char **argv)
return 0; return 0;
} }

View File

@ -17,6 +17,8 @@
#include "or/or_circuit_st.h" #include "or/or_circuit_st.h"
#include "or/origin_circuit_st.h" #include "or/origin_circuit_st.h"
#include "lib/container/bitarray.h"
static channel_t * static channel_t *
new_fake_channel(void) new_fake_channel(void)
{ {
@ -470,4 +472,3 @@ struct testcase_t circuitlist_tests[] = {
TT_FORK, NULL, NULL }, TT_FORK, NULL, NULL },
END_OF_TESTCASES END_OF_TESTCASES
}; };

View File

@ -9,6 +9,10 @@
#include "or/fp_pair.h" #include "or/fp_pair.h"
#include "test/test.h" #include "test/test.h"
#include "lib/container/bitarray.h"
#include "lib/container/bloomfilt.h"
#include "lib/container/order.h"
/** Helper: return a tristate based on comparing the strings in *<b>a</b> and /** Helper: return a tristate based on comparing the strings in *<b>a</b> and
* *<b>b</b>. */ * *<b>b</b>. */
static int static int
@ -1295,4 +1299,3 @@ struct testcase_t container_tests[] = {
CONTAINER(smartlist_strings_eq, 0), CONTAINER(smartlist_strings_eq, 0),
END_OF_TESTCASES END_OF_TESTCASES
}; };

View File

@ -43,6 +43,8 @@
#include "test/test_helpers.h" #include "test/test_helpers.h"
#include "test/log_test_helpers.h" #include "test/log_test_helpers.h"
#include "lib/container/bloomfilt.h"
/* TODO: /* TODO:
* choose_random_entry() test with state set. * choose_random_entry() test with state set.
* *
@ -3074,4 +3076,3 @@ struct testcase_t entrynodes_tests[] = {
END_OF_TESTCASES END_OF_TESTCASES
}; };