GNUnet  0.10.x
Functions
gnunet-service-dht_nse.h File Reference

GNUnet DHT integration with NSE. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

double GDS_NSE_get (void)
 Return the log of the current network size estimate. More...
 
void GDS_NSE_init (void)
 Initialize NSE subsystem. More...
 
void GDS_NSE_done (void)
 Shutdown NSE subsystem. More...
 

Detailed Description

GNUnet DHT integration with NSE.

Author
Christian Grothoff

Definition in file gnunet-service-dht_nse.h.

Function Documentation

◆ GDS_NSE_get()

double GDS_NSE_get ( void  )

Return the log of the current network size estimate.

Returns
log of NSE

Definition at line 72 of file gnunet-service-dht_nse.c.

References log_of_network_size_estimate.

Referenced by get_forward_count(), and select_peer().

73 {
75 }
static double log_of_network_size_estimate
log of the current network size estimate, used as the point where we switch between random and determ...
Here is the caller graph for this function:

◆ GDS_NSE_init()

void GDS_NSE_init ( void  )

Initialize NSE subsystem.

Definition at line 82 of file gnunet-service-dht_nse.c.

References GDS_cfg, GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_have_value(), GNUNET_NSE_connect(), GNUNET_OK, GNUNET_YES, log_of_network_size_estimate, and update_network_size_estimate().

Referenced by run().

83 {
84  unsigned long long hops;
85 
86  if ( (GNUNET_YES ==
88  "dht",
89  "FORCE_NSE")) &&
90  (GNUNET_OK ==
92  "dht",
93  "FORCE_NSE",
94  &hops)) )
95  {
96  log_of_network_size_estimate = (double) hops;
97  return;
98  }
100 }
int GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
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.
Definition: nse_api.c:165
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
int GNUNET_CONFIGURATION_have_value(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Test if we have a value for a particular option.
static void update_network_size_estimate(void *cls, struct GNUNET_TIME_Absolute timestamp, double logestimate, double std_dev)
Callback that is called when network size estimate is updated.
static struct GNUNET_NSE_Handle * nse
Network size estimation handle.
#define GNUNET_YES
Definition: gnunet_common.h:80
const struct GNUNET_CONFIGURATION_Handle * GDS_cfg
Configuration we use.
static double log_of_network_size_estimate
log of the current network size estimate, used as the point where we switch between random and determ...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GDS_NSE_done()

void GDS_NSE_done ( void  )

Shutdown NSE subsystem.

Definition at line 107 of file gnunet-service-dht_nse.c.

References GNUNET_NSE_disconnect().

Referenced by shutdown_task().

108 {
109  if (NULL != nse)
110  {
112  nse = NULL;
113  }
114 }
void GNUNET_NSE_disconnect(struct GNUNET_NSE_Handle *h)
Disconnect from network size estimation service.
Definition: nse_api.c:193
static struct GNUNET_NSE_Handle * nse
Network size estimation handle.
Here is the call graph for this function:
Here is the caller graph for this function: