Network Size Estimation. More...
Macros | |
#define | GNUNET_NSE_VERSION 0x00000000 |
Version of the network size estimation API. More... | |
#define | GNUNET_NSE_log_estimate_to_n(loge) pow (2.0, (loge)) |
Convert the logarithmic estimated returned to the 'GNUNET_NSE_Callback' into an absolute estimate in terms of the number of peers in the network. More... | |
Typedefs | |
typedef void(* | GNUNET_NSE_Callback) (void *cls, struct GNUNET_TIME_Absolute timestamp, double logestimate, double std_dev) |
Callback to call when network size estimate is updated. More... | |
Functions | |
struct GNUNET_NSE_Handle * | GNUNET_NSE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_NSE_Callback func, void *func_cls) |
Connect to the network size estimation service. More... | |
void | GNUNET_NSE_disconnect (struct GNUNET_NSE_Handle *h) |
Disconnect from network size estimation service. More... | |
Network Size Estimation.
Provides an API to retrieve the current network size estimate, also to register for notifications whenever a new network size estimate is calculated.
#define GNUNET_NSE_VERSION 0x00000000 |
Version of the network size estimation API.
Definition at line 59 of file gnunet_nse_service.h.
#define GNUNET_NSE_log_estimate_to_n | ( | loge | ) | pow (2.0, (loge)) |
Convert the logarithmic estimated returned to the 'GNUNET_NSE_Callback' into an absolute estimate in terms of the number of peers in the network.
loge | logarithmic estimate |
Definition at line 88 of file gnunet_nse_service.h.
typedef void(* GNUNET_NSE_Callback) (void *cls, struct GNUNET_TIME_Absolute timestamp, double logestimate, double std_dev) |
Callback to call when network size estimate is updated.
cls | closure |
timestamp | time when the estimate was received from the server (or created by the server) |
logestimate | the log(Base 2) value of the current network size estimate |
std_dev | standard deviation for the estimate |
Definition at line 74 of file gnunet_nse_service.h.
struct GNUNET_NSE_Handle * GNUNET_NSE_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_NSE_Callback | func, | ||
void * | func_cls | ||
) |
Connect to the network size estimation service.
cfg | the configuration to use |
func | function to call with network size estimate |
func_cls | closure to pass to func |
cfg | the configuration to use |
func | function to call with network size estimate |
func_cls | closure to pass to func |
Definition at line 164 of file nse_api.c.
References cfg, GNUNET_ARM_Handle::cfg, GNUNET_assert, GNUNET_free, GNUNET_new, GNUNET_TIME_UNIT_ZERO, h, GNUNET_ARM_Handle::mq, and reconnect().
Referenced by DHTU_gnunet_init(), reconnect(), and run().
void GNUNET_NSE_disconnect | ( | struct GNUNET_NSE_Handle * | h | ) |
Disconnect from network size estimation service.
h | handle to destroy |
Definition at line 192 of file nse_api.c.
References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), h, GNUNET_ARM_Handle::mq, and GNUNET_ARM_Handle::reconnect_task.
Referenced by DHTU_gnunet_done(), do_shutdown(), GNUNET_RPS_disconnect(), reconnect(), and shutdown_task().