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.
31 * - auto-initialze default egos; maybe trigger default
32 * initializations (such as gnunet-gns-import.sh?)
35 #include "gnunet_util_lib.h"
36 #include "gnunet_constants.h"
37 #include "gnunet_protocols.h"
38 #include "gnunet_statistics_service.h"
39 #include "gnunet_identity_service.h"
44 * Information we keep about each ego.
50 * We keep egos in a DLL.
55 * We keep egos in a DLL.
60 * Private key of the ego.
62 struct GNUNET_CRYPTO_EccPrivateKey *pk;
65 * String identifier for the ego.
73 * Handle to our current configuration.
75 static const struct GNUNET_CONFIGURATION_Handle *cfg;
78 * Handle to subsystem configuration which for each subsystem contains
79 * the name of the default ego.
81 static struct GNUNET_CONFIGURATION_Handle *subsystem_cfg;
84 * Handle to the statistics service.
86 static struct GNUNET_STATISTICS_Handle *stats;
89 * Notification context, simplifies client broadcasts.
91 static struct GNUNET_SERVER_NotificationContext *nc;
94 * Directory where we store the identities.
96 static char *ego_directory;
99 * Configuration file name where subsystem information is kept.
101 static char *subsystem_cfg_file;
104 * Head of DLL of all egos.
106 static struct Ego *ego_head;
109 * Tail of DLL of all egos.
111 static struct Ego *ego_tail;
115 * Get the name of the file we use to store a given ego.
117 * @param ego ego for which we need the filename
118 * @return full filename for the given ego
121 get_ego_filename (struct Ego *ego)
125 GNUNET_asprintf (&filename,
135 * Task run during shutdown.
141 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
147 GNUNET_SERVER_notification_context_destroy (nc);
152 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
155 GNUNET_CONFIGURATION_destroy (subsystem_cfg);
156 subsystem_cfg = NULL;
157 GNUNET_free (subsystem_cfg_file);
158 subsystem_cfg_file = NULL;
159 GNUNET_free (ego_directory);
160 ego_directory = NULL;
161 while (NULL != (e = ego_head))
163 GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, e);
164 GNUNET_CRYPTO_ecc_key_free (e->pk);
171 * Send a result code back to the client.
173 * @param client client that should receive the result code
174 * @param result_code code to transmit
175 * @param emsg error message to include (or NULL for none)
178 send_result_code (struct GNUNET_SERVER_Client *client,
179 uint32_t result_code,
182 struct GNUNET_IDENTITY_ResultCodeMessage *rcm;
188 elen = strlen (emsg) + 1;
189 rcm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
190 rcm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE);
191 rcm->header.size = htons (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
192 rcm->result_code = htonl (result_code);
193 memcpy (&rcm[1], emsg, elen);
194 GNUNET_SERVER_notification_context_unicast (nc, client, &rcm->header, GNUNET_YES);
200 * Create an update message with information about the current state of an ego.
202 * @param ego ego to create message for
203 * @return corresponding update message
205 static struct GNUNET_IDENTITY_UpdateMessage *
206 create_update_message (struct Ego *ego)
208 struct GNUNET_IDENTITY_UpdateMessage *um;
212 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc;
214 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
215 enc = GNUNET_CRYPTO_ecc_encode_key (ego->pk);
216 pk_len = ntohs (enc->size);
217 um = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + pk_len + name_len);
218 um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
219 um->header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + pk_len + name_len);
220 um->name_len = htons (name_len);
221 um->pk_len = htons (pk_len);
222 str = (char *) &um[1];
223 memcpy (str, enc, pk_len);
224 memcpy (&str[pk_len], ego->identifier, name_len);
231 * Create a set default message with information about the current state of an ego.
233 * @param ego ego to create message for
234 * @param servicename name of the service to provide in the message
235 * @return corresponding set default message
237 static struct GNUNET_IDENTITY_SetDefaultMessage *
238 create_set_default_message (struct Ego *ego,
239 const char *servicename)
241 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
245 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc;
247 name_len = (NULL == servicename) ? 0 : (strlen (servicename) + 1);
248 enc = GNUNET_CRYPTO_ecc_encode_key (ego->pk);
249 pk_len = ntohs (enc->size);
250 sdm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + pk_len + name_len);
251 sdm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
252 sdm->header.size = htons (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + pk_len + name_len);
253 sdm->name_len = htons (name_len);
254 sdm->pk_len = htons (pk_len);
255 str = (char *) &sdm[1];
256 memcpy (str, enc, pk_len);
257 memcpy (&str[pk_len], servicename, name_len);
264 * Handler for START message from client, sends information
265 * about all identities to the client immediately and
266 * adds the client to the notification context for future
270 * @param client who sent the message
271 * @param message the message received
274 handle_start_message (void *cls, struct GNUNET_SERVER_Client *client,
275 const struct GNUNET_MessageHeader *message)
277 struct GNUNET_IDENTITY_UpdateMessage *um;
278 struct GNUNET_IDENTITY_UpdateMessage ume;
281 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
282 "Received START message from client\n");
283 GNUNET_SERVER_notification_context_add (nc, client);
284 for (ego = ego_head; NULL != ego; ego = ego->next)
286 um = create_update_message (ego);
287 GNUNET_SERVER_notification_context_unicast (nc, client, &um->header, GNUNET_YES);
290 ume.header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
291 ume.header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage));
292 ume.pk_len = htons (0);
293 ume.name_len = htons (0);
294 GNUNET_SERVER_notification_context_unicast (nc, client, &ume.header, GNUNET_YES);
295 GNUNET_SERVER_receive_done (client, GNUNET_OK);
300 * Handler for GET_DEFAULT message from client, returns
301 * default identity for some service.
304 * @param client who sent the message
305 * @param message the message received
308 handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client,
309 const struct GNUNET_MessageHeader *message)
311 const struct GNUNET_IDENTITY_GetDefaultMessage *gdm;
312 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
319 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
320 "Received GET_DEFAULT message from client\n");
321 size = ntohs (message->size);
322 if (size <= sizeof (struct GNUNET_IDENTITY_GetDefaultMessage))
325 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
328 gdm = (const struct GNUNET_IDENTITY_GetDefaultMessage *) message;
329 name = (const char *) &gdm[1];
330 name_len = ntohs (gdm->name_len);
331 if ( (name_len + sizeof (struct GNUNET_IDENTITY_GetDefaultMessage) != size) ||
332 (0 != ntohs (gdm->reserved)) ||
333 ('\0' != name[name_len - 1]) )
336 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
340 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
342 "DEFAULT_IDENTIFIER",
345 send_result_code (client, 1, gettext_noop ("no default known"));
346 GNUNET_SERVER_receive_done (client, GNUNET_OK);
349 for (ego = ego_head; NULL != ego; ego = ego->next)
351 if (0 == strcmp (ego->identifier,
354 sdm = create_set_default_message (ego,
356 GNUNET_SERVER_notification_context_broadcast (nc, &sdm->header, GNUNET_YES);
358 GNUNET_SERVER_receive_done (client, GNUNET_OK);
362 send_result_code (client, 1,
363 gettext_noop ("default configured, but ego unknown (internal error)"));
364 GNUNET_SERVER_receive_done (client, GNUNET_OK);
369 * Compare the given two private keys for equality.
371 * @param pk1 one private key
372 * @param pk2 another private key
373 * @return 0 if the keys are equal
376 key_cmp (const struct GNUNET_CRYPTO_EccPrivateKey *pk1,
377 const struct GNUNET_CRYPTO_EccPrivateKey *pk2)
379 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded p1;
380 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded p2;
382 GNUNET_CRYPTO_ecc_key_get_public (pk1, &p1);
383 GNUNET_CRYPTO_ecc_key_get_public (pk2, &p2);
384 return memcmp (&p1, &p2, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded));
389 * Handler for SET_DEFAULT message from client, updates
390 * default identity for some service.
393 * @param client who sent the message
394 * @param message the message received
397 handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client,
398 const struct GNUNET_MessageHeader *message)
400 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
406 struct GNUNET_CRYPTO_EccPrivateKey *pk;
408 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
409 "Received SET_DEFAULT message from client\n");
410 size = ntohs (message->size);
411 if (size <= sizeof (struct GNUNET_IDENTITY_SetDefaultMessage))
414 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
417 sdm = (const struct GNUNET_IDENTITY_SetDefaultMessage *) message;
418 name_len = ntohs (sdm->name_len);
419 pk_len = ntohs (sdm->pk_len);
420 str = (const char *) &sdm[1];
421 if ( (name_len + pk_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) != size) ||
422 (NULL == (pk = GNUNET_CRYPTO_ecc_decode_key (str, pk_len, GNUNET_YES))) )
425 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
429 if ('\0' != str[name_len - 1])
432 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
435 for (ego = ego_head; NULL != ego; ego = ego->next)
437 if (0 == key_cmp (ego->pk,
440 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
442 "DEFAULT_IDENTIFIER",
445 GNUNET_CONFIGURATION_write (subsystem_cfg,
447 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
448 _("Failed to write subsystem default identifier map to `%s'.\n"),
450 send_result_code (client, 0, NULL);
451 GNUNET_SERVER_receive_done (client, GNUNET_OK);
452 GNUNET_CRYPTO_ecc_key_free (pk);
456 send_result_code (client, 1, _("Unknown ego specified for service (internal error)"));
457 GNUNET_SERVER_receive_done (client, GNUNET_OK);
458 GNUNET_CRYPTO_ecc_key_free (pk);
463 * Send an updated message for the given ego to all listeners.
465 * @param ego ego to send the update for
468 notify_listeners (struct Ego *ego)
470 struct GNUNET_IDENTITY_UpdateMessage *um;
472 um = create_update_message (ego);
473 GNUNET_SERVER_notification_context_broadcast (nc, &um->header, GNUNET_YES);
479 * Handler for CREATE message from client, creates
483 * @param client who sent the message
484 * @param message the message received
487 handle_create_message (void *cls, struct GNUNET_SERVER_Client *client,
488 const struct GNUNET_MessageHeader *message)
490 const struct GNUNET_IDENTITY_CreateRequestMessage *crm;
497 struct GNUNET_CRYPTO_EccPrivateKey *pk;
500 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
501 "Received CREATE message from client\n");
502 size = ntohs (message->size);
503 if (size <= sizeof (struct GNUNET_IDENTITY_CreateRequestMessage))
506 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
509 crm = (const struct GNUNET_IDENTITY_CreateRequestMessage *) message;
510 name_len = ntohs (crm->name_len);
511 pk_len = ntohs (crm->pk_len);
512 pks = (const char *) &crm[1];
513 if ( (name_len + pk_len + sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) != size) ||
514 (NULL == (pk = GNUNET_CRYPTO_ecc_decode_key (pks, pk_len, GNUNET_YES))) )
517 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
521 if ('\0' != str[name_len - 1])
524 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
527 for (ego = ego_head; NULL != ego; ego = ego->next)
529 if (0 == strcmp (ego->identifier,
532 send_result_code (client, 1, gettext_noop ("identifier already in use for another ego"));
533 GNUNET_SERVER_receive_done (client, GNUNET_OK);
534 GNUNET_CRYPTO_ecc_key_free (pk);
538 ego = GNUNET_new (struct Ego);
540 ego->identifier = GNUNET_strdup (str);
541 GNUNET_CONTAINER_DLL_insert (ego_head,
544 send_result_code (client, 0, NULL);
545 fn = get_ego_filename (ego);
546 (void) GNUNET_DISK_directory_create_for_file (fn);
548 GNUNET_DISK_fn_write (fn, pks, pk_len,
549 GNUNET_DISK_PERM_USER_READ |
550 GNUNET_DISK_PERM_USER_WRITE))
551 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
554 notify_listeners (ego);
555 GNUNET_SERVER_receive_done (client, GNUNET_OK);
560 * Closure for 'handle_ego_rename'.
567 const char *old_name;
572 const char *new_name;
577 * An ego was renamed; rename it in all subsystems where it is
578 * currently set as the default.
580 * @param cls the 'struct RenameContext'
581 * @param section a section in the configuration to process
584 handle_ego_rename (void *cls,
587 struct RenameContext *rc = cls;
591 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
593 "DEFAULT_IDENTIFIER",
596 if (0 != strcmp (id, rc->old_name))
601 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
603 "DEFAULT_IDENTIFIER",
610 * Handler for RENAME message from client, creates
614 * @param client who sent the message
615 * @param message the message received
618 handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client,
619 const struct GNUNET_MessageHeader *message)
621 const struct GNUNET_IDENTITY_RenameMessage *rm;
623 uint16_t old_name_len;
624 uint16_t new_name_len;
626 const char *old_name;
627 const char *new_name;
628 struct RenameContext rename_ctx;
632 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
633 "Received RENAME message from client\n");
634 size = ntohs (message->size);
635 if (size <= sizeof (struct GNUNET_IDENTITY_RenameMessage))
638 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
641 rm = (const struct GNUNET_IDENTITY_RenameMessage *) message;
642 old_name_len = ntohs (rm->old_name_len);
643 new_name_len = ntohs (rm->new_name_len);
644 old_name = (const char *) &rm[1];
645 new_name = &old_name[old_name_len];
646 if ( (old_name_len + new_name_len + sizeof (struct GNUNET_IDENTITY_RenameMessage) != size) ||
647 ('\0' != old_name[old_name_len - 1]) ||
648 ('\0' != new_name[new_name_len - 1]) )
651 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
655 /* check if new name is already in use */
656 for (ego = ego_head; NULL != ego; ego = ego->next)
658 if (0 == strcmp (ego->identifier,
661 send_result_code (client, 1, gettext_noop ("target name already exists"));
662 GNUNET_SERVER_receive_done (client, GNUNET_OK);
667 /* locate old name and, if found, perform rename */
668 for (ego = ego_head; NULL != ego; ego = ego->next)
670 if (0 == strcmp (ego->identifier,
673 fn_old = get_ego_filename (ego);
674 GNUNET_free (ego->identifier);
675 rename_ctx.old_name = old_name;
676 rename_ctx.new_name = new_name;
677 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
681 GNUNET_CONFIGURATION_write (subsystem_cfg,
683 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
684 _("Failed to write subsystem default identifier map to `%s'.\n"),
686 ego->identifier = GNUNET_strdup (new_name);
687 fn_new = get_ego_filename (ego);
688 if (0 != RENAME (fn_old, fn_new))
689 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old);
690 GNUNET_free (fn_old);
691 GNUNET_free (fn_new);
692 notify_listeners (ego);
693 send_result_code (client, 0, NULL);
694 GNUNET_SERVER_receive_done (client, GNUNET_OK);
699 /* failed to locate old name */
700 send_result_code (client, 1, gettext_noop ("no matching ego found"));
701 GNUNET_SERVER_receive_done (client, GNUNET_OK);
706 * An ego was removed, remove it from all subsystems where it is
707 * currently set as the default.
709 * @param cls name of the removed ego (const char *)
710 * @param section a section in the configuration to process
713 handle_ego_delete (void *cls,
716 const char *identifier = cls;
720 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
722 "DEFAULT_IDENTIFIER",
725 if (0 != strcmp (id, identifier))
730 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
732 "DEFAULT_IDENTIFIER",
739 * Handler for DELETE message from client, creates
743 * @param client who sent the message
744 * @param message the message received
747 handle_delete_message (void *cls, struct GNUNET_SERVER_Client *client,
748 const struct GNUNET_MessageHeader *message)
750 const struct GNUNET_IDENTITY_DeleteMessage *dm;
757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
758 "Received DELETE message from client\n");
759 size = ntohs (message->size);
760 if (size <= sizeof (struct GNUNET_IDENTITY_DeleteMessage))
763 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
766 dm = (const struct GNUNET_IDENTITY_DeleteMessage *) message;
767 name = (const char *) &dm[1];
768 name_len = ntohs (dm->name_len);
769 if ( (name_len + sizeof (struct GNUNET_IDENTITY_DeleteMessage) != size) ||
770 (0 != ntohs (dm->reserved)) ||
771 ('\0' != name[name_len - 1]) )
774 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
777 for (ego = ego_head; NULL != ego; ego = ego->next)
779 if (0 == strcmp (ego->identifier,
782 GNUNET_CONTAINER_DLL_remove (ego_head,
785 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
789 GNUNET_CONFIGURATION_write (subsystem_cfg,
791 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
792 _("Failed to write subsystem default identifier map to `%s'.\n"),
794 fn = get_ego_filename (ego);
795 if (0 != UNLINK (fn))
796 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
798 GNUNET_free (ego->identifier);
799 ego->identifier = NULL;
800 notify_listeners (ego);
801 GNUNET_CRYPTO_ecc_key_free (ego->pk);
803 send_result_code (client, 0, NULL);
804 GNUNET_SERVER_receive_done (client, GNUNET_OK);
809 send_result_code (client, 1, gettext_noop ("no matching ego found"));
810 GNUNET_SERVER_receive_done (client, GNUNET_OK);
815 * Process the given file from the "EGODIR". Parses the file
816 * and creates the respective 'struct Ego' in memory.
819 * @param filename name of the file to parse
820 * @return GNUNET_OK to continue to iterate,
821 * GNUNET_NO to stop iteration with no error,
822 * GNUNET_SYSERR to abort iteration with error!
825 process_ego_file (void *cls,
826 const char *filename)
831 fn = strrchr (filename, (int) DIR_SEPARATOR);
837 ego = GNUNET_new (struct Ego);
838 ego->pk = GNUNET_CRYPTO_ecc_key_create_from_file (filename);
842 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
843 _("Failed to parse ego information in `%s'\n"),
848 ego->identifier = GNUNET_strdup (fn);
849 GNUNET_CONTAINER_DLL_insert (ego_head,
857 * Handle network size estimate clients.
860 * @param server the initialized server
861 * @param c configuration to use
865 struct GNUNET_SERVER_Handle *server,
866 const struct GNUNET_CONFIGURATION_Handle *c)
868 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
869 {&handle_start_message, NULL,
870 GNUNET_MESSAGE_TYPE_IDENTITY_START, sizeof (struct GNUNET_MessageHeader)},
871 {&handle_get_default_message, NULL,
872 GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT, 0},
873 {&handle_set_default_message, NULL,
874 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, 0},
875 {&handle_create_message, NULL,
876 GNUNET_MESSAGE_TYPE_IDENTITY_CREATE, 0},
877 {&handle_rename_message, NULL,
878 GNUNET_MESSAGE_TYPE_IDENTITY_RENAME, 0},
879 {&handle_delete_message, NULL,
880 GNUNET_MESSAGE_TYPE_IDENTITY_DELETE, 0},
886 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
890 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "EGODIR");
891 GNUNET_SCHEDULER_shutdown ();
895 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
897 &subsystem_cfg_file))
899 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "SUBSYSTEM_CFG");
900 GNUNET_SCHEDULER_shutdown ();
903 subsystem_cfg = GNUNET_CONFIGURATION_create ();
905 GNUNET_DISK_file_test (subsystem_cfg_file)) &&
907 GNUNET_CONFIGURATION_parse (subsystem_cfg,
908 subsystem_cfg_file)) )
910 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
911 _("Failed to parse subsystem identity configuration file `%s'\n"),
913 GNUNET_SCHEDULER_shutdown ();
916 stats = GNUNET_STATISTICS_create ("identity", cfg);
917 GNUNET_SERVER_add_handlers (server, handlers);
918 nc = GNUNET_SERVER_notification_context_create (server, 1);
919 GNUNET_DISK_directory_scan (ego_directory,
922 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
928 * The main function for the network size estimation service.
930 * @param argc number of arguments from the command line
931 * @param argv command line arguments
932 * @return 0 ok, 1 on error
935 main (int argc, char *const *argv)
938 GNUNET_SERVICE_run (argc, argv, "identity",
939 GNUNET_SERVICE_OPTION_NONE,
940 &run, NULL)) ? 0 : 1;
944 /* end of gnunet-service-identity.c */