aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-07-23 13:23:40 +0000
committerChristian Grothoff <christian@grothoff.org>2011-07-23 13:23:40 +0000
commitf53e991a59f4befa47b0ce90d8b68318dcd23864 (patch)
tree89dae5aaf3c8bef1fa1412133fe9d22d4f4e232d /src/include
parentc1ed03a28d6de09d7d0ac2025af9f8067e6bb0fd (diff)
downloadgnunet-f53e991a59f4befa47b0ce90d8b68318dcd23864.tar.gz
gnunet-f53e991a59f4befa47b0ce90d8b68318dcd23864.zip
nse hacking
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_nse_service.h56
1 files changed, 16 insertions, 40 deletions
diff --git a/src/include/gnunet_nse_service.h b/src/include/gnunet_nse_service.h
index 27cce9bd0..7a670a584 100644
--- a/src/include/gnunet_nse_service.h
+++ b/src/include/gnunet_nse_service.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors) 3 (C) 2011 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -48,55 +48,31 @@ extern "C"
48#define GNUNET_NSE_VERSION 0x00000000 48#define GNUNET_NSE_VERSION 0x00000000
49 49
50/** 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#if 0
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 */
65#endif
66#define GNUNET_NSE_INTERVAL 360000 /* Every ten minutes */
67/**
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.
73 *
74 * There are 86400000 milliseconds in a day.
75 */
76#define GNUNET_NSE_DRIFT_TOLERANCE 600000 /* Ten minutes. */
77
78/**
79 * Number of bits
80 */
81#define GNUNET_NSE_BITS
82
83/**
84 * Handle for the network size estimation service. 51 * Handle for the network size estimation service.
85 */ 52 */
86struct GNUNET_NSE_Handle; 53struct GNUNET_NSE_Handle;
87 54
88
89/** 55/**
90 * Callback to call when network size estimate is updated. 56 * Callback to call when network size estimate is updated.
91 * 57 *
92 * @param cls closure 58 * @param cls closure
93 * @param estimate the value of the current network size estimate 59 * @param logestimate the log(Base 2) value of the current network size estimate
94 * @param std_dev standard deviation (rounded down to nearest integer) 60 * @param std_dev standard deviation for the estimate
95 * of the size estimation values seen 61 *
62 */
63typedef void (*GNUNET_NSE_Callback) (void *cls,
64 double logestimate,
65 double std_dev);
66
67
68/**
69 * Convert the logarithmic estimated returned to the 'GNUNET_NSE_Callback'
70 * into an absolute estimate in terms of the number of peers in the network.
96 * 71 *
72 * @param loge logarithmic estimate
73 * @return absolute number of peers in the network (estimated)
97 */ 74 */
98typedef void 75#define GNUNET_NSE_log_estimate_to_n(loge) pow(2.0, (loge))
99(*GNUNET_NSE_Callback) (void *cls, double estimate, double std_dev);
100 76
101/** 77/**
102 * Connect to the network size estimation service. 78 * Connect to the network size estimation service.