GNUnet 0.22.2
gnunet-service-identity.c File Reference

identity management service More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_statistics_service.h"
#include "identity.h"
Include dependency graph for gnunet-service-identity.c:

Go to the source code of this file.

Data Structures

struct  Ego
 Information we keep about each ego. More...
 
struct  RenameContext
 Closure for 'handle_ego_rename'. More...
 

Functions

static char * get_ego_filename (struct Ego *ego)
 Get the name of the file we use to store a given ego. More...
 
static void client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx)
 Called whenever a client is disconnected. More...
 
static void * client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
 Add a client to our list of active clients. More...
 
static void shutdown_task (void *cls)
 Task run during shutdown. More...
 
static void send_result_code (struct GNUNET_SERVICE_Client *client, uint32_t result_code)
 Send a result code back to the client. More...
 
static struct GNUNET_MQ_Envelopecreate_update_message (struct Ego *ego)
 Create an update message with information about the current state of an ego. More...
 
static void handle_start_message (void *cls, const struct GNUNET_MessageHeader *message)
 Handler for START message from client, sends information about all identities to the client immediately and adds the client to the notification context for future updates. More...
 
static int check_lookup_message (void *cls, const struct LookupMessage *message)
 Handler for LOOKUP message from client, sends information about ONE identity to the client immediately. More...
 
static void handle_lookup_message (void *cls, const struct LookupMessage *message)
 Handler for LOOKUP message from client, sends information about ONE identity to the client immediately. More...
 
static int check_lookup_by_suffix_message (void *cls, const struct LookupMessage *message)
 Handler for LOOKUP message from client, sends information about ONE identity to the client immediately. More...
 
static void handle_lookup_by_suffix_message (void *cls, const struct LookupMessage *message)
 Handler for LOOKUP_BY_SUFFIX message from client, sends information about ONE identity to the client immediately. More...
 
static void notify_listeners (struct Ego *ego)
 Send an updated message for the given ego to all listeners. More...
 
static int check_create_message (void *cls, const struct CreateRequestMessage *msg)
 Checks a GNUNET_MESSAGE_TYPE_IDENTITY_CREATE message. More...
 
static void handle_create_message (void *cls, const struct CreateRequestMessage *crm)
 Handler for CREATE message from client, creates new identity. More...
 
static void handle_ego_rename (void *cls, const char *section)
 An ego was renamed; rename it in all subsystems where it is currently set as the default. More...
 
static int check_rename_message (void *cls, const struct RenameMessage *msg)
 Checks a GNUNET_MESSAGE_TYPE_IDENTITY_RENAME message. More...
 
static void handle_rename_message (void *cls, const struct RenameMessage *rm)
 Handler for RENAME message from client, creates new identity. More...
 
static void handle_ego_delete (void *cls, const char *section)
 An ego was removed, remove it from all subsystems where it is currently set as the default. More...
 
static int check_delete_message (void *cls, const struct DeleteMessage *msg)
 Checks a GNUNET_MESSAGE_TYPE_IDENTITY_DELETE message. More...
 
static void handle_delete_message (void *cls, const struct DeleteMessage *dm)
 Handler for DELETE message from client, creates new identity. More...
 
static int read_from_file (const char *filename, void *buf, size_t buf_size)
 
static int process_ego_file (void *cls, const char *filename)
 Process the given file from the "EGODIR". More...
 
static void run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *service)
 Handle network size estimate clients. More...
 
 GNUNET_SERVICE_MAIN (GNUNET_OS_project_data_gnunet(), "identity", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_fixed_size(start_message, GNUNET_MESSAGE_TYPE_IDENTITY_START, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_var_size(lookup_message, GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP, struct LookupMessage, NULL), GNUNET_MQ_hd_var_size(lookup_by_suffix_message, GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP_BY_SUFFIX, struct LookupMessage, NULL), GNUNET_MQ_hd_var_size(create_message, GNUNET_MESSAGE_TYPE_IDENTITY_CREATE, struct CreateRequestMessage, NULL), GNUNET_MQ_hd_var_size(rename_message, GNUNET_MESSAGE_TYPE_IDENTITY_RENAME, struct RenameMessage, NULL), GNUNET_MQ_hd_var_size(delete_message, GNUNET_MESSAGE_TYPE_IDENTITY_DELETE, struct DeleteMessage, NULL), GNUNET_MQ_handler_end())
 Define "main" method using service macro. More...
 

Variables

static const struct GNUNET_CONFIGURATION_Handlecfg
 Handle to our current configuration. More...
 
static struct GNUNET_CONFIGURATION_Handlesubsystem_cfg
 Handle to subsystem configuration which for each subsystem contains the name of the default ego. More...
 
static struct GNUNET_STATISTICS_Handlestats
 Handle to the statistics service. More...
 
static struct GNUNET_NotificationContextnc
 Notification context, simplifies client broadcasts. More...
 
static char * ego_directory
 Directory where we store the identities. More...
 
static char * subsystem_cfg_file
 Configuration file name where subsystem information is kept. More...
 
static struct Egoego_head
 Head of DLL of all egos. More...
 
static struct Egoego_tail
 Tail of DLL of all egos. More...
 

Detailed Description

identity management service

Author
Christian Grothoff

The purpose of this service is to manage private keys that represent the various egos/pseudonyms/identities of a GNUnet user.

Todo:

  • auto-initialze default egos; maybe trigger default initializations (such as gnunet-gns-import.sh?)

Definition in file gnunet-service-identity.c.

Function Documentation

◆ get_ego_filename()

static char * get_ego_filename ( struct Ego ego)
static

Get the name of the file we use to store a given ego.

Parameters
egoego for which we need the filename
Returns
full filename for the given ego

Definition at line 116 of file gnunet-service-identity.c.

117{
118 char *filename;
119
121 "%s%s%s",
124 ego->identifier);
125 return filename;
126}
static char * filename
static char * ego_directory
Directory where we store the identities.
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define DIR_SEPARATOR_STR
Definition: platform.h:166
char * identifier
String identifier for the ego.

