#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet-service-rps_sampler_elem.h"
#include <inttypes.h>
#include "rps-test_util.h"
Go to the source code of this file.
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "rps-sampler_elem", __VA_ARGS__) |
Functions | |
void | RPS_sampler_elem_reinit (struct RPS_SamplerElement *sampler_elem) |
Reinitialise a previously initialised sampler element. More... | |
struct RPS_SamplerElement * | RPS_sampler_elem_create (void) |
Create a sampler element and initialise it. More... | |
void | RPS_sampler_elem_destroy (struct RPS_SamplerElement *sampler_elem) |
Destroy a sampler element. More... | |
void | RPS_sampler_elem_next (struct RPS_SamplerElement *sampler_elem, const struct GNUNET_PeerIdentity *new_ID) |
Update a sampler element with a PeerID. More... | |
void | RPS_sampler_elem_set (struct RPS_SamplerElement *sampler_elem, struct GNUNET_CRYPTO_AuthKey auth_key) |
Set the min-wise independent function of the given sampler element. More... | |
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "rps-sampler_elem", __VA_ARGS__) |
Definition at line 35 of file gnunet-service-rps_sampler_elem.c.
void RPS_sampler_elem_reinit | ( | struct RPS_SamplerElement * | sampler_elem | ) |
Reinitialise a previously initialised sampler element.
sampler_elem | The sampler element to (re-) initialise |
Definition at line 50 of file gnunet-service-rps_sampler_elem.c.
References RPS_SamplerElement::auth_key, RPS_SamplerElement::birth, EMPTY, GNUNET_CRYPTO_HASH_LENGTH, GNUNET_CRYPTO_QUALITY_STRONG, GNUNET_CRYPTO_random_block(), GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_FOREVER_ABS, RPS_SamplerElement::is_empty, GNUNET_CRYPTO_AuthKey::key, RPS_SamplerElement::last_client_request, RPS_SamplerElement::num_change, and RPS_SamplerElement::num_peers.
Referenced by RPS_sampler_elem_create(), RPS_sampler_reinitialise_by_value(), and sampler_mod_get_rand_peer().
struct RPS_SamplerElement * RPS_sampler_elem_create | ( | void | ) |
Create a sampler element and initialise it.
In this implementation this means choosing an auth_key for later use in a hmac at random.
Definition at line 76 of file gnunet-service-rps_sampler_elem.c.
References GNUNET_new, and RPS_sampler_elem_reinit().
Referenced by sampler_resize().
void RPS_sampler_elem_destroy | ( | struct RPS_SamplerElement * | sampler_elem | ) |
Destroy a sampler element.
sampler_elem | the element to destroy |
Definition at line 94 of file gnunet-service-rps_sampler_elem.c.
References GNUNET_free.
Referenced by sampler_resize().
void RPS_sampler_elem_next | ( | struct RPS_SamplerElement * | sampler_elem, |
const struct GNUNET_PeerIdentity * | new_ID | ||
) |
Update a sampler element with a PeerID.
sampler_elem | The sampler element to update |
new_ID | The PeerID to update with |
Definition at line 107 of file gnunet-service-rps_sampler_elem.c.
References RPS_SamplerElement::auth_key, EMPTY, GNUNET_CRYPTO_hash_cmp(), GNUNET_CRYPTO_hmac(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_memcmp, RPS_SamplerElement::is_empty, LOG, NOT_EMPTY, RPS_SamplerElement::num_change, RPS_SamplerElement::num_peers, RPS_SamplerElement::peer_id, and RPS_SamplerElement::peer_id_hash.
Referenced by RPS_sampler_update().
void RPS_sampler_elem_set | ( | struct RPS_SamplerElement * | sampler_elem, |
struct GNUNET_CRYPTO_AuthKey | auth_key | ||
) |
Set the min-wise independent function of the given sampler element.
sampler_elem | the sampler element |
auth_key | the key to use |
Definition at line 163 of file gnunet-service-rps_sampler_elem.c.
References RPS_SamplerElement::auth_key.