26 #ifndef BLOOM_FILTER_H
27 #define BLOOM_FILTER_H
73 return (key % bf->
size);
static uint64_t MALP_Trace_crc64(char *source, uint64_t size)
Computes the hash of a given data.
struct Bit_Array array
The bit Array containing the filter data.
uint64_t size
The number of uint8_t array contains.
MALP_Spinlock lock
The lock for concurrent access on the bit array.
static void Bloom_Filter_push(struct Bloom_Filter *bf, void *payload)
Adds an element to the filter.
static uint64_t Bloom_Filter_get_cell(struct Bloom_Filter *bf, void *payload)
Gets the given element's index within internal bit array.
int MALP_Spinlock_unlock(MALP_Spinlock *mutex)
Unlocks the given MALP_Spinlock.
void Bloom_Filter_release(struct Bloom_Filter *bf)
Releases a Bloom_Filter.
This is the main structure defining the Bloom Filter.
size_t sizeof_payload
The size of elements that can be added to the filter.
int MALP_Spinlock_lock(MALP_Spinlock *mutex)
Locks the given MALP_Spinlock.
static int Bloom_Filter_test(struct Bloom_Filter *bf, void *payload)
Tests if the filter contains an element.
static void Bit_Array_set(struct Bit_Array *ba, uint64_t key, uint8_t value)
Sets a bit in a Bit_Array.
volatile unsigned int MALP_Spinlock
The type of spinlocks in MALP.
void Bloom_Filter_init(struct Bloom_Filter *bf, uint64_t size, size_t sizeof_payload)
Initializes a Bloom_Filter.
static uint8_t Bit_Array_get(struct Bit_Array *ba, uint64_t key)
Gets a bit in a Bit_Array.
uint64_t size
The size of the filter data.
void Bloom_Filter_replicate(struct Bloom_Filter *dest, struct Bloom_Filter *src)
Copies a Bloom_Filter within an other.