address_set.h 1007 B

123456789101112131415161718192021222324252627282930313233
  1. /* Copyright (c) 2018, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file addressset.h
  5. * \brief Types to handle sets of addresses.
  6. *
  7. * This module was first written on a semi-emergency basis to improve the
  8. * robustness of the anti-DoS module. As such, it's written in a pretty
  9. * conservative way, and should be susceptible to improvement later on.
  10. **/
  11. #ifndef TOR_ADDRESS_SET_H
  12. #define TOR_ADDRESS_SET_H
  13. #include "orconfig.h"
  14. /**
  15. * An address_set_t represents a set of tor_addr_t values. The implementation
  16. * is probabilistic: false negatives cannot occur but false positives are
  17. * possible.
  18. */
  19. typedef struct address_set_t address_set_t;
  20. struct tor_addr_t;
  21. address_set_t *address_set_new(int max_addresses_guess);
  22. void address_set_free(address_set_t *set);
  23. void address_set_add(address_set_t *set, const struct tor_addr_t *addr);
  24. int address_set_probably_contains(address_set_t *set,
  25. const struct tor_addr_t *addr);
  26. #endif