2 This file is part of GNUnet.
3 (C) 2013 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 3, 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 * @file identity/gnunet-service-identity.c
23 * @brief network size estimation service
24 * @author Nathan Evans
25 * @author Christian Grothoff
27 * The purpose of this service is to estimate the size of the network.
28 * Given a specified interval, each peer hashes the most recent
29 * timestamp which is evenly divisible by that interval. This hash is
30 * compared in distance to the peer identity to choose an offset. The
31 * closer the peer identity to the hashed timestamp, the earlier the
32 * peer sends out a "nearest peer" message. The closest peer's
33 * message should thus be received before any others, which stops
34 * those peer from sending their messages at a later duration. So
35 * every peer should receive the same nearest peer message, and from
36 * this can calculate the expected number of peers in the network.
40 #include "gnunet_util_lib.h"
41 #include "gnunet_constants.h"
42 #include "gnunet_protocols.h"
43 #include "gnunet_signatures.h"
44 #include "gnunet_statistics_service.h"
45 #include "gnunet_identity_service.h"
49 * Handle to our current configuration.
51 static const struct GNUNET_CONFIGURATION_Handle *cfg;
54 * Handle to the statistics service.
56 static struct GNUNET_STATISTICS_Handle *stats;
60 * Handle network size estimate clients.
63 * @param server the initialized server
64 * @param c configuration to use
68 struct GNUNET_SERVER_Handle *server,
69 const struct GNUNET_CONFIGURATION_Handle *c)
71 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
72 // {&handle_start_message, NULL, GNUNET_MESSAGE_TYPE_IDENTITY_START, sizeof (struct GNUNET_MessageHeader)},
77 stats = GNUNET_STATISTICS_create ("identity", cfg);
82 * The main function for the network size estimation service.
84 * @param argc number of arguments from the command line
85 * @param argv command line arguments
86 * @return 0 ok, 1 on error
89 main (int argc, char *const *argv)
92 GNUNET_SERVICE_run (argc, argv, "identity", GNUNET_SERVICE_OPTION_NONE,
97 /* end of gnunet-service-identity.c */