invertible bloom filter More...
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 InvertibleBloomFilter * | ibf_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 InvertibleBloomFilter * | ibf_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... | |
invertible bloom filter
Definition in file ibf.h.
#define IBF_BUCKET_SIZE |
Size of one ibf bucket in bytes.
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.
ibf | the ibf to write |
start | with which bucket to start |
count | how many buckets to write |
buf | buffer to write the data to |
Definition at line 291 of file ibf.c.
References InvertibleBloomFilter::count, GNUNET_assert, GNUNET_memcpy, InvertibleBloomFilter::key_hash_sum, InvertibleBloomFilter::key_sum, size, and start.
Referenced by send_ibf(), and strata_estimator_write().
void ibf_read_slice | ( | const void * | buf, |
uint32_t | start, | ||
uint32_t | count, | ||
struct InvertibleBloomFilter * | ibf | ||
) |
Read buckets from a buffer into an ibf.
buf | pointer to the buffer to read from |
start | which bucket to start at |
count | how many buckets to read |
ibf | the ibf to write to |
buf | pointer to the buffer to read from |
start | which bucket to start at |
count | how many buckets to read |
ibf | the ibf to read from |
Definition at line 324 of file ibf.c.
References InvertibleBloomFilter::count, GNUNET_assert, GNUNET_memcpy, InvertibleBloomFilter::key_hash_sum, InvertibleBloomFilter::key_sum, size, and start.
Referenced by handle_union_p2p_ibf(), and strata_estimator_read().
struct IBF_Key ibf_key_from_hashcode | ( | const struct GNUNET_HashCode * | hash | ) |
void ibf_hashcode_from_key | ( | struct IBF_Key | key, |
struct GNUNET_HashCode * | dst | ||
) |
struct InvertibleBloomFilter * ibf_create | ( | uint32_t | size, |
uint8_t | hash_num | ||
) |
Create an invertible bloom filter.
size | number of IBF buckets |
hash_num | number of buckets one element is hashed in, usually 3 or 4 |
size | number of IBF buckets |
hash_num | number of buckets one element is hashed in |
Definition at line 80 of file ibf.c.
void ibf_insert | ( | struct InvertibleBloomFilter * | ibf, |
struct IBF_Key | key | ||
) |
Insert a key into an IBF.
ibf | the IBF |
key | the element's hash code |
Definition at line 168 of file ibf.c.
void ibf_remove | ( | struct InvertibleBloomFilter * | ibf, |
struct IBF_Key | key | ||
) |
void ibf_subtract | ( | struct InvertibleBloomFilter * | ibf1, |
const struct InvertibleBloomFilter * | ibf2 | ||
) |
int ibf_decode | ( | struct InvertibleBloomFilter * | ibf, |
int * | ret_side, | ||
struct IBF_Key * | ret_id | ||
) |
Decode and remove an element from the IBF, if possible.
ibf | the invertible bloom filter to decode |
ret_side | sign 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_id | receives the hash code of the decoded element, if successful |
ibf | the invertible bloom filter to decode |
ret_side | sign 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_id | receives the hash code of the decoded element, if successful |
Definition at line 229 of file ibf.c.
struct InvertibleBloomFilter * ibf_dup | ( | const struct InvertibleBloomFilter * | ibf | ) |
Create a copy of an IBF, the copy has to be destroyed properly.
ibf | the IBF to copy |
Definition at line 380 of file ibf.c.
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.
ibf | the intertible bloom filter to destroy |