2 This file is part of GNUnet.
3 Copyright (C) 2013 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
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 * - auto-initialze default egos; maybe trigger default
31 * initializations (such as gnunet-gns-import.sh?)
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_EcdsaPrivateKey *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_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,
133 * Called whenever a client is disconnected.
136 * @param client identification of the client
137 * @param app_ctx @a client
140 client_disconnect_cb (void *cls,
141 struct GNUNET_SERVICE_Client *client,
144 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
145 "Client %p disconnected\n",
151 * Add a client to our list of active clients.
154 * @param client client to add
155 * @param mq message queue for @a client
156 * @return internal namestore client structure for this client
159 client_connect_cb (void *cls,
160 struct GNUNET_SERVICE_Client *client,
161 struct GNUNET_MQ_Handle *mq)
167 * Task run during shutdown.
172 shutdown_task (void *cls)
178 GNUNET_notification_context_destroy (nc);
183 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
186 GNUNET_CONFIGURATION_destroy (subsystem_cfg);
187 subsystem_cfg = NULL;
188 GNUNET_free (subsystem_cfg_file);
189 subsystem_cfg_file = NULL;
190 GNUNET_free (ego_directory);
191 ego_directory = NULL;
192 while (NULL != (e = ego_head))
194 GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, e);
196 GNUNET_free (e->identifier);
203 * Send a result code back to the client.
205 * @param client client that should receive the result code
206 * @param result_code code to transmit
207 * @param emsg error message to include (or NULL for none)
210 send_result_code (struct GNUNET_SERVICE_Client *client,
211 uint32_t result_code,
214 struct ResultCodeMessage *rcm;
215 struct GNUNET_MQ_Envelope *env;
221 elen = strlen (emsg) + 1;
222 env = GNUNET_MQ_msg_extra (rcm,
224 GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE);
225 rcm->result_code = htonl (result_code);
227 GNUNET_memcpy (&rcm[1], emsg, elen);
228 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
229 "Sending result %d (%s) to client\n",
232 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
237 * Create an update message with information about the current state of an ego.
239 * @param ego ego to create message for
240 * @return corresponding update message
242 static struct GNUNET_MQ_Envelope *
243 create_update_message (struct Ego *ego)
245 struct UpdateMessage *um;
246 struct GNUNET_MQ_Envelope *env;
249 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
250 env = GNUNET_MQ_msg_extra (um,
252 GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
253 um->name_len = htons (name_len);
254 um->end_of_list = htons (GNUNET_NO);
255 um->private_key = *ego->pk;
256 GNUNET_memcpy (&um[1], ego->identifier, name_len);
262 * Create a set default message with information about the current state of an ego.
264 * @param ego ego to create message for
265 * @param servicename name of the service to provide in the message
266 * @return corresponding set default message
268 static struct GNUNET_MQ_Envelope *
269 create_set_default_message (struct Ego *ego,
270 const char *servicename)
272 struct SetDefaultMessage *sdm;
273 struct GNUNET_MQ_Envelope *env;
276 name_len = (NULL == servicename) ? 0 : (strlen (servicename) + 1);
277 env = GNUNET_MQ_msg_extra (sdm,
279 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
280 sdm->name_len = htons (name_len);
281 sdm->reserved = htons (0);
282 sdm->private_key = *ego->pk;
283 GNUNET_memcpy (&sdm[1], servicename, name_len);
289 * Handler for START message from client, sends information
290 * about all identities to the client immediately and
291 * adds the client to the notification context for future
295 * @param client who sent the message
296 * @param message the message received
299 handle_start_message (void *cls,
300 const struct GNUNET_MessageHeader *message)
302 struct UpdateMessage *ume;
303 struct GNUNET_SERVICE_Client *client = cls;
304 struct GNUNET_MQ_Envelope *env;
307 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
308 "Received START message from client\n");
309 GNUNET_SERVICE_client_mark_monitor (client);
310 GNUNET_SERVICE_client_disable_continue_warning (client);
311 GNUNET_notification_context_add (nc,
312 GNUNET_SERVICE_client_get_mq(client));
313 for (ego = ego_head; NULL != ego; ego = ego->next)
315 env = create_update_message (ego);
316 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq(client), env);
318 env = GNUNET_MQ_msg_extra (ume,
320 GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
321 ume->end_of_list = htons (GNUNET_YES);
322 ume->name_len = htons (0);
323 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq(client), env);
324 GNUNET_SERVICE_client_continue (client);
328 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT message
330 * @param cls client sending the message
331 * @param msg message of type `struct GetDefaultMessage`
332 * @return #GNUNET_OK if @a msg is well-formed
335 check_get_default_message (void *cls,
336 const struct GetDefaultMessage *msg)
342 size = ntohs (msg->header.size);
343 if (size <= sizeof (struct GetDefaultMessage))
346 return GNUNET_SYSERR;
348 name = (const char *) &msg[1];
349 name_len = ntohs (msg->name_len);
350 if ( (name_len + sizeof (struct GetDefaultMessage) != size) ||
351 (0 != ntohs (msg->reserved)) ||
352 ('\0' != name[name_len - 1]) )
355 return GNUNET_SYSERR;
362 * Handler for GET_DEFAULT message from client, returns
363 * default identity for some service.
366 * @param client who sent the message
367 * @param message the message received
370 handle_get_default_message (void *cls,
371 const struct GetDefaultMessage *gdm)
373 struct GNUNET_MQ_Envelope *env;
374 struct GNUNET_SERVICE_Client *client = cls;
380 name = GNUNET_strdup ((const char *) &gdm[1]);
381 GNUNET_STRINGS_utf8_tolower ((const char *) &gdm[1], name);
382 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
383 "Received GET_DEFAULT for service `%s' from client\n",
386 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
388 "DEFAULT_IDENTIFIER",
391 send_result_code (client, 1, gettext_noop ("no default known"));
392 GNUNET_SERVICE_client_continue (client);
396 for (ego = ego_head; NULL != ego; ego = ego->next)
398 if (0 == strcmp (ego->identifier,
401 env = create_set_default_message (ego,
403 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
404 GNUNET_SERVICE_client_continue (client);
405 GNUNET_free (identifier);
410 GNUNET_free (identifier);
411 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
412 "Failed to find ego `%s'\n",
415 send_result_code (client, 1,
416 gettext_noop ("default configured, but ego unknown (internal error)"));
417 GNUNET_SERVICE_client_continue (client);
422 * Compare the given two private keys for equality.
424 * @param pk1 one private key
425 * @param pk2 another private key
426 * @return 0 if the keys are equal
429 key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1,
430 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2)
432 return memcmp (pk1, pk2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
436 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT message
438 * @param cls client sending the message
439 * @param msg message of type `struct SetDefaultMessage`
440 * @return #GNUNET_OK if @a msg is well-formed
443 check_set_default_message (void *cls,
444 const struct SetDefaultMessage *msg)
450 size = ntohs (msg->header.size);
451 if (size <= sizeof (struct SetDefaultMessage))
454 return GNUNET_SYSERR;
456 name_len = ntohs (msg->name_len);
457 GNUNET_break (0 == ntohs (msg->reserved));
458 if (name_len + sizeof (struct SetDefaultMessage) != size)
461 return GNUNET_SYSERR;
463 str = (const char *) &msg[1];
464 if ('\0' != str[name_len - 1])
467 return GNUNET_SYSERR;
473 * Handler for SET_DEFAULT message from client, updates
474 * default identity for some service.
477 * @param client who sent the message
478 * @param message the message received
481 handle_set_default_message (void *cls,
482 const struct SetDefaultMessage *sdm)
485 struct GNUNET_SERVICE_Client *client = cls;
488 str = GNUNET_strdup ((const char *) &sdm[1]);
489 GNUNET_STRINGS_utf8_tolower ((const char *) &sdm[1], str);
491 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
492 "Received SET_DEFAULT for service `%s' from client\n",
494 for (ego = ego_head; NULL != ego; ego = ego->next)
496 if (0 == key_cmp (ego->pk,
499 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
501 "DEFAULT_IDENTIFIER",
504 GNUNET_CONFIGURATION_write (subsystem_cfg,
506 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
507 _("Failed to write subsystem default identifier map to `%s'.\n"),
509 send_result_code (client, 0, NULL);
510 GNUNET_SERVICE_client_continue (client);
515 send_result_code (client, 1, _("Unknown ego specified for service (internal error)"));
517 GNUNET_SERVICE_client_continue (client);
522 * Send an updated message for the given ego to all listeners.
524 * @param ego ego to send the update for
527 notify_listeners (struct Ego *ego)
529 struct UpdateMessage *um;
532 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
533 um = GNUNET_malloc (sizeof (struct UpdateMessage) + name_len);
534 um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
535 um->header.size = htons (sizeof (struct UpdateMessage) + name_len);
536 um->name_len = htons (name_len);
537 um->end_of_list = htons (GNUNET_NO);
538 um->private_key = *ego->pk;
539 GNUNET_memcpy (&um[1], ego->identifier, name_len);
540 GNUNET_notification_context_broadcast (nc,
547 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_CREATE message
549 * @param cls client sending the message
550 * @param msg message of type `struct CreateRequestMessage`
551 * @return #GNUNET_OK if @a msg is well-formed
554 check_create_message (void *cls,
555 const struct CreateRequestMessage *msg)
562 size = ntohs (msg->header.size);
563 if (size <= sizeof (struct CreateRequestMessage))
566 return GNUNET_SYSERR;
568 name_len = ntohs (msg->name_len);
569 GNUNET_break (0 == ntohs (msg->reserved));
570 if (name_len + sizeof (struct CreateRequestMessage) != size)
573 return GNUNET_SYSERR;
575 str = (const char *) &msg[1];
576 if ('\0' != str[name_len - 1])
579 return GNUNET_SYSERR;
585 * Handler for CREATE message from client, creates
589 * @param client who sent the message
590 * @param message the message received
593 handle_create_message (void *cls,
594 const struct CreateRequestMessage *crm)
596 struct GNUNET_SERVICE_Client *client = cls;
601 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
602 "Received CREATE message from client\n");
603 str = GNUNET_strdup ((const char *) &crm[1]);
604 GNUNET_STRINGS_utf8_tolower ((const char *) &crm[1], str);
605 for (ego = ego_head; NULL != ego; ego = ego->next)
607 if (0 == strcmp (ego->identifier,
610 send_result_code (client, 1, gettext_noop ("identifier already in use for another ego"));
611 GNUNET_SERVICE_client_continue (client);
616 ego = GNUNET_new (struct Ego);
617 ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
618 *ego->pk = crm->private_key;
619 ego->identifier = GNUNET_strdup (str);
620 GNUNET_CONTAINER_DLL_insert (ego_head,
623 send_result_code (client, 0, NULL);
624 fn = get_ego_filename (ego);
625 (void) GNUNET_DISK_directory_create_for_file (fn);
626 if (sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) !=
627 GNUNET_DISK_fn_write (fn,
629 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey),
630 GNUNET_DISK_PERM_USER_READ |
631 GNUNET_DISK_PERM_USER_WRITE))
632 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
636 notify_listeners (ego);
637 GNUNET_SERVICE_client_continue (client);
642 * Closure for 'handle_ego_rename'.
649 const char *old_name;
654 const char *new_name;
658 * An ego was renamed; rename it in all subsystems where it is
659 * currently set as the default.
661 * @param cls the 'struct RenameContext'
662 * @param section a section in the configuration to process
665 handle_ego_rename (void *cls,
668 struct RenameContext *rc = cls;
672 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
674 "DEFAULT_IDENTIFIER",
677 if (0 != strcmp (id, rc->old_name))
682 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
684 "DEFAULT_IDENTIFIER",
690 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_RENAME message
692 * @param cls client sending the message
693 * @param msg message of type `struct RenameMessage`
694 * @return #GNUNET_OK if @a msg is well-formed
697 check_rename_message (void *cls,
698 const struct RenameMessage *msg)
701 uint16_t old_name_len;
702 uint16_t new_name_len;
703 const char *old_name;
704 const char *new_name;
706 size = ntohs (msg->header.size);
707 if (size <= sizeof (struct RenameMessage))
710 return GNUNET_SYSERR;
712 old_name_len = ntohs (msg->old_name_len);
713 new_name_len = ntohs (msg->new_name_len);
714 old_name = (const char *) &msg[1];
715 new_name = &old_name[old_name_len];
716 if ( (old_name_len + new_name_len + sizeof (struct RenameMessage) != size) ||
717 ('\0' != old_name[old_name_len - 1]) ||
718 ('\0' != new_name[new_name_len - 1]) )
721 return GNUNET_SYSERR;
729 * Handler for RENAME message from client, creates
733 * @param client who sent the message
734 * @param message the message received
737 handle_rename_message (void *cls,
738 const struct RenameMessage *rm)
740 uint16_t old_name_len;
744 struct RenameContext rename_ctx;
745 struct GNUNET_SERVICE_Client *client = cls;
748 const char *old_name_tmp;
750 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
751 "Received RENAME message from client\n");
752 old_name_len = ntohs (rm->old_name_len);
753 old_name_tmp = (const char *) &rm[1];
754 old_name = GNUNET_strdup (old_name_tmp);
755 GNUNET_STRINGS_utf8_tolower (old_name_tmp, old_name);
756 new_name = GNUNET_strdup (&old_name_tmp[old_name_len]);
757 GNUNET_STRINGS_utf8_tolower (&old_name_tmp[old_name_len], new_name);
759 /* check if new name is already in use */
760 for (ego = ego_head; NULL != ego; ego = ego->next)
762 if (0 == strcmp (ego->identifier,
765 send_result_code (client, 1, gettext_noop ("target name already exists"));
766 GNUNET_SERVICE_client_continue (client);
767 GNUNET_free (old_name);
768 GNUNET_free (new_name);
773 /* locate old name and, if found, perform rename */
774 for (ego = ego_head; NULL != ego; ego = ego->next)
776 if (0 == strcmp (ego->identifier,
779 fn_old = get_ego_filename (ego);
780 GNUNET_free (ego->identifier);
781 rename_ctx.old_name = old_name;
782 rename_ctx.new_name = new_name;
783 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
787 GNUNET_CONFIGURATION_write (subsystem_cfg,
789 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
790 _("Failed to write subsystem default identifier map to `%s'.\n"),
792 ego->identifier = GNUNET_strdup (new_name);
793 fn_new = get_ego_filename (ego);
794 if (0 != RENAME (fn_old, fn_new))
795 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old);
796 GNUNET_free (fn_old);
797 GNUNET_free (fn_new);
798 GNUNET_free (old_name);
799 GNUNET_free (new_name);
800 notify_listeners (ego);
801 send_result_code (client, 0, NULL);
802 GNUNET_SERVICE_client_continue (client);
807 /* failed to locate old name */
808 send_result_code (client, 1, gettext_noop ("no matching ego found"));
809 GNUNET_free (old_name);
810 GNUNET_free (new_name);
811 GNUNET_SERVICE_client_continue (client);
816 * An ego was removed, remove it from all subsystems where it is
817 * currently set as the default.
819 * @param cls name of the removed ego (const char *)
820 * @param section a section in the configuration to process
823 handle_ego_delete (void *cls,
826 const char *identifier = cls;
830 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
832 "DEFAULT_IDENTIFIER",
835 if (0 != strcmp (id, identifier))
840 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
842 "DEFAULT_IDENTIFIER",
848 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_DELETE message
850 * @param cls client sending the message
851 * @param msg message of type `struct DeleteMessage`
852 * @return #GNUNET_OK if @a msg is well-formed
855 check_delete_message (void *cls,
856 const struct DeleteMessage *msg)
862 size = ntohs (msg->header.size);
863 if (size <= sizeof (struct DeleteMessage))
866 return GNUNET_SYSERR;
868 name = (const char *) &msg[1];
869 name_len = ntohs (msg->name_len);
870 if ( (name_len + sizeof (struct DeleteMessage) != size) ||
871 (0 != ntohs (msg->reserved)) ||
872 ('\0' != name[name_len - 1]) )
875 return GNUNET_SYSERR;
882 * Handler for DELETE message from client, creates
886 * @param client who sent the message
887 * @param message the message received
890 handle_delete_message (void *cls,
891 const struct DeleteMessage *dm)
896 struct GNUNET_SERVICE_Client *client = cls;
898 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
899 "Received DELETE message from client\n");
900 name = GNUNET_strdup ((const char *) &dm[1]);
901 GNUNET_STRINGS_utf8_tolower ((const char *) &dm[1], name);
903 for (ego = ego_head; NULL != ego; ego = ego->next)
905 if (0 == strcmp (ego->identifier,
908 GNUNET_CONTAINER_DLL_remove (ego_head,
911 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
915 GNUNET_CONFIGURATION_write (subsystem_cfg,
917 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
918 _("Failed to write subsystem default identifier map to `%s'.\n"),
920 fn = get_ego_filename (ego);
921 if (0 != UNLINK (fn))
922 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
924 GNUNET_free (ego->identifier);
925 ego->identifier = NULL;
926 notify_listeners (ego);
927 GNUNET_free (ego->pk);
930 send_result_code (client, 0, NULL);
931 GNUNET_SERVICE_client_continue (client);
936 send_result_code (client, 1, gettext_noop ("no matching ego found"));
938 GNUNET_SERVICE_client_continue (client);
943 * Process the given file from the "EGODIR". Parses the file
944 * and creates the respective 'struct Ego' in memory.
947 * @param filename name of the file to parse
948 * @return #GNUNET_OK to continue to iterate,
949 * #GNUNET_NO to stop iteration with no error,
950 * #GNUNET_SYSERR to abort iteration with error!
953 process_ego_file (void *cls,
954 const char *filename)
959 fn = strrchr (filename, (int) DIR_SEPARATOR);
965 ego = GNUNET_new (struct Ego);
966 ego->pk = GNUNET_CRYPTO_ecdsa_key_create_from_file (filename);
970 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
971 _("Failed to parse ego information in `%s'\n"),
975 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
978 ego->identifier = GNUNET_strdup (fn + 1);
979 GNUNET_CONTAINER_DLL_insert (ego_head,
987 * Handle network size estimate clients.
990 * @param server the initialized server
991 * @param c configuration to use
995 const struct GNUNET_CONFIGURATION_Handle *c,
996 struct GNUNET_SERVICE_Handle *service)
999 nc = GNUNET_notification_context_create (1);
1001 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
1005 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "EGODIR");
1006 GNUNET_SCHEDULER_shutdown ();
1010 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
1012 &subsystem_cfg_file))
1014 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "SUBSYSTEM_CFG");
1015 GNUNET_SCHEDULER_shutdown ();
1018 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1019 "Loading subsystem configuration `%s'\n",
1020 subsystem_cfg_file);
1021 subsystem_cfg = GNUNET_CONFIGURATION_create ();
1023 GNUNET_DISK_file_test (subsystem_cfg_file)) &&
1025 GNUNET_CONFIGURATION_parse (subsystem_cfg,
1026 subsystem_cfg_file)) )
1028 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1029 _("Failed to parse subsystem identity configuration file `%s'\n"),
1030 subsystem_cfg_file);
1031 GNUNET_SCHEDULER_shutdown ();
1034 stats = GNUNET_STATISTICS_create ("identity", cfg);
1036 GNUNET_DISK_directory_create (ego_directory))
1038 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1039 _("Failed to create directory `%s' for storing egos\n"),
1042 GNUNET_DISK_directory_scan (ego_directory,
1045 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
1051 * Define "main" method using service macro.
1055 GNUNET_SERVICE_OPTION_NONE,
1058 &client_disconnect_cb,
1060 GNUNET_MQ_hd_fixed_size (start_message,
1061 GNUNET_MESSAGE_TYPE_IDENTITY_START,
1062 struct GNUNET_MessageHeader,
1064 GNUNET_MQ_hd_var_size (get_default_message,
1065 GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT,
1066 struct GetDefaultMessage,
1068 GNUNET_MQ_hd_var_size (set_default_message,
1069 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT,
1070 struct SetDefaultMessage,
1072 GNUNET_MQ_hd_var_size (create_message,
1073 GNUNET_MESSAGE_TYPE_IDENTITY_CREATE,
1074 struct CreateRequestMessage,
1076 GNUNET_MQ_hd_var_size (rename_message,
1077 GNUNET_MESSAGE_TYPE_IDENTITY_RENAME,
1078 struct RenameMessage,
1080 GNUNET_MQ_hd_var_size (delete_message,
1081 GNUNET_MESSAGE_TYPE_IDENTITY_DELETE,
1082 struct DeleteMessage,
1084 GNUNET_MQ_handler_end());
1088 /* end of gnunet-service-identity.c */