diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-06-01 00:52:06 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-06-01 00:52:13 +0200 |
commit | 47a7c12c47fa10728494623ea8f89beab8e5cd77 (patch) | |
tree | 2e37a6a55d169c96e9927c608a12f540e5cd0123 /src/identity/gnunet-service-identity.c | |
parent | 09d0b535d3b5dc8798b18a4791d45b4a9c8ab529 (diff) | |
download | gnunet-47a7c12c47fa10728494623ea8f89beab8e5cd77.tar.gz gnunet-47a7c12c47fa10728494623ea8f89beab8e5cd77.zip |
stash
Diffstat (limited to 'src/identity/gnunet-service-identity.c')
-rw-r--r-- | src/identity/gnunet-service-identity.c | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c index 0a2fbbcb8..a675a01f0 100644 --- a/src/identity/gnunet-service-identity.c +++ b/src/identity/gnunet-service-identity.c | |||
@@ -291,16 +291,15 @@ create_set_default_message (struct Ego *ego, | |||
291 | * adds the client to the notification context for future | 291 | * adds the client to the notification context for future |
292 | * updates. | 292 | * updates. |
293 | * | 293 | * |
294 | * @param cls unused | 294 | * @param cls a `struct GNUNET_SERVICE_Client *` |
295 | * @param client who sent the message | ||
296 | * @param message the message received | 295 | * @param message the message received |
297 | */ | 296 | */ |
298 | static void | 297 | static void |
299 | handle_start_message (void *cls, | 298 | handle_start_message (void *cls, |
300 | const struct GNUNET_MessageHeader *message) | 299 | const struct GNUNET_MessageHeader *message) |
301 | { | 300 | { |
302 | struct UpdateMessage *ume; | ||
303 | struct GNUNET_SERVICE_Client *client = cls; | 301 | struct GNUNET_SERVICE_Client *client = cls; |
302 | struct UpdateMessage *ume; | ||
304 | struct GNUNET_MQ_Envelope *env; | 303 | struct GNUNET_MQ_Envelope *env; |
305 | struct Ego *ego; | 304 | struct Ego *ego; |
306 | 305 | ||
@@ -324,6 +323,60 @@ handle_start_message (void *cls, | |||
324 | GNUNET_SERVICE_client_continue (client); | 323 | GNUNET_SERVICE_client_continue (client); |
325 | } | 324 | } |
326 | 325 | ||
326 | |||
327 | /** | ||
328 | * Handler for LOOKUP message from client, sends information | ||
329 | * about ONE identity to the client immediately. | ||
330 | * | ||
331 | * @param cls unused | ||
332 | * @param message the message received | ||
333 | * @return #GNUNET_SYSERR if message was ill-formed | ||
334 | */ | ||
335 | static int | ||
336 | check_lookup_message (void *cls, | ||
337 | const struct LookupMessage *message) | ||
338 | { | ||
339 | GNUNET_MQ_check_zero_termination (message); | ||
340 | return GNUNET_OK; | ||
341 | } | ||
342 | |||
343 | |||
344 | /** | ||
345 | * Handler for LOOKUP message from client, sends information | ||
346 | * about ONE identity to the client immediately. | ||
347 | * | ||
348 | * @param cls a `struct GNUNET_SERVICE_Client *` | ||
349 | * @param message the message received | ||
350 | */ | ||
351 | static void | ||
352 | handle_lookup_message (void *cls, | ||
353 | const struct LookupMessage *message) | ||
354 | { | ||
355 | struct GNUNET_SERVICE_Client *client = cls; | ||
356 | const char *name; | ||
357 | struct GNUNET_MQ_Envelope *env; | ||
358 | struct Ego *ego; | ||
359 | |||
360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
361 | "Received LOOKUP message from client\n"); | ||
362 | name = (const char *) &message[1]; | ||
363 | for (ego = ego_head; NULL != ego; ego = ego->next) | ||
364 | { | ||
365 | if (0 != strcasecmp (name, | ||
366 | ego->identifier)) | ||
367 | continue; | ||
368 | env = create_update_message (ego); | ||
369 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env); | ||
370 | GNUNET_SERVICE_client_continue (client); | ||
371 | return; | ||
372 | } | ||
373 | send_result_code (client, | ||
374 | 0, | ||
375 | "ego not found"); | ||
376 | GNUNET_SERVICE_client_continue (client); | ||
377 | } | ||
378 | |||
379 | |||
327 | /** | 380 | /** |
328 | * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT message | 381 | * Checks a #GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT message |
329 | * | 382 | * |
@@ -1061,6 +1114,10 @@ GNUNET_SERVICE_MAIN | |||
1061 | GNUNET_MESSAGE_TYPE_IDENTITY_START, | 1114 | GNUNET_MESSAGE_TYPE_IDENTITY_START, |
1062 | struct GNUNET_MessageHeader, | 1115 | struct GNUNET_MessageHeader, |
1063 | NULL), | 1116 | NULL), |
1117 | GNUNET_MQ_hd_var_size (lookup_message, | ||
1118 | GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP, | ||
1119 | struct LookupMessage, | ||
1120 | NULL), | ||
1064 | GNUNET_MQ_hd_var_size (get_default_message, | 1121 | GNUNET_MQ_hd_var_size (get_default_message, |
1065 | GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT, | 1122 | GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT, |
1066 | struct GetDefaultMessage, | 1123 | struct GetDefaultMessage, |