diff options
Diffstat (limited to 'src/reclaim/reclaim_api.c')
-rw-r--r-- | src/reclaim/reclaim_api.c | 418 |
1 files changed, 411 insertions, 7 deletions
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index 7d4d7588a..847abb58a 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -486,7 +486,7 @@ handle_consume_ticket_result (void *cls, | |||
486 | uint32_t r_id = ntohl (msg->id); | 486 | uint32_t r_id = ntohl (msg->id); |
487 | 487 | ||
488 | attrs_len = ntohs (msg->attrs_len); | 488 | attrs_len = ntohs (msg->attrs_len); |
489 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attribute result.\n"); | 489 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); |
490 | 490 | ||
491 | 491 | ||
492 | for (op = h->op_head; NULL != op; op = op->next) | 492 | for (op = h->op_head; NULL != op; op = op->next) |
@@ -498,22 +498,36 @@ handle_consume_ticket_result (void *cls, | |||
498 | { | 498 | { |
499 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; | 499 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; |
500 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; | 500 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; |
501 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le2; | ||
501 | attrs = | 502 | attrs = |
502 | GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *) &msg[1], attrs_len); | 503 | GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *) &msg[1], attrs_len); |
503 | if (NULL != op->ar_cb) | 504 | if (NULL != op->ar_cb) |
504 | { | 505 | { |
505 | if (NULL == attrs) | 506 | if (NULL == attrs) |
506 | { | 507 | { |
507 | op->ar_cb (op->cls, &msg->identity, NULL); | 508 | op->ar_cb (op->cls, &msg->identity, NULL, NULL, NULL); |
508 | } | 509 | } |
509 | else | 510 | else |
510 | { | 511 | { |
511 | for (le = attrs->list_head; NULL != le; le = le->next) | 512 | for (le = attrs->list_head; NULL != le; le = le->next) |
512 | op->ar_cb (op->cls, &msg->identity, le->claim); | 513 | { |
514 | if (le->reference != NULL && le->attest == NULL) | ||
515 | { | ||
516 | for (le2 = attrs->list_head; NULL != le2; le2 = le2->next) | ||
517 | { | ||
518 | if (le2->attest != NULL && le2->attest->id == le->reference->id_attest) | ||
519 | { | ||
520 | op->ar_cb (op->cls, &msg->identity, le->claim, le2->attest, le->reference); | ||
521 | break; | ||
522 | } | ||
523 | |||
524 | } | ||
525 | } | ||
526 | } | ||
513 | GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); | 527 | GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); |
514 | attrs = NULL; | 528 | attrs = NULL; |
515 | } | 529 | } |
516 | op->ar_cb (op->cls, NULL, NULL); | 530 | op->ar_cb (op->cls, NULL, NULL, NULL, NULL); |
517 | } | 531 | } |
518 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); | 532 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); |
519 | free_op (op); | 533 | free_op (op); |
@@ -597,7 +611,7 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
597 | if (NULL != op) | 611 | if (NULL != op) |
598 | { | 612 | { |
599 | if (NULL != op->ar_cb) | 613 | if (NULL != op->ar_cb) |
600 | op->ar_cb (op->cls, NULL, NULL); | 614 | op->ar_cb (op->cls, NULL, NULL, NULL, NULL); |
601 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); | 615 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); |
602 | free_op (op); | 616 | free_op (op); |
603 | } | 617 | } |
@@ -610,12 +624,111 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
610 | if (NULL != it) | 624 | if (NULL != it) |
611 | { | 625 | { |
612 | if (NULL != it->proc) | 626 | if (NULL != it->proc) |
613 | it->proc (it->proc_cls, &msg->identity, attr); | 627 | it->proc (it->proc_cls, &msg->identity, attr, NULL, NULL); |
628 | } | ||
629 | else if (NULL != op) | ||
630 | { | ||
631 | if (NULL != op->ar_cb) | ||
632 | op->ar_cb (op->cls, &msg->identity, attr, NULL, NULL); | ||
633 | } | ||
634 | GNUNET_free (attr); | ||
635 | return; | ||
636 | } | ||
637 | GNUNET_assert (0); | ||
638 | } | ||
639 | |||
640 | /** | ||
641 | * Handle an incoming message of type | ||
642 | * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT | ||
643 | * | ||
644 | * @param cls | ||
645 | * @param msg the message we received | ||
646 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | ||
647 | */ | ||
648 | static int | ||
649 | check_attestation_result (void *cls, const struct AttributeResultMessage *msg) | ||
650 | { | ||
651 | size_t msg_len; | ||
652 | size_t attr_len; | ||
653 | |||
654 | msg_len = ntohs (msg->header.size); | ||
655 | attr_len = ntohs (msg->attr_len); | ||
656 | if (msg_len != sizeof(struct AttributeResultMessage) + attr_len) | ||
657 | { | ||
658 | GNUNET_break (0); | ||
659 | return GNUNET_SYSERR; | ||
660 | } | ||
661 | return GNUNET_OK; | ||
662 | } | ||
663 | |||
664 | |||
665 | /** | ||
666 | * Handle an incoming message of type | ||
667 | * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT | ||
668 | * | ||
669 | * @param cls | ||
670 | * @param msg the message we received | ||
671 | */ | ||
672 | static void | ||
673 | handle_attestation_result (void *cls, const struct AttributeResultMessage *msg) | ||
674 | { | ||
675 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; | ||
676 | struct GNUNET_RECLAIM_Handle *h = cls; | ||
677 | struct GNUNET_RECLAIM_AttributeIterator *it; | ||
678 | struct GNUNET_RECLAIM_Operation *op; | ||
679 | size_t attr_len; | ||
680 | uint32_t r_id = ntohl (msg->id); | ||
681 | |||
682 | attr_len = ntohs (msg->attr_len); | ||
683 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attestation result.\n"); | ||
684 | |||
685 | |||
686 | for (it = h->it_head; NULL != it; it = it->next) | ||
687 | if (it->r_id == r_id) | ||
688 | break; | ||
689 | for (op = h->op_head; NULL != op; op = op->next) | ||
690 | if (op->r_id == r_id) | ||
691 | break; | ||
692 | if ((NULL == it) && (NULL == op)) | ||
693 | return; | ||
694 | |||
695 | if ((0 == | ||
696 | (memcmp (&msg->identity, &identity_dummy, sizeof(identity_dummy))))) | ||
697 | { | ||
698 | if ((NULL == it) && (NULL == op)) | ||
699 | { | ||
700 | GNUNET_break (0); | ||
701 | force_reconnect (h); | ||
702 | return; | ||
703 | } | ||
704 | if (NULL != it) | ||
705 | { | ||
706 | if (NULL != it->finish_cb) | ||
707 | it->finish_cb (it->finish_cb_cls); | ||
708 | free_it (it); | ||
709 | } | ||
710 | if (NULL != op) | ||
711 | { | ||
712 | if (NULL != op->ar_cb) | ||
713 | op->ar_cb (op->cls, NULL, NULL, NULL, NULL); | ||
714 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); | ||
715 | free_op (op); | ||
716 | } | ||
717 | return; | ||
718 | } | ||
719 | |||
720 | { | ||
721 | struct GNUNET_RECLAIM_ATTESTATION_Claim *attr; | ||
722 | attr = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &msg[1], attr_len); | ||
723 | if (NULL != it) | ||
724 | { | ||
725 | if (NULL != it->proc) | ||
726 | it->proc (it->proc_cls, &msg->identity, NULL, attr, NULL); | ||
614 | } | 727 | } |
615 | else if (NULL != op) | 728 | else if (NULL != op) |
616 | { | 729 | { |
617 | if (NULL != op->ar_cb) | 730 | if (NULL != op->ar_cb) |
618 | op->ar_cb (op->cls, &msg->identity, attr); | 731 | op->ar_cb (op->cls, &msg->identity, NULL, attr, NULL); |
619 | } | 732 | } |
620 | GNUNET_free (attr); | 733 | GNUNET_free (attr); |
621 | return; | 734 | return; |
@@ -623,6 +736,110 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
623 | GNUNET_assert (0); | 736 | GNUNET_assert (0); |
624 | } | 737 | } |
625 | 738 | ||
739 | /** | ||
740 | * Handle an incoming message of type | ||
741 | * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT | ||
742 | * | ||
743 | * @param cls | ||
744 | * @param msg the message we received | ||
745 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | ||
746 | */ | ||
747 | static int | ||
748 | check_reference_result (void *cls, const struct ReferenceResultMessage *msg) | ||
749 | { | ||
750 | size_t msg_len; | ||
751 | size_t attr_len; | ||
752 | size_t ref_len; | ||
753 | |||
754 | msg_len = ntohs (msg->header.size); | ||
755 | attr_len = ntohs (msg->attest_len); | ||
756 | ref_len = ntohs (msg->ref_len); | ||
757 | if (msg_len != sizeof(struct ReferenceResultMessage) + attr_len + ref_len) | ||
758 | { | ||
759 | GNUNET_break (0); | ||
760 | return GNUNET_SYSERR; | ||
761 | } | ||
762 | return GNUNET_OK; | ||
763 | } | ||
764 | |||
765 | /** | ||
766 | * Handle an incoming message of type | ||
767 | * #GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT | ||
768 | * | ||
769 | * @param cls | ||
770 | * @param msg the message we received | ||
771 | */ | ||
772 | static void | ||
773 | handle_reference_result (void *cls, const struct ReferenceResultMessage *msg) | ||
774 | { | ||
775 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; | ||
776 | struct GNUNET_RECLAIM_Handle *h = cls; | ||
777 | struct GNUNET_RECLAIM_AttributeIterator *it; | ||
778 | struct GNUNET_RECLAIM_Operation *op; | ||
779 | size_t attest_len; | ||
780 | size_t ref_len; | ||
781 | uint32_t r_id = ntohl (msg->id); | ||
782 | attest_len = ntohs (msg->attest_len); | ||
783 | ref_len = ntohs (msg->ref_len); | ||
784 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing reference result.\n"); | ||
785 | for (it = h->it_head; NULL != it; it = it->next) | ||
786 | if (it->r_id == r_id) | ||
787 | break; | ||
788 | for (op = h->op_head; NULL != op; op = op->next) | ||
789 | if (op->r_id == r_id) | ||
790 | break; | ||
791 | if ((NULL == it) && (NULL == op)) | ||
792 | return; | ||
793 | |||
794 | if ((0 == | ||
795 | (memcmp (&msg->identity, &identity_dummy, sizeof(identity_dummy))))) | ||
796 | { | ||
797 | if ((NULL == it) && (NULL == op)) | ||
798 | { | ||
799 | GNUNET_break (0); | ||
800 | force_reconnect (h); | ||
801 | return; | ||
802 | } | ||
803 | if (NULL != it) | ||
804 | { | ||
805 | if (NULL != it->finish_cb) | ||
806 | it->finish_cb (it->finish_cb_cls); | ||
807 | free_it (it); | ||
808 | } | ||
809 | if (NULL != op) | ||
810 | { | ||
811 | if (NULL != op->ar_cb) | ||
812 | op->ar_cb (op->cls, NULL, NULL, NULL, NULL); | ||
813 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); | ||
814 | free_op (op); | ||
815 | } | ||
816 | return; | ||
817 | } | ||
818 | |||
819 | { | ||
820 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref; | ||
821 | struct GNUNET_RECLAIM_ATTESTATION_Claim *attest; | ||
822 | attest = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &msg[1], | ||
823 | attest_len); | ||
824 | ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &msg[1] | ||
825 | + attest_len, | ||
826 | ref_len); | ||
827 | if (NULL != it) | ||
828 | { | ||
829 | if (NULL != it->proc) | ||
830 | it->proc (it->proc_cls, &msg->identity, NULL, attest, ref); | ||
831 | } | ||
832 | else if (NULL != op) | ||
833 | { | ||
834 | if (NULL != op->ar_cb) | ||
835 | op->ar_cb (op->cls, &msg->identity, NULL, attest, ref); | ||
836 | } | ||
837 | GNUNET_free (ref); | ||
838 | GNUNET_free (attest); | ||
839 | return; | ||
840 | } | ||
841 | GNUNET_assert (0); | ||
842 | } | ||
626 | 843 | ||
627 | /** | 844 | /** |
628 | * Handle an incoming message of type | 845 | * Handle an incoming message of type |
@@ -742,6 +959,14 @@ reconnect (struct GNUNET_RECLAIM_Handle *h) | |||
742 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, | 959 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, |
743 | struct AttributeResultMessage, | 960 | struct AttributeResultMessage, |
744 | h), | 961 | h), |
962 | GNUNET_MQ_hd_var_size (attestation_result, | ||
963 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, | ||
964 | struct AttributeResultMessage, | ||
965 | h), | ||
966 | GNUNET_MQ_hd_var_size (reference_result, | ||
967 | GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT, | ||
968 | struct ReferenceResultMessage, | ||
969 | h), | ||
745 | GNUNET_MQ_hd_fixed_size (ticket_result, | 970 | GNUNET_MQ_hd_fixed_size (ticket_result, |
746 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, | 971 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, |
747 | struct TicketResultMessage, | 972 | struct TicketResultMessage, |
@@ -925,6 +1150,185 @@ GNUNET_RECLAIM_attribute_delete ( | |||
925 | return op; | 1150 | return op; |
926 | } | 1151 | } |
927 | 1152 | ||
1153 | /** | ||
1154 | * Store an attestation. If the attestation is already present, | ||
1155 | * it is replaced with the new attestation. | ||
1156 | * | ||
1157 | * @param h handle to the re:claimID service | ||
1158 | * @param pkey private key of the identity | ||
1159 | * @param attr the attestation value | ||
1160 | * @param exp_interval the relative expiration interval for the attestation | ||
1161 | * @param cont continuation to call when done | ||
1162 | * @param cont_cls closure for @a cont | ||
1163 | * @return handle to abort the request | ||
1164 | */ | ||
1165 | struct GNUNET_RECLAIM_Operation * | ||
1166 | GNUNET_RECLAIM_attestation_store ( | ||
1167 | struct GNUNET_RECLAIM_Handle *h, | ||
1168 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
1169 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, | ||
1170 | const struct GNUNET_TIME_Relative *exp_interval, | ||
1171 | GNUNET_RECLAIM_ContinuationWithStatus cont, | ||
1172 | void *cont_cls) | ||
1173 | { | ||
1174 | struct GNUNET_RECLAIM_Operation *op; | ||
1175 | struct AttributeStoreMessage *sam; | ||
1176 | size_t attr_len; | ||
1177 | |||
1178 | op = GNUNET_new (struct GNUNET_RECLAIM_Operation); | ||
1179 | op->h = h; | ||
1180 | op->as_cb = cont; | ||
1181 | op->cls = cont_cls; | ||
1182 | op->r_id = h->r_id_gen++; | ||
1183 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | ||
1184 | attr_len = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (attr); | ||
1185 | op->env = GNUNET_MQ_msg_extra (sam, | ||
1186 | attr_len, | ||
1187 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE); | ||
1188 | sam->identity = *pkey; | ||
1189 | sam->id = htonl (op->r_id); | ||
1190 | sam->exp = GNUNET_htonll (exp_interval->rel_value_us); | ||
1191 | |||
1192 | GNUNET_RECLAIM_ATTESTATION_serialize (attr, (char *) &sam[1]); | ||
1193 | |||
1194 | sam->attr_len = htons (attr_len); | ||
1195 | if (NULL != h->mq) | ||
1196 | GNUNET_MQ_send_copy (h->mq, op->env); | ||
1197 | return op; | ||
1198 | } | ||
1199 | |||
1200 | /** | ||
1201 | * Delete an attestation. Tickets used to share this attestation are updated | ||
1202 | * accordingly. | ||
1203 | * | ||
1204 | * @param h handle to the re:claimID service | ||
1205 | * @param pkey Private key of the identity to add an attribute to | ||
1206 | * @param attr The attestation | ||
1207 | * @param cont Continuation to call when done | ||
1208 | * @param cont_cls Closure for @a cont | ||
1209 | * @return handle Used to to abort the request | ||
1210 | */ | ||
1211 | struct GNUNET_RECLAIM_Operation * | ||
1212 | GNUNET_RECLAIM_attestation_delete ( | ||
1213 | struct GNUNET_RECLAIM_Handle *h, | ||
1214 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
1215 | const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, | ||
1216 | GNUNET_RECLAIM_ContinuationWithStatus cont, | ||
1217 | void *cont_cls) | ||
1218 | { | ||
1219 | struct GNUNET_RECLAIM_Operation *op; | ||
1220 | struct AttributeDeleteMessage *dam; | ||
1221 | size_t attr_len; | ||
1222 | |||
1223 | op = GNUNET_new (struct GNUNET_RECLAIM_Operation); | ||
1224 | op->h = h; | ||
1225 | op->as_cb = cont; | ||
1226 | op->cls = cont_cls; | ||
1227 | op->r_id = h->r_id_gen++; | ||
1228 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | ||
1229 | attr_len = GNUNET_RECLAIM_ATTESTATION_serialize_get_size (attr); | ||
1230 | op->env = GNUNET_MQ_msg_extra (dam, | ||
1231 | attr_len, | ||
1232 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE); | ||
1233 | dam->identity = *pkey; | ||
1234 | dam->id = htonl (op->r_id); | ||
1235 | GNUNET_RECLAIM_ATTESTATION_serialize (attr, (char *) &dam[1]); | ||
1236 | |||
1237 | dam->attr_len = htons (attr_len); | ||
1238 | if (NULL != h->mq) | ||
1239 | GNUNET_MQ_send_copy (h->mq, op->env); | ||
1240 | return op; | ||
1241 | } | ||
1242 | |||
1243 | /** | ||
1244 | * Store an attestation reference. If the reference is already present, | ||
1245 | * it is replaced with the new reference. | ||
1246 | * | ||
1247 | * @param h handle to the re:claimID service | ||
1248 | * @param pkey private key of the identity | ||
1249 | * @param attr the reference value | ||
1250 | * @param exp_interval the relative expiration interval for the reference | ||
1251 | * @param cont continuation to call when done | ||
1252 | * @param cont_cls closure for @a cont | ||
1253 | * @return handle to abort the request | ||
1254 | */ | ||
1255 | struct GNUNET_RECLAIM_Operation * | ||
1256 | GNUNET_RECLAIM_attestation_reference_store ( | ||
1257 | struct GNUNET_RECLAIM_Handle *h, | ||
1258 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
1259 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr, | ||
1260 | const struct GNUNET_TIME_Relative *exp_interval, | ||
1261 | GNUNET_RECLAIM_ContinuationWithStatus cont, | ||
1262 | void *cont_cls) | ||
1263 | { | ||
1264 | struct GNUNET_RECLAIM_Operation *op; | ||
1265 | struct AttributeStoreMessage *sam; | ||
1266 | size_t attr_len; | ||
1267 | op = GNUNET_new (struct GNUNET_RECLAIM_Operation); | ||
1268 | op->h = h; | ||
1269 | op->as_cb = cont; | ||
1270 | op->cls = cont_cls; | ||
1271 | op->r_id = h->r_id_gen++; | ||
1272 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | ||
1273 | attr_len = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (attr); | ||
1274 | op->env = GNUNET_MQ_msg_extra (sam, | ||
1275 | attr_len, | ||
1276 | GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_STORE); | ||
1277 | sam->identity = *pkey; | ||
1278 | sam->id = htonl (op->r_id); | ||
1279 | sam->exp = GNUNET_htonll (exp_interval->rel_value_us); | ||
1280 | |||
1281 | GNUNET_RECLAIM_ATTESTATION_REF_serialize (attr, (char *) &sam[1]); | ||
1282 | |||
1283 | sam->attr_len = htons (attr_len); | ||
1284 | if (NULL != h->mq) | ||
1285 | GNUNET_MQ_send_copy (h->mq, op->env); | ||
1286 | return op; | ||
1287 | } | ||
1288 | |||
1289 | /** | ||
1290 | * Delete an attestation reference. Tickets used to share this reference are updated | ||
1291 | * accordingly. | ||
1292 | * | ||
1293 | * @param h handle to the re:claimID service | ||
1294 | * @param pkey Private key of the identity to delete the reference from | ||
1295 | * @param attr The reference | ||
1296 | * @param cont Continuation to call when done | ||
1297 | * @param cont_cls Closure for @a cont | ||
1298 | * @return handle Used to to abort the request | ||
1299 | */ | ||
1300 | struct GNUNET_RECLAIM_Operation * | ||
1301 | GNUNET_RECLAIM_attestation_reference_delete ( | ||
1302 | struct GNUNET_RECLAIM_Handle *h, | ||
1303 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
1304 | const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr, | ||
1305 | GNUNET_RECLAIM_ContinuationWithStatus cont, | ||
1306 | void *cont_cls) | ||
1307 | { | ||
1308 | |||
1309 | struct GNUNET_RECLAIM_Operation *op; | ||
1310 | struct AttributeDeleteMessage *dam; | ||
1311 | size_t attr_len; | ||
1312 | |||
1313 | op = GNUNET_new (struct GNUNET_RECLAIM_Operation); | ||
1314 | op->h = h; | ||
1315 | op->as_cb = cont; | ||
1316 | op->cls = cont_cls; | ||
1317 | op->r_id = h->r_id_gen++; | ||
1318 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | ||
1319 | attr_len = GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size (attr); | ||
1320 | op->env = GNUNET_MQ_msg_extra (dam, | ||
1321 | attr_len, | ||
1322 | GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_DELETE); | ||
1323 | dam->identity = *pkey; | ||
1324 | dam->id = htonl (op->r_id); | ||
1325 | GNUNET_RECLAIM_ATTESTATION_REF_serialize (attr, (char *) &dam[1]); | ||
1326 | |||
1327 | dam->attr_len = htons (attr_len); | ||
1328 | if (NULL != h->mq) | ||
1329 | GNUNET_MQ_send_copy (h->mq, op->env); | ||
1330 | return op; | ||
1331 | } | ||
928 | 1332 | ||
929 | /** | 1333 | /** |
930 | * List all attributes for a local identity. | 1334 | * List all attributes for a local identity. |