1 /* Copyright (c) 2018-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
6 * \brief Types to handle sets of addresses.
9 #ifndef TOR_ADDRESS_SET_H
10 #define TOR_ADDRESS_SET_H
13 #include "lib/cc/torint.h"
14 #include "lib/container/bloomfilt.h"
19 * An address_set_t represents a set of tor_addr_t values. The implementation
20 * is probabilistic: false negatives cannot occur but false positives are
23 typedef struct bloomfilt_t address_set_t
;
25 address_set_t
*address_set_new(int max_addresses_guess
);
26 #define address_set_free(set) bloomfilt_free(set)
27 void address_set_add(address_set_t
*set
, const struct tor_addr_t
*addr
);
28 void address_set_add_ipv4h(address_set_t
*set
, uint32_t addr
);
29 int address_set_probably_contains(const address_set_t
*set
,
30 const struct tor_addr_t
*addr
);
32 #endif /* !defined(TOR_ADDRESS_SET_H) */