References DIR_SEPARATOR_STR, ego_directory, filename, GNUNET_asprintf(), and Ego::identifier.

Referenced by handle_create_message(), handle_delete_message(), and handle_rename_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ client_disconnect_cb()

static void client_disconnect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
void *  app_ctx 
)
static

Called whenever a client is disconnected.

Parameters
clsclosure
clientidentification of the client
app_ctxclient

Definition at line 137 of file gnunet-service-identity.c.

140{
142 "Client %p disconnected\n",
143 client);
144}
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_DEBUG

References GNUNET_ERROR_TYPE_DEBUG, and GNUNET_log.

◆ client_connect_cb()

static void * client_connect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
struct GNUNET_MQ_Handle mq 
)
static

Add a client to our list of active clients.

Parameters
clsNULL
clientclient to add
mqmessage queue for client
Returns
internal namestore client structure for this client

Definition at line 156 of file gnunet-service-identity.c.

159{
160 return client;
161}

◆ shutdown_task()

static void shutdown_task ( void *  cls)
static

Task run during shutdown.

Parameters
clsunused

Definition at line 170 of file gnunet-service-identity.c.

171{
172 struct Ego *e;
173
174 if (NULL != nc)
175 {
177 nc = NULL;
178 }
179 if (NULL != stats)
180 {
182 stats = NULL;
183 }
185 subsystem_cfg = NULL;
187 subsystem_cfg_file = NULL;
189 ego_directory = NULL;
190 while (NULL != (e = ego_head))
191 {
193 ego_tail,
194 e);
196 GNUNET_free (e);
197 }
198}
static struct Ego * ego_tail
Tail of DLL of all egos.
static struct GNUNET_STATISTICS_Handle * stats
Handle to the statistics service.
static struct GNUNET_NotificationContext * nc
Notification context, simplifies client broadcasts.
static char * subsystem_cfg_file
Configuration file name where subsystem information is kept.
static struct Ego * ego_head
Head of DLL of all egos.
static struct GNUNET_CONFIGURATION_Handle * subsystem_cfg
Handle to subsystem configuration which for each subsystem contains the name of the default ego.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
@ GNUNET_NO
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_notification_context_destroy(struct GNUNET_NotificationContext *nc)
Destroy the context, force disconnect for all subscribers.
Definition: nc.c:138
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
Information we keep about each ego.

References ego_directory, ego_head, ego_tail, GNUNET_CONFIGURATION_destroy(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NO, GNUNET_notification_context_destroy(), GNUNET_STATISTICS_destroy(), Ego::identifier, nc, stats, subsystem_cfg, and subsystem_cfg_file.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_result_code()

static void send_result_code ( struct GNUNET_SERVICE_Client client,
uint32_t  result_code 
)
static

Send a result code back to the client.

Parameters
clientclient that should receive the result code
result_codecode to transmit

Definition at line 208 of file gnunet-service-identity.c.

210{
211 struct ResultCodeMessage *rcm;
212 struct GNUNET_MQ_Envelope *env;
213
214 env =
216 rcm->result_code = htonl (result_code);
218 "Sending result %d (%s) to client\n",
219 (int) result_code,
220 GNUNET_ErrorCode_get_hint (result_code));
222}
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:305
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:76
#define GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE
Generic response from identity service with success and/or error message.
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2500
const char * GNUNET_ErrorCode_get_hint(enum GNUNET_ErrorCode ec)
Returns a hint for a given error code.
Answer from service to client about last operation; GET_DEFAULT maybe answered with this message on f...
Definition: identity.h:81
uint32_t result_code
Status code for the last operation, in NBO.
Definition: identity.h:91

References env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ErrorCode_get_hint(), GNUNET_log, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_get_mq(), and ResultCodeMessage::result_code.

Referenced by handle_create_message(), handle_delete_message(), handle_lookup_by_suffix_message(), handle_lookup_message(), and handle_rename_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_update_message()

static struct GNUNET_MQ_Envelope * create_update_message ( struct Ego ego)
static

Create an update message with information about the current state of an ego.

Parameters
egoego to create message for
Returns
corresponding update message

Definition at line 232 of file gnunet-service-identity.c.

