Go to the source code of this file.
Data Structures | |
struct | StrataEstimator |
A handle to a strata estimator. More... | |
struct | MultiStrataEstimator |
Functions | |
uint8_t | determine_strata_count (uint64_t avg_element_size, uint64_t element_count) |
Deteminate how many strata estimators in the message are necessary. More... | |
size_t | strata_estimator_write (struct MultiStrataEstimator *se, uint16_t se_ibf_total_size, uint8_t number_se_send, void *buf) |
Write the given strata estimator to the buffer. More... | |
int | strata_estimator_read (const void *buf, size_t buf_len, int is_compressed, uint8_t number_se_received, uint16_t se_ibf_total_size, struct MultiStrataEstimator *se) |
Read strata from the buffer into the given strata estimator. More... | |
struct MultiStrataEstimator * | strata_estimator_create (unsigned int strata_count, uint32_t ibf_size, uint8_t ibf_hashnum) |
Create a new strata estimator with the given parameters. More... | |
void | strata_estimator_difference (const struct MultiStrataEstimator *se1, const struct MultiStrataEstimator *se2) |
Get an estimation of the symmetric difference of the elements contained in both strata estimators. More... | |
void | strata_estimator_insert (struct MultiStrataEstimator *se, struct IBF_Key key) |
Add a key to the strata estimator. More... | |
void | strata_estimator_remove (struct MultiStrataEstimator *se, struct IBF_Key key) |
Remove a key from the strata estimator. More... | |
void | strata_estimator_destroy (struct MultiStrataEstimator *se) |
Destroy a strata estimator, free all of its resources. More... | |
struct MultiStrataEstimator * | strata_estimator_dup (struct MultiStrataEstimator *se) |
Make a copy of a strata estimator. More... | |
uint8_t determine_strata_count | ( | uint64_t | avg_element_size, |
uint64_t | element_count | ||
) |
Deteminate how many strata estimators in the message are necessary.
avg_element_size | |
element_count |
Deteminate how many strata estimators in the message are necessary.
avg_element_size | |
element_count |
Definition at line 59 of file gnunet-service-setu_strata_estimator.c.
References AVG_BYTE_SIZE_SE.
Referenced by handle_client_accept().
size_t strata_estimator_write | ( | struct MultiStrataEstimator * | se, |
uint16_t | se_ibf_total_size, | ||
uint8_t | number_se_send, | ||
void * | buf | ||
) |
Write the given strata estimator to the buffer.
se | strata estimator to serialize | |
[out] | buf | buffer to write to, must be of appropriate size |
Definition at line 118 of file gnunet-service-setu_strata_estimator.c.
References GNUNET_assert, GNUNET_free, GNUNET_memcpy, GNUNET_try_compression(), GNUNET_YES, IBF_BUCKET_SIZE, StrataEstimator::ibf_size, ibf_write_slice(), MultiStrataEstimator::size, StrataEstimator::strata, StrataEstimator::strata_count, and MultiStrataEstimator::stratas.
int strata_estimator_read | ( | const void * | buf, |
size_t | buf_len, | ||
int | is_compressed, | ||
uint8_t | number_se_received, | ||
uint16_t | se_ibf_total_size, | ||
struct MultiStrataEstimator * | se | ||
) |
Read strata from the buffer into the given strata estimator.
The strata estimator must already be allocated.
buf | buffer to read from | |
buf_len | number of bytes in buf | |
is_compressed | is the data compressed? | |
[out] | se | strata estimator to write to |
Definition at line 176 of file gnunet-service-setu_strata_estimator.c.
References GNUNET_break, GNUNET_break_op, GNUNET_decompress(), GNUNET_free, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, IBF_BUCKET_SIZE, ibf_read_slice(), StrataEstimator::ibf_size, MultiStrataEstimator::size, StrataEstimator::strata, StrataEstimator::strata_count, and MultiStrataEstimator::stratas.
struct MultiStrataEstimator * strata_estimator_create | ( | unsigned int | strata_count, |
uint32_t | ibf_size, | ||
uint8_t | ibf_hashnum | ||
) |
Create a new strata estimator with the given parameters.
strata_count | number of stratas, that is, number of ibfs in the estimator |
ibf_size | size of each ibf stratum |
ibf_hashnum | hashnum parameter of each ibf |
Definition at line 182 of file gnunet-service-set_union_strata_estimator.c.
References GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_new_array, ibf_create(), ibf_destroy(), StrataEstimator::ibf_size, ibf_size, MULTI_SE_BASE_COUNT, MultiStrataEstimator::size, StrataEstimator::strata, StrataEstimator::strata_count, and MultiStrataEstimator::stratas.
Referenced by handle_client_create_set(), handle_union_p2p_strata_estimator(), and union_set_create().
void strata_estimator_difference | ( | const struct MultiStrataEstimator * | se1, |
const struct MultiStrataEstimator * | se2 | ||
) |
Get an estimation of the symmetric difference of the elements contained in both strata estimators.
se1 | first strata estimator |
se2 | second strata estimator |
Get an estimation of the symmetric difference of the elements contained in both strata estimators.
arrays of IBFs. Does not not modify its arguments.
se1 | first strata estimator |
se2 | second strata estimator |
Definition at line 359 of file gnunet-service-setu_strata_estimator.c.
References GNUNET_assert, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, ibf_decode(), ibf_destroy(), ibf_dup(), ibf_subtract(), InvertibleBloomFilter::local_decoded_count, InvertibleBloomFilter::remote_decoded_count, InvertibleBloomFilter::size, MultiStrataEstimator::size, StrataEstimator::strata, StrataEstimator::strata_count, and MultiStrataEstimator::stratas.
void strata_estimator_insert | ( | struct MultiStrataEstimator * | se, |
struct IBF_Key | key | ||
) |
Add a key to the strata estimator.
se | strata estimator to add the key to |
key | key to add |
Definition at line 235 of file gnunet-service-setu_strata_estimator.c.
References ibf_insert(), key, IBF_Key::key_val, MULTI_SE_BASE_COUNT, salt_key(), StrataEstimator::strata, and MultiStrataEstimator::stratas.
void strata_estimator_remove | ( | struct MultiStrataEstimator * | se, |
struct IBF_Key | key | ||
) |
Remove a key from the strata estimator.
se | strata estimator to remove the key from |
key | key to remove |
(NOT USED)
se | strata estimator to remove the key from |
key | key to remove |
Definition at line 268 of file gnunet-service-setu_strata_estimator.c.
References ibf_remove(), key, IBF_Key::key_val, MULTI_SE_BASE_COUNT, MultiStrataEstimator::size, StrataEstimator::strata, MultiStrataEstimator::stratas, and unsalt_key().
void strata_estimator_destroy | ( | struct MultiStrataEstimator * | se | ) |
Destroy a strata estimator, free all of its resources.
se | strata estimator to destroy. |
Definition at line 464 of file gnunet-service-setu_strata_estimator.c.
References GNUNET_free, ibf_destroy(), MULTI_SE_BASE_COUNT, StrataEstimator::strata, StrataEstimator::strata_count, and MultiStrataEstimator::stratas.
struct MultiStrataEstimator * strata_estimator_dup | ( | struct MultiStrataEstimator * | se | ) |
Make a copy of a strata estimator.
se | the strata estimator to copy |
Definition at line 433 of file gnunet-service-setu_strata_estimator.c.
References GNUNET_new, GNUNET_new_array, ibf_dup(), StrataEstimator::ibf_size, MULTI_SE_BASE_COUNT, StrataEstimator::strata, StrataEstimator::strata_count, and MultiStrataEstimator::stratas.