diff options
Diffstat (limited to 'src/reclaim/reclaim_api.c')
-rw-r--r-- | src/reclaim/reclaim_api.c | 224 |
1 files changed, 131 insertions, 93 deletions
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index d73241a6f..1e0251519 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 |
@@ -92,6 +92,11 @@ struct GNUNET_RECLAIM_Operation | |||
92 | GNUNET_RECLAIM_TicketCallback tr_cb; | 92 | GNUNET_RECLAIM_TicketCallback tr_cb; |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Ticket issue result callback | ||
96 | */ | ||
97 | GNUNET_RECLAIM_IssueTicketCallback ti_cb; | ||
98 | |||
99 | /** | ||
95 | * Envelope with the message for this queue entry. | 100 | * Envelope with the message for this queue entry. |
96 | */ | 101 | */ |
97 | struct GNUNET_MQ_Envelope *env; | 102 | struct GNUNET_MQ_Envelope *env; |
@@ -239,19 +244,19 @@ struct GNUNET_RECLAIM_AttributeIterator | |||
239 | }; | 244 | }; |
240 | 245 | ||
241 | /** | 246 | /** |
242 | * Handle for a attestation iterator operation | 247 | * Handle for a credential iterator operation |
243 | */ | 248 | */ |
244 | struct GNUNET_RECLAIM_AttestationIterator | 249 | struct GNUNET_RECLAIM_CredentialIterator |
245 | { | 250 | { |
246 | /** | 251 | /** |
247 | * Kept in a DLL. | 252 | * Kept in a DLL. |
248 | */ | 253 | */ |
249 | struct GNUNET_RECLAIM_AttestationIterator *next; | 254 | struct GNUNET_RECLAIM_CredentialIterator *next; |
250 | 255 | ||
251 | /** | 256 | /** |
252 | * Kept in a DLL. | 257 | * Kept in a DLL. |
253 | */ | 258 | */ |
254 | struct GNUNET_RECLAIM_AttestationIterator *prev; | 259 | struct GNUNET_RECLAIM_CredentialIterator *prev; |
255 | 260 | ||
256 | /** | 261 | /** |
257 | * Main handle to access the service. | 262 | * Main handle to access the service. |
@@ -271,7 +276,7 @@ struct GNUNET_RECLAIM_AttestationIterator | |||
271 | /** | 276 | /** |
272 | * The continuation to call with the results | 277 | * The continuation to call with the results |
273 | */ | 278 | */ |
274 | GNUNET_RECLAIM_AttestationResult proc; | 279 | GNUNET_RECLAIM_CredentialResult proc; |
275 | 280 | ||
276 | /** | 281 | /** |
277 | * Closure for @e proc. | 282 | * Closure for @e proc. |
@@ -349,12 +354,12 @@ struct GNUNET_RECLAIM_Handle | |||
349 | /** | 354 | /** |
350 | * Head of active iterations | 355 | * Head of active iterations |
351 | */ | 356 | */ |
352 | struct GNUNET_RECLAIM_AttestationIterator *ait_head; | 357 | struct GNUNET_RECLAIM_CredentialIterator *ait_head; |
353 | 358 | ||
354 | /** | 359 | /** |
355 | * Tail of active iterations | 360 | * Tail of active iterations |
356 | */ | 361 | */ |
357 | struct GNUNET_RECLAIM_AttestationIterator *ait_tail; | 362 | struct GNUNET_RECLAIM_CredentialIterator *ait_tail; |
358 | 363 | ||
359 | /** | 364 | /** |
360 | * Head of active iterations | 365 | * Head of active iterations |
@@ -464,7 +469,7 @@ free_it (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
464 | * @param ait entry to free | 469 | * @param ait entry to free |
465 | */ | 470 | */ |
466 | static void | 471 | static void |
467 | free_ait (struct GNUNET_RECLAIM_AttestationIterator *ait) | 472 | free_ait (struct GNUNET_RECLAIM_CredentialIterator *ait) |
468 | { | 473 | { |
469 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 474 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
470 | 475 | ||
@@ -561,13 +566,13 @@ check_consume_ticket_result (void *cls, | |||
561 | { | 566 | { |
562 | size_t msg_len; | 567 | size_t msg_len; |
563 | size_t attrs_len; | 568 | size_t attrs_len; |
564 | size_t attests_len; | 569 | size_t pl_len; |
565 | 570 | ||
566 | msg_len = ntohs (msg->header.size); | 571 | msg_len = ntohs (msg->header.size); |
567 | attrs_len = ntohs (msg->attrs_len); | 572 | attrs_len = ntohs (msg->attrs_len); |
568 | attests_len = ntohs (msg->attestations_len); | 573 | pl_len = ntohs (msg->presentations_len); |
569 | if (msg_len != | 574 | if (msg_len != |
570 | sizeof(struct ConsumeTicketResultMessage) + attrs_len + attests_len) | 575 | sizeof(struct ConsumeTicketResultMessage) + attrs_len + pl_len) |
571 | { | 576 | { |
572 | GNUNET_break (0); | 577 | GNUNET_break (0); |
573 | return GNUNET_SYSERR; | 578 | return GNUNET_SYSERR; |
@@ -590,12 +595,12 @@ handle_consume_ticket_result (void *cls, | |||
590 | struct GNUNET_RECLAIM_Handle *h = cls; | 595 | struct GNUNET_RECLAIM_Handle *h = cls; |
591 | struct GNUNET_RECLAIM_Operation *op; | 596 | struct GNUNET_RECLAIM_Operation *op; |
592 | size_t attrs_len; | 597 | size_t attrs_len; |
593 | size_t attests_len; | 598 | size_t pl_len; |
594 | uint32_t r_id = ntohl (msg->id); | 599 | uint32_t r_id = ntohl (msg->id); |
595 | char *read_ptr; | 600 | char *read_ptr; |
596 | 601 | ||
597 | attrs_len = ntohs (msg->attrs_len); | 602 | attrs_len = ntohs (msg->attrs_len); |
598 | attests_len = ntohs (msg->attestations_len); | 603 | pl_len = ntohs (msg->presentations_len); |
599 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); | 604 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); |
600 | 605 | ||
601 | 606 | ||
@@ -608,13 +613,12 @@ handle_consume_ticket_result (void *cls, | |||
608 | { | 613 | { |
609 | struct GNUNET_RECLAIM_AttributeList *attrs; | 614 | struct GNUNET_RECLAIM_AttributeList *attrs; |
610 | struct GNUNET_RECLAIM_AttributeListEntry *le; | 615 | struct GNUNET_RECLAIM_AttributeListEntry *le; |
611 | struct GNUNET_RECLAIM_AttestationList *attests; | 616 | struct GNUNET_RECLAIM_PresentationList *pl; |
612 | struct GNUNET_RECLAIM_AttestationListEntry *ale; | 617 | struct GNUNET_RECLAIM_PresentationListEntry *ple; |
613 | attrs = | 618 | attrs = |
614 | GNUNET_RECLAIM_attribute_list_deserialize ((char *) &msg[1], attrs_len); | 619 | GNUNET_RECLAIM_attribute_list_deserialize ((char *) &msg[1], attrs_len); |
615 | read_ptr = ((char *) &msg[1]) + attrs_len; | 620 | read_ptr = ((char *) &msg[1]) + attrs_len; |
616 | attests = | 621 | 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) | 622 | if (NULL != op->atr_cb) |
619 | { | 623 | { |
620 | if (NULL == attrs) | 624 | if (NULL == attrs) |
@@ -626,22 +630,22 @@ handle_consume_ticket_result (void *cls, | |||
626 | for (le = attrs->list_head; NULL != le; le = le->next) | 630 | for (le = attrs->list_head; NULL != le; le = le->next) |
627 | { | 631 | { |
628 | if (GNUNET_NO == | 632 | if (GNUNET_NO == |
629 | GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation)) | 633 | GNUNET_RECLAIM_id_is_zero (&le->attribute->credential)) |
630 | { | 634 | { |
631 | for (ale = attests->list_head; NULL != ale; ale = ale->next) | 635 | for (ple = pl->list_head; NULL != ple; ple = ple->next) |
632 | { | 636 | { |
633 | if (GNUNET_YES == | 637 | if (GNUNET_YES == |
634 | GNUNET_RECLAIM_id_is_equal (&le->attribute->attestation, | 638 | GNUNET_RECLAIM_id_is_equal (&le->attribute->credential, |
635 | &ale->attestation->id)) | 639 | &ple->presentation->credential_id)) |
636 | { | 640 | { |
637 | op->atr_cb (op->cls, &msg->identity, | 641 | op->atr_cb (op->cls, &msg->identity, |
638 | le->attribute, ale->attestation); | 642 | le->attribute, ple->presentation); |
639 | break; | 643 | break; |
640 | } | 644 | } |
641 | 645 | ||
642 | } | 646 | } |
643 | } | 647 | } |
644 | else // No attestations | 648 | else // No credentials |
645 | { | 649 | { |
646 | op->atr_cb (op->cls, &msg->identity, | 650 | op->atr_cb (op->cls, &msg->identity, |
647 | le->attribute, NULL); | 651 | le->attribute, NULL); |
@@ -649,10 +653,10 @@ handle_consume_ticket_result (void *cls, | |||
649 | } | 653 | } |
650 | if (NULL != attrs) | 654 | if (NULL != attrs) |
651 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | 655 | GNUNET_RECLAIM_attribute_list_destroy (attrs); |
652 | if (NULL != attests) | 656 | if (NULL != pl) |
653 | GNUNET_RECLAIM_attestation_list_destroy (attests); | 657 | GNUNET_RECLAIM_presentation_list_destroy (pl); |
654 | attrs = NULL; | 658 | attrs = NULL; |
655 | attests = NULL; | 659 | pl = NULL; |
656 | } | 660 | } |
657 | op->atr_cb (op->cls, NULL, NULL, NULL); | 661 | op->atr_cb (op->cls, NULL, NULL, NULL); |
658 | } | 662 | } |
@@ -747,7 +751,8 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
747 | 751 | ||
748 | { | 752 | { |
749 | struct GNUNET_RECLAIM_Attribute *attr; | 753 | struct GNUNET_RECLAIM_Attribute *attr; |
750 | attr = GNUNET_RECLAIM_attribute_deserialize ((char *) &msg[1], attr_len); | 754 | GNUNET_RECLAIM_attribute_deserialize ((char *) &msg[1], attr_len, |
755 | &attr); | ||
751 | if (NULL != it) | 756 | if (NULL != it) |
752 | { | 757 | { |
753 | if (NULL != it->proc) | 758 | if (NULL != it->proc) |
@@ -767,21 +772,21 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
767 | 772 | ||
768 | /** | 773 | /** |
769 | * Handle an incoming message of type | 774 | * Handle an incoming message of type |
770 | * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT | 775 | * #GNUNET_MESSAGE_TYPE_RECLAIM_credential_RESULT |
771 | * | 776 | * |
772 | * @param cls | 777 | * @param cls |
773 | * @param msg the message we received | 778 | * @param msg the message we received |
774 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 779 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
775 | */ | 780 | */ |
776 | static int | 781 | static int |
777 | check_attestation_result (void *cls, const struct AttestationResultMessage *msg) | 782 | check_credential_result (void *cls, const struct CredentialResultMessage *msg) |
778 | { | 783 | { |
779 | size_t msg_len; | 784 | size_t msg_len; |
780 | size_t attest_len; | 785 | size_t cred_len; |
781 | 786 | ||
782 | msg_len = ntohs (msg->header.size); | 787 | msg_len = ntohs (msg->header.size); |
783 | attest_len = ntohs (msg->attestation_len); | 788 | cred_len = ntohs (msg->credential_len); |
784 | if (msg_len != sizeof(struct AttestationResultMessage) + attest_len) | 789 | if (msg_len != sizeof(struct CredentialResultMessage) + cred_len) |
785 | { | 790 | { |
786 | GNUNET_break (0); | 791 | GNUNET_break (0); |
787 | return GNUNET_SYSERR; | 792 | return GNUNET_SYSERR; |
@@ -792,24 +797,24 @@ check_attestation_result (void *cls, const struct AttestationResultMessage *msg) | |||
792 | 797 | ||
793 | /** | 798 | /** |
794 | * Handle an incoming message of type | 799 | * Handle an incoming message of type |
795 | * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT | 800 | * #GNUNET_MESSAGE_TYPE_RECLAIM_credential_RESULT |
796 | * | 801 | * |
797 | * @param cls | 802 | * @param cls |
798 | * @param msg the message we received | 803 | * @param msg the message we received |
799 | */ | 804 | */ |
800 | static void | 805 | static void |
801 | handle_attestation_result (void *cls, const struct | 806 | handle_credential_result (void *cls, const struct |
802 | AttestationResultMessage *msg) | 807 | CredentialResultMessage *msg) |
803 | { | 808 | { |
804 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; | 809 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; |
805 | struct GNUNET_RECLAIM_Handle *h = cls; | 810 | struct GNUNET_RECLAIM_Handle *h = cls; |
806 | struct GNUNET_RECLAIM_AttestationIterator *it; | 811 | struct GNUNET_RECLAIM_CredentialIterator *it; |
807 | struct GNUNET_RECLAIM_Operation *op; | 812 | struct GNUNET_RECLAIM_Operation *op; |
808 | size_t att_len; | 813 | size_t att_len; |
809 | uint32_t r_id = ntohl (msg->id); | 814 | uint32_t r_id = ntohl (msg->id); |
810 | 815 | ||
811 | att_len = ntohs (msg->attestation_len); | 816 | att_len = ntohs (msg->credential_len); |
812 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attestation result.\n"); | 817 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing credential result.\n"); |
813 | 818 | ||
814 | 819 | ||
815 | for (it = h->ait_head; NULL != it; it = it->next) | 820 | for (it = h->ait_head; NULL != it; it = it->next) |
@@ -847,8 +852,8 @@ handle_attestation_result (void *cls, const struct | |||
847 | } | 852 | } |
848 | 853 | ||
849 | { | 854 | { |
850 | struct GNUNET_RECLAIM_Attestation *att; | 855 | struct GNUNET_RECLAIM_Credential *att; |
851 | att = GNUNET_RECLAIM_attestation_deserialize ((char *) &msg[1], att_len); | 856 | att = GNUNET_RECLAIM_credential_deserialize ((char *) &msg[1], att_len); |
852 | 857 | ||
853 | if (NULL != it) | 858 | if (NULL != it) |
854 | { | 859 | { |
@@ -866,6 +871,30 @@ handle_attestation_result (void *cls, const struct | |||
866 | GNUNET_assert (0); | 871 | GNUNET_assert (0); |
867 | } | 872 | } |
868 | 873 | ||
874 | /** | ||
875 | * Handle an incoming message of type | ||
876 | * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT | ||
877 | * | ||
878 | * @param cls | ||
879 | * @param msg the message we received | ||
880 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | ||
881 | */ | ||
882 | static int | ||
883 | check_ticket_result (void *cls, const struct TicketResultMessage *msg) | ||
884 | { | ||
885 | size_t msg_len; | ||
886 | size_t pres_len; | ||
887 | |||
888 | msg_len = ntohs (msg->header.size); | ||
889 | pres_len = ntohs (msg->presentations_len); | ||
890 | if (msg_len != sizeof(struct TicketResultMessage) + pres_len) | ||
891 | { | ||
892 | GNUNET_break (0); | ||
893 | return GNUNET_SYSERR; | ||
894 | } | ||
895 | return GNUNET_OK; | ||
896 | } | ||
897 | |||
869 | 898 | ||
870 | /** | 899 | /** |
871 | * Handle an incoming message of type | 900 | * Handle an incoming message of type |
@@ -880,8 +909,10 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg) | |||
880 | struct GNUNET_RECLAIM_Handle *handle = cls; | 909 | struct GNUNET_RECLAIM_Handle *handle = cls; |
881 | struct GNUNET_RECLAIM_Operation *op; | 910 | struct GNUNET_RECLAIM_Operation *op; |
882 | struct GNUNET_RECLAIM_TicketIterator *it; | 911 | struct GNUNET_RECLAIM_TicketIterator *it; |
912 | struct GNUNET_RECLAIM_PresentationList *pres; | ||
883 | uint32_t r_id = ntohl (msg->id); | 913 | uint32_t r_id = ntohl (msg->id); |
884 | static const struct GNUNET_RECLAIM_Ticket ticket; | 914 | static const struct GNUNET_RECLAIM_Ticket ticket; |
915 | uint32_t pres_len = ntohs (msg->presentations_len); | ||
885 | 916 | ||
886 | for (op = handle->op_head; NULL != op; op = op->next) | 917 | for (op = handle->op_head; NULL != op; op = op->next) |
887 | if (op->r_id == r_id) | 918 | if (op->r_id == r_id) |
@@ -893,18 +924,25 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg) | |||
893 | return; | 924 | return; |
894 | if (NULL != op) | 925 | if (NULL != op) |
895 | { | 926 | { |
927 | if (0 < pres_len) | ||
928 | pres = GNUNET_RECLAIM_presentation_list_deserialize ((char*)&msg[1], | ||
929 | pres_len); | ||
896 | GNUNET_CONTAINER_DLL_remove (handle->op_head, handle->op_tail, op); | 930 | GNUNET_CONTAINER_DLL_remove (handle->op_head, handle->op_tail, op); |
897 | if (0 == | 931 | if (0 == |
898 | memcmp (&msg->ticket, &ticket, sizeof(struct GNUNET_RECLAIM_Ticket))) | 932 | memcmp (&msg->ticket, &ticket, sizeof(struct GNUNET_RECLAIM_Ticket))) |
899 | { | 933 | { |
900 | if (NULL != op->tr_cb) | 934 | if (NULL != op->ti_cb) |
901 | op->tr_cb (op->cls, NULL); | 935 | op->ti_cb (op->cls, NULL, NULL); |
902 | } | 936 | } |
903 | else | 937 | else |
904 | { | 938 | { |
905 | if (NULL != op->tr_cb) | 939 | if (NULL != op->ti_cb) |
906 | op->tr_cb (op->cls, &msg->ticket); | 940 | op->ti_cb (op->cls, |
941 | &msg->ticket, | ||
942 | (0 < pres_len) ? pres : NULL); | ||
907 | } | 943 | } |
944 | if (0 < pres_len) | ||
945 | GNUNET_RECLAIM_presentation_list_destroy (pres); | ||
908 | free_op (op); | 946 | free_op (op); |
909 | return; | 947 | return; |
910 | } | 948 | } |
@@ -985,14 +1023,14 @@ reconnect (struct GNUNET_RECLAIM_Handle *h) | |||
985 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, | 1023 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, |
986 | struct AttributeResultMessage, | 1024 | struct AttributeResultMessage, |
987 | h), | 1025 | h), |
988 | GNUNET_MQ_hd_var_size (attestation_result, | 1026 | GNUNET_MQ_hd_var_size (credential_result, |
989 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, | 1027 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT, |
990 | struct AttestationResultMessage, | 1028 | struct CredentialResultMessage, |
1029 | h), | ||
1030 | GNUNET_MQ_hd_var_size (ticket_result, | ||
1031 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, | ||
1032 | struct TicketResultMessage, | ||
991 | h), | 1033 | h), |
992 | GNUNET_MQ_hd_fixed_size (ticket_result, | ||
993 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, | ||
994 | struct TicketResultMessage, | ||
995 | h), | ||
996 | GNUNET_MQ_hd_var_size (consume_ticket_result, | 1034 | GNUNET_MQ_hd_var_size (consume_ticket_result, |
997 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT, | 1035 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT, |
998 | struct ConsumeTicketResultMessage, | 1036 | struct ConsumeTicketResultMessage, |
@@ -1174,22 +1212,22 @@ GNUNET_RECLAIM_attribute_delete ( | |||
1174 | 1212 | ||
1175 | 1213 | ||
1176 | /** | 1214 | /** |
1177 | * Store an attestation. If the attestation is already present, | 1215 | * Store an credential. If the credential is already present, |
1178 | * it is replaced with the new attestation. | 1216 | * it is replaced with the new credential. |
1179 | * | 1217 | * |
1180 | * @param h handle to the re:claimID service | 1218 | * @param h handle to the re:claimID service |
1181 | * @param pkey private key of the identity | 1219 | * @param pkey private key of the identity |
1182 | * @param attr the attestation value | 1220 | * @param attr the credential value |
1183 | * @param exp_interval the relative expiration interval for the attestation | 1221 | * @param exp_interval the relative expiration interval for the credential |
1184 | * @param cont continuation to call when done | 1222 | * @param cont continuation to call when done |
1185 | * @param cont_cls closure for @a cont | 1223 | * @param cont_cls closure for @a cont |
1186 | * @return handle to abort the request | 1224 | * @return handle to abort the request |
1187 | */ | 1225 | */ |
1188 | struct GNUNET_RECLAIM_Operation * | 1226 | struct GNUNET_RECLAIM_Operation * |
1189 | GNUNET_RECLAIM_attestation_store ( | 1227 | GNUNET_RECLAIM_credential_store ( |
1190 | struct GNUNET_RECLAIM_Handle *h, | 1228 | struct GNUNET_RECLAIM_Handle *h, |
1191 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 1229 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
1192 | const struct GNUNET_RECLAIM_Attestation *attr, | 1230 | const struct GNUNET_RECLAIM_Credential *attr, |
1193 | const struct GNUNET_TIME_Relative *exp_interval, | 1231 | const struct GNUNET_TIME_Relative *exp_interval, |
1194 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 1232 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
1195 | void *cont_cls) | 1233 | void *cont_cls) |
@@ -1204,15 +1242,15 @@ GNUNET_RECLAIM_attestation_store ( | |||
1204 | op->cls = cont_cls; | 1242 | op->cls = cont_cls; |
1205 | op->r_id = h->r_id_gen++; | 1243 | op->r_id = h->r_id_gen++; |
1206 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1244 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1207 | attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr); | 1245 | attr_len = GNUNET_RECLAIM_credential_serialize_get_size (attr); |
1208 | op->env = GNUNET_MQ_msg_extra (sam, | 1246 | op->env = GNUNET_MQ_msg_extra (sam, |
1209 | attr_len, | 1247 | attr_len, |
1210 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE); | 1248 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE); |
1211 | sam->identity = *pkey; | 1249 | sam->identity = *pkey; |
1212 | sam->id = htonl (op->r_id); | 1250 | sam->id = htonl (op->r_id); |
1213 | sam->exp = GNUNET_htonll (exp_interval->rel_value_us); | 1251 | sam->exp = GNUNET_htonll (exp_interval->rel_value_us); |
1214 | 1252 | ||
1215 | GNUNET_RECLAIM_attestation_serialize (attr, (char *) &sam[1]); | 1253 | GNUNET_RECLAIM_credential_serialize (attr, (char *) &sam[1]); |
1216 | 1254 | ||
1217 | sam->attr_len = htons (attr_len); | 1255 | sam->attr_len = htons (attr_len); |
1218 | if (NULL != h->mq) | 1256 | if (NULL != h->mq) |
@@ -1222,21 +1260,21 @@ GNUNET_RECLAIM_attestation_store ( | |||
1222 | 1260 | ||
1223 | 1261 | ||
1224 | /** | 1262 | /** |
1225 | * Delete an attestation. Tickets used to share this attestation are updated | 1263 | * Delete an credential. Tickets used to share this credential are updated |
1226 | * accordingly. | 1264 | * accordingly. |
1227 | * | 1265 | * |
1228 | * @param h handle to the re:claimID service | 1266 | * @param h handle to the re:claimID service |
1229 | * @param pkey Private key of the identity to add an attribute to | 1267 | * @param pkey Private key of the identity to add an attribute to |
1230 | * @param attr The attestation | 1268 | * @param attr The credential |
1231 | * @param cont Continuation to call when done | 1269 | * @param cont Continuation to call when done |
1232 | * @param cont_cls Closure for @a cont | 1270 | * @param cont_cls Closure for @a cont |
1233 | * @return handle Used to to abort the request | 1271 | * @return handle Used to to abort the request |
1234 | */ | 1272 | */ |
1235 | struct GNUNET_RECLAIM_Operation * | 1273 | struct GNUNET_RECLAIM_Operation * |
1236 | GNUNET_RECLAIM_attestation_delete ( | 1274 | GNUNET_RECLAIM_credential_delete ( |
1237 | struct GNUNET_RECLAIM_Handle *h, | 1275 | struct GNUNET_RECLAIM_Handle *h, |
1238 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 1276 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
1239 | const struct GNUNET_RECLAIM_Attestation *attr, | 1277 | const struct GNUNET_RECLAIM_Credential *attr, |
1240 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 1278 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
1241 | void *cont_cls) | 1279 | void *cont_cls) |
1242 | { | 1280 | { |
@@ -1250,13 +1288,13 @@ GNUNET_RECLAIM_attestation_delete ( | |||
1250 | op->cls = cont_cls; | 1288 | op->cls = cont_cls; |
1251 | op->r_id = h->r_id_gen++; | 1289 | op->r_id = h->r_id_gen++; |
1252 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1290 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1253 | attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr); | 1291 | attr_len = GNUNET_RECLAIM_credential_serialize_get_size (attr); |
1254 | op->env = GNUNET_MQ_msg_extra (dam, | 1292 | op->env = GNUNET_MQ_msg_extra (dam, |
1255 | attr_len, | 1293 | attr_len, |
1256 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE); | 1294 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE); |
1257 | dam->identity = *pkey; | 1295 | dam->identity = *pkey; |
1258 | dam->id = htonl (op->r_id); | 1296 | dam->id = htonl (op->r_id); |
1259 | GNUNET_RECLAIM_attestation_serialize (attr, (char *) &dam[1]); | 1297 | GNUNET_RECLAIM_credential_serialize (attr, (char *) &dam[1]); |
1260 | 1298 | ||
1261 | dam->attr_len = htons (attr_len); | 1299 | dam->attr_len = htons (attr_len); |
1262 | if (NULL != h->mq) | 1300 | if (NULL != h->mq) |
@@ -1375,12 +1413,12 @@ GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
1375 | 1413 | ||
1376 | 1414 | ||
1377 | /** | 1415 | /** |
1378 | * List all attestations for a local identity. | 1416 | * List all credentials for a local identity. |
1379 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` | 1417 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` |
1380 | * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and | 1418 | * for any other calls than #GNUNET_RECLAIM_get_credentials_next() and |
1381 | * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once | 1419 | * #GNUNET_RECLAIM_get_credentials_stop. @a proc will be called once |
1382 | * immediately, and then again after | 1420 | * immediately, and then again after |
1383 | * #GNUNET_RECLAIM_get_attestations_next() is invoked. | 1421 | * #GNUNET_RECLAIM_get_credentials_next() is invoked. |
1384 | * | 1422 | * |
1385 | * On error (disconnect), @a error_cb will be invoked. | 1423 | * On error (disconnect), @a error_cb will be invoked. |
1386 | * On normal completion, @a finish_cb proc will be | 1424 | * On normal completion, @a finish_cb proc will be |
@@ -1391,31 +1429,31 @@ GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
1391 | * @param error_cb Function to call on error (i.e. disconnect), | 1429 | * @param error_cb Function to call on error (i.e. disconnect), |
1392 | * the handle is afterwards invalid | 1430 | * the handle is afterwards invalid |
1393 | * @param error_cb_cls Closure for @a error_cb | 1431 | * @param error_cb_cls Closure for @a error_cb |
1394 | * @param proc Function to call on each attestation | 1432 | * @param proc Function to call on each credential |
1395 | * @param proc_cls Closure for @a proc | 1433 | * @param proc_cls Closure for @a proc |
1396 | * @param finish_cb Function to call on completion | 1434 | * @param finish_cb Function to call on completion |
1397 | * the handle is afterwards invalid | 1435 | * the handle is afterwards invalid |
1398 | * @param finish_cb_cls Closure for @a finish_cb | 1436 | * @param finish_cb_cls Closure for @a finish_cb |
1399 | * @return an iterator Handle to use for iteration | 1437 | * @return an iterator Handle to use for iteration |
1400 | */ | 1438 | */ |
1401 | struct GNUNET_RECLAIM_AttestationIterator * | 1439 | struct GNUNET_RECLAIM_CredentialIterator * |
1402 | GNUNET_RECLAIM_get_attestations_start ( | 1440 | GNUNET_RECLAIM_get_credentials_start ( |
1403 | struct GNUNET_RECLAIM_Handle *h, | 1441 | struct GNUNET_RECLAIM_Handle *h, |
1404 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 1442 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
1405 | GNUNET_SCHEDULER_TaskCallback error_cb, | 1443 | GNUNET_SCHEDULER_TaskCallback error_cb, |
1406 | void *error_cb_cls, | 1444 | void *error_cb_cls, |
1407 | GNUNET_RECLAIM_AttestationResult proc, | 1445 | GNUNET_RECLAIM_CredentialResult proc, |
1408 | void *proc_cls, | 1446 | void *proc_cls, |
1409 | GNUNET_SCHEDULER_TaskCallback finish_cb, | 1447 | GNUNET_SCHEDULER_TaskCallback finish_cb, |
1410 | void *finish_cb_cls) | 1448 | void *finish_cb_cls) |
1411 | { | 1449 | { |
1412 | struct GNUNET_RECLAIM_AttestationIterator *ait; | 1450 | struct GNUNET_RECLAIM_CredentialIterator *ait; |
1413 | struct GNUNET_MQ_Envelope *env; | 1451 | struct GNUNET_MQ_Envelope *env; |
1414 | struct AttestationIterationStartMessage *msg; | 1452 | struct CredentialIterationStartMessage *msg; |
1415 | uint32_t rid; | 1453 | uint32_t rid; |
1416 | 1454 | ||
1417 | rid = h->r_id_gen++; | 1455 | rid = h->r_id_gen++; |
1418 | ait = GNUNET_new (struct GNUNET_RECLAIM_AttestationIterator); | 1456 | ait = GNUNET_new (struct GNUNET_RECLAIM_CredentialIterator); |
1419 | ait->h = h; | 1457 | ait->h = h; |
1420 | ait->error_cb = error_cb; | 1458 | ait->error_cb = error_cb; |
1421 | ait->error_cb_cls = error_cb_cls; | 1459 | ait->error_cb_cls = error_cb_cls; |
@@ -1428,7 +1466,7 @@ GNUNET_RECLAIM_get_attestations_start ( | |||
1428 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); | 1466 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); |
1429 | env = | 1467 | env = |
1430 | GNUNET_MQ_msg (msg, | 1468 | GNUNET_MQ_msg (msg, |
1431 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START); | 1469 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START); |
1432 | msg->id = htonl (rid); | 1470 | msg->id = htonl (rid); |
1433 | msg->identity = *identity; | 1471 | msg->identity = *identity; |
1434 | if (NULL == h->mq) | 1472 | if (NULL == h->mq) |
@@ -1440,21 +1478,21 @@ GNUNET_RECLAIM_get_attestations_start ( | |||
1440 | 1478 | ||
1441 | 1479 | ||
1442 | /** | 1480 | /** |
1443 | * Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start | 1481 | * Calls the record processor specified in #GNUNET_RECLAIM_get_credential_start |
1444 | * for the next record. | 1482 | * for the next record. |
1445 | * | 1483 | * |
1446 | * @param it the iterator | 1484 | * @param it the iterator |
1447 | */ | 1485 | */ |
1448 | void | 1486 | void |
1449 | GNUNET_RECLAIM_get_attestations_next (struct | 1487 | GNUNET_RECLAIM_get_credentials_next (struct |
1450 | GNUNET_RECLAIM_AttestationIterator *ait) | 1488 | GNUNET_RECLAIM_CredentialIterator *ait) |
1451 | { | 1489 | { |
1452 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1490 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1453 | struct AttestationIterationNextMessage *msg; | 1491 | struct CredentialIterationNextMessage *msg; |
1454 | struct GNUNET_MQ_Envelope *env; | 1492 | struct GNUNET_MQ_Envelope *env; |
1455 | 1493 | ||
1456 | env = | 1494 | env = |
1457 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT); | 1495 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT); |
1458 | msg->id = htonl (ait->r_id); | 1496 | msg->id = htonl (ait->r_id); |
1459 | GNUNET_MQ_send (h->mq, env); | 1497 | GNUNET_MQ_send (h->mq, env); |
1460 | } | 1498 | } |
@@ -1468,18 +1506,18 @@ GNUNET_RECLAIM_get_attestations_next (struct | |||
1468 | * @param it the iterator | 1506 | * @param it the iterator |
1469 | */ | 1507 | */ |
1470 | void | 1508 | void |
1471 | GNUNET_RECLAIM_get_attestations_stop (struct | 1509 | GNUNET_RECLAIM_get_credentials_stop (struct |
1472 | GNUNET_RECLAIM_AttestationIterator *ait) | 1510 | GNUNET_RECLAIM_CredentialIterator *ait) |
1473 | { | 1511 | { |
1474 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1512 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1475 | struct GNUNET_MQ_Envelope *env; | 1513 | struct GNUNET_MQ_Envelope *env; |
1476 | struct AttestationIterationStopMessage *msg; | 1514 | struct CredentialIterationStopMessage *msg; |
1477 | 1515 | ||
1478 | if (NULL != h->mq) | 1516 | if (NULL != h->mq) |
1479 | { | 1517 | { |
1480 | env = | 1518 | env = |
1481 | GNUNET_MQ_msg (msg, | 1519 | GNUNET_MQ_msg (msg, |
1482 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP); | 1520 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP); |
1483 | msg->id = htonl (ait->r_id); | 1521 | msg->id = htonl (ait->r_id); |
1484 | GNUNET_MQ_send (h->mq, env); | 1522 | GNUNET_MQ_send (h->mq, env); |
1485 | } | 1523 | } |
@@ -1506,7 +1544,7 @@ GNUNET_RECLAIM_ticket_issue ( | |||
1506 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, | 1544 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, |
1507 | const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, | 1545 | const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, |
1508 | const struct GNUNET_RECLAIM_AttributeList *attrs, | 1546 | const struct GNUNET_RECLAIM_AttributeList *attrs, |
1509 | GNUNET_RECLAIM_TicketCallback cb, | 1547 | GNUNET_RECLAIM_IssueTicketCallback cb, |
1510 | void *cb_cls) | 1548 | void *cb_cls) |
1511 | { | 1549 | { |
1512 | struct GNUNET_RECLAIM_Operation *op; | 1550 | struct GNUNET_RECLAIM_Operation *op; |
@@ -1516,7 +1554,7 @@ GNUNET_RECLAIM_ticket_issue ( | |||
1516 | fprintf (stderr, "Issuing ticket\n"); | 1554 | fprintf (stderr, "Issuing ticket\n"); |
1517 | op = GNUNET_new (struct GNUNET_RECLAIM_Operation); | 1555 | op = GNUNET_new (struct GNUNET_RECLAIM_Operation); |
1518 | op->h = h; | 1556 | op->h = h; |
1519 | op->tr_cb = cb; | 1557 | op->ti_cb = cb; |
1520 | op->cls = cb_cls; | 1558 | op->cls = cb_cls; |
1521 | op->r_id = h->r_id_gen++; | 1559 | op->r_id = h->r_id_gen++; |
1522 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1560 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
@@ -1573,7 +1611,7 @@ GNUNET_RECLAIM_ticket_consume ( | |||
1573 | if (NULL != h->mq) | 1611 | if (NULL != h->mq) |
1574 | GNUNET_MQ_send_copy (h->mq, op->env); | 1612 | GNUNET_MQ_send_copy (h->mq, op->env); |
1575 | else | 1613 | else |
1576 | reconnect(h); | 1614 | reconnect (h); |
1577 | return op; | 1615 | return op; |
1578 | } | 1616 | } |
1579 | 1617 | ||