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/>.
20 * @file identity/gnunet-service-identity.c
21 * @brief identity management service
22 * @author Christian Grothoff
24 * The purpose of this service is to manage private keys that
25 * represent the various egos/pseudonyms/identities of a GNUnet user.
28 * - auto-initialze default egos; maybe trigger default
29 * initializations (such as gnunet-gns-import.sh?)
32 #include "gnunet_util_lib.h"
33 #include "gnunet_constants.h"
34 #include "gnunet_protocols.h"
35 #include "gnunet_statistics_service.h"
36 #include "gnunet_identity_service.h"
41 * Information we keep about each ego.
47 * We keep egos in a DLL.
52 * We keep egos in a DLL.
57 * Private key of the ego.
59 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
62 * String identifier for the ego.
70 * Handle to our current configuration.
72 static const struct GNUNET_CONFIGURATION_Handle *cfg;
75 * Handle to subsystem configuration which for each subsystem contains
76 * the name of the default ego.
78 static struct GNUNET_CONFIGURATION_Handle *subsystem_cfg;
81 * Handle to the statistics service.
83 static struct GNUNET_STATISTICS_Handle *stats;
86 * Notification context, simplifies client broadcasts.
88 static struct GNUNET_NotificationContext *nc;
91 * Directory where we store the identities.
93 static char *ego_directory;
96 * Configuration file name where subsystem information is kept.
98 static char *subsystem_cfg_file;
101 * Head of DLL of all egos.
103 static struct Ego *ego_head;
106 * Tail of DLL of all egos.
108 static struct Ego *ego_tail;
112 * Get the name of the file we use to store a given ego.
114 * @param ego ego for which we need the filename
115 * @return full filename for the given ego
118 get_ego_filename (struct Ego *ego)
122 GNUNET_asprintf (&filename,
131 * Called whenever a client is disconnected.
134 * @param client identification of the client
135 * @param app_ctx @a client
138 client_disconnect_cb (void *cls,
139 struct GNUNET_SERVICE_Client *client,
142 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
143 "Client %p disconnected\n",
149 * Add a client to our list of active clients.
152 * @param client client to add
153 * @param mq message queue for @a client
154 * @return internal namestore client structure for this client
157 client_connect_cb (void *cls,
158 struct GNUNET_SERVICE_Client *client,
159 struct GNUNET_MQ_Handle *mq)
165 * Task run during shutdown.
170 shutdown_task (void *cls)
176 GNUNET_notification_context_destroy (nc);
181 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
184 GNUNET_CONFIGURATION_destroy (subsystem_cfg);
185 subsystem_cfg = NULL;
186 GNUNET_free (subsystem_cfg_file);
187 subsystem_cfg_file = NULL;
188 GNUNET_free (ego_directory);
189 ego_directory = NULL;
190 while (NULL != (e = ego_head))
192 GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, e);
194 GNUNET_free (e->identifier);
201 * Send a result code back to the client.
203 * @param client client that should receive the result code
204 * @param result_code code to transmit
205 * @param emsg error message to include (or NULL for none)
208 send_result_code (struct GNUNET_SERVICE_Client *client,
209 uint32_t result_code,
212 struct ResultCodeMessage *rcm;
213 struct GNUNET_MQ_Envelope *env;
219 elen = strlen (emsg) + 1;
220 env = GNUNET_MQ_msg_extra (rcm,
222 GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE);
223 rcm->result_code = htonl (result_code);
225 GNUNET_memcpy (&rcm[1], emsg, elen);
226 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
227 "Sending result %d (%s) to client\n",
230 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
235 * Create an update message with information about the current state of an ego.
237 * @param ego ego to create message for
238 * @return corresponding update message
240 static struct GNUNET_MQ_Envelope *
241 create_update_message (struct Ego *ego)
243 struct UpdateMessage *um;
244 struct GNUNET_MQ_Envelope *env;
247 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
248 env = GNUNET_MQ_msg_extra (um,
250 GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
251 um->name_len = htons (name_len);
252 um->end_of_list = htons (GNUNET_NO);
253 um->private_key = *ego->pk;
254 GNUNET_memcpy (&um[1], ego->identifier, name_len);
260 * Create a set default message with information about the current state of an ego.
262 * @param ego ego to create message for
263 * @param servicename name of the service to provide in the message
264 * @return corresponding set default message
266 static struct GNUNET_MQ_Envelope *
267 create_set_default_message (struct Ego *ego,
268 const char *servicename)
270 struct SetDefaultMessage *sdm;
271 struct GNUNET_MQ_Envelope *env;
274 name_len = (NULL == servicename) ? 0 : (strlen (servicename) + 1);
275 env = GNUNET_MQ_msg_extra (sdm,
277 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
278 sdm->name_len = htons (name_len);
279 sdm->reserved = htons (0);
280 sdm->private_key = *ego->pk;
281 GNUNET_memcpy (&sdm[1], servicename, name_len);
287 * Handler for START message from client, sends information
288 * about all identities to the client immediately and
289 * adds the client to the notification context for future
293 * @param client who sent the message
294 * @param message the message received
297 handle_start_message (void *cls,
298 const struct GNUNET_MessageHeader *message)
300 struct UpdateMessage *ume;
301 struct GNUNET_SERVICE_Client *client = cls;
302 struct GNUNET_MQ_Envelope *env;
305 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
306 "Received START message from client\n");
307 GNUNET_SERVICE_client_mark_monitor (client);
308 GNUNET_SERVICE_client_disable_continue_warning (client);
309 GNUNET_notification_context_add (nc,
310 GNUNET_SERVICE_client_get_mq(client));
311 for (ego = ego_head; NULL != ego; ego = ego->next)
313 env = create_update_message (ego);
314 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq(client), env);
316 env = GNUNET_MQ_msg_extra (ume,
318 GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
319 ume->end_of_list = htons (GNUNET_YES);
320 ume->name_len = htons (0);
321 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq(client), env);
322 GNUNET_SERVICE_client_continue (client);
326 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT message
328 * @param cls client sending the message
329 * @param msg message of type `struct GetDefaultMessage`
330 * @return #GNUNET_OK if @a msg is well-formed
333 check_get_default_message (void *cls,
334 const struct GetDefaultMessage *msg)
340 size = ntohs (msg->header.size);
341 if (size <= sizeof (struct GetDefaultMessage))
344 return GNUNET_SYSERR;
346 name = (const char *) &msg[1];
347 name_len = ntohs (msg->name_len);
348 if ( (name_len + sizeof (struct GetDefaultMessage) != size) ||
349 (0 != ntohs (msg->reserved)) ||
350 ('\0' != name[name_len - 1]) )
353 return GNUNET_SYSERR;
360 * Handler for GET_DEFAULT message from client, returns
361 * default identity for some service.
364 * @param client who sent the message
365 * @param message the message received
368 handle_get_default_message (void *cls,
369 const struct GetDefaultMessage *gdm)
371 struct GNUNET_MQ_Envelope *env;
372 struct GNUNET_SERVICE_Client *client = cls;
378 name = GNUNET_strdup ((const char *) &gdm[1]);
379 GNUNET_STRINGS_utf8_tolower ((const char *) &gdm[1], name);
380 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
381 "Received GET_DEFAULT for service `%s' from client\n",
384 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
386 "DEFAULT_IDENTIFIER",
389 send_result_code (client, 1, gettext_noop ("no default known"));
390 GNUNET_SERVICE_client_continue (client);
394 for (ego = ego_head; NULL != ego; ego = ego->next)
396 if (0 == strcmp (ego->identifier,
399 env = create_set_default_message (ego,
401 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
402 GNUNET_SERVICE_client_continue (client);
403 GNUNET_free (identifier);
408 GNUNET_free (identifier);
409 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
410 "Failed to find ego `%s'\n",
413 send_result_code (client, 1,
414 gettext_noop ("default configured, but ego unknown (internal error)"));
415 GNUNET_SERVICE_client_continue (client);
420 * Compare the given two private keys for equality.
422 * @param pk1 one private key
423 * @param pk2 another private key
424 * @return 0 if the keys are equal
427 key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1,
428 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2)
430 return memcmp (pk1, pk2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
434 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT message
436 * @param cls client sending the message
437 * @param msg message of type `struct SetDefaultMessage`
438 * @return #GNUNET_OK if @a msg is well-formed
441 check_set_default_message (void *cls,
442 const struct SetDefaultMessage *msg)
448 size = ntohs (msg->header.size);
449 if (size <= sizeof (struct SetDefaultMessage))
452 return GNUNET_SYSERR;
454 name_len = ntohs (msg->name_len);
455 GNUNET_break (0 == ntohs (msg->reserved));
456 if (name_len + sizeof (struct SetDefaultMessage) != size)
459 return GNUNET_SYSERR;
461 str = (const char *) &msg[1];
462 if ('\0' != str[name_len - 1])
465 return GNUNET_SYSERR;
471 * Handler for SET_DEFAULT message from client, updates
472 * default identity for some service.
475 * @param client who sent the message
476 * @param message the message received
479 handle_set_default_message (void *cls,
480 const struct SetDefaultMessage *sdm)
483 struct GNUNET_SERVICE_Client *client = cls;
486 str = GNUNET_strdup ((const char *) &sdm[1]);
487 GNUNET_STRINGS_utf8_tolower ((const char *) &sdm[1], str);
489 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
490 "Received SET_DEFAULT for service `%s' from client\n",
492 for (ego = ego_head; NULL != ego; ego = ego->next)
494 if (0 == key_cmp (ego->pk,
497 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
499 "DEFAULT_IDENTIFIER",
502 GNUNET_CONFIGURATION_write (subsystem_cfg,
504 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
505 _("Failed to write subsystem default identifier map to `%s'.\n"),
507 send_result_code (client, 0, NULL);
508 GNUNET_SERVICE_client_continue (client);
513 send_result_code (client, 1, _("Unknown ego specified for service (internal error)"));
515 GNUNET_SERVICE_client_continue (client);
520 * Send an updated message for the given ego to all listeners.
522 * @param ego ego to send the update for
525 notify_listeners (struct Ego *ego)
527 struct UpdateMessage *um;
530 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
531 um = GNUNET_malloc (sizeof (struct UpdateMessage) + name_len);
532 um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
533 um->header.size = htons (sizeof (struct UpdateMessage) + name_len);
534 um->name_len = htons (name_len);
535 um->end_of_list = htons (GNUNET_NO);
536 um->private_key = *ego->pk;
537 GNUNET_memcpy (&um[1], ego->identifier, name_len);
538 GNUNET_notification_context_broadcast (nc,
545 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_CREATE message
547 * @param cls client sending the message
548 * @param msg message of type `struct CreateRequestMessage`
549 * @return #GNUNET_OK if @a msg is well-formed
552 check_create_message (void *cls,
553 const struct CreateRequestMessage *msg)
560 size = ntohs (msg->header.size);
561 if (size <= sizeof (struct CreateRequestMessage))
564 return GNUNET_SYSERR;
566 name_len = ntohs (msg->name_len);
567 GNUNET_break (0 == ntohs (msg->reserved));
568 if (name_len + sizeof (struct CreateRequestMessage) != size)
571 return GNUNET_SYSERR;
573 str = (const char *) &msg[1];
574 if ('\0' != str[name_len - 1])
577 return GNUNET_SYSERR;
583 * Handler for CREATE message from client, creates
587 * @param client who sent the message
588 * @param message the message received
591 handle_create_message (void *cls,
592 const struct CreateRequestMessage *crm)
594 struct GNUNET_SERVICE_Client *client = cls;
599 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
600 "Received CREATE message from client\n");
601 str = GNUNET_strdup ((const char *) &crm[1]);
602 GNUNET_STRINGS_utf8_tolower ((const char *) &crm[1], str);
603 for (ego = ego_head; NULL != ego; ego = ego->next)
605 if (0 == strcmp (ego->identifier,
608 send_result_code (client, 1, gettext_noop ("identifier already in use for another ego"));
609 GNUNET_SERVICE_client_continue (client);
614 ego = GNUNET_new (struct Ego);
615 ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
616 *ego->pk = crm->private_key;
617 ego->identifier = GNUNET_strdup (str);
618 GNUNET_CONTAINER_DLL_insert (ego_head,
621 send_result_code (client, 0, NULL);
622 fn = get_ego_filename (ego);
623 (void) GNUNET_DISK_directory_create_for_file (fn);
624 if (sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) !=
625 GNUNET_DISK_fn_write (fn,
627 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey),
628 GNUNET_DISK_PERM_USER_READ |
629 GNUNET_DISK_PERM_USER_WRITE))
630 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
634 notify_listeners (ego);
635 GNUNET_SERVICE_client_continue (client);
640 * Closure for 'handle_ego_rename'.
647 const char *old_name;
652 const char *new_name;
656 * An ego was renamed; rename it in all subsystems where it is
657 * currently set as the default.
659 * @param cls the 'struct RenameContext'
660 * @param section a section in the configuration to process
663 handle_ego_rename (void *cls,
666 struct RenameContext *rc = cls;
670 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
672 "DEFAULT_IDENTIFIER",
675 if (0 != strcmp (id, rc->old_name))
680 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
682 "DEFAULT_IDENTIFIER",
688 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_RENAME message
690 * @param cls client sending the message
691 * @param msg message of type `struct RenameMessage`
692 * @return #GNUNET_OK if @a msg is well-formed
695 check_rename_message (void *cls,
696 const struct RenameMessage *msg)
699 uint16_t old_name_len;
700 uint16_t new_name_len;
701 const char *old_name;
702 const char *new_name;
704 size = ntohs (msg->header.size);
705 if (size <= sizeof (struct RenameMessage))
708 return GNUNET_SYSERR;
710 old_name_len = ntohs (msg->old_name_len);
711 new_name_len = ntohs (msg->new_name_len);
712 old_name = (const char *) &msg[1];
713 new_name = &old_name[old_name_len];
714 if ( (old_name_len + new_name_len + sizeof (struct RenameMessage) != size) ||
715 ('\0' != old_name[old_name_len - 1]) ||
716 ('\0' != new_name[new_name_len - 1]) )
719 return GNUNET_SYSERR;
727 * Handler for RENAME message from client, creates
731 * @param client who sent the message
732 * @param message the message received
735 handle_rename_message (void *cls,
736 const struct RenameMessage *rm)
738 uint16_t old_name_len;
742 struct RenameContext rename_ctx;
743 struct GNUNET_SERVICE_Client *client = cls;
746 const char *old_name_tmp;
748 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
749 "Received RENAME message from client\n");
750 old_name_len = ntohs (rm->old_name_len);
751 old_name_tmp = (const char *) &rm[1];
752 old_name = GNUNET_strdup (old_name_tmp);
753 GNUNET_STRINGS_utf8_tolower (old_name_tmp, old_name);
754 new_name = GNUNET_strdup (&old_name_tmp[old_name_len]);
755 GNUNET_STRINGS_utf8_tolower (&old_name_tmp[old_name_len], old_name);
757 /* check if new name is already in use */
758 for (ego = ego_head; NULL != ego; ego = ego->next)
760 if (0 == strcmp (ego->identifier,
763 send_result_code (client, 1, gettext_noop ("target name already exists"));
764 GNUNET_SERVICE_client_continue (client);
765 GNUNET_free (old_name);
766 GNUNET_free (new_name);
771 /* locate old name and, if found, perform rename */
772 for (ego = ego_head; NULL != ego; ego = ego->next)
774 if (0 == strcmp (ego->identifier,
777 fn_old = get_ego_filename (ego);
778 GNUNET_free (ego->identifier);
779 rename_ctx.old_name = old_name;
780 rename_ctx.new_name = new_name;
781 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
785 GNUNET_CONFIGURATION_write (subsystem_cfg,
787 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
788 _("Failed to write subsystem default identifier map to `%s'.\n"),
790 ego->identifier = GNUNET_strdup (new_name);
791 fn_new = get_ego_filename (ego);
792 if (0 != RENAME (fn_old, fn_new))
793 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old);
794 GNUNET_free (fn_old);
795 GNUNET_free (fn_new);
796 GNUNET_free (old_name);
797 GNUNET_free (new_name);
798 notify_listeners (ego);
799 send_result_code (client, 0, NULL);
800 GNUNET_SERVICE_client_continue (client);
805 /* failed to locate old name */
806 send_result_code (client, 1, gettext_noop ("no matching ego found"));
807 GNUNET_free (old_name);
808 GNUNET_free (new_name);
809 GNUNET_SERVICE_client_continue (client);
814 * An ego was removed, remove it from all subsystems where it is
815 * currently set as the default.
817 * @param cls name of the removed ego (const char *)
818 * @param section a section in the configuration to process
821 handle_ego_delete (void *cls,
824 const char *identifier = cls;
828 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
830 "DEFAULT_IDENTIFIER",
833 if (0 != strcmp (id, identifier))
838 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
840 "DEFAULT_IDENTIFIER",
846 * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_DELETE message
848 * @param cls client sending the message
849 * @param msg message of type `struct DeleteMessage`
850 * @return #GNUNET_OK if @a msg is well-formed
853 check_delete_message (void *cls,
854 const struct DeleteMessage *msg)
860 size = ntohs (msg->header.size);
861 if (size <= sizeof (struct DeleteMessage))
864 return GNUNET_SYSERR;
866 name = (const char *) &msg[1];
867 name_len = ntohs (msg->name_len);
868 if ( (name_len + sizeof (struct DeleteMessage) != size) ||
869 (0 != ntohs (msg->reserved)) ||
870 ('\0' != name[name_len - 1]) )
873 return GNUNET_SYSERR;
880 * Handler for DELETE message from client, creates
884 * @param client who sent the message
885 * @param message the message received
888 handle_delete_message (void *cls,
889 const struct DeleteMessage *dm)
894 struct GNUNET_SERVICE_Client *client = cls;
896 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
897 "Received DELETE message from client\n");
898 name = GNUNET_strdup ((const char *) &dm[1]);
899 GNUNET_STRINGS_utf8_tolower ((const char *) &dm[1], name);
901 for (ego = ego_head; NULL != ego; ego = ego->next)
903 if (0 == strcmp (ego->identifier,
906 GNUNET_CONTAINER_DLL_remove (ego_head,
909 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
913 GNUNET_CONFIGURATION_write (subsystem_cfg,
915 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
916 _("Failed to write subsystem default identifier map to `%s'.\n"),
918 fn = get_ego_filename (ego);
919 if (0 != UNLINK (fn))
920 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
922 GNUNET_free (ego->identifier);
923 ego->identifier = NULL;
924 notify_listeners (ego);
925 GNUNET_free (ego->pk);
928 send_result_code (client, 0, NULL);
929 GNUNET_SERVICE_client_continue (client);
934 send_result_code (client, 1, gettext_noop ("no matching ego found"));
936 GNUNET_SERVICE_client_continue (client);
941 * Process the given file from the "EGODIR". Parses the file
942 * and creates the respective 'struct Ego' in memory.
945 * @param filename name of the file to parse
946 * @return #GNUNET_OK to continue to iterate,
947 * #GNUNET_NO to stop iteration with no error,
948 * #GNUNET_SYSERR to abort iteration with error!
951 process_ego_file (void *cls,
952 const char *filename)
957 fn = strrchr (filename, (int) DIR_SEPARATOR);
963 ego = GNUNET_new (struct Ego);
964 ego->pk = GNUNET_CRYPTO_ecdsa_key_create_from_file (filename);
968 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
969 _("Failed to parse ego information in `%s'\n"),
973 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
976 ego->identifier = GNUNET_strdup (fn + 1);
977 GNUNET_CONTAINER_DLL_insert (ego_head,
985 * Handle network size estimate clients.
988 * @param server the initialized server
989 * @param c configuration to use
993 const struct GNUNET_CONFIGURATION_Handle *c,
994 struct GNUNET_SERVICE_Handle *service)
997 nc = GNUNET_notification_context_create (1);
999 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
1003 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "EGODIR");
1004 GNUNET_SCHEDULER_shutdown ();
1008 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
1010 &subsystem_cfg_file))
1012 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "SUBSYSTEM_CFG");
1013 GNUNET_SCHEDULER_shutdown ();
1016 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1017 "Loading subsystem configuration `%s'\n",
1018 subsystem_cfg_file);
1019 subsystem_cfg = GNUNET_CONFIGURATION_create ();
1021 GNUNET_DISK_file_test (subsystem_cfg_file)) &&
1023 GNUNET_CONFIGURATION_parse (subsystem_cfg,
1024 subsystem_cfg_file)) )
1026 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1027 _("Failed to parse subsystem identity configuration file `%s'\n"),
1028 subsystem_cfg_file);
1029 GNUNET_SCHEDULER_shutdown ();
1032 stats = GNUNET_STATISTICS_create ("identity", cfg);
1034 GNUNET_DISK_directory_create (ego_directory))
1036 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1037 _("Failed to create directory `%s' for storing egos\n"),
1040 GNUNET_DISK_directory_scan (ego_directory,
1043 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
1049 * Define "main" method using service macro.
1053 GNUNET_SERVICE_OPTION_NONE,
1056 &client_disconnect_cb,
1058 GNUNET_MQ_hd_fixed_size (start_message,
1059 GNUNET_MESSAGE_TYPE_IDENTITY_START,
1060 struct GNUNET_MessageHeader,
1062 GNUNET_MQ_hd_var_size (get_default_message,
1063 GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT,
1064 struct GetDefaultMessage,
1066 GNUNET_MQ_hd_var_size (set_default_message,
1067 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT,
1068 struct SetDefaultMessage,
1070 GNUNET_MQ_hd_var_size (create_message,
1071 GNUNET_MESSAGE_TYPE_IDENTITY_CREATE,
1072 struct CreateRequestMessage,
1074 GNUNET_MQ_hd_var_size (rename_message,
1075 GNUNET_MESSAGE_TYPE_IDENTITY_RENAME,
1076 struct RenameMessage,
1078 GNUNET_MQ_hd_var_size (delete_message,
1079 GNUNET_MESSAGE_TYPE_IDENTITY_DELETE,
1080 struct DeleteMessage,
1082 GNUNET_MQ_handler_end());
1086 /* end of gnunet-service-identity.c */