233{
234 struct UpdateMessage *um;
235 struct GNUNET_MQ_Envelope *env;
236 size_t name_len;
237 ssize_t key_len;
238
240 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
241 env = GNUNET_MQ_msg_extra (um, name_len + key_len,
243 um->name_len = htons (name_len);
244 um->end_of_list = htons (GNUNET_NO);
245 um->key_len = htons (key_len);
246 GNUNET_memcpy (&um[1], ego->identifier, name_len);
248 ((char*) &um[1]) + name_len,
249 key_len);
250 return env;
251}
ssize_t GNUNET_CRYPTO_private_key_get_length(const struct GNUNET_CRYPTO_PrivateKey *key)
Get the compacted length of a GNUNET_CRYPTO_PrivateKey.
Definition: crypto_pkey.c:64
ssize_t GNUNET_CRYPTO_write_private_key_to_buffer(const struct GNUNET_CRYPTO_PrivateKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PrivateKey to a compact buffer.
Definition: crypto_pkey.c:172
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:61
#define GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE
Update about identity status from service to clients.
struct GNUNET_CRYPTO_PrivateKey pk
Private key of the ego.
Service informs client about status of a pseudonym.
Definition: identity.h:114
uint16_t end_of_list
Usually GNUNET_NO, GNUNET_YES to signal end of list.
Definition: identity.h:129
uint16_t key_len
Key length.
Definition: identity.h:134
uint16_t name_len
Number of bytes in ego name string including 0-termination, in NBO; 0 if the ego was deleted.
Definition: identity.h:124

References UpdateMessage::end_of_list, env, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, GNUNET_MQ_msg_extra, GNUNET_NO, Ego::identifier, UpdateMessage::key_len, UpdateMessage::name_len, and Ego::pk.

Referenced by handle_lookup_by_suffix_message(), handle_lookup_message(), and handle_start_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_start_message()

static void handle_start_message ( void *  cls,
const struct GNUNET_MessageHeader message 
)
static

Handler for START message from client, sends information about all identities to the client immediately and adds the client to the notification context for future updates.

Parameters
clsa struct GNUNET_SERVICE_Client *
messagethe message received

Definition at line 264 of file gnunet-service-identity.c.

266{
267 struct GNUNET_SERVICE_Client *client = cls;
268
270 "Received START message from client\n");
275 for (struct Ego *ego = ego_head; NULL != ego; ego = ego->next)
276 {
279 }
280 {
281 struct UpdateMessage *ume;
282 struct GNUNET_MQ_Envelope *env;
283
285 0,
287 ume->end_of_list = htons (GNUNET_YES);
288 ume->name_len = htons (0);
289 ume->key_len = htons (0);
291 env);
292 }
294}
static struct GNUNET_MQ_Envelope * create_update_message(struct Ego *ego)
Create an update message with information about the current state of an ego.
@ GNUNET_YES
void GNUNET_notification_context_add(struct GNUNET_NotificationContext *nc, struct GNUNET_MQ_Handle *mq)
Add a subscriber to the notification context.
Definition: nc.c:161
void GNUNET_SERVICE_client_mark_monitor(struct GNUNET_SERVICE_Client *c)
Set the 'monitor' flag on this client.
Definition: service.c:2483
void GNUNET_SERVICE_client_disable_continue_warning(struct GNUNET_SERVICE_Client *c)
Disable the warning the server issues if a message is not acknowledged in a timely fashion.
Definition: service.c:2406
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2389
struct Ego * next
We keep egos in a DLL.
Handle to a client that is connected to a service.
Definition: service.c:249

References create_update_message(), ego_head, UpdateMessage::end_of_list, env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_notification_context_add(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_disable_continue_warning(), GNUNET_SERVICE_client_get_mq(), GNUNET_SERVICE_client_mark_monitor(), GNUNET_YES, UpdateMessage::key_len, UpdateMessage::name_len, nc, and Ego::next.

Here is the call graph for this function:

◆ check_lookup_message()

static int check_lookup_message ( void *  cls,
const struct LookupMessage message 
)
static

Handler for LOOKUP message from client, sends information about ONE identity to the client immediately.

Parameters
clsunused
messagethe message received
Returns
GNUNET_SYSERR if message was ill-formed

Definition at line 306 of file gnunet-service-identity.c.

308{
310 return GNUNET_OK;
311}
@ GNUNET_OK
#define GNUNET_MQ_check_zero_termination(m)
Insert code for a "check_" function that verifies that a given variable-length message received over ...

References GNUNET_MQ_check_zero_termination, and GNUNET_OK.

◆ handle_lookup_message()

static void handle_lookup_message ( void *  cls,
const struct LookupMessage message 
)
static

Handler for LOOKUP message from client, sends information about ONE identity to the client immediately.

Parameters
clsa struct GNUNET_SERVICE_Client *
messagethe message received

Definition at line 322 of file gnunet-service-identity.c.

324{
325 struct GNUNET_SERVICE_Client *client = cls;
326 const char *name;
327 struct GNUNET_MQ_Envelope *env;
328 struct Ego *ego;
329
331 "Received LOOKUP message from client\n");
332 name = (const char *) &message[1];
333 for (ego = ego_head; NULL != ego; ego = ego->next)
334 {
335 if (0 != strcasecmp (name, ego->identifier))
336 continue;
340 return;
341 }
344}
static char * name
Name (label) of the records to list.
static void send_result_code(struct GNUNET_SERVICE_Client *client, uint32_t result_code)
Send a result code back to the client.
@ GNUNET_EC_IDENTITY_NOT_FOUND
Ego not found.

