aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-07-08 17:10:45 +0000
committerNathan S. Evans <evans@in.tum.de>2011-07-08 17:10:45 +0000
commit5058b5b92455e26dd740b5c0344f78e95cd0fc2e (patch)
tree0077531e5ff8c9c9348b301a10618b0328bef90e /src/include
parenta6627549cdea39c0c5eb75966598e4ee7c31cad1 (diff)
downloadgnunet-5058b5b92455e26dd740b5c0344f78e95cd0fc2e.tar.gz
gnunet-5058b5b92455e26dd740b5c0344f78e95cd0fc2e.zip
initial nse commit
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_nse_service.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/src/include/gnunet_nse_service.h b/src/include/gnunet_nse_service.h
new file mode 100644
index 000000000..012a61c22
--- /dev/null
+++ b/src/include/gnunet_nse_service.h
@@ -0,0 +1,115 @@
1/*
2 This file is part of GNUnet
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19 */
20
21#ifndef GNUNET_NSE_SERVICE_H_
22#define GNUNET_NSE_SERVICE_H_
23
24/**
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.
29 *
30 * @author Nathan Evans
31 */
32
33#ifdef __cplusplus
34extern "C"
35{
36#if 0 /* keep Emacsens' auto-indent happy */
37}
38#endif
39#endif
40
41#include "gnunet_common.h"
42#include "gnunet_configuration_lib.h"
43#include "gnunet_scheduler_lib.h"
44
45/**
46 * Version of the network size estimation API.
47 */
48#define GNUNET_NSE_VERSION 0x00000000
49
50/**
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
55 * by this amount.
56 *
57 * There are 86400000 milliseconds in a day.
58 */
59#define GNUNET_NSE_INTERVAL 3600000 /* Once per hour */
60
61/**
62 * Number of bits
63 */
64#define GNUNET_NSE_BITS
65
66/**
67 * Handle for the network size estimation service.
68 */
69struct GNUNET_NSE_Handle;
70
71
72/**
73 * Callback to call when network size estimate is updated.
74 *
75 * @param cls closure
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
80 */
81typedef int
82(*GNUNET_NSE_Callback) (void *cls, double estimate, double std_dev);
83
84/**
85 * Connect to the network size estimation service.
86 *
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
90 *
91 * @return handle to use
92 */
93struct GNUNET_NSE_Handle *
94GNUNET_NSE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
95 GNUNET_NSE_Callback func, void *func_cls);
96
97
98/**
99 * Disconnect from network size estimation service
100 *
101 * @param h handle to destroy
102 *
103 */
104void
105GNUNET_NSE_disconnect (struct GNUNET_NSE_Handle *h);
106
107
108#if 0 /* keep Emacsens' auto-indent happy */
109{
110#endif
111#ifdef __cplusplus
112}
113#endif
114
115#endif /* GNUNET_NSE_SERVICE_H_ */