diff options
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 314 |
1 files changed, 169 insertions, 145 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index 0cd8c10a5..d2cdc62a2 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -170,17 +170,17 @@ struct IdpClient | |||
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Head of the DLL of | 172 | * Head of the DLL of |
173 | * Attribute iteration operations in | 173 | * Credential iteration operations in |
174 | * progress initiated by this client | 174 | * progress initiated by this client |
175 | */ | 175 | */ |
176 | struct Iterator *attest_iter_head; | 176 | struct Iterator *cred_iter_head; |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Tail of the DLL of | 179 | * Tail of the DLL of |
180 | * Attribute iteration operations | 180 | * Credential iteration operations |
181 | * in progress initiated by this client | 181 | * in progress initiated by this client |
182 | */ | 182 | */ |
183 | struct Iterator *attest_iter_tail; | 183 | struct Iterator *cred_iter_tail; |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * Head of DLL of ticket iteration ops | 186 | * Head of DLL of ticket iteration ops |
@@ -285,9 +285,9 @@ struct AttributeDeleteHandle | |||
285 | struct GNUNET_RECLAIM_Attribute *claim; | 285 | struct GNUNET_RECLAIM_Attribute *claim; |
286 | 286 | ||
287 | /** | 287 | /** |
288 | * The attestation to delete | 288 | * The credential to delete |
289 | */ | 289 | */ |
290 | struct GNUNET_RECLAIM_Attestation *attest; | 290 | struct GNUNET_RECLAIM_Credential *credential; |
291 | 291 | ||
292 | /** | 292 | /** |
293 | * Tickets to update | 293 | * Tickets to update |
@@ -352,9 +352,9 @@ struct AttributeStoreHandle | |||
352 | struct GNUNET_RECLAIM_Attribute *claim; | 352 | struct GNUNET_RECLAIM_Attribute *claim; |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * The attestation to store | 355 | * The credential to store |
356 | */ | 356 | */ |
357 | struct GNUNET_RECLAIM_Attestation *attest; | 357 | struct GNUNET_RECLAIM_Credential *credential; |
358 | 358 | ||
359 | /** | 359 | /** |
360 | * The attribute expiration interval | 360 | * The attribute expiration interval |
@@ -488,8 +488,8 @@ cleanup_adh (struct AttributeDeleteHandle *adh) | |||
488 | GNUNET_free (adh->label); | 488 | GNUNET_free (adh->label); |
489 | if (NULL != adh->claim) | 489 | if (NULL != adh->claim) |
490 | GNUNET_free (adh->claim); | 490 | GNUNET_free (adh->claim); |
491 | if (NULL != adh->attest) | 491 | if (NULL != adh->credential) |
492 | GNUNET_free (adh->attest); | 492 | GNUNET_free (adh->credential); |
493 | while (NULL != (le = adh->tickets_to_update_head)) | 493 | while (NULL != (le = adh->tickets_to_update_head)) |
494 | { | 494 | { |
495 | GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head, | 495 | GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head, |
@@ -517,8 +517,8 @@ cleanup_as_handle (struct AttributeStoreHandle *ash) | |||
517 | GNUNET_NAMESTORE_cancel (ash->ns_qe); | 517 | GNUNET_NAMESTORE_cancel (ash->ns_qe); |
518 | if (NULL != ash->claim) | 518 | if (NULL != ash->claim) |
519 | GNUNET_free (ash->claim); | 519 | GNUNET_free (ash->claim); |
520 | if (NULL != ash->attest) | 520 | if (NULL != ash->credential) |
521 | GNUNET_free (ash->attest); | 521 | GNUNET_free (ash->credential); |
522 | GNUNET_free (ash); | 522 | GNUNET_free (ash); |
523 | } | 523 | } |
524 | 524 | ||
@@ -569,9 +569,9 @@ cleanup_client (struct IdpClient *idp) | |||
569 | GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai); | 569 | GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai); |
570 | GNUNET_free (ai); | 570 | GNUNET_free (ai); |
571 | } | 571 | } |
572 | while (NULL != (ai = idp->attest_iter_head)) | 572 | while (NULL != (ai = idp->cred_iter_head)) |
573 | { | 573 | { |
574 | GNUNET_CONTAINER_DLL_remove (idp->attest_iter_head, idp->attest_iter_tail, | 574 | GNUNET_CONTAINER_DLL_remove (idp->cred_iter_head, idp->cred_iter_tail, |
575 | ai); | 575 | ai); |
576 | GNUNET_free (ai); | 576 | GNUNET_free (ai); |
577 | } | 577 | } |
@@ -646,19 +646,33 @@ static void | |||
646 | send_ticket_result (const struct IdpClient *client, | 646 | send_ticket_result (const struct IdpClient *client, |
647 | uint32_t r_id, | 647 | uint32_t r_id, |
648 | const struct GNUNET_RECLAIM_Ticket *ticket, | 648 | const struct GNUNET_RECLAIM_Ticket *ticket, |
649 | const struct GNUNET_RECLAIM_PresentationList *presentations, | ||
649 | uint32_t success) | 650 | uint32_t success) |
650 | { | 651 | { |
651 | struct TicketResultMessage *irm; | 652 | struct TicketResultMessage *irm; |
652 | struct GNUNET_MQ_Envelope *env; | 653 | struct GNUNET_MQ_Envelope *env; |
654 | size_t pres_len = 0; | ||
653 | 655 | ||
654 | env = GNUNET_MQ_msg (irm, | 656 | if (NULL != presentations) |
655 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); | 657 | { |
658 | pres_len = | ||
659 | GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations); | ||
660 | } | ||
661 | env = GNUNET_MQ_msg_extra (irm, | ||
662 | pres_len, | ||
663 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); | ||
656 | if (NULL != ticket) | 664 | if (NULL != ticket) |
657 | { | 665 | { |
658 | irm->ticket = *ticket; | 666 | irm->ticket = *ticket; |
659 | } | 667 | } |
660 | // TODO add success member | 668 | // TODO add success member |
661 | irm->id = htonl (r_id); | 669 | irm->id = htonl (r_id); |
670 | irm->presentations_len = htons (pres_len); | ||
671 | if (NULL != presentations) | ||
672 | { | ||
673 | GNUNET_RECLAIM_presentation_list_serialize (presentations, | ||
674 | (char*) &irm[1]); | ||
675 | } | ||
662 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); | 676 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); |
663 | GNUNET_MQ_send (client->mq, env); | 677 | GNUNET_MQ_send (client->mq, env); |
664 | } | 678 | } |
@@ -669,12 +683,14 @@ send_ticket_result (const struct IdpClient *client, | |||
669 | * | 683 | * |
670 | * @param cls out ticket issue operation handle | 684 | * @param cls out ticket issue operation handle |
671 | * @param ticket the issued ticket | 685 | * @param ticket the issued ticket |
686 | * @param presentations newly created credential presentations (NULL on error) | ||
672 | * @param success issue success status (GNUNET_OK if successful) | 687 | * @param success issue success status (GNUNET_OK if successful) |
673 | * @param emsg error message (NULL of success is GNUNET_OK) | 688 | * @param emsg error message (NULL of success is GNUNET_OK) |
674 | */ | 689 | */ |
675 | static void | 690 | static void |
676 | issue_ticket_result_cb (void *cls, | 691 | issue_ticket_result_cb (void *cls, |
677 | struct GNUNET_RECLAIM_Ticket *ticket, | 692 | struct GNUNET_RECLAIM_Ticket *ticket, |
693 | struct GNUNET_RECLAIM_PresentationList *presentations, | ||
678 | int32_t success, | 694 | int32_t success, |
679 | const char *emsg) | 695 | const char *emsg) |
680 | { | 696 | { |
@@ -682,7 +698,7 @@ issue_ticket_result_cb (void *cls, | |||
682 | 698 | ||
683 | if (GNUNET_OK != success) | 699 | if (GNUNET_OK != success) |
684 | { | 700 | { |
685 | send_ticket_result (tio->client, tio->r_id, NULL, GNUNET_SYSERR); | 701 | send_ticket_result (tio->client, tio->r_id, NULL, NULL, GNUNET_SYSERR); |
686 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, | 702 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, |
687 | tio->client->issue_op_tail, | 703 | tio->client->issue_op_tail, |
688 | tio); | 704 | tio); |
@@ -690,7 +706,8 @@ issue_ticket_result_cb (void *cls, | |||
690 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg); | 706 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg); |
691 | return; | 707 | return; |
692 | } | 708 | } |
693 | send_ticket_result (tio->client, tio->r_id, ticket, GNUNET_SYSERR); | 709 | send_ticket_result (tio->client, tio->r_id, |
710 | ticket, presentations, GNUNET_SYSERR); | ||
694 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, | 711 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, |
695 | tio->client->issue_op_tail, | 712 | tio->client->issue_op_tail, |
696 | tio); | 713 | tio); |
@@ -732,6 +749,7 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) | |||
732 | struct TicketIssueOperation *tio; | 749 | struct TicketIssueOperation *tio; |
733 | struct IdpClient *idp = cls; | 750 | struct IdpClient *idp = cls; |
734 | struct GNUNET_RECLAIM_AttributeList *attrs; | 751 | struct GNUNET_RECLAIM_AttributeList *attrs; |
752 | struct GNUNET_RECLAIM_AttributeListEntry *le; | ||
735 | size_t attrs_len; | 753 | size_t attrs_len; |
736 | 754 | ||
737 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n"); | 755 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n"); |
@@ -739,6 +757,10 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) | |||
739 | attrs_len = ntohs (im->attr_len); | 757 | attrs_len = ntohs (im->attr_len); |
740 | attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1], | 758 | attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1], |
741 | attrs_len); | 759 | attrs_len); |
760 | for (le = attrs->list_head; NULL != le; le = le->next) | ||
761 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
762 | "List entry: %s\n", le->attribute->name); | ||
763 | |||
742 | tio->r_id = ntohl (im->id); | 764 | tio->r_id = ntohl (im->id); |
743 | tio->client = idp; | 765 | tio->client = idp; |
744 | GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio); | 766 | GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio); |
@@ -842,7 +864,7 @@ static void | |||
842 | consume_result_cb (void *cls, | 864 | consume_result_cb (void *cls, |
843 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 865 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
844 | const struct GNUNET_RECLAIM_AttributeList *attrs, | 866 | const struct GNUNET_RECLAIM_AttributeList *attrs, |
845 | const struct GNUNET_RECLAIM_AttestationList *attests, | 867 | const struct GNUNET_RECLAIM_PresentationList *presentations, |
846 | int32_t success, | 868 | int32_t success, |
847 | const char *emsg) | 869 | const char *emsg) |
848 | { | 870 | { |
@@ -851,28 +873,28 @@ consume_result_cb (void *cls, | |||
851 | struct GNUNET_MQ_Envelope *env; | 873 | struct GNUNET_MQ_Envelope *env; |
852 | char *data_tmp; | 874 | char *data_tmp; |
853 | size_t attrs_len = 0; | 875 | size_t attrs_len = 0; |
854 | size_t attests_len = 0; | 876 | size_t pres_len = 0; |
855 | 877 | ||
856 | if (GNUNET_OK != success) | 878 | if (GNUNET_OK != success) |
857 | { | 879 | { |
858 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg); | 880 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg); |
859 | } | 881 | } |
860 | attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); | 882 | attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); |
861 | attests_len = GNUNET_RECLAIM_attestation_list_serialize_get_size (attests); | 883 | pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations); |
862 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 884 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
863 | "Sending CONSUME_TICKET_RESULT message\n"); | 885 | "Sending CONSUME_TICKET_RESULT message\n"); |
864 | env = GNUNET_MQ_msg_extra (crm, | 886 | env = GNUNET_MQ_msg_extra (crm, |
865 | attrs_len + attests_len, | 887 | attrs_len + pres_len, |
866 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); | 888 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); |
867 | crm->id = htonl (cop->r_id); | 889 | crm->id = htonl (cop->r_id); |
868 | crm->attrs_len = htons (attrs_len); | 890 | crm->attrs_len = htons (attrs_len); |
869 | crm->attestations_len = htons (attests_len); | 891 | crm->presentations_len = htons (pres_len); |
870 | crm->identity = *identity; | 892 | crm->identity = *identity; |
871 | crm->result = htonl (success); | 893 | crm->result = htonl (success); |
872 | data_tmp = (char *) &crm[1]; | 894 | data_tmp = (char *) &crm[1]; |
873 | GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp); | 895 | GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp); |
874 | data_tmp += attrs_len; | 896 | data_tmp += attrs_len; |
875 | GNUNET_RECLAIM_attestation_list_serialize (attests, data_tmp); | 897 | GNUNET_RECLAIM_presentation_list_serialize (presentations, data_tmp); |
876 | GNUNET_MQ_send (cop->client->mq, env); | 898 | GNUNET_MQ_send (cop->client->mq, env); |
877 | GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head, | 899 | GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head, |
878 | cop->client->consume_op_tail, | 900 | cop->client->consume_op_tail, |
@@ -1053,8 +1075,9 @@ handle_attribute_store_message (void *cls, | |||
1053 | data_len = ntohs (sam->attr_len); | 1075 | data_len = ntohs (sam->attr_len); |
1054 | 1076 | ||
1055 | ash = GNUNET_new (struct AttributeStoreHandle); | 1077 | ash = GNUNET_new (struct AttributeStoreHandle); |
1056 | ash->claim = GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1], | 1078 | GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1], |
1057 | data_len); | 1079 | data_len, |
1080 | &ash->claim); | ||
1058 | 1081 | ||
1059 | ash->r_id = ntohl (sam->id); | 1082 | ash->r_id = ntohl (sam->id); |
1060 | ash->identity = sam->identity; | 1083 | ash->identity = sam->identity; |
@@ -1069,14 +1092,14 @@ handle_attribute_store_message (void *cls, | |||
1069 | 1092 | ||
1070 | 1093 | ||
1071 | /** | 1094 | /** |
1072 | * Attestation store result handler | 1095 | * Credential store result handler |
1073 | * | 1096 | * |
1074 | * @param cls our attribute store handle | 1097 | * @param cls our attribute store handle |
1075 | * @param success GNUNET_OK if successful | 1098 | * @param success GNUNET_OK if successful |
1076 | * @param emsg error message (NULL if success=GNUNET_OK) | 1099 | * @param emsg error message (NULL if success=GNUNET_OK) |
1077 | */ | 1100 | */ |
1078 | static void | 1101 | static void |
1079 | attest_store_cont (void *cls, int32_t success, const char *emsg) | 1102 | cred_store_cont (void *cls, int32_t success, const char *emsg) |
1080 | { | 1103 | { |
1081 | struct AttributeStoreHandle *ash = cls; | 1104 | struct AttributeStoreHandle *ash = cls; |
1082 | struct GNUNET_MQ_Envelope *env; | 1105 | struct GNUNET_MQ_Envelope *env; |
@@ -1090,7 +1113,7 @@ attest_store_cont (void *cls, int32_t success, const char *emsg) | |||
1090 | if (GNUNET_SYSERR == success) | 1113 | if (GNUNET_SYSERR == success) |
1091 | { | 1114 | { |
1092 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1115 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1093 | "Failed to store attestation %s\n", | 1116 | "Failed to store credential: %s\n", |
1094 | emsg); | 1117 | emsg); |
1095 | cleanup_as_handle (ash); | 1118 | cleanup_as_handle (ash); |
1096 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 1119 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
@@ -1107,16 +1130,16 @@ attest_store_cont (void *cls, int32_t success, const char *emsg) | |||
1107 | 1130 | ||
1108 | 1131 | ||
1109 | /** | 1132 | /** |
1110 | * Error looking up potential attestation. Abort. | 1133 | * Error looking up potential credential. Abort. |
1111 | * | 1134 | * |
1112 | * @param cls our attribute store handle | 1135 | * @param cls our attribute store handle |
1113 | */ | 1136 | */ |
1114 | static void | 1137 | static void |
1115 | attest_error (void *cls) | 1138 | cred_error (void *cls) |
1116 | { | 1139 | { |
1117 | struct AttributeStoreHandle *ash = cls; | 1140 | struct AttributeStoreHandle *ash = cls; |
1118 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1141 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1119 | "Failed to check for existing Attestation\n"); | 1142 | "Failed to check for existing credential.\n"); |
1120 | cleanup_as_handle (ash); | 1143 | cleanup_as_handle (ash); |
1121 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 1144 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
1122 | return; | 1145 | return; |
@@ -1124,7 +1147,7 @@ attest_error (void *cls) | |||
1124 | 1147 | ||
1125 | 1148 | ||
1126 | /** | 1149 | /** |
1127 | * Check for existing record before storing attestation | 1150 | * Check for existing record before storing credential |
1128 | * | 1151 | * |
1129 | * @param cls our attribute store handle | 1152 | * @param cls our attribute store handle |
1130 | * @param zone zone we are iterating | 1153 | * @param zone zone we are iterating |
@@ -1133,33 +1156,34 @@ attest_error (void *cls) | |||
1133 | * @param rd records | 1156 | * @param rd records |
1134 | */ | 1157 | */ |
1135 | static void | 1158 | static void |
1136 | attest_add_cb (void *cls, | 1159 | cred_add_cb (void *cls, |
1137 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 1160 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
1138 | const char *label, | 1161 | const char *label, |
1139 | unsigned int rd_count, | 1162 | unsigned int rd_count, |
1140 | const struct GNUNET_GNSRECORD_Data *rd) | 1163 | const struct GNUNET_GNSRECORD_Data *rd) |
1141 | { | 1164 | { |
1142 | struct AttributeStoreHandle *ash = cls; | 1165 | struct AttributeStoreHandle *ash = cls; |
1166 | struct GNUNET_GNSRECORD_Data rd_new[1]; | ||
1143 | char *buf; | 1167 | char *buf; |
1144 | size_t buf_size; | 1168 | size_t buf_size; |
1145 | buf_size = GNUNET_RECLAIM_attestation_serialize_get_size (ash->attest); | 1169 | |
1170 | buf_size = GNUNET_RECLAIM_credential_serialize_get_size (ash->credential); | ||
1146 | buf = GNUNET_malloc (buf_size); | 1171 | buf = GNUNET_malloc (buf_size); |
1147 | GNUNET_RECLAIM_attestation_serialize (ash->attest, buf); | 1172 | GNUNET_RECLAIM_credential_serialize (ash->credential, buf); |
1148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1149 | "Storing new Attestation\n"); | 1174 | "Storing new credential under `%s'.\n", |
1150 | struct GNUNET_GNSRECORD_Data rd_new[1]; | 1175 | label); |
1151 | rd_new[0].data_size = buf_size; | 1176 | rd_new[0].data_size = buf_size; |
1152 | rd_new[0].data = buf; | 1177 | rd_new[0].data = buf; |
1153 | rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION; | 1178 | rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL; |
1154 | rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | 1179 | rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; |
1155 | rd_new[0].expiration_time = ash->exp.rel_value_us; | 1180 | rd_new[0].expiration_time = ash->exp.rel_value_us; |
1156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label); | ||
1157 | ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, | 1181 | ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, |
1158 | &ash->identity, | 1182 | &ash->identity, |
1159 | label, | 1183 | label, |
1160 | 1, | 1184 | 1, |
1161 | rd_new, | 1185 | rd_new, |
1162 | &attest_store_cont, | 1186 | &cred_store_cont, |
1163 | ash); | 1187 | ash); |
1164 | GNUNET_free (buf); | 1188 | GNUNET_free (buf); |
1165 | return; | 1189 | return; |
@@ -1167,44 +1191,43 @@ attest_add_cb (void *cls, | |||
1167 | 1191 | ||
1168 | 1192 | ||
1169 | /** | 1193 | /** |
1170 | * Add a new attestation | 1194 | * Add a new credential |
1171 | * | 1195 | * |
1172 | * @param cls the AttributeStoreHandle | 1196 | * @param cls the AttributeStoreHandle |
1173 | */ | 1197 | */ |
1174 | static void | 1198 | static void |
1175 | attest_store_task (void *cls) | 1199 | cred_store_task (void *cls) |
1176 | { | 1200 | { |
1177 | struct AttributeStoreHandle *ash = cls; | 1201 | struct AttributeStoreHandle *ash = cls; |
1178 | char *label; | 1202 | char *label; |
1179 | 1203 | ||
1180 | // Give the ash a new id if unset | 1204 | // Give the ash a new id if unset |
1181 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->attest->id)) | 1205 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->credential->id)) |
1182 | GNUNET_RECLAIM_id_generate (&ash->attest->id); | 1206 | GNUNET_RECLAIM_id_generate (&ash->credential->id); |
1183 | label = GNUNET_STRINGS_data_to_string_alloc (&ash->attest->id, | 1207 | label = GNUNET_STRINGS_data_to_string_alloc (&ash->credential->id, |
1184 | sizeof (ash->attest->id)); | 1208 | sizeof (ash->credential->id)); |
1185 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1209 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1186 | "Looking up existing data under label %s\n", label); | 1210 | "Looking up existing data under label `%s'\n", label); |
1187 | // Test for the content of the existing ID | ||
1188 | ash->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, | 1211 | ash->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, |
1189 | &ash->identity, | 1212 | &ash->identity, |
1190 | label, | 1213 | label, |
1191 | &attest_error, | 1214 | &cred_error, |
1192 | ash, | 1215 | ash, |
1193 | &attest_add_cb, | 1216 | &cred_add_cb, |
1194 | ash); | 1217 | ash); |
1195 | GNUNET_free (label); | 1218 | GNUNET_free (label); |
1196 | } | 1219 | } |
1197 | 1220 | ||
1198 | 1221 | ||
1199 | /** | 1222 | /** |
1200 | * Check an attestation store message | 1223 | * Check an credential store message |
1201 | * | 1224 | * |
1202 | * @param cls unused | 1225 | * @param cls unused |
1203 | * @param sam the message to check | 1226 | * @param sam the message to check |
1204 | */ | 1227 | */ |
1205 | static int | 1228 | static int |
1206 | check_attestation_store_message (void *cls, | 1229 | check_credential_store_message (void *cls, |
1207 | const struct AttributeStoreMessage *sam) | 1230 | const struct AttributeStoreMessage *sam) |
1208 | { | 1231 | { |
1209 | uint16_t size; | 1232 | uint16_t size; |
1210 | 1233 | ||
@@ -1219,26 +1242,26 @@ check_attestation_store_message (void *cls, | |||
1219 | 1242 | ||
1220 | 1243 | ||
1221 | /** | 1244 | /** |
1222 | * Handle an attestation store message | 1245 | * Handle a credential store message |
1223 | * | 1246 | * |
1224 | * @param cls our client | 1247 | * @param cls our client |
1225 | * @param sam the message to handle | 1248 | * @param sam the message to handle |
1226 | */ | 1249 | */ |
1227 | static void | 1250 | static void |
1228 | handle_attestation_store_message (void *cls, | 1251 | handle_credential_store_message (void *cls, |
1229 | const struct AttributeStoreMessage *sam) | 1252 | const struct AttributeStoreMessage *sam) |
1230 | { | 1253 | { |
1231 | struct AttributeStoreHandle *ash; | 1254 | struct AttributeStoreHandle *ash; |
1232 | struct IdpClient *idp = cls; | 1255 | struct IdpClient *idp = cls; |
1233 | size_t data_len; | 1256 | size_t data_len; |
1234 | 1257 | ||
1235 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTESTATION_STORE message\n"); | 1258 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n"); |
1236 | 1259 | ||
1237 | data_len = ntohs (sam->attr_len); | 1260 | data_len = ntohs (sam->attr_len); |
1238 | 1261 | ||
1239 | ash = GNUNET_new (struct AttributeStoreHandle); | 1262 | ash = GNUNET_new (struct AttributeStoreHandle); |
1240 | ash->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &sam[1], | 1263 | ash->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &sam[1], |
1241 | data_len); | 1264 | data_len); |
1242 | 1265 | ||
1243 | ash->r_id = ntohl (sam->id); | 1266 | ash->r_id = ntohl (sam->id); |
1244 | ash->identity = sam->identity; | 1267 | ash->identity = sam->identity; |
@@ -1248,7 +1271,7 @@ handle_attestation_store_message (void *cls, | |||
1248 | GNUNET_SERVICE_client_continue (idp->client); | 1271 | GNUNET_SERVICE_client_continue (idp->client); |
1249 | ash->client = idp; | 1272 | ash->client = idp; |
1250 | GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash); | 1273 | GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash); |
1251 | GNUNET_SCHEDULER_add_now (&attest_store_task, ash); | 1274 | GNUNET_SCHEDULER_add_now (&cred_store_task, ash); |
1252 | } | 1275 | } |
1253 | 1276 | ||
1254 | 1277 | ||
@@ -1304,12 +1327,12 @@ ticket_iter (void *cls, | |||
1304 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1327 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1305 | &adh->claim->id)) | 1328 | &adh->claim->id)) |
1306 | continue; | 1329 | continue; |
1307 | if (adh->attest != NULL) | 1330 | if (adh->credential != NULL) |
1308 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1331 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1309 | &adh->attest->id)) | 1332 | &adh->credential->id)) |
1310 | continue; | 1333 | continue; |
1311 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1334 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1312 | "Attribute or Attestation to delete found (%s)\n", | 1335 | "Attribute to delete found (%s)\n", |
1313 | adh->label); | 1336 | adh->label); |
1314 | has_changed = GNUNET_YES; | 1337 | has_changed = GNUNET_YES; |
1315 | break; | 1338 | break; |
@@ -1404,10 +1427,10 @@ update_tickets (void *cls) | |||
1404 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1427 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1405 | &adh->claim->id))) | 1428 | &adh->claim->id))) |
1406 | continue; | 1429 | continue; |
1407 | if (adh->attest != NULL) | 1430 | if (adh->credential != NULL) |
1408 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type) | 1431 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type) |
1409 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1432 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1410 | &adh->attest->id))) | 1433 | &adh->credential->id))) |
1411 | continue; | 1434 | continue; |
1412 | rd_new[j] = rd[i]; | 1435 | rd_new[j] = rd[i]; |
1413 | j++; | 1436 | j++; |
@@ -1548,9 +1571,10 @@ handle_attribute_delete_message (void *cls, | |||
1548 | data_len = ntohs (dam->attr_len); | 1571 | data_len = ntohs (dam->attr_len); |
1549 | 1572 | ||
1550 | adh = GNUNET_new (struct AttributeDeleteHandle); | 1573 | adh = GNUNET_new (struct AttributeDeleteHandle); |
1551 | adh->claim = GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1], | 1574 | GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1], |
1552 | data_len); | 1575 | data_len, |
1553 | adh->attest = NULL; | 1576 | &adh->claim); |
1577 | adh->credential = NULL; | ||
1554 | 1578 | ||
1555 | adh->r_id = ntohl (dam->id); | 1579 | adh->r_id = ntohl (dam->id); |
1556 | adh->identity = dam->identity; | 1580 | adh->identity = dam->identity; |
@@ -1571,14 +1595,14 @@ handle_attribute_delete_message (void *cls, | |||
1571 | 1595 | ||
1572 | 1596 | ||
1573 | /** | 1597 | /** |
1574 | * Attestation deleted callback | 1598 | * Credential deleted callback |
1575 | * | 1599 | * |
1576 | * @param cls our handle | 1600 | * @param cls our handle |
1577 | * @param success success status | 1601 | * @param success success status |
1578 | * @param emsg error message (NULL if success=GNUNET_OK) | 1602 | * @param emsg error message (NULL if success=GNUNET_OK) |
1579 | */ | 1603 | */ |
1580 | static void | 1604 | static void |
1581 | attest_delete_cont (void *cls, int32_t success, const char *emsg) | 1605 | cred_delete_cont (void *cls, int32_t success, const char *emsg) |
1582 | { | 1606 | { |
1583 | struct AttributeDeleteHandle *adh = cls; | 1607 | struct AttributeDeleteHandle *adh = cls; |
1584 | 1608 | ||
@@ -1586,7 +1610,7 @@ attest_delete_cont (void *cls, int32_t success, const char *emsg) | |||
1586 | if (GNUNET_SYSERR == success) | 1610 | if (GNUNET_SYSERR == success) |
1587 | { | 1611 | { |
1588 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1612 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1589 | "Error deleting attestation %s\n", | 1613 | "Error deleting credential `%s'\n", |
1590 | adh->label); | 1614 | adh->label); |
1591 | send_delete_response (adh, GNUNET_SYSERR); | 1615 | send_delete_response (adh, GNUNET_SYSERR); |
1592 | cleanup_adh (adh); | 1616 | cleanup_adh (adh); |
@@ -1598,14 +1622,14 @@ attest_delete_cont (void *cls, int32_t success, const char *emsg) | |||
1598 | 1622 | ||
1599 | 1623 | ||
1600 | /** | 1624 | /** |
1601 | * Check attestation delete message format | 1625 | * Check credential delete message format |
1602 | * | 1626 | * |
1603 | * @cls unused | 1627 | * @cls unused |
1604 | * @dam message to check | 1628 | * @dam message to check |
1605 | */ | 1629 | */ |
1606 | static int | 1630 | static int |
1607 | check_attestation_delete_message (void *cls, | 1631 | check_credential_delete_message (void *cls, |
1608 | const struct AttributeDeleteMessage *dam) | 1632 | const struct AttributeDeleteMessage *dam) |
1609 | { | 1633 | { |
1610 | uint16_t size; | 1634 | uint16_t size; |
1611 | 1635 | ||
@@ -1620,33 +1644,33 @@ check_attestation_delete_message (void *cls, | |||
1620 | 1644 | ||
1621 | 1645 | ||
1622 | /** | 1646 | /** |
1623 | * Handle attestation deletion | 1647 | * Handle credential deletion |
1624 | * | 1648 | * |
1625 | * @param cls our client | 1649 | * @param cls our client |
1626 | * @param dam deletion message | 1650 | * @param dam deletion message |
1627 | */ | 1651 | */ |
1628 | static void | 1652 | static void |
1629 | handle_attestation_delete_message (void *cls, | 1653 | handle_credential_delete_message (void *cls, |
1630 | const struct AttributeDeleteMessage *dam) | 1654 | const struct AttributeDeleteMessage *dam) |
1631 | { | 1655 | { |
1632 | struct AttributeDeleteHandle *adh; | 1656 | struct AttributeDeleteHandle *adh; |
1633 | struct IdpClient *idp = cls; | 1657 | struct IdpClient *idp = cls; |
1634 | size_t data_len; | 1658 | size_t data_len; |
1635 | 1659 | ||
1636 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTESTATION_DELETE message\n"); | 1660 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n"); |
1637 | 1661 | ||
1638 | data_len = ntohs (dam->attr_len); | 1662 | data_len = ntohs (dam->attr_len); |
1639 | 1663 | ||
1640 | adh = GNUNET_new (struct AttributeDeleteHandle); | 1664 | adh = GNUNET_new (struct AttributeDeleteHandle); |
1641 | adh->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &dam[1], | 1665 | adh->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &dam[1], |
1642 | data_len); | 1666 | data_len); |
1643 | adh->claim = NULL; | 1667 | adh->claim = NULL; |
1644 | 1668 | ||
1645 | adh->r_id = ntohl (dam->id); | 1669 | adh->r_id = ntohl (dam->id); |
1646 | adh->identity = dam->identity; | 1670 | adh->identity = dam->identity; |
1647 | adh->label | 1671 | adh->label |
1648 | = GNUNET_STRINGS_data_to_string_alloc (&adh->attest->id, | 1672 | = GNUNET_STRINGS_data_to_string_alloc (&adh->credential->id, |
1649 | sizeof(adh->attest->id)); | 1673 | sizeof(adh->credential->id)); |
1650 | GNUNET_SERVICE_client_continue (idp->client); | 1674 | GNUNET_SERVICE_client_continue (idp->client); |
1651 | adh->client = idp; | 1675 | adh->client = idp; |
1652 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); | 1676 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); |
@@ -1655,7 +1679,7 @@ handle_attestation_delete_message (void *cls, | |||
1655 | adh->label, | 1679 | adh->label, |
1656 | 0, | 1680 | 0, |
1657 | NULL, | 1681 | NULL, |
1658 | &attest_delete_cont, | 1682 | &cred_delete_cont, |
1659 | adh); | 1683 | adh); |
1660 | } | 1684 | } |
1661 | 1685 | ||
@@ -1705,7 +1729,7 @@ attr_iter_error (void *cls) | |||
1705 | 1729 | ||
1706 | 1730 | ||
1707 | /** | 1731 | /** |
1708 | * Got record. Return if it is an attribute or attestation. | 1732 | * Got record. Return if it is an attribute. |
1709 | * | 1733 | * |
1710 | * @param cls our attribute iterator | 1734 | * @param cls our attribute iterator |
1711 | * @param zone zone we are iterating | 1735 | * @param zone zone we are iterating |
@@ -1845,51 +1869,51 @@ handle_iteration_next (void *cls, | |||
1845 | 1869 | ||
1846 | 1870 | ||
1847 | /************************************************* | 1871 | /************************************************* |
1848 | * Attestation iteration | 1872 | * Credential iteration |
1849 | *************************************************/ | 1873 | *************************************************/ |
1850 | 1874 | ||
1851 | 1875 | ||
1852 | /** | 1876 | /** |
1853 | * Done iterating over attestations | 1877 | * Done iterating over credentials |
1854 | * | 1878 | * |
1855 | * @param cls our iterator handle | 1879 | * @param cls our iterator handle |
1856 | */ | 1880 | */ |
1857 | static void | 1881 | static void |
1858 | attest_iter_finished (void *cls) | 1882 | cred_iter_finished (void *cls) |
1859 | { | 1883 | { |
1860 | struct Iterator *ai = cls; | 1884 | struct Iterator *ai = cls; |
1861 | struct GNUNET_MQ_Envelope *env; | 1885 | struct GNUNET_MQ_Envelope *env; |
1862 | struct AttestationResultMessage *arm; | 1886 | struct CredentialResultMessage *arm; |
1863 | 1887 | ||
1864 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTESTATION_RESULT message\n"); | 1888 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n"); |
1865 | env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT); | 1889 | env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); |
1866 | arm->id = htonl (ai->request_id); | 1890 | arm->id = htonl (ai->request_id); |
1867 | arm->attestation_len = htons (0); | 1891 | arm->credential_len = htons (0); |
1868 | GNUNET_MQ_send (ai->client->mq, env); | 1892 | GNUNET_MQ_send (ai->client->mq, env); |
1869 | GNUNET_CONTAINER_DLL_remove (ai->client->attest_iter_head, | 1893 | GNUNET_CONTAINER_DLL_remove (ai->client->cred_iter_head, |
1870 | ai->client->attest_iter_tail, | 1894 | ai->client->cred_iter_tail, |
1871 | ai); | 1895 | ai); |
1872 | GNUNET_free (ai); | 1896 | GNUNET_free (ai); |
1873 | } | 1897 | } |
1874 | 1898 | ||
1875 | 1899 | ||
1876 | /** | 1900 | /** |
1877 | * Error iterating over attestations. Abort. | 1901 | * Error iterating over credentials. Abort. |
1878 | * | 1902 | * |
1879 | * @param cls our attribute iteration handle | 1903 | * @param cls our attribute iteration handle |
1880 | */ | 1904 | */ |
1881 | static void | 1905 | static void |
1882 | attest_iter_error (void *cls) | 1906 | cred_iter_error (void *cls) |
1883 | { | 1907 | { |
1884 | struct Iterator *ai = cls; | 1908 | struct Iterator *ai = cls; |
1885 | 1909 | ||
1886 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attestations\n"); | 1910 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over credentials\n"); |
1887 | attest_iter_finished (ai); | 1911 | cred_iter_finished (ai); |
1888 | } | 1912 | } |
1889 | 1913 | ||
1890 | 1914 | ||
1891 | /** | 1915 | /** |
1892 | * Got record. Return attestation. | 1916 | * Got record. Return credential. |
1893 | * | 1917 | * |
1894 | * @param cls our attribute iterator | 1918 | * @param cls our attribute iterator |
1895 | * @param zone zone we are iterating | 1919 | * @param zone zone we are iterating |
@@ -1898,32 +1922,32 @@ attest_iter_error (void *cls) | |||
1898 | * @param rd records | 1922 | * @param rd records |
1899 | */ | 1923 | */ |
1900 | static void | 1924 | static void |
1901 | attest_iter_cb (void *cls, | 1925 | cred_iter_cb (void *cls, |
1902 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 1926 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
1903 | const char *label, | 1927 | const char *label, |
1904 | unsigned int rd_count, | 1928 | unsigned int rd_count, |
1905 | const struct GNUNET_GNSRECORD_Data *rd) | 1929 | const struct GNUNET_GNSRECORD_Data *rd) |
1906 | { | 1930 | { |
1907 | struct Iterator *ai = cls; | 1931 | struct Iterator *ai = cls; |
1908 | struct GNUNET_MQ_Envelope *env; | 1932 | struct GNUNET_MQ_Envelope *env; |
1909 | struct AttestationResultMessage *arm; | 1933 | struct CredentialResultMessage *arm; |
1910 | char *data_tmp; | 1934 | char *data_tmp; |
1911 | 1935 | ||
1912 | if ((rd_count != 1) || | 1936 | if ((rd_count != 1) || |
1913 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd->record_type)) | 1937 | (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL != rd->record_type)) |
1914 | { | 1938 | { |
1915 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); | 1939 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); |
1916 | return; | 1940 | return; |
1917 | } | 1941 | } |
1918 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n", | 1942 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found credential under: %s\n", |
1919 | label); | 1943 | label); |
1920 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1944 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1921 | "Sending ATTESTATION_RESULT message\n"); | 1945 | "Sending CREDENTIAL_RESULT message\n"); |
1922 | env = GNUNET_MQ_msg_extra (arm, | 1946 | env = GNUNET_MQ_msg_extra (arm, |
1923 | rd->data_size, | 1947 | rd->data_size, |
1924 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT); | 1948 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); |
1925 | arm->id = htonl (ai->request_id); | 1949 | arm->id = htonl (ai->request_id); |
1926 | arm->attestation_len = htons (rd->data_size); | 1950 | arm->credential_len = htons (rd->data_size); |
1927 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); | 1951 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); |
1928 | data_tmp = (char *) &arm[1]; | 1952 | data_tmp = (char *) &arm[1]; |
1929 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); | 1953 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); |
@@ -1939,29 +1963,29 @@ attest_iter_cb (void *cls, | |||
1939 | * @param ais_msg the iteration message to start | 1963 | * @param ais_msg the iteration message to start |
1940 | */ | 1964 | */ |
1941 | static void | 1965 | static void |
1942 | handle_attestation_iteration_start (void *cls, | 1966 | handle_credential_iteration_start (void *cls, |
1943 | const struct | 1967 | const struct |
1944 | AttestationIterationStartMessage *ais_msg) | 1968 | CredentialIterationStartMessage *ais_msg) |
1945 | { | 1969 | { |
1946 | struct IdpClient *idp = cls; | 1970 | struct IdpClient *idp = cls; |
1947 | struct Iterator *ai; | 1971 | struct Iterator *ai; |
1948 | 1972 | ||
1949 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1973 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1950 | "Received ATTESTATION_ITERATION_START message\n"); | 1974 | "Received CREDENTIAL_ITERATION_START message\n"); |
1951 | ai = GNUNET_new (struct Iterator); | 1975 | ai = GNUNET_new (struct Iterator); |
1952 | ai->request_id = ntohl (ais_msg->id); | 1976 | ai->request_id = ntohl (ais_msg->id); |
1953 | ai->client = idp; | 1977 | ai->client = idp; |
1954 | ai->identity = ais_msg->identity; | 1978 | ai->identity = ais_msg->identity; |
1955 | 1979 | ||
1956 | GNUNET_CONTAINER_DLL_insert (idp->attest_iter_head, idp->attest_iter_tail, | 1980 | GNUNET_CONTAINER_DLL_insert (idp->cred_iter_head, idp->cred_iter_tail, |
1957 | ai); | 1981 | ai); |
1958 | ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh, | 1982 | ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh, |
1959 | &ai->identity, | 1983 | &ai->identity, |
1960 | &attest_iter_error, | 1984 | &cred_iter_error, |
1961 | ai, | 1985 | ai, |
1962 | &attest_iter_cb, | 1986 | &cred_iter_cb, |
1963 | ai, | 1987 | ai, |
1964 | &attest_iter_finished, | 1988 | &cred_iter_finished, |
1965 | ai); | 1989 | ai); |
1966 | GNUNET_SERVICE_client_continue (idp->client); | 1990 | GNUNET_SERVICE_client_continue (idp->client); |
1967 | } | 1991 | } |
@@ -1974,9 +1998,9 @@ handle_attestation_iteration_start (void *cls, | |||
1974 | * @param ais_msg the stop message | 1998 | * @param ais_msg the stop message |
1975 | */ | 1999 | */ |
1976 | static void | 2000 | static void |
1977 | handle_attestation_iteration_stop (void *cls, | 2001 | handle_credential_iteration_stop (void *cls, |
1978 | const struct | 2002 | const struct |
1979 | AttestationIterationStopMessage *ais_msg) | 2003 | CredentialIterationStopMessage *ais_msg) |
1980 | { | 2004 | { |
1981 | struct IdpClient *idp = cls; | 2005 | struct IdpClient *idp = cls; |
1982 | struct Iterator *ai; | 2006 | struct Iterator *ai; |
@@ -1984,9 +2008,9 @@ handle_attestation_iteration_stop (void *cls, | |||
1984 | 2008 | ||
1985 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2009 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1986 | "Received `%s' message\n", | 2010 | "Received `%s' message\n", |
1987 | "ATTESTATION_ITERATION_STOP"); | 2011 | "CREDENTIAL_ITERATION_STOP"); |
1988 | rid = ntohl (ais_msg->id); | 2012 | rid = ntohl (ais_msg->id); |
1989 | for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next) | 2013 | for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next) |
1990 | if (ai->request_id == rid) | 2014 | if (ai->request_id == rid) |
1991 | break; | 2015 | break; |
1992 | if (NULL == ai) | 2016 | if (NULL == ai) |
@@ -1995,7 +2019,7 @@ handle_attestation_iteration_stop (void *cls, | |||
1995 | GNUNET_SERVICE_client_drop (idp->client); | 2019 | GNUNET_SERVICE_client_drop (idp->client); |
1996 | return; | 2020 | return; |
1997 | } | 2021 | } |
1998 | GNUNET_CONTAINER_DLL_remove (idp->attest_iter_head, idp->attest_iter_tail, | 2022 | GNUNET_CONTAINER_DLL_remove (idp->cred_iter_head, idp->cred_iter_tail, |
1999 | ai); | 2023 | ai); |
2000 | GNUNET_free (ai); | 2024 | GNUNET_free (ai); |
2001 | GNUNET_SERVICE_client_continue (idp->client); | 2025 | GNUNET_SERVICE_client_continue (idp->client); |
@@ -2003,24 +2027,24 @@ handle_attestation_iteration_stop (void *cls, | |||
2003 | 2027 | ||
2004 | 2028 | ||
2005 | /** | 2029 | /** |
2006 | * Client requests next attestation from iterator | 2030 | * Client requests next credential from iterator |
2007 | * | 2031 | * |
2008 | * @param cls the client | 2032 | * @param cls the client |
2009 | * @param ais_msg the message | 2033 | * @param ais_msg the message |
2010 | */ | 2034 | */ |
2011 | static void | 2035 | static void |
2012 | handle_attestation_iteration_next (void *cls, | 2036 | handle_credential_iteration_next (void *cls, |
2013 | const struct | 2037 | const struct |
2014 | AttestationIterationNextMessage *ais_msg) | 2038 | CredentialIterationNextMessage *ais_msg) |
2015 | { | 2039 | { |
2016 | struct IdpClient *idp = cls; | 2040 | struct IdpClient *idp = cls; |
2017 | struct Iterator *ai; | 2041 | struct Iterator *ai; |
2018 | uint32_t rid; | 2042 | uint32_t rid; |
2019 | 2043 | ||
2020 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2044 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2021 | "Received ATTESTATION_ITERATION_NEXT message\n"); | 2045 | "Received CREDENTIAL_ITERATION_NEXT message\n"); |
2022 | rid = ntohl (ais_msg->id); | 2046 | rid = ntohl (ais_msg->id); |
2023 | for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next) | 2047 | for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next) |
2024 | if (ai->request_id == rid) | 2048 | if (ai->request_id == rid) |
2025 | break; | 2049 | break; |
2026 | if (NULL == ai) | 2050 | if (NULL == ai) |
@@ -2262,16 +2286,16 @@ GNUNET_SERVICE_MAIN ( | |||
2262 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, | 2286 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, |
2263 | struct AttributeStoreMessage, | 2287 | struct AttributeStoreMessage, |
2264 | NULL), | 2288 | NULL), |
2265 | GNUNET_MQ_hd_var_size (attestation_store_message, | 2289 | GNUNET_MQ_hd_var_size (credential_store_message, |
2266 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE, | 2290 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE, |
2267 | struct AttributeStoreMessage, | 2291 | struct AttributeStoreMessage, |
2268 | NULL), | 2292 | NULL), |
2269 | GNUNET_MQ_hd_var_size (attribute_delete_message, | 2293 | GNUNET_MQ_hd_var_size (attribute_delete_message, |
2270 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, | 2294 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, |
2271 | struct AttributeDeleteMessage, | 2295 | struct AttributeDeleteMessage, |
2272 | NULL), | 2296 | NULL), |
2273 | GNUNET_MQ_hd_var_size (attestation_delete_message, | 2297 | GNUNET_MQ_hd_var_size (credential_delete_message, |
2274 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE, | 2298 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE, |
2275 | struct AttributeDeleteMessage, | 2299 | struct AttributeDeleteMessage, |
2276 | NULL), | 2300 | NULL), |
2277 | GNUNET_MQ_hd_fixed_size (iteration_start, | 2301 | GNUNET_MQ_hd_fixed_size (iteration_start, |
@@ -2286,17 +2310,17 @@ GNUNET_SERVICE_MAIN ( | |||
2286 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, | 2310 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, |
2287 | struct AttributeIterationStopMessage, | 2311 | struct AttributeIterationStopMessage, |
2288 | NULL), | 2312 | NULL), |
2289 | GNUNET_MQ_hd_fixed_size (attestation_iteration_start, | 2313 | GNUNET_MQ_hd_fixed_size (credential_iteration_start, |
2290 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START, | 2314 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, |
2291 | struct AttestationIterationStartMessage, | 2315 | struct CredentialIterationStartMessage, |
2292 | NULL), | 2316 | NULL), |
2293 | GNUNET_MQ_hd_fixed_size (attestation_iteration_next, | 2317 | GNUNET_MQ_hd_fixed_size (credential_iteration_next, |
2294 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT, | 2318 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, |
2295 | struct AttestationIterationNextMessage, | 2319 | struct CredentialIterationNextMessage, |
2296 | NULL), | 2320 | NULL), |
2297 | GNUNET_MQ_hd_fixed_size (attestation_iteration_stop, | 2321 | GNUNET_MQ_hd_fixed_size (credential_iteration_stop, |
2298 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP, | 2322 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP, |
2299 | struct AttestationIterationStopMessage, | 2323 | struct CredentialIterationStopMessage, |
2300 | NULL), | 2324 | NULL), |
2301 | 2325 | ||
2302 | GNUNET_MQ_hd_var_size (issue_ticket_message, | 2326 | GNUNET_MQ_hd_var_size (issue_ticket_message, |