References create_update_message(), ego_head, env, GNUNET_EC_IDENTITY_NOT_FOUND, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_get_mq(), Ego::identifier, name, Ego::next, and send_result_code().

Here is the call graph for this function:

◆ check_lookup_by_suffix_message()

static int check_lookup_by_suffix_message ( void *  cls,
const struct LookupMessage message 
)
static

Handler for LOOKUP message from client, sends information about ONE identity to the client immediately.

Parameters
clsunused
messagethe message received
Returns
GNUNET_SYSERR if message was ill-formed

Definition at line 356 of file gnunet-service-identity.c.

358{
360 return GNUNET_OK;
361}

References GNUNET_MQ_check_zero_termination, and GNUNET_OK.

◆ handle_lookup_by_suffix_message()

static void handle_lookup_by_suffix_message ( void *  cls,
const struct LookupMessage message 
)
static

Handler for LOOKUP_BY_SUFFIX message from client, sends information about ONE identity to the client immediately.

Parameters
clsa struct GNUNET_SERVICE_Client *
messagethe message received

Definition at line 372 of file gnunet-service-identity.c.

374{
375 struct GNUNET_SERVICE_Client *client = cls;
376 const char *name;
377 struct GNUNET_MQ_Envelope *env;
378 struct Ego *lprefix;
379
381 "Received LOOKUP_BY_SUFFIX message from client\n");
382 name = (const char *) &message[1];
383 lprefix = NULL;
384 for (struct Ego *ego = ego_head; NULL != ego; ego = ego->next)
385 {
386 if ((strlen (ego->identifier) <= strlen (name)) &&
387 (0 == strcmp (ego->identifier,
388 &name[strlen (name) - strlen (ego->identifier)])) &&
389 ((strlen (name) == strlen (ego->identifier)) ||
390 ('.' == name[strlen (name) - strlen (ego->identifier) - 1])) &&
391 ((NULL == lprefix) ||
392 (strlen (ego->identifier) > strlen (lprefix->identifier))))
393 {
394 /* found better match, update! */
395 lprefix = ego;
396 }
397 }
398 if (NULL != lprefix)
399 {
400 env = create_update_message (lprefix);
403 return;
404 }
407}

References create_update_message(), ego_head, env, GNUNET_EC_IDENTITY_NOT_FOUND, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_get_mq(), Ego::identifier, name, Ego::next, and send_result_code().

Here is the call graph for this function:

◆ notify_listeners()

static void notify_listeners ( struct Ego ego)
static

Send an updated message for the given ego to all listeners.

Parameters
egoego to send the update for

Definition at line 416 of file gnunet-service-identity.c.

417{
418 struct UpdateMessage *um;
419 size_t name_len;
420 ssize_t key_len;
421
422 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
424 um = GNUNET_malloc (sizeof(struct UpdateMessage) + name_len + key_len);
426 um->header.size = htons (sizeof(struct UpdateMessage) + name_len + key_len);
427 um->name_len = htons (name_len);
428 um->end_of_list = htons (GNUNET_NO);
429 um->key_len = htons (key_len);
430 GNUNET_memcpy (&um[1], ego->identifier, name_len);
432 ((char*) &um[1]) + name_len,
433 key_len);
435 GNUNET_free (um);
436}
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
#define GNUNET_malloc(size)
Wrapper around malloc.
void GNUNET_notification_context_broadcast(struct GNUNET_NotificationContext *nc, const struct GNUNET_MessageHeader *msg, int can_drop)
Send a message to all subscribers of this context.
Definition: nc.c:190
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE.
Definition: identity.h:118

References UpdateMessage::end_of_list, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, GNUNET_NO, GNUNET_notification_context_broadcast(), UpdateMessage::header, Ego::identifier, UpdateMessage::key_len, UpdateMessage::name_len, nc, Ego::pk, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.

Referenced by handle_create_message(), handle_delete_message(), and handle_rename_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_create_message()

static int check_create_message ( void *  cls,
const struct CreateRequestMessage msg 
)
static

Checks a GNUNET_MESSAGE_TYPE_IDENTITY_CREATE message.

Parameters
clsclient sending the message
msgmessage of type struct CreateRequestMessage
Returns
GNUNET_OK if msg is well-formed

Definition at line 447 of file gnunet-service-identity.c.

449{
450 uint16_t size;
451 uint16_t name_len;
452 size_t key_len;
453 const char *str;
454
455 size = ntohs (msg->header.size);
456 if (size <= sizeof(struct CreateRequestMessage))
457 {
458 GNUNET_break (0);
459 return GNUNET_SYSERR;
460 }
461 name_len = ntohs (msg->name_len);
462 key_len = ntohs (msg->key_len);
463 if (name_len + key_len + sizeof(struct CreateRequestMessage) != size)
464 {
465 GNUNET_break (0);
466 return GNUNET_SYSERR;
467 }
468 str = (const char *) &msg[1] + key_len;
469 if ('\0' != str[name_len - 1])
470 {
471 GNUNET_break (0);
472 return GNUNET_SYSERR;
473 }
474 return GNUNET_OK;
475}
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
@ GNUNET_SYSERR
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
static unsigned int size
Size of the "table".
Definition: peer.c:68
Client requests creation of an identity.
Definition: identity.h:151

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, UpdateMessage::key_len, msg, UpdateMessage::name_len, GNUNET_MessageHeader::size, and size.

◆ handle_create_message()

static void handle_create_message ( void *  cls,
const struct CreateRequestMessage crm 
)
static

Handler for CREATE message from client, creates new identity.

Parameters
clsunused
crmthe message received

Definition at line 485 of file gnunet-service-identity.c.

487{
488 struct GNUNET_CRYPTO_PrivateKey private_key;
489 struct GNUNET_SERVICE_Client *client = cls;
490 struct Ego *ego;
491 char *str;
492 char *fn;
493 size_t key_len;
494 size_t kb_read;
495
496 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREATE message from client\n");
497 key_len = ntohs (crm->key_len);
498 if ((GNUNET_SYSERR ==
500 key_len,
501 &private_key,
502 &kb_read)) ||
503 (kb_read != key_len))
504 {
506 return;
507 }
508 str = GNUNET_strdup ((const char *) &crm[1] + key_len);
509 GNUNET_STRINGS_utf8_tolower ((const char *) &crm[1] + key_len, str);
510 for (ego = ego_head; NULL != ego; ego = ego->next)
511 {
512 if (0 == strcmp (ego->identifier, str))
513 {
514 send_result_code (client,
517 GNUNET_free (str);
518 return;
519 }
520 }
521 ego = GNUNET_new (struct Ego);
522 ego->pk = private_key;
523 ego->identifier = GNUNET_strdup (str);
525 ego_tail,
526 ego);
528 fn = get_ego_filename (ego);
529 if (GNUNET_OK !=
531 &private_key,
532 sizeof(struct GNUNET_CRYPTO_PrivateKey),
536 GNUNET_free (fn);
537 GNUNET_free (str);
538 notify_listeners (ego);
540}
static void notify_listeners(struct Ego *ego)
Send an updated message for the given ego to all listeners.
static char * get_ego_filename(struct Ego *ego)
Get the name of the file we use to store a given ego.
enum GNUNET_GenericReturnValue GNUNET_DISK_fn_write(const char *fn, const void *buf, size_t buf_size, enum GNUNET_DISK_AccessPermissions mode)
Write a buffer to a file atomically.
Definition: disk.c:722
@ GNUNET_DISK_PERM_USER_READ
Owner can read.
@ GNUNET_DISK_PERM_USER_WRITE
Owner can write.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_private_key_from_buffer(const void *buffer, size_t len, struct GNUNET_CRYPTO_PrivateKey *key, size_t *read)
Reads a GNUNET_CRYPTO_PrivateKey from a compact buffer.
Definition: crypto_pkey.c:146
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2418
enum GNUNET_GenericReturnValue GNUNET_STRINGS_utf8_tolower(const char *input, char *output)
Convert the utf-8 input string to lower case.
Definition: strings.c:459
@ GNUNET_EC_NONE
No error (success).
@ GNUNET_EC_IDENTITY_NAME_CONFLICT
Identifier already in use for another ego.
uint16_t key_len
Key length.
Definition: identity.h:165
A private key for an identity as per LSD0001.

References ego_head, ego_tail, get_ego_filename(), GNUNET_CONTAINER_DLL_insert, GNUNET_CRYPTO_read_private_key_from_buffer(), GNUNET_DISK_fn_write(), GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_EC_IDENTITY_NAME_CONFLICT, GNUNET_EC_NONE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_log_strerror_file, GNUNET_new, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_strdup, GNUNET_STRINGS_utf8_tolower(), GNUNET_SYSERR, Ego::identifier, CreateRequestMessage::key_len, Ego::next, notify_listeners(), Ego::pk, and send_result_code().

Here is the call graph for this function:

◆ handle_ego_rename()

static void handle_ego_rename ( void *  cls,
const char *  section 
)
static

An ego was renamed; rename it in all subsystems where it is currently set as the default.

Parameters
clsthe 'struct RenameContext'
sectiona section in the configuration to process

Definition at line 567 of file gnunet-service-identity.c.

568{
569 struct RenameContext *rc = cls;
570 char *id;
571
573 section,
574 "DEFAULT_IDENTIFIER",
575 &id))
576 return;
577 if (0 != strcmp (id, rc->old_name))
578 {
579 GNUNET_free (id);
580 return;
581 }
583 section,
584 "DEFAULT_IDENTIFIER",
585 rc->new_name);
586 GNUNET_free (id);
587}
static struct GNUNET_IDENTITY_Handle * id
Handle to IDENTITY.
void GNUNET_CONFIGURATION_set_value_string(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value)
Set a configuration value that should be a string.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
Closure for 'handle_ego_rename'.
const char * old_name
Old name.
const char * new_name
New name.

References GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_set_value_string(), GNUNET_free, GNUNET_OK, id, RenameContext::new_name, RenameContext::old_name, and subsystem_cfg.

Referenced by handle_rename_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_rename_message()

static int check_rename_message ( void *  cls,
const struct RenameMessage msg 
)
static

Checks a GNUNET_MESSAGE_TYPE_IDENTITY_RENAME message.

Parameters
clsclient sending the message
msgmessage of type struct RenameMessage
Returns
GNUNET_OK if msg is well-formed

Definition at line 598 of file gnunet-service-identity.c.

599{
600 uint16_t size;
601 uint16_t old_name_len;
602 uint16_t new_name_len;
603 const char *old_name;
604 const char *new_name;
605
606 size = ntohs (msg->header.size);
607 if (size <= sizeof(struct RenameMessage))
608 {
609 GNUNET_break (0);
610 return GNUNET_SYSERR;
611 }
612 old_name_len = ntohs (msg->old_name_len);
613 new_name_len = ntohs (msg->new_name_len);
614 old_name = (const char *) &msg[1];
615 new_name = &old_name[old_name_len];
616 if ((old_name_len + new_name_len + sizeof(struct RenameMessage) != size) ||
617 ('\0' != old_name[old_name_len - 1]) ||
618 ('\0' != new_name[new_name_len - 1]))
619 {
620 GNUNET_break (0);
621 return GNUNET_SYSERR;
622 }
623
624 return GNUNET_OK;
625}
Client requests renaming of an identity.
Definition: identity.h:178

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, msg, RenameContext::new_name, RenameContext::old_name, GNUNET_MessageHeader::size, and size.

◆ handle_rename_message()

static void handle_rename_message ( void *  cls,
const struct RenameMessage rm 
)
static

Handler for RENAME message from client, creates new identity.

Parameters
clsunused
rmthe message received

Definition at line 636 of file gnunet-service-identity.c.

637{
638 uint16_t old_name_len;
639 struct Ego *ego;
640 char *old_name;
641 char *new_name;
642 struct RenameContext rename_ctx;
643 struct GNUNET_SERVICE_Client *client = cls;
644 char *fn_old;
645 char *fn_new;
646 const char *old_name_tmp;
647
648 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received RENAME message from client\n");
649 old_name_len = ntohs (rm->old_name_len);
650 old_name_tmp = (const char *) &rm[1];
651 old_name = GNUNET_strdup (old_name_tmp);
652 GNUNET_STRINGS_utf8_tolower (old_name_tmp, old_name);
653 new_name = GNUNET_strdup (&old_name_tmp[old_name_len]);
654 GNUNET_STRINGS_utf8_tolower (&old_name_tmp[old_name_len], new_name);
655
656 /* check if new name is already in use */
657 for (ego = ego_head; NULL != ego; ego = ego->next)
658 {
659 if (0 == strcmp (ego->identifier, new_name))
660 {
663 GNUNET_free (old_name);
664 GNUNET_free (new_name);
665 return;
666 }
667 }
668
669 /* locate old name and, if found, perform rename */
670 for (ego = ego_head; NULL != ego; ego = ego->next)
671 {
672 if (0 == strcmp (ego->identifier, old_name))
673 {
674 fn_old = get_ego_filename (ego);
675 GNUNET_free (ego->identifier);
676 rename_ctx.old_name = old_name;
677 rename_ctx.new_name = new_name;
680 &rename_ctx);
681 if (GNUNET_OK !=
683 GNUNET_log (
685 _ ("Failed to write subsystem default identifier map to `%s'.\n"),
687 ego->identifier = GNUNET_strdup (new_name);
688 fn_new = get_ego_filename (ego);
689 if (0 != rename (fn_old, fn_new))
691 GNUNET_free (fn_old);
692 GNUNET_free (fn_new);
693 GNUNET_free (old_name);
694 GNUNET_free (new_name);
695 notify_listeners (ego);
698 return;
699 }
700 }
701
702 /* failed to locate old name */
704 GNUNET_free (old_name);
705 GNUNET_free (new_name);
707}
static void handle_ego_rename(void *cls, const char *section)
An ego was renamed; rename it in all subsystems where it is currently set as the default.
void GNUNET_CONFIGURATION_iterate_sections(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_SectionIterator iter, void *iter_cls)
Iterate over all sections in the configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_write(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Write configuration file.
@ GNUNET_ERROR_TYPE_WARNING
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
uint16_t old_name_len
Number of characters in the old name including 0-termination, in NBO.
Definition: identity.h:187

References _, ego_head, get_ego_filename(), GNUNET_CONFIGURATION_iterate_sections(), GNUNET_CONFIGURATION_write(), GNUNET_EC_IDENTITY_NAME_CONFLICT, GNUNET_EC_IDENTITY_NOT_FOUND, GNUNET_EC_NONE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_log_strerror_file, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_strdup, GNUNET_STRINGS_utf8_tolower(), handle_ego_rename(), Ego::identifier, RenameContext::new_name, Ego::next, notify_listeners(), RenameContext::old_name, RenameMessage::old_name_len, send_result_code(), subsystem_cfg, and subsystem_cfg_file.

Here is the call graph for this function:

◆ handle_ego_delete()

static void handle_ego_delete ( void *  cls,
const char *  section 
)
static

An ego was removed, remove it from all subsystems where it is currently set as the default.

Parameters
clsname of the removed ego (const char *)
sectiona section in the configuration to process

Definition at line 718 of file gnunet-service-identity.c.

719{
720 const char *identifier = cls;
721 char *id;
722
724 section,
725 "DEFAULT_IDENTIFIER",
726 &id))
727 return;
728 if (0 != strcmp (id, identifier))
729 {
730 GNUNET_free (id);
731 return;
732 }
734 section,
735 "DEFAULT_IDENTIFIER",
736 NULL);
737 GNUNET_free (id);
738}

References GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_set_value_string(), GNUNET_free, GNUNET_OK, id, and subsystem_cfg.

Referenced by handle_delete_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_delete_message()

static int check_delete_message ( void *  cls,
const struct DeleteMessage msg 
)
static

Checks a GNUNET_MESSAGE_TYPE_IDENTITY_DELETE message.

Parameters
clsclient sending the message
msgmessage of type struct DeleteMessage
Returns
GNUNET_OK if msg is well-formed

Definition at line 749 of file gnunet-service-identity.c.

750{
751 uint16_t size;
752 uint16_t name_len;
753 const char *name;
754
755 size = ntohs (msg->header.size);
756 if (size <= sizeof(struct DeleteMessage))
757 {
758 GNUNET_break (0);
759 return GNUNET_SYSERR;
760 }
761 name = (const char *) &msg[1];
762 name_len = ntohs (msg->name_len);
763 if ((name_len + sizeof(struct DeleteMessage) != size) ||
764 (0 != ntohs (msg->reserved)) || ('\0' != name[name_len - 1]))
765 {
766 GNUNET_break (0);
767 return GNUNET_SYSERR;
768 }
769 return GNUNET_OK;
770}
Client requests deletion of an identity.
Definition: identity.h:204

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, msg, name, GNUNET_MessageHeader::size, and size.

◆ handle_delete_message()

static void handle_delete_message ( void *  cls,
const struct DeleteMessage dm 
)
static

Handler for DELETE message from client, creates new identity.

Parameters
clsunused
dmthe message received

Definition at line 781 of file gnunet-service-identity.c.

782{
783 struct Ego *ego;
784 char *name;
785 char *fn;
786 struct GNUNET_SERVICE_Client *client = cls;
787
788 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received DELETE message from client\n");
789 name = GNUNET_strdup ((const char *) &dm[1]);
790 GNUNET_STRINGS_utf8_tolower ((const char *) &dm[1], name);
791
792 for (ego = ego_head; NULL != ego; ego = ego->next)
793 {
794 if (0 == strcmp (ego->identifier, name))
795 {
799 ego->identifier);
800 if (GNUNET_OK !=
802 GNUNET_log (
804 _ ("Failed to write subsystem default identifier map to `%s'.\n"),
806 fn = get_ego_filename (ego);
807 if (0 != unlink (fn))
809 GNUNET_free (fn);
810 GNUNET_free (ego->identifier);
811 ego->identifier = NULL;
812 notify_listeners (ego);
813 GNUNET_free (ego);
817 return;
818 }
819 }
820
824}
static void handle_ego_delete(void *cls, const char *section)
An ego was removed, remove it from all subsystems where it is currently set as the default.

References _, ego_head, ego_tail, get_ego_filename(), GNUNET_CONFIGURATION_iterate_sections(), GNUNET_CONFIGURATION_write(), GNUNET_CONTAINER_DLL_remove, GNUNET_EC_IDENTITY_NOT_FOUND, GNUNET_EC_NONE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_log_strerror_file, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_strdup, GNUNET_STRINGS_utf8_tolower(), handle_ego_delete(), Ego::identifier, name, Ego::next, notify_listeners(), send_result_code(), subsystem_cfg, and subsystem_cfg_file.

Here is the call graph for this function:

◆ read_from_file()

static int read_from_file ( const char *  filename,
void *  buf,
size_t  buf_size 
)
static

Definition at line 828 of file gnunet-service-identity.c.

831{
832 int fd;
833 struct stat sb;
834
835 fd = open (filename,
836 O_RDONLY);
837 if (-1 == fd)
838 {
839 memset (buf,
840 0,
841 buf_size);
842 return GNUNET_SYSERR;
843 }
844 if (0 != fstat (fd,
845 &sb))
846 {
848 "stat",
849 filename);
850 GNUNET_assert (0 == close (fd));
851 memset (buf,
852 0,
853 buf_size);
854 return GNUNET_SYSERR;
855 }
856 if (sb.st_size != buf_size)
857 {
859 "File `%s' has wrong size (%llu), expected %llu bytes\n",
860 filename,
861 (unsigned long long) sb.st_size,
862 (unsigned long long) buf_size);
863 GNUNET_assert (0 == close (fd));
864 memset (buf,
865 0,
866 buf_size);
867 return GNUNET_SYSERR;
868 }
869 if (buf_size !=
870 read (fd,
871 buf,
872 buf_size))
873 {
875 "read",
876 filename);
877 GNUNET_assert (0 == close (fd));
878 memset (buf,
879 0,
880 buf_size);
881 return GNUNET_SYSERR;
882 }
883 GNUNET_assert (0 == close (fd));
884 return GNUNET_OK;
885}
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.

References filename, GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_log_strerror_file, GNUNET_OK, and GNUNET_SYSERR.

Referenced by process_ego_file().

Here is the caller graph for this function:

◆ process_ego_file()

static int process_ego_file ( void *  cls,
const char *  filename 
)
static

Process the given file from the "EGODIR".

Parses the file and creates the respective 'struct Ego' in memory.

