tor  master
Typedefs | Functions
address_set.h File Reference

Types to handle sets of addresses. More...

#include "orconfig.h"
#include "torint.h"
Include dependency graph for address_set.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct address_set_t address_set_t
 

Functions

address_set_taddress_set_new (int max_addresses_guess)
 
void address_set_free (address_set_t *set)
 
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 (address_set_t *set, const struct tor_addr_t *addr)
 

Detailed Description

Types to handle sets 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.

Typedef Documentation

◆ address_set_t

typedef struct address_set_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.

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Here is the call graph for this function:

◆ address_set_free()

void address_set_free ( address_set_t set)

Release all storage associated with 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.

Here is the call graph for this function:

◆ address_set_probably_contains()

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

Here is the call graph for this function: