GNUnet  0.11.x
Data Structures | Macros | Typedefs | Functions
container_bloomfilter.c File Reference

data structure used to reduce disk accesses. More...

#include "platform.h"
#include "gnunet_util_lib.h"
Include dependency graph for container_bloomfilter.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_CONTAINER_BloomFilter
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "util-container-bloomfilter", __VA_ARGS__)
 
#define LOG_STRERROR(kind, syscall)   GNUNET_log_from_strerror (kind, "util-container-bloomfilter", syscall)
 
#define LOG_STRERROR_FILE(kind, syscall, filename)
 
#define BUFFSIZE   65536
 

Typedefs

typedef int(* BitIterator) (void *cls, const struct GNUNET_CONTAINER_BloomFilter *bf, unsigned int bit)
 Iterator (callback) method to be called by the bloomfilter iterator on each bit that is to be set or tested for the key. More...
 

Functions

size_t GNUNET_CONTAINER_bloomfilter_get_element_addresses (const struct GNUNET_CONTAINER_BloomFilter *bf)
 Get the number of the addresses set per element in the bloom filter. More...
 
size_t GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter *bf)
 Get size of the bloom filter. More...
 
struct GNUNET_CONTAINER_BloomFilterGNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter *bf)
 Copy an existing memory. More...
 
static void setBit (char *bitArray, unsigned int bitIdx)
 Sets a bit active in the bitArray. More...
 
static void clearBit (char *bitArray, unsigned int bitIdx)
 Clears a bit from bitArray. More...
 
static int testBit (char *bitArray, unsigned int bitIdx)
 Checks if a bit is active in the bitArray. More...
 
static void incrementBit (char *bitArray, unsigned int bitIdx, const struct GNUNET_DISK_FileHandle *fh)
 Sets a bit active in the bitArray and increments bit-specific usage counter on disk (but only if the counter was below 4 bit max (==15)). More...
 
static void decrementBit (char *bitArray, unsigned int bitIdx, const struct GNUNET_DISK_FileHandle *fh)
 Clears a bit from bitArray if the respective usage counter on the disk hits/is zero. More...
 
static int make_empty_file (const struct GNUNET_DISK_FileHandle *fh, size_t size)
 Creates a file filled with zeroes. More...
 
static void iterateBits (const struct GNUNET_CONTAINER_BloomFilter *bf, BitIterator callback, void *arg, const struct GNUNET_HashCode *key)
 Call an iterator for each bit that the bloomfilter must test or set for this element. More...
 
static int incrementBitCallback (void *cls, const struct GNUNET_CONTAINER_BloomFilter *bf, unsigned int bit)
 Callback: increment bit. More...
 
static int decrementBitCallback (void *cls, const struct GNUNET_CONTAINER_BloomFilter *bf, unsigned int bit)
 Callback: decrement bit. More...
 
static int testBitCallback (void *cls, const struct GNUNET_CONTAINER_BloomFilter *bf, unsigned int bit)
 Callback: test if all bits are set. More...
 
struct GNUNET_CONTAINER_BloomFilterGNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size, unsigned int k)
 Load a bloom-filter from a file. More...
 
struct GNUNET_CONTAINER_BloomFilterGNUNET_CONTAINER_bloomfilter_init (const char *data, size_t size, unsigned int k)
 Create a bloom filter from raw bits. More...
 
int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct GNUNET_CONTAINER_BloomFilter *bf, char *data, size_t size)
 Copy the raw data of this bloomfilter into the given data array. More...
 
void GNUNET_CONTAINER_bloomfilter_free (struct GNUNET_CONTAINER_BloomFilter *bf)
 Free the space associated with a filter in memory, flush to drive if needed (do not free the space on the drive) More...
 
void GNUNET_CONTAINER_bloomfilter_clear (struct GNUNET_CONTAINER_BloomFilter *bf)
 Reset a bloom filter to empty. More...
 
int GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
 Test if an element is in the filter. More...
 
void GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
 Add an element to the filter. More...
 
int GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf, const char *data, size_t size)
 Or the entries of the given raw data array with the data of the given bloom filter. More...
 
int GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_CONTAINER_BloomFilter *to_or)
 Or the entries of the given raw data array with the data of the given bloom filter. More...
 
void GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
 Remove an element from the filter. More...
 
void GNUNET_CONTAINER_bloomfilter_resize (struct GNUNET_CONTAINER_BloomFilter *bf, GNUNET_CONTAINER_HashCodeIterator iterator, void *iterator_cls, size_t size, unsigned int k)
 Resize a bloom filter. More...
 