Parameters
clsNULL
filenamename of the file to parse
Returns
GNUNET_OK to continue to iterate, GNUNET_NO to stop iteration with no error, GNUNET_SYSERR to abort iteration with error!

Definition at line 899 of file gnunet-service-identity.c.

901{
902 struct Ego *ego;
903 const char *fn;
904
905 fn = strrchr (filename, (int) DIR_SEPARATOR);
906 if (NULL == fn)
907 {
908 GNUNET_break (0);
909 return GNUNET_OK;
910 }
911 ego = GNUNET_new (struct Ego);
912 if (GNUNET_OK !=
914 &ego->pk,
915 sizeof (ego->pk)))
916 {
917 GNUNET_free (ego);
919 _ ("Failed to parse ego information in `%s'\n"),
920 filename);
921 return GNUNET_OK;
922 }
924 "Loaded ego `%s'\n",
925 fn + 1);
926 ego->identifier = GNUNET_strdup (fn + 1);
928 return GNUNET_OK;
929}
static int read_from_file(const char *filename, void *buf, size_t buf_size)
#define DIR_SEPARATOR
Definition: platform.h:165

References _, DIR_SEPARATOR, ego_head, ego_tail, filename, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_OK, GNUNET_strdup, Ego::identifier, Ego::pk, and read_from_file().

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle c,
struct GNUNET_SERVICE_Handle service 
)
static

Handle network size estimate clients.

Parameters
clsclosure
serverthe initialized server
cconfiguration to use

Definition at line 940 of file gnunet-service-identity.c.

943{
944 cfg = c;
947 "identity",
948 "EGODIR",
950 {
953 return;
954 }
955 if (GNUNET_OK !=
957 "identity",
958 "SUBSYSTEM_CFG",
960 {
962 "identity",
963 "SUBSYSTEM_CFG");
965 return;
966 }
968 "Loading subsystem configuration `%s'\n",
971 ;
973 (GNUNET_OK !=
975 {
977 _ (
978 "Failed to parse subsystem identity configuration file `%s'\n"),
981 return;
982 }
983 stats = GNUNET_STATISTICS_create ("identity", cfg);
985 {
987 _ ("Failed to create directory `%s' for storing egos\n"),
989 }
992 NULL);
994}
static const struct GNUNET_CONFIGURATION_Handle * cfg
Handle to our current configuration.
static void shutdown_task(void *cls)
Task run during shutdown.
static int process_ego_file(void *cls, const char *filename)
Process the given file from the "EGODIR".
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(const struct GNUNET_OS_ProjectData *pd)
Create a new configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_parse(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Parse a configuration file, add all of the options in the file to the configuration environment.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory).
Definition: disk.c:506
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create(const char *dir)
Implementation of "mkdir -p".
Definition: disk.c:520
int GNUNET_DISK_directory_scan(const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
Scan a directory for files.
Definition: disk.c:811
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
struct GNUNET_NotificationContext * GNUNET_notification_context_create(unsigned int queue_length)
Create a new notification context.
Definition: nc.c:122
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:567
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
Definition: scheduler.c:1339
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.

References _, cfg, ego_directory, GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_parse(), GNUNET_DISK_directory_create(), GNUNET_DISK_directory_scan(), GNUNET_DISK_file_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_log_config_missing(), GNUNET_notification_context_create(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), GNUNET_YES, nc, process_ego_file(), shutdown_task(), stats, subsystem_cfg, and subsystem_cfg_file.

Here is the call graph for this function:

◆ GNUNET_SERVICE_MAIN()

Define "main" method using service macro.

Variable Documentation

◆ cfg

const struct GNUNET_CONFIGURATION_Handle* cfg
static

Handle to our current configuration.

Definition at line 70 of file gnunet-service-identity.c.

Referenced by run().

◆ subsystem_cfg

struct GNUNET_CONFIGURATION_Handle* subsystem_cfg
static

Handle to subsystem configuration which for each subsystem contains the name of the default ego.

Definition at line 76 of file gnunet-service-identity.c.

Referenced by handle_delete_message(), handle_ego_delete(), handle_ego_rename(), handle_rename_message(), run(), and shutdown_task().

◆ stats

struct GNUNET_STATISTICS_Handle* stats
static

Handle to the statistics service.

Definition at line 81 of file gnunet-service-identity.c.

Referenced by run(), and shutdown_task().

◆ nc

struct GNUNET_NotificationContext* nc
static

Notification context, simplifies client broadcasts.

Definition at line 86 of file gnunet-service-identity.c.

Referenced by handle_start_message(), notify_listeners(), run(), and shutdown_task().

◆ ego_directory

char* ego_directory
static

Directory where we store the identities.

Definition at line 91 of file gnunet-service-identity.c.

Referenced by get_ego_filename(), run(), and shutdown_task().

◆ subsystem_cfg_file

char* subsystem_cfg_file
static

Configuration file name where subsystem information is kept.

Definition at line 96 of file gnunet-service-identity.c.

Referenced by handle_delete_message(), handle_rename_message(), run(), and shutdown_task().

◆ ego_head

◆ ego_tail

struct Ego* ego_tail
static

Tail of DLL of all egos.

Definition at line 106 of file gnunet-service-identity.c.

Referenced by handle_create_message(), handle_delete_message(), process_ego_file(), and shutdown_task().