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.
60 #define GNUNET_NSE_INTERVAL 60000 /* Every minute */
61 #define GNUNET_NSE_INTERVAL 180000 /* Every three minutes */
62 #define GNUNET_NSE_INTERVAL 360000 /* Every six minutes */
63 #define GNUNET_NSE_INTERVAL 600000 /* Every ten minutes */
64 #define GNUNET_NSE_INTERVAL 1200000 /* Every twenty minutes */
66 #define GNUNET_NSE_INTERVAL 360000 /* Every ten minutes */
68 * How much clock skew (in milliseconds) will we allow
69 * for received messages. We check our current time
70 * with the timestamp received as part of the message
71 * and if the difference is greater than this tolerance
72 * we will discard the message as invalid.
74 * There are 86400000 milliseconds in a day.
76 #define GNUNET_NSE_DRIFT_TOLERANCE 600000 /* Ten minutes. */
81 #define GNUNET_NSE_BITS
84 * Handle for the network size estimation service.
86 struct GNUNET_NSE_Handle;
90 * Callback to call when network size estimate is updated.
93 * @param estimate the value of the current network size estimate
94 * @param std_dev standard deviation (rounded down to nearest integer)
95 * of the size estimation values seen
99 (*GNUNET_NSE_Callback) (void *cls, double estimate, double std_dev);
102 * Connect to the network size estimation service.
104 * @param cfg the configuration to use
105 * @param func funtion to call with network size estimate
106 * @param func_cls closure to pass for network size estimate callback
108 * @return handle to use
110 struct GNUNET_NSE_Handle *
111 GNUNET_NSE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
112 GNUNET_NSE_Callback func, void *func_cls);
116 * Disconnect from network size estimation service
118 * @param h handle to destroy
122 GNUNET_NSE_disconnect (struct GNUNET_NSE_Handle *h);
125 #if 0 /* keep Emacsens' auto-indent happy */
132 #endif /* GNUNET_NSE_SERVICE_H_ */