Detailed Description

data structure used to reduce disk accesses.

The idea basically: Create a signature for each element in the database. Add those signatures to a bit array. When doing a lookup, check if the bit array matches the signature of the requested element. If yes, address the disk, otherwise return 'not found'.

A property of the bloom filter is that sometimes we will have a match even if the element is not on the disk (then we do an unnecessary disk access), but what's most important is that we never get a single "false negative".

To be able to delete entries from the bloom filter, we maintain a 4 bit counter in the file on the drive (we still use only one bit in memory).

Author
Igor Wronsky
Christian Grothoff

Definition in file container_bloomfilter.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "util-container-bloomfilter", __VA_ARGS__)

Definition at line 45 of file container_bloomfilter.c.

◆ LOG_STRERROR

#define LOG_STRERROR (   kind,
  syscall 
)    GNUNET_log_from_strerror (kind, "util-container-bloomfilter", syscall)

Definition at line 48 of file container_bloomfilter.c.

◆ LOG_STRERROR_FILE

#define LOG_STRERROR_FILE (   kind,
  syscall,
  filename 
)
Value:
"util-container-bloomfilter", \
syscall, \
#define GNUNET_log_from_strerror_file(level, component, cmd, filename)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
static char * filename

Definition at line 51 of file container_bloomfilter.c.

Referenced by GNUNET_CONTAINER_bloomfilter_load().

◆ BUFFSIZE

#define BUFFSIZE   65536

Definition at line 310 of file container_bloomfilter.c.

Referenced by GNUNET_CONTAINER_bloomfilter_load(), and make_empty_file().

Typedef Documentation

◆ BitIterator

typedef int(* BitIterator) (void *cls, const struct GNUNET_CONTAINER_BloomFilter *bf, unsigned int bit)

Iterator (callback) method to be called by the bloomfilter iterator on each bit that is to be set or tested for the key.

Parameters
clsclosure
bfthe filter to manipulate
bitthe current bit
Returns
GNUNET_YES to continue, GNUNET_NO to stop early

Definition at line 363 of file container_bloomfilter.c.

Function Documentation

◆ GNUNET_CONTAINER_bloomfilter_get_element_addresses()

size_t GNUNET_CONTAINER_bloomfilter_get_element_addresses ( const struct GNUNET_CONTAINER_BloomFilter bf)

Get the number of the addresses set per element in the bloom filter.

Parameters
bfthe filter
Returns
addresses set per element in the bf

Definition at line 93 of file container_bloomfilter.c.

References GNUNET_CONTAINER_BloomFilter::addressesPerElement.

95 {
96  if (bf == NULL)
97  return 0;
98  return bf->addressesPerElement;
99 }
unsigned int addressesPerElement
How many bits we set for each stored element.

◆ setBit()

static void setBit ( char *  bitArray,
unsigned int  bitIdx 
)
static

Sets a bit active in the bitArray.

Increment bit-specific usage counter on disk only if below 4bit max (==15).

Parameters
bitArraymemory area to set the bit in
bitIdxwhich bit to set

Definition at line 142 of file container_bloomfilter.c.

Referenced by GNUNET_CONTAINER_bloomfilter_load(), and incrementBit().

143 {
144  size_t arraySlot;
145  unsigned int targetBit;
146 
147  arraySlot = bitIdx / 8;
148  targetBit = (1L << (bitIdx % 8));
149  bitArray[arraySlot] |= targetBit;
150 }
Here is the caller graph for this function:

◆ clearBit()

static void clearBit ( char *  bitArray,
unsigned int  bitIdx 
)
static

Clears a bit from bitArray.

Bit is cleared from the array only if the respective usage counter on the disk hits/is zero.

Parameters
bitArraymemory area to set the bit in
bitIdxwhich bit to unset

Definition at line 161 of file container_bloomfilter.c.

Referenced by decrementBit().

162 {
163  size_t slot;
164  unsigned int targetBit;
165 
166  slot = bitIdx / 8;
167  targetBit = (1L << (bitIdx % 8));
168  bitArray[slot] = bitArray[slot] & (~targetBit);
169 }
Here is the caller graph for this function:

◆ testBit()

static int testBit ( char *  bitArray,
unsigned int  bitIdx 
)
static

Checks if a bit is active in the bitArray.

Parameters
bitArraymemory area to set the bit in
bitIdxwhich bit to test
Returns
GNUNET_YES if the bit is set, GNUNET_NO if not.

Definition at line 180 of file container_bloomfilter.c.

References GNUNET_NO, and GNUNET_YES.

Referenced by testBitCallback().

181 {
182  size_t slot;
183  unsigned int targetBit;
184 
185  slot = bitIdx / 8;
186  targetBit = (1L << (bitIdx % 8));
187  if (bitArray[slot] & targetBit)
188  return GNUNET_YES;
189  else
190  return GNUNET_NO;
191 }
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the caller graph for this function:

◆ incrementBit()

static void incrementBit ( char *  bitArray,
unsigned int  bitIdx,
const struct GNUNET_DISK_FileHandle fh 
)
static

Sets a bit active in the bitArray and increments bit-specific usage counter on disk (but only if the counter was below 4 bit max (==15)).

Parameters
bitArraymemory area to set the bit in
bitIdxwhich bit to test
fhA file to keep the 4 bit address usage counters in

Definition at line 204 of file container_bloomfilter.c.

References GNUNET_assert, GNUNET_DISK_file_read(), GNUNET_DISK_file_seek(), GNUNET_DISK_file_write(), GNUNET_DISK_handle_invalid(), GNUNET_DISK_SEEK_SET, setBit(), and value.

Referenced by incrementBitCallback().

207 {
208  off_t fileSlot;
209  unsigned char value;
210  unsigned int high;
211  unsigned int low;
212  unsigned int targetLoc;
213 
214  setBit (bitArray, bitIdx);
216  return;
217  /* Update the counter file on disk */
218  fileSlot = bitIdx / 2;
219  targetLoc = bitIdx % 2;
220 
221  GNUNET_assert (fileSlot ==
223  if (1 != GNUNET_DISK_file_read (fh, &value, 1))
224  value = 0;
225  low = value & 0xF;
226  high = (value & (~0xF)) >> 4;
227 
228  if (targetLoc == 0)
229  {
230  if (low < 0xF)
231  low++;
232  }
233  else
234  {
235  if (high < 0xF)
236  high++;
237  }
238  value = ((high << 4) | low);
239  GNUNET_assert (fileSlot ==
241  GNUNET_assert (1 == GNUNET_DISK_file_write (fh, &value, 1));
242 }
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
Definition: disk.c:732
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
off_t GNUNET_DISK_file_seek(const struct GNUNET_DISK_FileHandle *h, off_t offset, enum GNUNET_DISK_Seek whence)
Move the read/write pointer in a file.
Definition: disk.c:226
int GNUNET_DISK_handle_invalid(const struct GNUNET_DISK_FileHandle *h)
Checks whether a handle is invalid.
Definition: disk.c:192
static char * value
Value of the record to add/remove.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:820
static void setBit(char *bitArray, unsigned int bitIdx)
Sets a bit active in the bitArray.
Seek an absolute position (from the start of the file).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ decrementBit()

static void decrementBit ( char *  bitArray,
unsigned int  bitIdx,
const struct GNUNET_DISK_FileHandle fh 
)
static

Clears a bit from bitArray if the respective usage counter on the disk hits/is zero.

Parameters
bitArraymemory area to set the bit in
bitIdxwhich bit to test
fhA file to keep the 4bit address usage counters in

Definition at line 254 of file container_bloomfilter.c.

References clearBit(), GNUNET_assert, GNUNET_DISK_file_read(), GNUNET_DISK_file_seek(), GNUNET_DISK_file_write(), GNUNET_DISK_handle_invalid(), GNUNET_DISK_SEEK_SET, GNUNET_ERROR_TYPE_ERROR, GNUNET_log_strerror, GNUNET_SYSERR, and value.

Referenced by decrementBitCallback().

257 {
258  off_t fileslot;
259  unsigned char value;
260  unsigned int high;
261  unsigned int low;
262  unsigned int targetLoc;
263 
265  return; /* cannot decrement! */
266  /* Each char slot in the counter file holds two 4 bit counters */
267  fileslot = bitIdx / 2;
268  targetLoc = bitIdx % 2;
269  if (GNUNET_SYSERR ==
271  {
273  return;
274  }
275  if (1 != GNUNET_DISK_file_read (fh, &value, 1))
276  value = 0;
277  low = value & 0xF;
278  high = (value & 0xF0) >> 4;
279 
280  /* decrement, but once we have reached the max, never go back! */
281  if (targetLoc == 0)
282  {
283  if ((low > 0) && (low < 0xF))
284  low--;
285  if (low == 0)
286  {
287  clearBit (bitArray, bitIdx);
288  }
289  }
290  else
291  {
292  if ((high > 0) && (high < 0xF))
293  high--;
294  if (high == 0)
295  {
296  clearBit (bitArray, bitIdx);
297  }
298  }
299  value = ((high << 4) | low);
300  if (GNUNET_SYSERR ==
302  {
304  return;
305  }
306  GNUNET_assert (1 == GNUNET_DISK_file_write (fh, &value, 1));
307 }
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
Definition: disk.c:732
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
off_t GNUNET_DISK_file_seek(const struct GNUNET_DISK_FileHandle *h, off_t offset, enum GNUNET_DISK_Seek whence)
Move the read/write pointer in a file.
Definition: disk.c:226
int GNUNET_DISK_handle_invalid(const struct GNUNET_DISK_FileHandle *h)
Checks whether a handle is invalid.
Definition: disk.c:192
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level &#39;level&#39; that indicates a failure of the command &#39;cmd&#39; with the mess...
static void clearBit(char *bitArray, unsigned int bitIdx)
Clears a bit from bitArray.
static char * value
Value of the record to add/remove.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:820
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
Seek an absolute position (from the start of the file).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_empty_file()

static int make_empty_file ( const struct GNUNET_DISK_FileHandle fh,
size_t  size 
)
static

Creates a file filled with zeroes.

Parameters
fhthe file handle
sizethe size of the file
Returns
GNUNET_OK if created ok, GNUNET_SYSERR otherwise

Definition at line 320 of file container_bloomfilter.c.

References BUFFSIZE, GNUNET_DISK_file_seek(), GNUNET_DISK_file_write(), GNUNET_DISK_handle_invalid(), GNUNET_DISK_SEEK_SET, GNUNET_OK, GNUNET_SYSERR, res, and size.

Referenced by GNUNET_CONTAINER_bloomfilter_clear(), GNUNET_CONTAINER_bloomfilter_load(), and GNUNET_CONTAINER_bloomfilter_resize().

321 {
322  char buffer[BUFFSIZE];
323  size_t bytesleft = size;
324  int res = 0;
325 
327  return GNUNET_SYSERR;
328  memset (buffer, 0, sizeof(buffer));
330  while (bytesleft > 0)
331  {
332  if (bytesleft > sizeof(buffer))
333  {
334  res = GNUNET_DISK_file_write (fh, buffer, sizeof(buffer));
335  if (res >= 0)
336  bytesleft -= res;
337  }
338  else
339  {
340  res = GNUNET_DISK_file_write (fh, buffer, bytesleft);
341  if (res >= 0)
342  bytesleft -= res;
343  }
344  if (GNUNET_SYSERR == res)
345  return GNUNET_SYSERR;
346  }
347  return GNUNET_OK;
348 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
off_t GNUNET_DISK_file_seek(const struct GNUNET_DISK_FileHandle *h, off_t offset, enum GNUNET_DISK_Seek whence)
Move the read/write pointer in a file.
Definition: disk.c:226
int GNUNET_DISK_handle_invalid(const struct GNUNET_DISK_FileHandle *h)
Checks whether a handle is invalid.
Definition: disk.c:192
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:820
static int res
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
static unsigned int size
Size of the "table".
Definition: peer.c:67
Seek an absolute position (from the start of the file).
#define BUFFSIZE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iterateBits()

static void iterateBits ( const struct GNUNET_CONTAINER_BloomFilter bf,
BitIterator  callback,
void *  arg,
const struct GNUNET_HashCode key 
)
static

Call an iterator for each bit that the bloomfilter must test or set for this element.

Parameters
bfthe filter
callbackthe method to call
argextra argument to callback
keythe key for which we iterate over the BF bits

Definition at line 378 of file container_bloomfilter.c.

References GNUNET_CONTAINER_BloomFilter::addressesPerElement, GNUNET_CONTAINER_BloomFilter::bitArraySize, GNUNET_assert, GNUNET_CRYPTO_hash(), GNUNET_YES, and key.

Referenced by GNUNET_CONTAINER_bloomfilter_add(), GNUNET_CONTAINER_bloomfilter_remove(), and GNUNET_CONTAINER_bloomfilter_test().

382 {
383  struct GNUNET_HashCode tmp[2];
384  int bitCount;
385  unsigned int round;
386  unsigned int slot = 0;
387 
388  bitCount = bf->addressesPerElement;
389  tmp[0] = *key;
390  round = 0;
391  GNUNET_assert (bf->bitArraySize > 0);
392  GNUNET_assert (bf->bitArraySize * 8LL > bf->bitArraySize);
393  while (bitCount > 0)
394  {
395  while (slot < (sizeof(struct GNUNET_HashCode) / sizeof(uint32_t)))
396  {
397  if (GNUNET_YES !=
398  callback (arg,
399  bf,
400  ntohl ((((uint32_t *) &tmp[round & 1])[slot]))
401  % ((bf->bitArraySize * 8LL))))
402  return;
403  slot++;
404  bitCount--;
405  if (bitCount == 0)
406  break;
407  }
408  if (bitCount > 0)
409  {
410  GNUNET_CRYPTO_hash (&tmp[round & 1],
411  sizeof(struct GNUNET_HashCode),
412  &tmp[(round + 1) & 1]);
413  round++;
414  slot = 0;
415  }
416  }
417 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
unsigned int addressesPerElement
How many bits we set for each stored element.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:48
size_t bitArraySize
Size of bitArray in bytes.
A 512-bit hashcode.
struct GNUNET_HashCode key
The key used in the DHT.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ incrementBitCallback()

static int incrementBitCallback ( void *  cls,
const struct GNUNET_CONTAINER_BloomFilter bf,
unsigned int  bit 
)
static

Callback: increment bit.

Parameters
clspointer to writeable form of bf
bfthe filter to manipulate
bitthe bit to increment
Returns
GNUNET_YES

Definition at line 429 of file container_bloomfilter.c.

References GNUNET_CONTAINER_BloomFilter::bitArray, GNUNET_CONTAINER_BloomFilter::fh, GNUNET_YES, and incrementBit().

Referenced by GNUNET_CONTAINER_bloomfilter_add().

432 {
433  struct GNUNET_CONTAINER_BloomFilter *b = cls;
434 
435  incrementBit (b->bitArray, bit, bf->fh);
436  return GNUNET_YES;
437 }
char * bitArray
The actual bloomfilter bit array.
struct GNUNET_DISK_FileHandle * fh
The bit counter file on disk.
static void incrementBit(char *bitArray, unsigned int bitIdx, const struct GNUNET_DISK_FileHandle *fh)
Sets a bit active in the bitArray and increments bit-specific usage counter on disk (but only if the ...
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ decrementBitCallback()

static int decrementBitCallback ( void *  cls,
const struct GNUNET_CONTAINER_BloomFilter bf,
unsigned int  bit 
)
static

Callback: decrement bit.

Parameters
clspointer to writeable form of bf
bfthe filter to manipulate
bitthe bit to decrement
Returns
GNUNET_YES

Definition at line 449 of file container_bloomfilter.c.

References GNUNET_CONTAINER_BloomFilter::bitArray, decrementBit(), GNUNET_CONTAINER_BloomFilter::fh, and GNUNET_YES.

Referenced by GNUNET_CONTAINER_bloomfilter_remove().

452 {
453  struct GNUNET_CONTAINER_BloomFilter *b = cls;
454 
455  decrementBit (b->bitArray, bit, bf->fh);
456  return GNUNET_YES;
457 }
static void decrementBit(char *bitArray, unsigned int bitIdx, const struct GNUNET_DISK_FileHandle *fh)
Clears a bit from bitArray if the respective usage counter on the disk hits/is zero.
char * bitArray
The actual bloomfilter bit array.
struct GNUNET_DISK_FileHandle * fh
The bit counter file on disk.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ testBitCallback()

static int testBitCallback ( void *  cls,
const struct GNUNET_CONTAINER_BloomFilter bf,
unsigned int  bit 
)
static

Callback: test if all bits are set.

Parameters
clspointer set to GNUNET_NO if bit is not set
bfthe filter
bitthe bit to test
Returns
YES if the bit is set, NO if not

Definition at line 469 of file container_bloomfilter.c.

References find_typedefs::arg, GNUNET_CONTAINER_BloomFilter::bitArray, GNUNET_NO, GNUNET_YES, and testBit().

Referenced by GNUNET_CONTAINER_bloomfilter_test().

472 {
473  int *arg = cls;
474 
475  if (GNUNET_NO == testBit (bf->bitArray, bit))
476  {
477  *arg = GNUNET_NO;
478  return GNUNET_NO;
479  }
480  return GNUNET_YES;
481 }
#define GNUNET_NO
Definition: gnunet_common.h:78
char * bitArray
The actual bloomfilter bit array.
static int testBit(char *bitArray, unsigned int bitIdx)
Checks if a bit is active in the bitArray.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function: