digestset.h (852B)
1 /* Copyright (c) 2018-2021, The Tor Project, Inc. */ 2 /* See LICENSE for licensing information */ 3 4 /** 5 * \file digestset.h 6 * \brief Types to handle sets of digests, based on bloom filters. 7 **/ 8 9 #ifndef TOR_DIGESTSET_H 10 #define TOR_DIGESTSET_H 11 12 #include "orconfig.h" 13 #include "lib/cc/torint.h" 14 #include "lib/container/bloomfilt.h" 15 16 /** 17 * An digestset_t represents a set of 20-byte digest values. The 18 * implementation is probabilistic: false negatives cannot occur but false 19 * positives are possible. 20 */ 21 typedef struct bloomfilt_t digestset_t; 22 23 digestset_t *digestset_new(int max_addresses_guess); 24 #define digestset_free(set) bloomfilt_free(set) 25 void digestset_add(digestset_t *set, const char *addr); 26 int digestset_probably_contains(const digestset_t *set, 27 const char *addr); 28 29 #endif /* !defined(TOR_DIGESTSET_H) */