tor  0.4.2.0-alpha-dev
Functions
address_set.c File Reference
#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"
#include "siphash.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_taddress_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)
 

Detailed Description

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.

Function Documentation

◆ address_set_add()

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 48 of file address_set.c.

References bloomfilt_add().

Referenced by address_set_add_ipv4h(), and node_add_to_address_set().

◆ 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 55 of file address_set.c.

References address_set_add(), and tor_addr_from_ipv4h.

Referenced by node_add_to_address_set().

◆ address_set_new()

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 34 of file address_set.c.

◆ address_set_probably_contains()

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 67 of file address_set.c.

References bloomfilt_probably_contains().