Tor
0.4.7.0-alpha-dev
|
Implementation for a set of addresses. More...
#include "orconfig.h"
#include "core/or/address_set.h"
#include "lib/net/address.h"
#include "lib/container/bloomfilt.h"
#include "lib/crypt_ops/crypto_rand.h"
Go to the source code of this file.
Functions | |
static uint64_t | bloomfilt_addr_hash (const struct sipkey *key, const void *item) |
address_set_t * | address_set_new (int max_addresses_guess) |
void | address_set_add (address_set_t *set, const struct tor_addr_t *addr) |
void | address_set_add_ipv4h (address_set_t *set, uint32_t addr) |
int | address_set_probably_contains (const address_set_t *set, const struct tor_addr_t *addr) |
Implementation for a set of addresses.
This module was first written on a semi-emergency basis to improve the robustness of the anti-DoS module. As such, it's written in a pretty conservative way, and should be susceptible to improvement later on.
Definition in file address_set.c.
void address_set_add | ( | address_set_t * | set, |
const struct tor_addr_t * | addr | ||
) |
Add addr to set.
All future queries for addr in set will return true. Removing items is not possible.
Definition at line 47 of file address_set.c.
Referenced by address_set_add_ipv4h().
void address_set_add_ipv4h | ( | address_set_t * | set, |
uint32_t | addr | ||
) |
As address_set_add(), but take an ipv4 address in host order.
Definition at line 54 of file address_set.c.
address_set_t* address_set_new | ( | int | max_addresses_guess | ) |
Allocate and return an address_set, suitable for holding up to max_address_guess distinct values.
Definition at line 33 of file address_set.c.
int address_set_probably_contains | ( | const address_set_t * | set, |
const struct tor_addr_t * | addr | ||
) |
Return true if addr is a member of set. (And probably, return false if addr is not a member of set.)
Definition at line 66 of file address_set.c.
|
static |
Wrap our hash function to have the signature that the bloom filter needs.
Definition at line 22 of file address_set.c.