GNUnet  0.10.x
Data Structures | Macros | Functions
ibf.h File Reference

invertible bloom filter More...

#include "platform.h"
#include "gnunet_util_lib.h"
Include dependency graph for ibf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  IBF_Key
 Keys that can be inserted into and removed from an IBF. More...
 
struct  IBF_KeyHash
 Hash of an IBF key. More...
 
struct  IBF_Count
 Type of the count field of IBF buckets. More...
 
struct  InvertibleBloomFilter
 Invertible bloom filter (IBF). More...
 

Macros

#define IBF_BUCKET_SIZE
 Size of one ibf bucket in bytes. More...
 

Functions

void ibf_write_slice (const struct InvertibleBloomFilter *ibf, uint32_t start, uint32_t count, void *buf)
 Write buckets from an ibf to a buffer. More...
 
void ibf_read_slice (const void *buf, uint32_t start, uint32_t count, struct InvertibleBloomFilter *ibf)
 Read buckets from a buffer into an ibf. More...
 
struct IBF_Key ibf_key_from_hashcode (const struct GNUNET_HashCode *hash)
 Create a key from a hashcode. More...
 
void ibf_hashcode_from_key (struct IBF_Key key, struct GNUNET_HashCode *dst)
 Create a hashcode from a key, by replicating the key until the hascode is filled. More...
 
struct InvertibleBloomFilteribf_create (uint32_t size, uint8_t hash_num)
 Create an invertible bloom filter. More...
 
void ibf_insert (struct InvertibleBloomFilter *ibf, struct IBF_Key key)
 Insert a key into an IBF. More...
 
void ibf_remove (struct InvertibleBloomFilter *ibf, struct IBF_Key key)
 Remove a key from an IBF. More...
 
void ibf_subtract (struct InvertibleBloomFilter *ibf1, const struct InvertibleBloomFilter *ibf2)
 Subtract ibf2 from ibf1, storing the result in ibf1. More...
 
int ibf_decode (struct InvertibleBloomFilter *ibf, int *ret_side, struct IBF_Key *ret_id)
 Decode and remove an element from the IBF, if possible. More...
 
struct InvertibleBloomFilteribf_dup (const struct InvertibleBloomFilter *ibf)
 Create a copy of an IBF, the copy has to be destroyed properly. More...
 
void ibf_destroy (struct InvertibleBloomFilter *ibf)
 Destroy all resources associated with the invertible bloom filter. More...
 

Detailed Description

invertible bloom filter

Author
Florian Dold

Definition in file ibf.h.

Macro Definition Documentation

◆ IBF_BUCKET_SIZE

#define IBF_BUCKET_SIZE
Value:
(sizeof (struct IBF_Count) + sizeof (struct IBF_Key) + \
sizeof (struct IBF_KeyHash))
Type of the count field of IBF buckets.
Definition: ibf.h:63
Hash of an IBF key.
Definition: ibf.h:54
Keys that can be inserted into and removed from an IBF.
Definition: ibf.h:45

Size of one ibf bucket in bytes.

Definition at line 72 of file ibf.h.

Referenced by check_union_p2p_ibf(), check_union_p2p_strata_estimator(), handle_union_p2p_ibf(), send_ibf(), strata_estimator_read(), strata_estimator_write(), and union_accept().

Function Documentation

◆ ibf_write_slice()

void ibf_write_slice ( const struct InvertibleBloomFilter ibf,
uint32_t  start,
uint32_t  count,
void *  buf 
)

Write buckets from an ibf to a buffer.

Exactly (IBF_BUCKET_SIZE*ibf->size) bytes are written to buf.

Parameters
ibfthe ibf to write
startwith which bucket to start
counthow many buckets to write
bufbuffer to write the data to

Definition at line 284 of file ibf.c.

References InvertibleBloomFilter::count, GNUNET_assert, GNUNET_memcpy, InvertibleBloomFilter::key_hash_sum, InvertibleBloomFilter::key_sum, and size.

Referenced by send_ibf(), and strata_estimator_write().

285 {
286  struct IBF_Key *key_dst;
287  struct IBF_KeyHash *key_hash_dst;
288  struct IBF_Count *count_dst;
289 
290  GNUNET_assert (start + count <= ibf->size);
291 
292  /* copy keys */
293  key_dst = (struct IBF_Key *) buf;
294  GNUNET_memcpy (key_dst, ibf->key_sum + start, count * sizeof *key_dst);
295  key_dst += count;
296  /* copy key hashes */
297  key_hash_dst = (struct IBF_KeyHash *) key_dst;
298  GNUNET_memcpy (key_hash_dst, ibf->key_hash_sum + start, count * sizeof *key_hash_dst);
299  key_hash_dst += count;
300  /* copy counts */
301  count_dst = (struct IBF_Count *) key_hash_dst;
302  GNUNET_memcpy (count_dst, ibf->count + start, count * sizeof *count_dst);
303 }
struct IBF_Key * key_sum
Xor sums of the elements&#39; keys, used to identify the elements.
Definition: ibf.h:99
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
static char buf[2048]
Type of the count field of IBF buckets.
Definition: ibf.h:63
struct IBF_KeyHash * key_hash_sum
Xor sums of the hashes of the keys of inserted elements.
Definition: ibf.h:105
static unsigned int size
Size of the "table".
Definition: peer.c:67
Hash of an IBF key.
Definition: ibf.h:54
Keys that can be inserted into and removed from an IBF.
Definition: ibf.h:45
struct IBF_Count * count
How many times has a bucket been hit? Can be negative, as a result of IBF subtraction.
Definition: ibf.h:112
Here is the caller graph for this function:

◆ ibf_read_slice()

void ibf_read_slice ( const void *  buf,
uint32_t  start,
uint32_t  count,
struct InvertibleBloomFilter ibf 
)

Read buckets from a buffer into an ibf.

Parameters
bufpointer to the buffer to read from
startwhich bucket to start at
counthow many buckets to read
ibfthe ibf to write to
bufpointer to the buffer to read from
startwhich bucket to start at
counthow many buckets to read
ibfthe ibf to read from

Definition at line 315 of file ibf.c.

References InvertibleBloomFilter::count, GNUNET_assert, GNUNET_memcpy, InvertibleBloomFilter::key_hash_sum, InvertibleBloomFilter::key_sum, and size.

Referenced by handle_union_p2p_ibf(), and strata_estimator_read().

316 {
317  struct IBF_Key *key_src;
318  struct IBF_KeyHash *key_hash_src;
319  struct IBF_Count *count_src;
320 
321  GNUNET_assert (count > 0);
322  GNUNET_assert (start + count <= ibf->size);
323 
324  /* copy keys */
325  key_src = (struct IBF_Key *) buf;
326  GNUNET_memcpy (ibf->key_sum + start, key_src, count * sizeof *key_src);
327  key_src += count;
328  /* copy key hashes */
329  key_hash_src = (struct IBF_KeyHash *) key_src;
330  GNUNET_memcpy (ibf->key_hash_sum + start, key_hash_src, count * sizeof *key_hash_src);
331  key_hash_src += count;
332  /* copy counts */
333  count_src = (struct IBF_Count *) key_hash_src;
334  GNUNET_memcpy (ibf->count + start, count_src, count * sizeof *count_src);
335 }
struct IBF_Key * key_sum
Xor sums of the elements&#39; keys, used to identify the elements.
Definition: ibf.h:99
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
static char buf[2048]
Type of the count field of IBF buckets.
Definition: ibf.h:63
struct IBF_KeyHash * key_hash_sum
Xor sums of the hashes of the keys of inserted elements.
Definition: ibf.h:105
static unsigned int size
Size of the "table".
Definition: peer.c:67
Hash of an IBF key.
Definition: ibf.h:54
Keys that can be inserted into and removed from an IBF.
Definition: ibf.h:45
struct IBF_Count * count
How many times has a bucket been hit? Can be negative, as a result of IBF subtraction.
Definition: ibf.h:112
Here is the caller graph for this function:

◆ ibf_key_from_hashcode()

struct IBF_Key ibf_key_from_hashcode ( const struct GNUNET_HashCode hash)

Create a key from a hashcode.

Parameters
hashthe hashcode
Returns
a key

Definition at line 42 of file ibf.c.

Referenced by insert_iterator(), and register_hashcode().

43 {
44  return *(struct IBF_Key *) hash;
45 }
Keys that can be inserted into and removed from an IBF.
Definition: ibf.h:45
Here is the caller graph for this function:

◆ ibf_hashcode_from_key()

void ibf_hashcode_from_key ( struct IBF_Key  key,
struct GNUNET_HashCode dst 
)

Create a hashcode from a key, by replicating the key until the hascode is filled.

Parameters
keythe key
dsthashcode to store the result in

Definition at line 55 of file ibf.c.

References p.

Referenced by iter_hashcodes(), and register_hashcode().

57 {
58  struct IBF_Key *p;
59  unsigned int i;
60  const unsigned int keys_per_hashcode = sizeof (struct GNUNET_HashCode) / sizeof (struct IBF_Key);
61 
62  p = (struct IBF_Key *) dst;
63  for (i = 0; i < keys_per_hashcode; i++)
64  *p++ = key;
65 }
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
A 512-bit hashcode.
Keys that can be inserted into and removed from an IBF.
Definition: ibf.h:45
Here is the caller graph for this function:

◆ ibf_create()

struct InvertibleBloomFilter* ibf_create ( uint32_t  size,
uint8_t  hash_num 
)

Create an invertible bloom filter.

Parameters
sizenumber of IBF buckets
hash_numnumber of buckets one element is hashed in, usually 3 or 4
Returns
the newly created invertible bloom filter, NULL on error
Parameters
sizenumber of IBF buckets
hash_numnumber of buckets one element is hashed in
Returns
the newly created invertible bloom filter, NULL on error

Definition at line 76 of file ibf.c.

References InvertibleBloomFilter::count, GNUNET_assert, GNUNET_free, GNUNET_malloc_large, GNUNET_new, hash_num, InvertibleBloomFilter::hash_num, InvertibleBloomFilter::key_hash_sum, InvertibleBloomFilter::key_sum, size, and InvertibleBloomFilter::size.

Referenced by handle_union_p2p_ibf(), prepare_ibf(), run(), and strata_estimator_create().

77 {
78  struct InvertibleBloomFilter *ibf;
79 
80  GNUNET_assert (0 != size);
81 
82  ibf = GNUNET_new (struct InvertibleBloomFilter);
83  ibf->count = GNUNET_malloc_large (size * sizeof (uint8_t));
84  if (NULL == ibf->count)
85  {
86  GNUNET_free (ibf);
87  return NULL;
88  }
89  ibf->key_sum = GNUNET_malloc_large (size * sizeof (struct IBF_Key));
90  if (NULL == ibf->key_sum)
91  {
92  GNUNET_free (ibf->count);
93  GNUNET_free (ibf);
94  return NULL;
95  }
96  ibf->key_hash_sum = GNUNET_malloc_large (size * sizeof (struct IBF_KeyHash));
97  if (NULL == ibf->key_hash_sum)
98  {
99  GNUNET_free (ibf->key_sum);
100  GNUNET_free (ibf->count);
101  GNUNET_free (ibf);
102  return NULL;
103  }
104  ibf->size = size;
105  ibf->hash_num = hash_num;
106 
107  return ibf;
108 }
struct IBF_Key * key_sum
Xor sums of the elements&#39; keys, used to identify the elements.
Definition: ibf.h:99
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Invertible bloom filter (IBF).
Definition: ibf.h:82
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc_large(size)
Wrapper around malloc.
uint32_t size
How many cells does this IBF have?
Definition: ibf.h:87
uint8_t hash_num
In how many cells do we hash one element? Usually 4 or 3.
Definition: ibf.h:93
struct IBF_KeyHash * key_hash_sum
Xor sums of the hashes of the keys of inserted elements.
Definition: ibf.h:105
static unsigned int size
Size of the "table".
Definition: peer.c:67
static unsigned int hash_num
Hash of an IBF key.
Definition: ibf.h:54
Keys that can be inserted into and removed from an IBF.
Definition: ibf.h:45
struct IBF_Count * count
How many times has a bucket been hit? Can be negative, as a result of IBF subtraction.
Definition: ibf.h:112
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ ibf_insert()

void ibf_insert ( struct InvertibleBloomFilter ibf,
struct IBF_Key  key 
)

Insert a key into an IBF.

Parameters
ibfthe IBF
keythe element's hash code

Definition at line 164 of file ibf.c.

