Tor  0.4.7.0-alpha-dev
address_set.h
Go to the documentation of this file.
1 /* Copyright (c) 2018-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 /**
5  * \file address_set.h
6  * \brief Types to handle sets of addresses.
7  **/
8 
9 #ifndef TOR_ADDRESS_SET_H
10 #define TOR_ADDRESS_SET_H
11 
12 #include "orconfig.h"
13 #include "lib/cc/torint.h"
15 
16 struct tor_addr_t;
17 
18 /**
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
21  * possible.
22  */
23 typedef struct bloomfilt_t address_set_t;
24 
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);
31 
32 #endif /* !defined(TOR_ADDRESS_SET_H) */
address_set_t * address_set_new(int max_addresses_guess)
Definition: address_set.c:33
void address_set_add_ipv4h(address_set_t *set, uint32_t addr)
Definition: address_set.c:54
void address_set_add(address_set_t *set, const struct tor_addr_t *addr)
Definition: address_set.c:47
int address_set_probably_contains(const address_set_t *set, const struct tor_addr_t *addr)
Definition: address_set.c:66
Header for bloomfilt.c.
Integer definitions used throughout Tor.