Macros | Typedefs | Functions
digestset.h File Reference
#include "orconfig.h"
#include "lib/cc/torint.h"
#include "lib/container/bloomfilt.h"

Go to the source code of this file.


#define digestset_free(set)   bloomfilt_free(set)


typedef struct bloomfilt_t digestset_t


digestset_tdigestset_new (int max_addresses_guess)
void digestset_add (digestset_t *set, const char *addr)
int digestset_probably_contains (const digestset_t *set, const char *addr)

Detailed Description

Types to handle sets of digests, based on bloom filters.

Definition in file digestset.h.

Typedef Documentation

◆ digestset_t

typedef struct bloomfilt_t digestset_t

An digestset_t represents a set of 20-byte digest values. The implementation is probabilistic: false negatives cannot occur but false positives are possible.

Definition at line 21 of file digestset.h.

Function Documentation

◆ digestset_add()

void digestset_add ( digestset_t set,
const char *  digest 

Add digest to set.

All future queries for digest in set will return true. Removing items is not possible.

Definition at line 44 of file digestset.c.

References bloomfilt_add().

◆ digestset_new()

digestset_t* digestset_new ( int  max_guess)

Allocate and return an digestset, suitable for holding up to max_guess distinct values.

Definition at line 30 of file digestset.c.

◆ digestset_probably_contains()

int digestset_probably_contains ( const digestset_t set,
const char *  digest 

Return true if digest is a member of set. (And probably, return false if digest is not a member of set.)

Definition at line 54 of file digestset.c.

References bloomfilt_probably_contains().