diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-09-28 12:43:27 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-09-28 12:43:27 +0000 |
commit | bca283abc269e0794226b82d16b762ed68718a91 (patch) | |
tree | 636c93ef4e793948ab95c6a8ebbe3e3472eca95a /src/identity/identity_api.c | |
parent | 64732cdb0d95320d9274b26fcac6e617d6473248 (diff) | |
download | gnunet-bca283abc269e0794226b82d16b762ed68718a91.tar.gz gnunet-bca283abc269e0794226b82d16b762ed68718a91.zip |
-new service API
Diffstat (limited to 'src/identity/identity_api.c')
-rw-r--r-- | src/identity/identity_api.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index dd61fdfb4..10a64d1ba 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c | |||
@@ -304,7 +304,7 @@ mq_error_handler (void *cls, | |||
304 | */ | 304 | */ |
305 | static int | 305 | static int |
306 | check_identity_result_code (void *cls, | 306 | check_identity_result_code (void *cls, |
307 | const struct GNUNET_IDENTITY_ResultCodeMessage *rcm) | 307 | const struct ResultCodeMessage *rcm) |
308 | { | 308 | { |
309 | uint16_t size = ntohs (rcm->header.size) - sizeof (*rcm); | 309 | uint16_t size = ntohs (rcm->header.size) - sizeof (*rcm); |
310 | const char *str = (const char *) &rcm[1]; | 310 | const char *str = (const char *) &rcm[1]; |
@@ -328,7 +328,7 @@ check_identity_result_code (void *cls, | |||
328 | */ | 328 | */ |
329 | static void | 329 | static void |
330 | handle_identity_result_code (void *cls, | 330 | handle_identity_result_code (void *cls, |
331 | const struct GNUNET_IDENTITY_ResultCodeMessage *rcm) | 331 | const struct ResultCodeMessage *rcm) |
332 | { | 332 | { |
333 | struct GNUNET_IDENTITY_Handle *h = cls; | 333 | struct GNUNET_IDENTITY_Handle *h = cls; |
334 | struct GNUNET_IDENTITY_Operation *op; | 334 | struct GNUNET_IDENTITY_Operation *op; |
@@ -363,13 +363,13 @@ handle_identity_result_code (void *cls, | |||
363 | */ | 363 | */ |
364 | static int | 364 | static int |
365 | check_identity_update (void *cls, | 365 | check_identity_update (void *cls, |
366 | const struct GNUNET_IDENTITY_UpdateMessage *um) | 366 | const struct UpdateMessage *um) |
367 | { | 367 | { |
368 | uint16_t size = ntohs (um->header.size); | 368 | uint16_t size = ntohs (um->header.size); |
369 | uint16_t name_len = ntohs (um->name_len); | 369 | uint16_t name_len = ntohs (um->name_len); |
370 | const char *str = (const char *) &um[1]; | 370 | const char *str = (const char *) &um[1]; |
371 | 371 | ||
372 | if ( (size != name_len + sizeof (struct GNUNET_IDENTITY_UpdateMessage)) || | 372 | if ( (size != name_len + sizeof (struct UpdateMessage)) || |
373 | ( (0 != name_len) && | 373 | ( (0 != name_len) && |
374 | ('\0' != str[name_len - 1])) ) | 374 | ('\0' != str[name_len - 1])) ) |
375 | { | 375 | { |
@@ -388,7 +388,7 @@ check_identity_update (void *cls, | |||
388 | */ | 388 | */ |
389 | static void | 389 | static void |
390 | handle_identity_update (void *cls, | 390 | handle_identity_update (void *cls, |
391 | const struct GNUNET_IDENTITY_UpdateMessage *um) | 391 | const struct UpdateMessage *um) |
392 | { | 392 | { |
393 | struct GNUNET_IDENTITY_Handle *h = cls; | 393 | struct GNUNET_IDENTITY_Handle *h = cls; |
394 | uint16_t name_len = ntohs (um->name_len); | 394 | uint16_t name_len = ntohs (um->name_len); |
@@ -475,7 +475,7 @@ handle_identity_update (void *cls, | |||
475 | */ | 475 | */ |
476 | static int | 476 | static int |
477 | check_identity_set_default (void *cls, | 477 | check_identity_set_default (void *cls, |
478 | const struct GNUNET_IDENTITY_SetDefaultMessage *sdm) | 478 | const struct SetDefaultMessage *sdm) |
479 | { | 479 | { |
480 | uint16_t size = ntohs (sdm->header.size) - sizeof (*sdm); | 480 | uint16_t size = ntohs (sdm->header.size) - sizeof (*sdm); |
481 | uint16_t name_len = ntohs (sdm->name_len); | 481 | uint16_t name_len = ntohs (sdm->name_len); |
@@ -502,7 +502,7 @@ check_identity_set_default (void *cls, | |||
502 | */ | 502 | */ |
503 | static void | 503 | static void |
504 | handle_identity_set_default (void *cls, | 504 | handle_identity_set_default (void *cls, |
505 | const struct GNUNET_IDENTITY_SetDefaultMessage *sdm) | 505 | const struct SetDefaultMessage *sdm) |
506 | { | 506 | { |
507 | struct GNUNET_IDENTITY_Handle *h = cls; | 507 | struct GNUNET_IDENTITY_Handle *h = cls; |
508 | struct GNUNET_IDENTITY_Operation *op; | 508 | struct GNUNET_IDENTITY_Operation *op; |
@@ -556,15 +556,15 @@ reconnect (void *cls) | |||
556 | struct GNUNET_MQ_MessageHandler handlers[] = { | 556 | struct GNUNET_MQ_MessageHandler handlers[] = { |
557 | GNUNET_MQ_hd_var_size (identity_result_code, | 557 | GNUNET_MQ_hd_var_size (identity_result_code, |
558 | GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, | 558 | GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, |
559 | struct GNUNET_IDENTITY_ResultCodeMessage, | 559 | struct ResultCodeMessage, |
560 | h), | 560 | h), |
561 | GNUNET_MQ_hd_var_size (identity_update, | 561 | GNUNET_MQ_hd_var_size (identity_update, |
562 | GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, | 562 | GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, |
563 | struct GNUNET_IDENTITY_UpdateMessage, | 563 | struct UpdateMessage, |
564 | h), | 564 | h), |
565 | GNUNET_MQ_hd_var_size (identity_set_default, | 565 | GNUNET_MQ_hd_var_size (identity_set_default, |
566 | GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, | 566 | GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, |
567 | struct GNUNET_IDENTITY_SetDefaultMessage, | 567 | struct SetDefaultMessage, |
568 | h), | 568 | h), |
569 | GNUNET_MQ_handler_end () | 569 | GNUNET_MQ_handler_end () |
570 | }; | 570 | }; |
@@ -665,13 +665,13 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *h, | |||
665 | { | 665 | { |
666 | struct GNUNET_IDENTITY_Operation *op; | 666 | struct GNUNET_IDENTITY_Operation *op; |
667 | struct GNUNET_MQ_Envelope *env; | 667 | struct GNUNET_MQ_Envelope *env; |
668 | struct GNUNET_IDENTITY_GetDefaultMessage *gdm; | 668 | struct GetDefaultMessage *gdm; |
669 | size_t slen; | 669 | size_t slen; |
670 | 670 | ||
671 | if (NULL == h->mq) | 671 | if (NULL == h->mq) |
672 | return NULL; | 672 | return NULL; |
673 | slen = strlen (service_name) + 1; | 673 | slen = strlen (service_name) + 1; |
674 | if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_GetDefaultMessage)) | 674 | if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GetDefaultMessage)) |
675 | { | 675 | { |
676 | GNUNET_break (0); | 676 | GNUNET_break (0); |
677 | return NULL; | 677 | return NULL; |
@@ -716,13 +716,13 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h, | |||
716 | { | 716 | { |
717 | struct GNUNET_IDENTITY_Operation *op; | 717 | struct GNUNET_IDENTITY_Operation *op; |
718 | struct GNUNET_MQ_Envelope *env; | 718 | struct GNUNET_MQ_Envelope *env; |
719 | struct GNUNET_IDENTITY_SetDefaultMessage *sdm; | 719 | struct SetDefaultMessage *sdm; |
720 | size_t slen; | 720 | size_t slen; |
721 | 721 | ||
722 | if (NULL == h->mq) | 722 | if (NULL == h->mq) |
723 | return NULL; | 723 | return NULL; |
724 | slen = strlen (service_name) + 1; | 724 | slen = strlen (service_name) + 1; |
725 | if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_SetDefaultMessage)) | 725 | if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct SetDefaultMessage)) |
726 | { | 726 | { |
727 | GNUNET_break (0); | 727 | GNUNET_break (0); |
728 | return NULL; | 728 | return NULL; |
@@ -766,14 +766,14 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, | |||
766 | { | 766 | { |
767 | struct GNUNET_IDENTITY_Operation *op; | 767 | struct GNUNET_IDENTITY_Operation *op; |
768 | struct GNUNET_MQ_Envelope *env; | 768 | struct GNUNET_MQ_Envelope *env; |
769 | struct GNUNET_IDENTITY_CreateRequestMessage *crm; | 769 | struct CreateRequestMessage *crm; |
770 | struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; | 770 | struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; |
771 | size_t slen; | 771 | size_t slen; |
772 | 772 | ||
773 | if (NULL == h->mq) | 773 | if (NULL == h->mq) |
774 | return NULL; | 774 | return NULL; |
775 | slen = strlen (name) + 1; | 775 | slen = strlen (name) + 1; |
776 | if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_CreateRequestMessage)) | 776 | if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct CreateRequestMessage)) |
777 | { | 777 | { |
778 | GNUNET_break (0); | 778 | GNUNET_break (0); |
779 | return NULL; | 779 | return NULL; |
@@ -821,7 +821,7 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h, | |||
821 | { | 821 | { |
822 | struct GNUNET_IDENTITY_Operation *op; | 822 | struct GNUNET_IDENTITY_Operation *op; |
823 | struct GNUNET_MQ_Envelope *env; | 823 | struct GNUNET_MQ_Envelope *env; |
824 | struct GNUNET_IDENTITY_RenameMessage *grm; | 824 | struct RenameMessage *grm; |
825 | size_t slen_old; | 825 | size_t slen_old; |
826 | size_t slen_new; | 826 | size_t slen_new; |
827 | char *dst; | 827 | char *dst; |
@@ -832,7 +832,7 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h, | |||
832 | slen_new = strlen (new_name) + 1; | 832 | slen_new = strlen (new_name) + 1; |
833 | if ( (slen_old >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || | 833 | if ( (slen_old >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || |
834 | (slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || | 834 | (slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || |
835 | (slen_old + slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_RenameMessage)) ) | 835 | (slen_old + slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct RenameMessage)) ) |
836 | { | 836 | { |
837 | GNUNET_break (0); | 837 | GNUNET_break (0); |
838 | return NULL; | 838 | return NULL; |
@@ -879,13 +879,13 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *h, | |||
879 | { | 879 | { |
880 | struct GNUNET_IDENTITY_Operation *op; | 880 | struct GNUNET_IDENTITY_Operation *op; |
881 | struct GNUNET_MQ_Envelope *env; | 881 | struct GNUNET_MQ_Envelope *env; |
882 | struct GNUNET_IDENTITY_DeleteMessage *gdm; | 882 | struct DeleteMessage *gdm; |
883 | size_t slen; | 883 | size_t slen; |
884 | 884 | ||
885 | if (NULL == h->mq) | 885 | if (NULL == h->mq) |
886 | return NULL; | 886 | return NULL; |
887 | slen = strlen (name) + 1; | 887 | slen = strlen (name) + 1; |
888 | if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_DeleteMessage)) | 888 | if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct DeleteMessage)) |
889 | { | 889 | { |
890 | GNUNET_break (0); | 890 | GNUNET_break (0); |
891 | return NULL; | 891 | return NULL; |