tor  0.4.2.0-alpha-dev
Macros | Typedefs | Functions
address_set.h File Reference
#include "orconfig.h"
#include "lib/cc/torint.h"
#include "lib/container/bloomfilt.h"

Go to the source code of this file.

Macros

#define address_set_free(set)   bloomfilt_free(set)
 

Typedefs

typedef struct bloomfilt_t address_set_t
 

Functions

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

Types to handle sets of addresses.

Definition in file address_set.h.

Typedef Documentation

◆ address_set_t

typedef struct bloomfilt_t address_set_t

An address_set_t represents a set of tor_addr_t values. The implementation is probabilistic: false negatives cannot occur but false positives are possible.

Definition at line 21 of file address_set.h.

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().