digestset.h 815 B

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