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 identity management service
24 * @author Christian Grothoff
26 * The purpose of this service is to manage private keys that
27 * represent the various egos/pseudonyms/identities of a GNUnet user.
30 * - hint for 'end of initial list' is not implemented
31 * (might ALSO be missing in client library!)
34 #include "gnunet_util_lib.h"
35 #include "gnunet_constants.h"
36 #include "gnunet_protocols.h"
37 #include "gnunet_statistics_service.h"
38 #include "gnunet_identity_service.h"
43 * Information we keep about each ego.
49 * We keep egos in a DLL.
54 * We keep egos in a DLL.
59 * Private key of the ego.
61 struct GNUNET_CRYPTO_EccPrivateKey *pk;
64 * String identifier for the ego.
72 * Handle to our current configuration.
74 static const struct GNUNET_CONFIGURATION_Handle *cfg;
77 * Handle to subsystem configuration which for each subsystem contains
78 * the name of the default ego.
80 static struct GNUNET_CONFIGURATION_Handle *subsystem_cfg;
83 * Handle to the statistics service.
85 static struct GNUNET_STATISTICS_Handle *stats;
88 * Notification context, simplifies client broadcasts.
90 static struct GNUNET_SERVER_NotificationContext *nc;
93 * Directory where we store the identities.
95 static char *ego_directory;
98 * Configuration file name where subsystem information is kept.
100 static char *subsystem_cfg_file;
103 * Head of DLL of all egos.
105 static struct Ego *ego_head;
108 * Tail of DLL of all egos.
110 static struct Ego *ego_tail;
114 * Get the name of the file we use to store a given ego.
116 * @param ego ego for which we need the filename
117 * @return full filename for the given ego
120 get_ego_filename (struct Ego *ego)
124 GNUNET_asprintf (&filename,
134 * Task run during shutdown.
140 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
146 GNUNET_SERVER_notification_context_destroy (nc);
151 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
154 GNUNET_CONFIGURATION_destroy (subsystem_cfg);
155 subsystem_cfg = NULL;
156 GNUNET_free (subsystem_cfg_file);
157 subsystem_cfg_file = NULL;
158 GNUNET_free (ego_directory);
159 ego_directory = NULL;
160 while (NULL != (e = ego_head))
162 GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, e);
163 GNUNET_CRYPTO_ecc_key_free (e->pk);
170 * Send a result code back to the client.
172 * @param client client that should receive the result code
173 * @param result_code code to transmit
174 * @param emsg error message to include (or NULL for none)
177 send_result_code (struct GNUNET_SERVER_Client *client,
178 uint32_t result_code,
181 struct GNUNET_IDENTITY_ResultCodeMessage *rcm;
187 elen = strlen (emsg) + 1;
188 rcm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
189 rcm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE);
190 rcm->header.size = htons (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
191 rcm->result_code = htonl (result_code);
192 memcpy (&rcm[1], emsg, elen);
193 GNUNET_SERVER_notification_context_unicast (nc, client, &rcm->header, GNUNET_YES);
199 * Create an update message with information about the current state of an ego.
201 * @param ego ego to create message for
202 * @return corresponding update message
204 static struct GNUNET_IDENTITY_UpdateMessage *
205 create_update_message (struct Ego *ego)
207 struct GNUNET_IDENTITY_UpdateMessage *um;
211 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc;
213 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
214 enc = GNUNET_CRYPTO_ecc_encode_key (ego->pk);
215 pk_len = ntohs (enc->size);
216 um = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + pk_len + name_len);
217 um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
218 um->header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + pk_len + name_len);
219 um->name_len = htons (name_len);
220 um->pk_len = htons (pk_len);
221 str = (char *) &um[1];
222 memcpy (str, enc, pk_len);
223 memcpy (&str[pk_len], ego->identifier, name_len);
230 * Create a set default message with information about the current state of an ego.
232 * @param ego ego to create message for
233 * @param servicename name of the service to provide in the message
234 * @return corresponding set default message
236 static struct GNUNET_IDENTITY_SetDefaultMessage *
237 create_set_default_message (struct Ego *ego,
238 const char *servicename)
240 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
244 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc;
246 name_len = (NULL == servicename) ? 0 : (strlen (servicename) + 1);
247 enc = GNUNET_CRYPTO_ecc_encode_key (ego->pk);
248 pk_len = ntohs (enc->size);
249 sdm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + pk_len + name_len);
250 sdm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
251 sdm->header.size = htons (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + pk_len + name_len);
252 sdm->name_len = htons (name_len);
253 sdm->pk_len = htons (pk_len);
254 str = (char *) &sdm[1];
255 memcpy (str, enc, pk_len);
256 memcpy (&str[pk_len], servicename, name_len);
263 * Handler for START message from client, sends information
264 * about all identities to the client immediately and
265 * adds the client to the notification context for future
269 * @param client who sent the message
270 * @param message the message received
273 handle_start_message (void *cls, struct GNUNET_SERVER_Client *client,
274 const struct GNUNET_MessageHeader *message)
276 struct GNUNET_IDENTITY_UpdateMessage *um;
279 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
280 "Received START message from client\n");
281 GNUNET_SERVER_notification_context_add (nc, client);
282 for (ego = ego_head; NULL != ego; ego = ego->next)
284 um = create_update_message (ego);
285 GNUNET_SERVER_notification_context_unicast (nc, client, &um->header, GNUNET_YES);
288 GNUNET_SERVER_receive_done (client, GNUNET_OK);
293 * Handler for GET_DEFAULT message from client, returns
294 * default identity for some service.
297 * @param client who sent the message
298 * @param message the message received
301 handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client,
302 const struct GNUNET_MessageHeader *message)
304 const struct GNUNET_IDENTITY_GetDefaultMessage *gdm;
305 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
312 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
313 "Received GET_DEFAULT message from client\n");
314 size = ntohs (message->size);
315 if (size <= sizeof (struct GNUNET_IDENTITY_GetDefaultMessage))
318 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
321 gdm = (const struct GNUNET_IDENTITY_GetDefaultMessage *) message;
322 name = (const char *) &gdm[1];
323 name_len = ntohs (gdm->name_len);
324 if ( (name_len + sizeof (struct GNUNET_IDENTITY_GetDefaultMessage) != size) ||
325 (0 != ntohs (gdm->reserved)) ||
326 ('\0' != name[name_len - 1]) )
329 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
333 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
335 "DEFAULT_IDENTIFIER",
338 send_result_code (client, 1, gettext_noop ("no default known"));
339 GNUNET_SERVER_receive_done (client, GNUNET_OK);
342 for (ego = ego_head; NULL != ego; ego = ego->next)
344 if (0 == strcmp (ego->identifier,
347 sdm = create_set_default_message (ego,
349 GNUNET_SERVER_notification_context_broadcast (nc, &sdm->header, GNUNET_YES);
351 GNUNET_SERVER_receive_done (client, GNUNET_OK);
355 send_result_code (client, 1,
356 gettext_noop ("default configured, but ego unknown (internal error)"));
357 GNUNET_SERVER_receive_done (client, GNUNET_OK);
362 * Compare the given two private keys for equality.
364 * @param pk1 one private key
365 * @param pk2 another private key
366 * @return 0 if the keys are equal
369 key_cmp (const struct GNUNET_CRYPTO_EccPrivateKey *pk1,
370 const struct GNUNET_CRYPTO_EccPrivateKey *pk2)
372 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded p1;
373 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded p2;
375 GNUNET_CRYPTO_ecc_key_get_public (pk1, &p1);
376 GNUNET_CRYPTO_ecc_key_get_public (pk2, &p2);
377 return memcmp (&p1, &p2, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded));
382 * Handler for SET_DEFAULT message from client, updates
383 * default identity for some service.
386 * @param client who sent the message
387 * @param message the message received
390 handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client,
391 const struct GNUNET_MessageHeader *message)
393 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
399 struct GNUNET_CRYPTO_EccPrivateKey *pk;
401 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
402 "Received SET_DEFAULT message from client\n");
403 size = ntohs (message->size);
404 if (size <= sizeof (struct GNUNET_IDENTITY_SetDefaultMessage))
407 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
410 sdm = (const struct GNUNET_IDENTITY_SetDefaultMessage *) message;
411 name_len = ntohs (sdm->name_len);
412 pk_len = ntohs (sdm->pk_len);
413 str = (const char *) &sdm[1];
414 if ( (name_len + pk_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) != size) ||
415 (NULL == (pk = GNUNET_CRYPTO_ecc_decode_key (str, pk_len, GNUNET_YES))) )
418 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
422 if ('\0' != str[name_len - 1])
425 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
428 for (ego = ego_head; NULL != ego; ego = ego->next)
430 if (0 == key_cmp (ego->pk,
433 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
435 "DEFAULT_IDENTIFIER",
438 GNUNET_CONFIGURATION_write (subsystem_cfg,
440 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
441 _("Failed to write subsystem default identifier map to `%s'.\n"),
443 send_result_code (client, 0, NULL);
444 GNUNET_SERVER_receive_done (client, GNUNET_OK);
445 GNUNET_CRYPTO_ecc_key_free (pk);
449 send_result_code (client, 1, _("Unknown ego specified for service (internal error)"));
450 GNUNET_SERVER_receive_done (client, GNUNET_OK);
451 GNUNET_CRYPTO_ecc_key_free (pk);
456 * Send an updated message for the given ego to all listeners.
458 * @param ego ego to send the update for
461 notify_listeners (struct Ego *ego)
463 struct GNUNET_IDENTITY_UpdateMessage *um;
465 um = create_update_message (ego);
466 GNUNET_SERVER_notification_context_broadcast (nc, &um->header, GNUNET_YES);
472 * Handler for CREATE message from client, creates
476 * @param client who sent the message
477 * @param message the message received
480 handle_create_message (void *cls, struct GNUNET_SERVER_Client *client,
481 const struct GNUNET_MessageHeader *message)
483 const struct GNUNET_IDENTITY_CreateRequestMessage *crm;
490 struct GNUNET_CRYPTO_EccPrivateKey *pk;
493 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
494 "Received CREATE message from client\n");
495 size = ntohs (message->size);
496 if (size <= sizeof (struct GNUNET_IDENTITY_CreateRequestMessage))
499 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
502 crm = (const struct GNUNET_IDENTITY_CreateRequestMessage *) message;
503 name_len = ntohs (crm->name_len);
504 pk_len = ntohs (crm->pk_len);
505 pks = (const char *) &crm[1];
506 if ( (name_len + pk_len + sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) != size) ||
507 (NULL == (pk = GNUNET_CRYPTO_ecc_decode_key (pks, pk_len, GNUNET_YES))) )
510 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
514 if ('\0' != str[name_len - 1])
517 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
520 for (ego = ego_head; NULL != ego; ego = ego->next)
522 if (0 == strcmp (ego->identifier,
525 send_result_code (client, 1, gettext_noop ("identifier already in use for another ego"));
526 GNUNET_SERVER_receive_done (client, GNUNET_OK);
527 GNUNET_CRYPTO_ecc_key_free (pk);
531 ego = GNUNET_new (struct Ego);
533 ego->identifier = GNUNET_strdup (str);
534 GNUNET_CONTAINER_DLL_insert (ego_head,
537 send_result_code (client, 0, NULL);
538 fn = get_ego_filename (ego);
539 (void) GNUNET_DISK_directory_create_for_file (fn);
541 GNUNET_DISK_fn_write (fn, pks, pk_len,
542 GNUNET_DISK_PERM_USER_READ |
543 GNUNET_DISK_PERM_USER_WRITE))
544 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
547 notify_listeners (ego);
548 GNUNET_SERVER_receive_done (client, GNUNET_OK);
553 * Closure for 'handle_ego_rename'.
560 const char *old_name;
565 const char *new_name;
570 * An ego was renamed; rename it in all subsystems where it is
571 * currently set as the default.
573 * @param cls the 'struct RenameContext'
574 * @param section a section in the configuration to process
577 handle_ego_rename (void *cls,
580 struct RenameContext *rc = cls;
584 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
586 "DEFAULT_IDENTIFIER",
589 if (0 != strcmp (id, rc->old_name))
594 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
596 "DEFAULT_IDENTIFIER",
603 * Handler for RENAME message from client, creates
607 * @param client who sent the message
608 * @param message the message received
611 handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client,
612 const struct GNUNET_MessageHeader *message)
614 const struct GNUNET_IDENTITY_RenameMessage *rm;
616 uint16_t old_name_len;
617 uint16_t new_name_len;
619 const char *old_name;
620 const char *new_name;
621 struct RenameContext rename_ctx;
625 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
626 "Received RENAME message from client\n");
627 size = ntohs (message->size);
628 if (size <= sizeof (struct GNUNET_IDENTITY_RenameMessage))
631 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
634 rm = (const struct GNUNET_IDENTITY_RenameMessage *) message;
635 old_name_len = ntohs (rm->old_name_len);
636 new_name_len = ntohs (rm->new_name_len);
637 old_name = (const char *) &rm[1];
638 new_name = &old_name[old_name_len];
639 if ( (old_name_len + new_name_len + sizeof (struct GNUNET_IDENTITY_RenameMessage) != size) ||
640 ('\0' != old_name[old_name_len - 1]) ||
641 ('\0' != new_name[new_name_len - 1]) )
644 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
648 /* check if new name is already in use */
649 for (ego = ego_head; NULL != ego; ego = ego->next)
651 if (0 == strcmp (ego->identifier,
654 send_result_code (client, 1, gettext_noop ("target name already exists"));
655 GNUNET_SERVER_receive_done (client, GNUNET_OK);
660 /* locate old name and, if found, perform rename */
661 for (ego = ego_head; NULL != ego; ego = ego->next)
663 if (0 == strcmp (ego->identifier,
666 fn_old = get_ego_filename (ego);
667 GNUNET_free (ego->identifier);
668 rename_ctx.old_name = old_name;
669 rename_ctx.new_name = new_name;
670 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
674 GNUNET_CONFIGURATION_write (subsystem_cfg,
676 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
677 _("Failed to write subsystem default identifier map to `%s'.\n"),
679 ego->identifier = GNUNET_strdup (new_name);
680 fn_new = get_ego_filename (ego);
681 if (0 != RENAME (fn_old, fn_new))
682 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old);
683 GNUNET_free (fn_old);
684 GNUNET_free (fn_new);
685 notify_listeners (ego);
686 send_result_code (client, 0, NULL);
687 GNUNET_SERVER_receive_done (client, GNUNET_OK);
692 /* failed to locate old name */
693 send_result_code (client, 1, gettext_noop ("no matching ego found"));
694 GNUNET_SERVER_receive_done (client, GNUNET_OK);
699 * An ego was removed, remove it from all subsystems where it is
700 * currently set as the default.
702 * @param cls name of the removed ego (const char *)
703 * @param section a section in the configuration to process
706 handle_ego_delete (void *cls,
709 const char *identifier = cls;
713 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
715 "DEFAULT_IDENTIFIER",
718 if (0 != strcmp (id, identifier))
723 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
725 "DEFAULT_IDENTIFIER",
732 * Handler for DELETE message from client, creates
736 * @param client who sent the message
737 * @param message the message received
740 handle_delete_message (void *cls, struct GNUNET_SERVER_Client *client,
741 const struct GNUNET_MessageHeader *message)
743 const struct GNUNET_IDENTITY_DeleteMessage *dm;
750 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
751 "Received DELETE message from client\n");
752 size = ntohs (message->size);
753 if (size <= sizeof (struct GNUNET_IDENTITY_DeleteMessage))
756 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
759 dm = (const struct GNUNET_IDENTITY_DeleteMessage *) message;
760 name = (const char *) &dm[1];
761 name_len = ntohs (dm->name_len);
762 if ( (name_len + sizeof (struct GNUNET_IDENTITY_DeleteMessage) != size) ||
763 (0 != ntohs (dm->reserved)) ||
764 ('\0' != name[name_len - 1]) )
767 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
770 for (ego = ego_head; NULL != ego; ego = ego->next)
772 if (0 == strcmp (ego->identifier,
775 GNUNET_CONTAINER_DLL_remove (ego_head,
778 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
782 GNUNET_CONFIGURATION_write (subsystem_cfg,
784 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
785 _("Failed to write subsystem default identifier map to `%s'.\n"),
787 fn = get_ego_filename (ego);
788 if (0 != UNLINK (fn))
789 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
791 GNUNET_free (ego->identifier);
792 ego->identifier = NULL;
793 notify_listeners (ego);
794 GNUNET_CRYPTO_ecc_key_free (ego->pk);
796 send_result_code (client, 0, NULL);
797 GNUNET_SERVER_receive_done (client, GNUNET_OK);
802 send_result_code (client, 1, gettext_noop ("no matching ego found"));
803 GNUNET_SERVER_receive_done (client, GNUNET_OK);
808 * Process the given file from the "EGODIR". Parses the file
809 * and creates the respective 'struct Ego' in memory.
812 * @param filename name of the file to parse
813 * @return GNUNET_OK to continue to iterate,
814 * GNUNET_NO to stop iteration with no error,
815 * GNUNET_SYSERR to abort iteration with error!
818 process_ego_file (void *cls,
819 const char *filename)
824 fn = strrchr (filename, (int) DIR_SEPARATOR);
830 ego = GNUNET_new (struct Ego);
831 ego->pk = GNUNET_CRYPTO_ecc_key_create_from_file (filename);
835 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
836 _("Failed to parse ego information in `%s'\n"),
841 ego->identifier = GNUNET_strdup (fn);
842 GNUNET_CONTAINER_DLL_insert (ego_head,
850 * Handle network size estimate clients.
853 * @param server the initialized server
854 * @param c configuration to use
858 struct GNUNET_SERVER_Handle *server,
859 const struct GNUNET_CONFIGURATION_Handle *c)
861 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
862 {&handle_start_message, NULL,
863 GNUNET_MESSAGE_TYPE_IDENTITY_START, sizeof (struct GNUNET_MessageHeader)},
864 {&handle_get_default_message, NULL,
865 GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT, 0},
866 {&handle_set_default_message, NULL,
867 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, 0},
868 {&handle_create_message, NULL,
869 GNUNET_MESSAGE_TYPE_IDENTITY_CREATE, 0},
870 {&handle_rename_message, NULL,
871 GNUNET_MESSAGE_TYPE_IDENTITY_RENAME, 0},
872 {&handle_delete_message, NULL,
873 GNUNET_MESSAGE_TYPE_IDENTITY_DELETE, 0},
879 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
883 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "EGODIR");
884 GNUNET_SCHEDULER_shutdown ();
888 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
890 &subsystem_cfg_file))
892 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "SUBSYSTEM_CFG");
893 GNUNET_SCHEDULER_shutdown ();
896 subsystem_cfg = GNUNET_CONFIGURATION_create ();
898 GNUNET_DISK_file_test (subsystem_cfg_file)) &&
900 GNUNET_CONFIGURATION_parse (subsystem_cfg,
901 subsystem_cfg_file)) )
903 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
904 _("Failed to parse subsystem identity configuration file `%s'\n"),
906 GNUNET_SCHEDULER_shutdown ();
909 stats = GNUNET_STATISTICS_create ("identity", cfg);
910 GNUNET_SERVER_add_handlers (server, handlers);
911 nc = GNUNET_SERVER_notification_context_create (server, 1);
912 GNUNET_DISK_directory_scan (ego_directory,
915 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
921 * The main function for the network size estimation service.
923 * @param argc number of arguments from the command line
924 * @param argv command line arguments
925 * @return 0 ok, 1 on error
928 main (int argc, char *const *argv)
931 GNUNET_SERVICE_run (argc, argv, "identity",
932 GNUNET_SERVICE_OPTION_NONE,
933 &run, NULL)) ? 0 : 1;
937 /* end of gnunet-service-identity.c */