2 This file is part of GNUnet.
3 (C) 2001-2011 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.
22 * @author Nathan Evans
25 * @brief Common type definitions for the network size estimation
31 #include "gnunet_common.h"
33 #define DEBUG_NSE GNUNET_YES
35 #define SIGNED_TIMESTAMP_SIZE sizeof(struct GNUNET_TIME_Absolute)
37 /** FIXME: define NSE message types here. */
39 struct GNUNET_Signed_Timestamp
41 char data[SIGNED_TIMESTAMP_SIZE];
45 * Network size estimate sent from the service
46 * to clients. Contains the current size estimate
47 * (or 0 if none has been calculated) and the
48 * standard deviation of known estimates.
51 struct GNUNET_NSE_ClientMessage
54 * Type: GNUNET_MESSAGE_TYPE_NSE_UPDATE
56 struct GNUNET_MessageHeader header;
59 * The current estimated network size.
64 * The standard deviation (rounded down
65 * to the nearest integer) of size
72 * Network size estimate reply; sent when "this"
73 * peer's timer has run out before receiving a
74 * valid reply from another peer.
76 * FIXME: Is this the right way to do this?
77 * I think we need to include both the public
78 * key and the timestamp signed by the private
79 * key. This way a recipient
80 * can verify that the peer at least generated
81 * the public/private key pair, and that the
82 * timestamp matches what the current peer
83 * believes it should be. The receiving peer
84 * would then check whether the XOR of the peer
85 * identity and the timestamp is within a
86 * reasonable range of the current time
87 * (+/- N seconds). If a closer message which
88 * also verifies hasn't been received (or this
89 * message is a duplicate), the peer
90 * calculates the size estimate and forwards
91 * the request to all other peers.
93 * Hmm... Is it enought to *just* send the peer
94 * identity? Obviously this is smaller, but it
95 * doesn't allow us to verify that the
96 * public/private key pair were generated, right?
98 struct GNUNET_NSE_ReplyMessage
101 * Type: GNUNET_MESSAGE_TYPE_NSE_REPLY
103 struct GNUNET_MessageHeader header;
106 * The current timestamp value (which all
107 * peers should agree on) signed by the
108 * private key of the initiating peer.
110 struct GNUNET_Signed_Timestamp timestamp;
113 * Public key of the originator, signed timestamp
114 * is decrypted by this.
116 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;