References GNUNET_assert, InvertibleBloomFilter::hash_num, ibf_get_indices(), ibf_insert_into(), and InvertibleBloomFilter::size.

Referenced by insert_iterator(), prepare_ibf_iterator(), and strata_estimator_insert().

165 {
166  int buckets[ibf->hash_num];
167  GNUNET_assert (ibf->hash_num <= ibf->size);
168  ibf_get_indices (ibf, key, buckets);
169  ibf_insert_into (ibf, key, buckets, 1);
170 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void ibf_insert_into(struct InvertibleBloomFilter *ibf, struct IBF_Key key, const int *buckets, int side)
Definition: ibf.c:140
uint32_t size
How many cells does this IBF have?
Definition: ibf.h:87
uint8_t hash_num
In how many cells do we hash one element? Usually 4 or 3.
Definition: ibf.h:93
static void ibf_get_indices(const struct InvertibleBloomFilter *ibf, struct IBF_Key key, int *dst)
Store unique bucket indices for the specified key in dst.
Definition: ibf.c:115
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ibf_remove()

void ibf_remove ( struct InvertibleBloomFilter ibf,
struct IBF_Key  key 
)

Remove a key from an IBF.

Parameters
ibfthe IBF
keythe element's hash code

Definition at line 180 of file ibf.c.

References GNUNET_assert, InvertibleBloomFilter::hash_num, ibf_get_indices(), ibf_insert_into(), and InvertibleBloomFilter::size.

Referenced by strata_estimator_remove().

181 {
182  int buckets[ibf->hash_num];
183  GNUNET_assert (ibf->hash_num <= ibf->size);
184  ibf_get_indices (ibf, key, buckets);
185  ibf_insert_into (ibf, key, buckets, -1);
186 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void ibf_insert_into(struct InvertibleBloomFilter *ibf, struct IBF_Key key, const int *buckets, int side)
Definition: ibf.c:140
uint32_t size
How many cells does this IBF have?
Definition: ibf.h:87
uint8_t hash_num
In how many cells do we hash one element? Usually 4 or 3.
Definition: ibf.h:93
static void ibf_get_indices(const struct InvertibleBloomFilter *ibf, struct IBF_Key key, int *dst)
Store unique bucket indices for the specified key in dst.
Definition: ibf.c:115
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ibf_subtract()

void ibf_subtract ( struct InvertibleBloomFilter ibf1,
const struct InvertibleBloomFilter ibf2 
)

Subtract ibf2 from ibf1, storing the result in ibf1.

The two IBF's must have the same parameters size and hash_num.

Parameters
ibf1IBF that is subtracted from
ibf2IBF that will be subtracted from ibf1

Definition at line 346 of file ibf.c.

References InvertibleBloomFilter::count, IBF_Count::count_val, GNUNET_assert, InvertibleBloomFilter::hash_num, InvertibleBloomFilter::key_hash_sum, IBF_KeyHash::key_hash_val, InvertibleBloomFilter::key_sum, IBF_Key::key_val, and InvertibleBloomFilter::size.

Referenced by decode_and_send(), run(), and strata_estimator_difference().

347 {
348  int i;
349 
350  GNUNET_assert (ibf1->size == ibf2->size);
351  GNUNET_assert (ibf1->hash_num == ibf2->hash_num);
352 
353  for (i = 0; i < ibf1->size; i++)
354  {
355  ibf1->count[i].count_val -= ibf2->count[i].count_val;
356  ibf1->key_hash_sum[i].key_hash_val ^= ibf2->key_hash_sum[i].key_hash_val;
357  ibf1->key_sum[i].key_val ^= ibf2->key_sum[i].key_val;
358  }
359 }
struct IBF_Key * key_sum
Xor sums of the elements&#39; keys, used to identify the elements.
Definition: ibf.h:99
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
uint64_t key_val
Definition: ibf.h:47
uint32_t size
How many cells does this IBF have?
Definition: ibf.h:87
uint32_t key_hash_val
Definition: ibf.h:56
uint8_t hash_num
In how many cells do we hash one element? Usually 4 or 3.
Definition: ibf.h:93
struct IBF_KeyHash * key_hash_sum
Xor sums of the hashes of the keys of inserted elements.
Definition: ibf.h:105
int8_t count_val
Definition: ibf.h:65
struct IBF_Count * count
How many times has a bucket been hit? Can be negative, as a result of IBF subtraction.
Definition: ibf.h:112
Here is the caller graph for this function:

◆ ibf_decode()

int ibf_decode ( struct InvertibleBloomFilter ibf,
int *  ret_side,
struct IBF_Key ret_id 
)

Decode and remove an element from the IBF, if possible.

Parameters
ibfthe invertible bloom filter to decode
ret_sidesign of the cell's count where the decoded element came from. A negative sign indicates that the element was recovered resides in an IBF that was previously subtracted from.
ret_idreceives the hash code of the decoded element, if successful
Returns
GNUNET_YES if decoding an element was successful, GNUNET_NO if the IBF is empty, GNUNET_SYSERR if the decoding has failed
Parameters
ibfthe invertible bloom filter to decode
ret_sidesign of the cell's count where the decoded element came from. A negative sign indicates that the element was recovered resides in an IBF that was previously subtracted from.
ret_idreceives the hash code of the decoded element, if successful
Returns
GNUNET_YES if decoding an element was successful, GNUNET_NO if the IBF is empty, GNUNET_SYSERR if the decoding has failed

Definition at line 222 of file ibf.c.

References InvertibleBloomFilter::count, IBF_Count::count_val, GNUNET_assert, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, InvertibleBloomFilter::hash_num, ibf_get_indices(), ibf_insert_into(), ibf_is_empty(), IBF_KEY_HASH_VAL, InvertibleBloomFilter::key_hash_sum, IBF_KeyHash::key_hash_val, InvertibleBloomFilter::key_sum, and InvertibleBloomFilter::size.

Referenced by decode_and_send(), run(), and strata_estimator_difference().

224 {
225  struct IBF_KeyHash hash;
226  int i;
227  int buckets[ibf->hash_num];
228 
229  GNUNET_assert (NULL != ibf);
230 
231  for (i = 0; i < ibf->size; i++)
232  {
233  int j;
234  int hit;
235 
236  /* we can only decode from pure buckets */
237  if ((1 != ibf->count[i].count_val) && (-1 != ibf->count[i].count_val))
238  continue;
239 
240  hash.key_hash_val = IBF_KEY_HASH_VAL (ibf->key_sum[i]);
241 
242  /* test if the hash matches the key */
243  if (hash.key_hash_val != ibf->key_hash_sum[i].key_hash_val)
244  continue;
245 
246  /* test if key in bucket hits its own location,
247  * if not, the key hash was subject to collision */
248  hit = GNUNET_NO;
249  ibf_get_indices (ibf, ibf->key_sum[i], buckets);
250  for (j = 0; j < ibf->hash_num; j++)
251  if (buckets[j] == i)
252  hit = GNUNET_YES;
253 
254  if (GNUNET_NO == hit)
255  continue;
256 
257  if (NULL != ret_side)
258  *ret_side = ibf->count[i].count_val;
259  if (NULL != ret_id)
260  *ret_id = ibf->key_sum[i];
261 
262  /* insert on the opposite side, effectively removing the element */
263  ibf_insert_into (ibf, ibf->key_sum[i], buckets, -ibf->count[i].count_val);
264 
265  return GNUNET_YES;
266  }
267 
268  if (GNUNET_YES == ibf_is_empty (ibf))
269  return GNUNET_NO;
270  return GNUNET_SYSERR;
271 }
struct IBF_Key * key_sum
Xor sums of the elements&#39; keys, used to identify the elements.
Definition: ibf.h:99
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void ibf_insert_into(struct InvertibleBloomFilter *ibf, struct IBF_Key key, const int *buckets, int side)
Definition: ibf.c:140
#define GNUNET_NO
Definition: gnunet_common.h:81
uint32_t size
How many cells does this IBF have?
Definition: ibf.h:87
uint32_t key_hash_val
Definition: ibf.h:56
uint8_t hash_num
In how many cells do we hash one element? Usually 4 or 3.
Definition: ibf.h:93
#define IBF_KEY_HASH_VAL(k)
Compute the key&#39;s hash from the key.
Definition: ibf.c:33
struct IBF_KeyHash * key_hash_sum
Xor sums of the hashes of the keys of inserted elements.
Definition: ibf.h:105
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
Hash of an IBF key.
Definition: ibf.h:54
static void ibf_get_indices(const struct InvertibleBloomFilter *ibf, struct IBF_Key key, int *dst)
Store unique bucket indices for the specified key in dst.
Definition: ibf.c:115
int8_t count_val
Definition: ibf.h:65
#define GNUNET_YES
Definition: gnunet_common.h:80
static int ibf_is_empty(struct InvertibleBloomFilter *ibf)
Test is the IBF is empty, i.e.
Definition: ibf.c:193
struct IBF_Count * count
How many times has a bucket been hit? Can be negative, as a result of IBF subtraction.
Definition: ibf.h:112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ibf_dup()

struct InvertibleBloomFilter* ibf_dup ( const struct InvertibleBloomFilter ibf)

Create a copy of an IBF, the copy has to be destroyed properly.

Parameters
ibfthe IBF to copy

Definition at line 368 of file ibf.c.

References InvertibleBloomFilter::count, GNUNET_malloc, GNUNET_memdup, InvertibleBloomFilter::hash_num, InvertibleBloomFilter::key_hash_sum, InvertibleBloomFilter::key_sum, and InvertibleBloomFilter::size.

Referenced by decode_and_send(), strata_estimator_difference(), and strata_estimator_dup().

369 {
370  struct InvertibleBloomFilter *copy;
371  copy = GNUNET_malloc (sizeof *copy);
372  copy->hash_num = ibf->hash_num;
373  copy->size = ibf->size;
374  copy->key_hash_sum = GNUNET_memdup (ibf->key_hash_sum, ibf->size * sizeof (struct IBF_KeyHash));
375  copy->key_sum = GNUNET_memdup (ibf->key_sum, ibf->size * sizeof (struct IBF_Key));
376  copy->count = GNUNET_memdup (ibf->count, ibf->size * sizeof (struct IBF_Count));
377  return copy;
378 }
struct IBF_Key * key_sum
Xor sums of the elements&#39; keys, used to identify the elements.
Definition: ibf.h:99
Invertible bloom filter (IBF).
Definition: ibf.h:82
#define GNUNET_memdup(buf, size)
Allocate and initialize a block of memory.
uint32_t size
How many cells does this IBF have?
Definition: ibf.h:87
uint8_t hash_num
In how many cells do we hash one element? Usually 4 or 3.
Definition: ibf.h:93
Type of the count field of IBF buckets.
Definition: ibf.h:63
struct IBF_KeyHash * key_hash_sum
Xor sums of the hashes of the keys of inserted elements.
Definition: ibf.h:105
Hash of an IBF key.
Definition: ibf.h:54
Keys that can be inserted into and removed from an IBF.
Definition: ibf.h:45
struct IBF_Count * count
How many times has a bucket been hit? Can be negative, as a result of IBF subtraction.
Definition: ibf.h:112
#define GNUNET_malloc(size)
Wrapper around malloc.
Here is the caller graph for this function:

◆ ibf_destroy()

void ibf_destroy ( struct InvertibleBloomFilter ibf)

Destroy all resources associated with the invertible bloom filter.

No more ibf_*-functions may be called on ibf after calling destroy.

Parameters
ibfthe intertible bloom filter to destroy

Definition at line 388 of file ibf.c.

References InvertibleBloomFilter::count, GNUNET_free, InvertibleBloomFilter::key_hash_sum, and InvertibleBloomFilter::key_sum.

Referenced by decode_and_send(), prepare_ibf(), strata_estimator_create(), strata_estimator_destroy(), strata_estimator_difference(), and union_op_cancel().

389 {
390  GNUNET_free (ibf->key_sum);
391  GNUNET_free (ibf->key_hash_sum);
392  GNUNET_free (ibf->count);
393  GNUNET_free (ibf);
394 }
struct IBF_Key * key_sum
Xor sums of the elements&#39; keys, used to identify the elements.
Definition: ibf.h:99
struct IBF_KeyHash * key_hash_sum
Xor sums of the hashes of the keys of inserted elements.
Definition: ibf.h:105
struct IBF_Count * count
How many times has a bucket been hit? Can be negative, as a result of IBF subtraction.
Definition: ibf.h:112
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function: