2 This file is part of GNUnet
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 #ifndef GNUNET_NSE_SERVICE_H_
22 #define GNUNET_NSE_SERVICE_H_
25 * @file include/gnunet_nse_service.h
26 * @brief API to retrieve the current network size estimate,
27 * also to register for notifications whenever a new
28 * network size estimate is calculated.
30 * @author Nathan Evans
36 #if 0 /* keep Emacsens' auto-indent happy */
41 #include "gnunet_common.h"
42 #include "gnunet_configuration_lib.h"
43 #include "gnunet_scheduler_lib.h"
46 * Version of the network size estimation API.
48 #define GNUNET_NSE_VERSION 0x00000000
51 * Interval for sending network size estimation flood requests.
52 * Number is in milliseconds.
53 * This needs to be a factor of the number milliseconds in
54 * a day, as the base time used is midnight each day offset
57 * There are 86400000 milliseconds in a day.
59 #define GNUNET_NSE_INTERVAL 3600000 /* Once per hour */
64 #define GNUNET_NSE_BITS
67 * Handle for the network size estimation service.
69 struct GNUNET_NSE_Handle;
73 * Callback to call when network size estimate is updated.
76 * @param estimate the value of the current network size estimate
77 * @param std_dev standard deviation (rounded down to nearest integer)
78 * of the size estimation values seen
79 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
82 (*GNUNET_NSE_Callback) (void *cls, double estimate, double std_dev);
85 * Connect to the network size estimation service.
87 * @param cfg the configuration to use
88 * @param func funtion to call with network size estimate
89 * @param func_cls closure to pass for network size estimate callback
91 * @return handle to use
93 struct GNUNET_NSE_Handle *
94 GNUNET_NSE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
95 GNUNET_NSE_Callback func, void *func_cls);
99 * Disconnect from network size estimation service
101 * @param h handle to destroy
105 GNUNET_NSE_disconnect (struct GNUNET_NSE_Handle *h);
108 #if 0 /* keep Emacsens' auto-indent happy */
115 #endif /* GNUNET_NSE_SERVICE_H_ */