address_set.h 928 B

12345678910111213141516171819202122232425262728293031
  1. /* Copyright (c) 2018-2019, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file address_set.h
  5. * \brief Types to handle sets of addresses.
  6. **/
  7. #ifndef TOR_ADDRESS_SET_H
  8. #define TOR_ADDRESS_SET_H
  9. #include "orconfig.h"
  10. #include "lib/cc/torint.h"
  11. #include "lib/container/bloomfilt.h"
  12. /**
  13. * An address_set_t represents a set of tor_addr_t values. The implementation
  14. * is probabilistic: false negatives cannot occur but false positives are
  15. * possible.
  16. */
  17. typedef struct bloomfilt_t address_set_t;
  18. struct tor_addr_t;
  19. address_set_t *address_set_new(int max_addresses_guess);
  20. #define address_set_free(set) bloomfilt_free(set)
  21. void address_set_add(address_set_t *set, const struct tor_addr_t *addr);
  22. void address_set_add_ipv4h(address_set_t *set, uint32_t addr);
  23. int address_set_probably_contains(const address_set_t *set,
  24. const struct tor_addr_t *addr);
  25. #endif