diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-19 19:05:23 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-20 17:59:01 +0200 |
commit | e75869506cc08e08056168383bd4ab02e1f007de (patch) | |
tree | b4617425e38fbd7070f6a6d7cd41544a7f41df5d /src/reclaim/reclaim_api.c | |
parent | 1ca1140d4602dcc5c66da0d1ab1b082db9258ead (diff) | |
download | gnunet-e75869506cc08e08056168383bd4ab02e1f007de.tar.gz gnunet-e75869506cc08e08056168383bd4ab02e1f007de.zip |
- towards separation between credentials and presentations thereof, wip, ftbfs
Diffstat (limited to 'src/reclaim/reclaim_api.c')
-rw-r--r-- | src/reclaim/reclaim_api.c | 161 |
1 files changed, 80 insertions, 81 deletions
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index b432b4f2a..2cfcbad09 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -77,9 +77,9 @@ struct GNUNET_RECLAIM_Operation | |||
77 | GNUNET_RECLAIM_AttributeTicketResult atr_cb; | 77 | GNUNET_RECLAIM_AttributeTicketResult atr_cb; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Attestation result callback | 80 | * Credential result callback |
81 | */ | 81 | */ |
82 | GNUNET_RECLAIM_AttestationResult at_cb; | 82 | GNUNET_RECLAIM_CredentialResult at_cb; |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Revocation result callback | 85 | * Revocation result callback |
@@ -239,19 +239,19 @@ struct GNUNET_RECLAIM_AttributeIterator | |||
239 | }; | 239 | }; |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * Handle for a attestation iterator operation | 242 | * Handle for a credential iterator operation |
243 | */ | 243 | */ |
244 | struct GNUNET_RECLAIM_AttestationIterator | 244 | struct GNUNET_RECLAIM_CredentialIterator |
245 | { | 245 | { |
246 | /** | 246 | /** |
247 | * Kept in a DLL. | 247 | * Kept in a DLL. |
248 | */ | 248 | */ |
249 | struct GNUNET_RECLAIM_AttestationIterator *next; | 249 | struct GNUNET_RECLAIM_CredentialIterator *next; |
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Kept in a DLL. | 252 | * Kept in a DLL. |
253 | */ | 253 | */ |
254 | struct GNUNET_RECLAIM_AttestationIterator *prev; | 254 | struct GNUNET_RECLAIM_CredentialIterator *prev; |
255 | 255 | ||
256 | /** | 256 | /** |
257 | * Main handle to access the service. | 257 | * Main handle to access the service. |
@@ -271,7 +271,7 @@ struct GNUNET_RECLAIM_AttestationIterator | |||
271 | /** | 271 | /** |
272 | * The continuation to call with the results | 272 | * The continuation to call with the results |
273 | */ | 273 | */ |
274 | GNUNET_RECLAIM_AttestationResult proc; | 274 | GNUNET_RECLAIM_CredentialResult proc; |
275 | 275 | ||
276 | /** | 276 | /** |
277 | * Closure for @e proc. | 277 | * Closure for @e proc. |
@@ -349,12 +349,12 @@ struct GNUNET_RECLAIM_Handle | |||
349 | /** | 349 | /** |
350 | * Head of active iterations | 350 | * Head of active iterations |
351 | */ | 351 | */ |
352 | struct GNUNET_RECLAIM_AttestationIterator *ait_head; | 352 | struct GNUNET_RECLAIM_CredentialIterator *ait_head; |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * Tail of active iterations | 355 | * Tail of active iterations |
356 | */ | 356 | */ |
357 | struct GNUNET_RECLAIM_AttestationIterator *ait_tail; | 357 | struct GNUNET_RECLAIM_CredentialIterator *ait_tail; |
358 | 358 | ||
359 | /** | 359 | /** |
360 | * Head of active iterations | 360 | * Head of active iterations |
@@ -464,7 +464,7 @@ free_it (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
464 | * @param ait entry to free | 464 | * @param ait entry to free |
465 | */ | 465 | */ |
466 | static void | 466 | static void |
467 | free_ait (struct GNUNET_RECLAIM_AttestationIterator *ait) | 467 | free_ait (struct GNUNET_RECLAIM_CredentialIterator *ait) |
468 | { | 468 | { |
469 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 469 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
470 | 470 | ||
@@ -561,13 +561,13 @@ check_consume_ticket_result (void *cls, | |||
561 | { | 561 | { |
562 | size_t msg_len; | 562 | size_t msg_len; |
563 | size_t attrs_len; | 563 | size_t attrs_len; |
564 | size_t attests_len; | 564 | size_t pl_len; |
565 | 565 | ||
566 | msg_len = ntohs (msg->header.size); | 566 | msg_len = ntohs (msg->header.size); |
567 | attrs_len = ntohs (msg->attrs_len); | 567 | attrs_len = ntohs (msg->attrs_len); |
568 | attests_len = ntohs (msg->attestations_len); | 568 | pl_len = ntohs (msg->presentations_len); |
569 | if (msg_len != | 569 | if (msg_len != |
570 | sizeof(struct ConsumeTicketResultMessage) + attrs_len + attests_len) | 570 | sizeof(struct ConsumeTicketResultMessage) + attrs_len + pl_len) |
571 | { | 571 | { |
572 | GNUNET_break (0); | 572 | GNUNET_break (0); |
573 | return GNUNET_SYSERR; | 573 | return GNUNET_SYSERR; |
@@ -590,12 +590,12 @@ handle_consume_ticket_result (void *cls, | |||
590 | struct GNUNET_RECLAIM_Handle *h = cls; | 590 | struct GNUNET_RECLAIM_Handle *h = cls; |
591 | struct GNUNET_RECLAIM_Operation *op; | 591 | struct GNUNET_RECLAIM_Operation *op; |
592 | size_t attrs_len; | 592 | size_t attrs_len; |
593 | size_t attests_len; | 593 | size_t pl_len; |
594 | uint32_t r_id = ntohl (msg->id); | 594 | uint32_t r_id = ntohl (msg->id); |
595 | char *read_ptr; | 595 | char *read_ptr; |
596 | 596 | ||
597 | attrs_len = ntohs (msg->attrs_len); | 597 | attrs_len = ntohs (msg->attrs_len); |
598 | attests_len = ntohs (msg->attestations_len); | 598 | pl_len = ntohs (msg->presentations_len); |
599 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); | 599 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); |
600 | 600 | ||
601 | 601 | ||
@@ -608,13 +608,12 @@ handle_consume_ticket_result (void *cls, | |||
608 | { | 608 | { |
609 | struct GNUNET_RECLAIM_AttributeList *attrs; | 609 | struct GNUNET_RECLAIM_AttributeList *attrs; |
610 | struct GNUNET_RECLAIM_AttributeListEntry *le; | 610 | struct GNUNET_RECLAIM_AttributeListEntry *le; |
611 | struct GNUNET_RECLAIM_AttestationList *attests; | 611 | struct GNUNET_RECLAIM_PresentationList *pl; |
612 | struct GNUNET_RECLAIM_AttestationListEntry *ale; | 612 | struct GNUNET_RECLAIM_PresentationListEntry *ple; |
613 | attrs = | 613 | attrs = |
614 | GNUNET_RECLAIM_attribute_list_deserialize ((char *) &msg[1], attrs_len); | 614 | GNUNET_RECLAIM_attribute_list_deserialize ((char *) &msg[1], attrs_len); |
615 | read_ptr = ((char *) &msg[1]) + attrs_len; | 615 | read_ptr = ((char *) &msg[1]) + attrs_len; |
616 | attests = | 616 | pl = GNUNET_RECLAIM_presentation_list_deserialize (read_ptr, pl_len); |
617 | GNUNET_RECLAIM_attestation_list_deserialize (read_ptr, attests_len); | ||
618 | if (NULL != op->atr_cb) | 617 | if (NULL != op->atr_cb) |
619 | { | 618 | { |
620 | if (NULL == attrs) | 619 | if (NULL == attrs) |
@@ -626,22 +625,22 @@ handle_consume_ticket_result (void *cls, | |||
626 | for (le = attrs->list_head; NULL != le; le = le->next) | 625 | for (le = attrs->list_head; NULL != le; le = le->next) |
627 | { | 626 | { |
628 | if (GNUNET_NO == | 627 | if (GNUNET_NO == |
629 | GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation)) | 628 | GNUNET_RECLAIM_id_is_zero (&le->attribute->credential)) |
630 | { | 629 | { |
631 | for (ale = attests->list_head; NULL != ale; ale = ale->next) | 630 | for (ple = pl->list_head; NULL != ple; ple = ple->next) |
632 | { | 631 | { |
633 | if (GNUNET_YES == | 632 | if (GNUNET_YES == |
634 | GNUNET_RECLAIM_id_is_equal (&le->attribute->attestation, | 633 | GNUNET_RECLAIM_id_is_equal (&le->attribute->credential, |
635 | &ale->attestation->id)) | 634 | &ple->presentation->credential_id)) |
636 | { | 635 | { |
637 | op->atr_cb (op->cls, &msg->identity, | 636 | op->atr_cb (op->cls, &msg->identity, |
638 | le->attribute, ale->attestation); | 637 | le->attribute, ple->presentation); |
639 | break; | 638 | break; |
640 | } | 639 | } |
641 | 640 | ||
642 | } | 641 | } |
643 | } | 642 | } |
644 | else // No attestations | 643 | else // No credentials |
645 | { | 644 | { |
646 | op->atr_cb (op->cls, &msg->identity, | 645 | op->atr_cb (op->cls, &msg->identity, |
647 | le->attribute, NULL); | 646 | le->attribute, NULL); |
@@ -649,10 +648,10 @@ handle_consume_ticket_result (void *cls, | |||
649 | } | 648 | } |
650 | if (NULL != attrs) | 649 | if (NULL != attrs) |
651 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | 650 | GNUNET_RECLAIM_attribute_list_destroy (attrs); |
652 | if (NULL != attests) | 651 | if (NULL != pl) |
653 | GNUNET_RECLAIM_attestation_list_destroy (attests); | 652 | GNUNET_RECLAIM_presentation_list_destroy (pl); |
654 | attrs = NULL; | 653 | attrs = NULL; |
655 | attests = NULL; | 654 | pl = NULL; |
656 | } | 655 | } |
657 | op->atr_cb (op->cls, NULL, NULL, NULL); | 656 | op->atr_cb (op->cls, NULL, NULL, NULL); |
658 | } | 657 | } |
@@ -768,21 +767,21 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
768 | 767 | ||
769 | /** | 768 | /** |
770 | * Handle an incoming message of type | 769 | * Handle an incoming message of type |
771 | * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT | 770 | * #GNUNET_MESSAGE_TYPE_RECLAIM_credential_RESULT |
772 | * | 771 | * |
773 | * @param cls | 772 | * @param cls |
774 | * @param msg the message we received | 773 | * @param msg the message we received |
775 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 774 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
776 | */ | 775 | */ |
777 | static int | 776 | static int |
778 | check_attestation_result (void *cls, const struct AttestationResultMessage *msg) | 777 | check_credential_result (void *cls, const struct CredentialResultMessage *msg) |
779 | { | 778 | { |
780 | size_t msg_len; | 779 | size_t msg_len; |
781 | size_t attest_len; | 780 | size_t cred_len; |
782 | 781 | ||
783 | msg_len = ntohs (msg->header.size); | 782 | msg_len = ntohs (msg->header.size); |
784 | attest_len = ntohs (msg->attestation_len); | 783 | cred_len = ntohs (msg->credential_len); |
785 | if (msg_len != sizeof(struct AttestationResultMessage) + attest_len) | 784 | if (msg_len != sizeof(struct CredentialResultMessage) + cred_len) |
786 | { | 785 | { |
787 | GNUNET_break (0); | 786 | GNUNET_break (0); |
788 | return GNUNET_SYSERR; | 787 | return GNUNET_SYSERR; |
@@ -793,24 +792,24 @@ check_attestation_result (void *cls, const struct AttestationResultMessage *msg) | |||
793 | 792 | ||
794 | /** | 793 | /** |
795 | * Handle an incoming message of type | 794 | * Handle an incoming message of type |
796 | * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT | 795 | * #GNUNET_MESSAGE_TYPE_RECLAIM_credential_RESULT |
797 | * | 796 | * |
798 | * @param cls | 797 | * @param cls |
799 | * @param msg the message we received | 798 | * @param msg the message we received |
800 | */ | 799 | */ |
801 | static void | 800 | static void |
802 | handle_attestation_result (void *cls, const struct | 801 | handle_credential_result (void *cls, const struct |
803 | AttestationResultMessage *msg) | 802 | CredentialResultMessage *msg) |
804 | { | 803 | { |
805 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; | 804 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; |
806 | struct GNUNET_RECLAIM_Handle *h = cls; | 805 | struct GNUNET_RECLAIM_Handle *h = cls; |
807 | struct GNUNET_RECLAIM_AttestationIterator *it; | 806 | struct GNUNET_RECLAIM_CredentialIterator *it; |
808 | struct GNUNET_RECLAIM_Operation *op; | 807 | struct GNUNET_RECLAIM_Operation *op; |
809 | size_t att_len; | 808 | size_t att_len; |
810 | uint32_t r_id = ntohl (msg->id); | 809 | uint32_t r_id = ntohl (msg->id); |
811 | 810 | ||
812 | att_len = ntohs (msg->attestation_len); | 811 | att_len = ntohs (msg->credential_len); |
813 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attestation result.\n"); | 812 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing credential result.\n"); |
814 | 813 | ||
815 | 814 | ||
816 | for (it = h->ait_head; NULL != it; it = it->next) | 815 | for (it = h->ait_head; NULL != it; it = it->next) |
@@ -848,8 +847,8 @@ handle_attestation_result (void *cls, const struct | |||
848 | } | 847 | } |
849 | 848 | ||
850 | { | 849 | { |
851 | struct GNUNET_RECLAIM_Attestation *att; | 850 | struct GNUNET_RECLAIM_Credential *att; |
852 | att = GNUNET_RECLAIM_attestation_deserialize ((char *) &msg[1], att_len); | 851 | att = GNUNET_RECLAIM_credential_deserialize ((char *) &msg[1], att_len); |
853 | 852 | ||
854 | if (NULL != it) | 853 | if (NULL != it) |
855 | { | 854 | { |
@@ -986,9 +985,9 @@ reconnect (struct GNUNET_RECLAIM_Handle *h) | |||
986 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, | 985 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, |
987 | struct AttributeResultMessage, | 986 | struct AttributeResultMessage, |
988 | h), | 987 | h), |
989 | GNUNET_MQ_hd_var_size (attestation_result, | 988 | GNUNET_MQ_hd_var_size (credential_result, |
990 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, | 989 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT, |
991 | struct AttestationResultMessage, | 990 | struct CredentialResultMessage, |
992 | h), | 991 | h), |
993 | GNUNET_MQ_hd_fixed_size (ticket_result, | 992 | GNUNET_MQ_hd_fixed_size (ticket_result, |
994 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, | 993 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, |
@@ -1175,22 +1174,22 @@ GNUNET_RECLAIM_attribute_delete ( | |||
1175 | 1174 | ||
1176 | 1175 | ||
1177 | /** | 1176 | /** |
1178 | * Store an attestation. If the attestation is already present, | 1177 | * Store an credential. If the credential is already present, |
1179 | * it is replaced with the new attestation. | 1178 | * it is replaced with the new credential. |
1180 | * | 1179 | * |
1181 | * @param h handle to the re:claimID service | 1180 | * @param h handle to the re:claimID service |
1182 | * @param pkey private key of the identity | 1181 | * @param pkey private key of the identity |
1183 | * @param attr the attestation value | 1182 | * @param attr the credential value |
1184 | * @param exp_interval the relative expiration interval for the attestation | 1183 | * @param exp_interval the relative expiration interval for the credential |
1185 | * @param cont continuation to call when done | 1184 | * @param cont continuation to call when done |
1186 | * @param cont_cls closure for @a cont | 1185 | * @param cont_cls closure for @a cont |
1187 | * @return handle to abort the request | 1186 | * @return handle to abort the request |
1188 | */ | 1187 | */ |
1189 | struct GNUNET_RECLAIM_Operation * | 1188 | struct GNUNET_RECLAIM_Operation * |
1190 | GNUNET_RECLAIM_attestation_store ( | 1189 | GNUNET_RECLAIM_credential_store ( |
1191 | struct GNUNET_RECLAIM_Handle *h, | 1190 | struct GNUNET_RECLAIM_Handle *h, |
1192 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 1191 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
1193 | const struct GNUNET_RECLAIM_Attestation *attr, | 1192 | const struct GNUNET_RECLAIM_Credential *attr, |
1194 | const struct GNUNET_TIME_Relative *exp_interval, | 1193 | const struct GNUNET_TIME_Relative *exp_interval, |
1195 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 1194 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
1196 | void *cont_cls) | 1195 | void *cont_cls) |
@@ -1205,15 +1204,15 @@ GNUNET_RECLAIM_attestation_store ( | |||
1205 | op->cls = cont_cls; | 1204 | op->cls = cont_cls; |
1206 | op->r_id = h->r_id_gen++; | 1205 | op->r_id = h->r_id_gen++; |
1207 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1206 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1208 | attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr); | 1207 | attr_len = GNUNET_RECLAIM_credential_serialize_get_size (attr); |
1209 | op->env = GNUNET_MQ_msg_extra (sam, | 1208 | op->env = GNUNET_MQ_msg_extra (sam, |
1210 | attr_len, | 1209 | attr_len, |
1211 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE); | 1210 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE); |
1212 | sam->identity = *pkey; | 1211 | sam->identity = *pkey; |
1213 | sam->id = htonl (op->r_id); | 1212 | sam->id = htonl (op->r_id); |
1214 | sam->exp = GNUNET_htonll (exp_interval->rel_value_us); | 1213 | sam->exp = GNUNET_htonll (exp_interval->rel_value_us); |
1215 | 1214 | ||
1216 | GNUNET_RECLAIM_attestation_serialize (attr, (char *) &sam[1]); | 1215 | GNUNET_RECLAIM_credential_serialize (attr, (char *) &sam[1]); |
1217 | 1216 | ||
1218 | sam->attr_len = htons (attr_len); | 1217 | sam->attr_len = htons (attr_len); |
1219 | if (NULL != h->mq) | 1218 | if (NULL != h->mq) |
@@ -1223,21 +1222,21 @@ GNUNET_RECLAIM_attestation_store ( | |||
1223 | 1222 | ||
1224 | 1223 | ||
1225 | /** | 1224 | /** |
1226 | * Delete an attestation. Tickets used to share this attestation are updated | 1225 | * Delete an credential. Tickets used to share this credential are updated |
1227 | * accordingly. | 1226 | * accordingly. |
1228 | * | 1227 | * |
1229 | * @param h handle to the re:claimID service | 1228 | * @param h handle to the re:claimID service |
1230 | * @param pkey Private key of the identity to add an attribute to | 1229 | * @param pkey Private key of the identity to add an attribute to |
1231 | * @param attr The attestation | 1230 | * @param attr The credential |
1232 | * @param cont Continuation to call when done | 1231 | * @param cont Continuation to call when done |
1233 | * @param cont_cls Closure for @a cont | 1232 | * @param cont_cls Closure for @a cont |
1234 | * @return handle Used to to abort the request | 1233 | * @return handle Used to to abort the request |
1235 | */ | 1234 | */ |
1236 | struct GNUNET_RECLAIM_Operation * | 1235 | struct GNUNET_RECLAIM_Operation * |
1237 | GNUNET_RECLAIM_attestation_delete ( | 1236 | GNUNET_RECLAIM_credential_delete ( |
1238 | struct GNUNET_RECLAIM_Handle *h, | 1237 | struct GNUNET_RECLAIM_Handle *h, |
1239 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 1238 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
1240 | const struct GNUNET_RECLAIM_Attestation *attr, | 1239 | const struct GNUNET_RECLAIM_Credential *attr, |
1241 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 1240 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
1242 | void *cont_cls) | 1241 | void *cont_cls) |
1243 | { | 1242 | { |
@@ -1251,13 +1250,13 @@ GNUNET_RECLAIM_attestation_delete ( | |||
1251 | op->cls = cont_cls; | 1250 | op->cls = cont_cls; |
1252 | op->r_id = h->r_id_gen++; | 1251 | op->r_id = h->r_id_gen++; |
1253 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1252 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1254 | attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr); | 1253 | attr_len = GNUNET_RECLAIM_credential_serialize_get_size (attr); |
1255 | op->env = GNUNET_MQ_msg_extra (dam, | 1254 | op->env = GNUNET_MQ_msg_extra (dam, |
1256 | attr_len, | 1255 | attr_len, |
1257 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE); | 1256 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE); |
1258 | dam->identity = *pkey; | 1257 | dam->identity = *pkey; |
1259 | dam->id = htonl (op->r_id); | 1258 | dam->id = htonl (op->r_id); |
1260 | GNUNET_RECLAIM_attestation_serialize (attr, (char *) &dam[1]); | 1259 | GNUNET_RECLAIM_credential_serialize (attr, (char *) &dam[1]); |
1261 | 1260 | ||
1262 | dam->attr_len = htons (attr_len); | 1261 | dam->attr_len = htons (attr_len); |
1263 | if (NULL != h->mq) | 1262 | if (NULL != h->mq) |
@@ -1376,12 +1375,12 @@ GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
1376 | 1375 | ||
1377 | 1376 | ||
1378 | /** | 1377 | /** |
1379 | * List all attestations for a local identity. | 1378 | * List all credentials for a local identity. |
1380 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` | 1379 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` |
1381 | * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and | 1380 | * for any other calls than #GNUNET_RECLAIM_get_credentials_next() and |
1382 | * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once | 1381 | * #GNUNET_RECLAIM_get_credentials_stop. @a proc will be called once |
1383 | * immediately, and then again after | 1382 | * immediately, and then again after |
1384 | * #GNUNET_RECLAIM_get_attestations_next() is invoked. | 1383 | * #GNUNET_RECLAIM_get_credentials_next() is invoked. |
1385 | * | 1384 | * |
1386 | * On error (disconnect), @a error_cb will be invoked. | 1385 | * On error (disconnect), @a error_cb will be invoked. |
1387 | * On normal completion, @a finish_cb proc will be | 1386 | * On normal completion, @a finish_cb proc will be |
@@ -1392,31 +1391,31 @@ GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
1392 | * @param error_cb Function to call on error (i.e. disconnect), | 1391 | * @param error_cb Function to call on error (i.e. disconnect), |
1393 | * the handle is afterwards invalid | 1392 | * the handle is afterwards invalid |
1394 | * @param error_cb_cls Closure for @a error_cb | 1393 | * @param error_cb_cls Closure for @a error_cb |
1395 | * @param proc Function to call on each attestation | 1394 | * @param proc Function to call on each credential |
1396 | * @param proc_cls Closure for @a proc | 1395 | * @param proc_cls Closure for @a proc |
1397 | * @param finish_cb Function to call on completion | 1396 | * @param finish_cb Function to call on completion |
1398 | * the handle is afterwards invalid | 1397 | * the handle is afterwards invalid |
1399 | * @param finish_cb_cls Closure for @a finish_cb | 1398 | * @param finish_cb_cls Closure for @a finish_cb |
1400 | * @return an iterator Handle to use for iteration | 1399 | * @return an iterator Handle to use for iteration |
1401 | */ | 1400 | */ |
1402 | struct GNUNET_RECLAIM_AttestationIterator * | 1401 | struct GNUNET_RECLAIM_CredentialIterator * |
1403 | GNUNET_RECLAIM_get_attestations_start ( | 1402 | GNUNET_RECLAIM_get_credentials_start ( |
1404 | struct GNUNET_RECLAIM_Handle *h, | 1403 | struct GNUNET_RECLAIM_Handle *h, |
1405 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 1404 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
1406 | GNUNET_SCHEDULER_TaskCallback error_cb, | 1405 | GNUNET_SCHEDULER_TaskCallback error_cb, |
1407 | void *error_cb_cls, | 1406 | void *error_cb_cls, |
1408 | GNUNET_RECLAIM_AttestationResult proc, | 1407 | GNUNET_RECLAIM_CredentialResult proc, |
1409 | void *proc_cls, | 1408 | void *proc_cls, |
1410 | GNUNET_SCHEDULER_TaskCallback finish_cb, | 1409 | GNUNET_SCHEDULER_TaskCallback finish_cb, |
1411 | void *finish_cb_cls) | 1410 | void *finish_cb_cls) |
1412 | { | 1411 | { |
1413 | struct GNUNET_RECLAIM_AttestationIterator *ait; | 1412 | struct GNUNET_RECLAIM_CredentialIterator *ait; |
1414 | struct GNUNET_MQ_Envelope *env; | 1413 | struct GNUNET_MQ_Envelope *env; |
1415 | struct AttestationIterationStartMessage *msg; | 1414 | struct CredentialIterationStartMessage *msg; |
1416 | uint32_t rid; | 1415 | uint32_t rid; |
1417 | 1416 | ||
1418 | rid = h->r_id_gen++; | 1417 | rid = h->r_id_gen++; |
1419 | ait = GNUNET_new (struct GNUNET_RECLAIM_AttestationIterator); | 1418 | ait = GNUNET_new (struct GNUNET_RECLAIM_CredentialIterator); |
1420 | ait->h = h; | 1419 | ait->h = h; |
1421 | ait->error_cb = error_cb; | 1420 | ait->error_cb = error_cb; |
1422 | ait->error_cb_cls = error_cb_cls; | 1421 | ait->error_cb_cls = error_cb_cls; |
@@ -1429,7 +1428,7 @@ GNUNET_RECLAIM_get_attestations_start ( | |||
1429 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); | 1428 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); |
1430 | env = | 1429 | env = |
1431 | GNUNET_MQ_msg (msg, | 1430 | GNUNET_MQ_msg (msg, |
1432 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START); | 1431 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START); |
1433 | msg->id = htonl (rid); | 1432 | msg->id = htonl (rid); |
1434 | msg->identity = *identity; | 1433 | msg->identity = *identity; |
1435 | if (NULL == h->mq) | 1434 | if (NULL == h->mq) |
@@ -1441,21 +1440,21 @@ GNUNET_RECLAIM_get_attestations_start ( | |||
1441 | 1440 | ||
1442 | 1441 | ||
1443 | /** | 1442 | /** |
1444 | * Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start | 1443 | * Calls the record processor specified in #GNUNET_RECLAIM_get_credential_start |
1445 | * for the next record. | 1444 | * for the next record. |
1446 | * | 1445 | * |
1447 | * @param it the iterator | 1446 | * @param it the iterator |
1448 | */ | 1447 | */ |
1449 | void | 1448 | void |
1450 | GNUNET_RECLAIM_get_attestations_next (struct | 1449 | GNUNET_RECLAIM_get_credentials_next (struct |
1451 | GNUNET_RECLAIM_AttestationIterator *ait) | 1450 | GNUNET_RECLAIM_CredentialIterator *ait) |
1452 | { | 1451 | { |
1453 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1452 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1454 | struct AttestationIterationNextMessage *msg; | 1453 | struct CredentialIterationNextMessage *msg; |
1455 | struct GNUNET_MQ_Envelope *env; | 1454 | struct GNUNET_MQ_Envelope *env; |
1456 | 1455 | ||
1457 | env = | 1456 | env = |
1458 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT); | 1457 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT); |
1459 | msg->id = htonl (ait->r_id); | 1458 | msg->id = htonl (ait->r_id); |
1460 | GNUNET_MQ_send (h->mq, env); | 1459 | GNUNET_MQ_send (h->mq, env); |
1461 | } | 1460 | } |
@@ -1469,18 +1468,18 @@ GNUNET_RECLAIM_get_attestations_next (struct | |||
1469 | * @param it the iterator | 1468 | * @param it the iterator |
1470 | */ | 1469 | */ |
1471 | void | 1470 | void |
1472 | GNUNET_RECLAIM_get_attestations_stop (struct | 1471 | GNUNET_RECLAIM_get_credentials_stop (struct |
1473 | GNUNET_RECLAIM_AttestationIterator *ait) | 1472 | GNUNET_RECLAIM_CredentialIterator *ait) |
1474 | { | 1473 | { |
1475 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1474 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1476 | struct GNUNET_MQ_Envelope *env; | 1475 | struct GNUNET_MQ_Envelope *env; |
1477 | struct AttestationIterationStopMessage *msg; | 1476 | struct CredentialIterationStopMessage *msg; |
1478 | 1477 | ||
1479 | if (NULL != h->mq) | 1478 | if (NULL != h->mq) |
1480 | { | 1479 | { |
1481 | env = | 1480 | env = |
1482 | GNUNET_MQ_msg (msg, | 1481 | GNUNET_MQ_msg (msg, |
1483 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP); | 1482 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP); |
1484 | msg->id = htonl (ait->r_id); | 1483 | msg->id = htonl (ait->r_id); |
1485 | GNUNET_MQ_send (h->mq, env); | 1484 | GNUNET_MQ_send (h->mq, env); |
1486 | } | 1485 | } |