diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-04-16 11:30:55 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-04-16 11:30:55 +0200 |
commit | c60e83d3939da9f4e368c13ba3d2ea950b6c28d1 (patch) | |
tree | bdb7fa6884c0aa529d01d6fc5d5e1ff75b0ad479 /src/reclaim/gnunet-service-reclaim.c | |
parent | 6299e8e87fb514782b1cf8eebde23dc044a3de89 (diff) | |
download | gnunet-c60e83d3939da9f4e368c13ba3d2ea950b6c28d1.tar.gz gnunet-c60e83d3939da9f4e368c13ba3d2ea950b6c28d1.zip |
update clang-format
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 272 |
1 files changed, 156 insertions, 116 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index bb4cd6716..9d4bcd967 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -563,15 +563,17 @@ issue_ticket_result_cb (void *cls, | |||
563 | struct TicketIssueOperation *tio = cls; | 563 | struct TicketIssueOperation *tio = cls; |
564 | if (GNUNET_OK != success) { | 564 | if (GNUNET_OK != success) { |
565 | send_ticket_result (tio->client, tio->r_id, NULL, GNUNET_SYSERR); | 565 | send_ticket_result (tio->client, tio->r_id, NULL, GNUNET_SYSERR); |
566 | GNUNET_CONTAINER_DLL_remove ( | 566 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, |
567 | tio->client->issue_op_head, tio->client->issue_op_tail, tio); | 567 | tio->client->issue_op_tail, |
568 | tio); | ||
568 | GNUNET_free (tio); | 569 | GNUNET_free (tio); |
569 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg); | 570 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg); |
570 | return; | 571 | return; |
571 | } | 572 | } |
572 | send_ticket_result (tio->client, tio->r_id, ticket, GNUNET_SYSERR); | 573 | send_ticket_result (tio->client, tio->r_id, ticket, GNUNET_SYSERR); |
573 | GNUNET_CONTAINER_DLL_remove ( | 574 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, |
574 | tio->client->issue_op_head, tio->client->issue_op_tail, tio); | 575 | tio->client->issue_op_tail, |
576 | tio); | ||
575 | GNUNET_free (tio); | 577 | GNUNET_free (tio); |
576 | } | 578 | } |
577 | 579 | ||
@@ -602,8 +604,11 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) | |||
602 | tio->r_id = ntohl (im->id); | 604 | tio->r_id = ntohl (im->id); |
603 | tio->client = idp; | 605 | tio->client = idp; |
604 | GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio); | 606 | GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio); |
605 | RECLAIM_TICKETS_issue ( | 607 | RECLAIM_TICKETS_issue (&im->identity, |
606 | &im->identity, attrs, &im->rp, &issue_ticket_result_cb, tio); | 608 | attrs, |
609 | &im->rp, | ||
610 | &issue_ticket_result_cb, | ||
611 | tio); | ||
607 | GNUNET_SERVICE_client_continue (idp->client); | 612 | GNUNET_SERVICE_client_continue (idp->client); |
608 | GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); | 613 | GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); |
609 | } | 614 | } |
@@ -624,8 +629,9 @@ revoke_result_cb (void *cls, int32_t success) | |||
624 | trm->id = htonl (rop->r_id); | 629 | trm->id = htonl (rop->r_id); |
625 | trm->success = htonl (success); | 630 | trm->success = htonl (success); |
626 | GNUNET_MQ_send (rop->client->mq, env); | 631 | GNUNET_MQ_send (rop->client->mq, env); |
627 | GNUNET_CONTAINER_DLL_remove ( | 632 | GNUNET_CONTAINER_DLL_remove (rop->client->revoke_op_head, |
628 | rop->client->revoke_op_head, rop->client->revoke_op_tail, rop); | 633 | rop->client->revoke_op_tail, |
634 | rop); | ||
629 | GNUNET_free (rop); | 635 | GNUNET_free (rop); |
630 | } | 636 | } |
631 | 637 | ||
@@ -656,7 +662,7 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm) | |||
656 | rop->client = idp; | 662 | rop->client = idp; |
657 | GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop); | 663 | GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop); |
658 | rop->rh | 664 | rop->rh |
659 | = RECLAIM_TICKETS_revoke (ticket, &rm->identity, &revoke_result_cb, rop); | 665 | = RECLAIM_TICKETS_revoke (ticket, &rm->identity, &revoke_result_cb, rop); |
660 | GNUNET_SERVICE_client_continue (idp->client); | 666 | GNUNET_SERVICE_client_continue (idp->client); |
661 | } | 667 | } |
662 | 668 | ||
@@ -689,8 +695,9 @@ consume_result_cb (void *cls, | |||
689 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg); | 695 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg); |
690 | } | 696 | } |
691 | attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); | 697 | attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); |
692 | env = GNUNET_MQ_msg_extra ( | 698 | env = GNUNET_MQ_msg_extra (crm, |
693 | crm, attrs_len, GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); | 699 | attrs_len, |
700 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); | ||
694 | crm->id = htonl (cop->r_id); | 701 | crm->id = htonl (cop->r_id); |
695 | crm->attrs_len = htons (attrs_len); | 702 | crm->attrs_len = htons (attrs_len); |
696 | crm->identity = *identity; | 703 | crm->identity = *identity; |
@@ -698,8 +705,9 @@ consume_result_cb (void *cls, | |||
698 | data_tmp = (char *)&crm[1]; | 705 | data_tmp = (char *)&crm[1]; |
699 | GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, data_tmp); | 706 | GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, data_tmp); |
700 | GNUNET_MQ_send (cop->client->mq, env); | 707 | GNUNET_MQ_send (cop->client->mq, env); |
701 | GNUNET_CONTAINER_DLL_remove ( | 708 | GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head, |
702 | cop->client->consume_op_head, cop->client->consume_op_tail, cop); | 709 | cop->client->consume_op_tail, |
710 | cop); | ||
703 | GNUNET_free (cop); | 711 | GNUNET_free (cop); |
704 | } | 712 | } |
705 | 713 | ||
@@ -714,8 +722,8 @@ handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm) | |||
714 | cop->r_id = ntohl (cm->id); | 722 | cop->r_id = ntohl (cm->id); |
715 | cop->client = idp; | 723 | cop->client = idp; |
716 | ticket = (struct GNUNET_RECLAIM_Ticket *)&cm[1]; | 724 | ticket = (struct GNUNET_RECLAIM_Ticket *)&cm[1]; |
717 | cop->ch = RECLAIM_TICKETS_consume ( | 725 | cop->ch |
718 | &cm->identity, ticket, &consume_result_cb, cop); | 726 | = RECLAIM_TICKETS_consume (&cm->identity, ticket, &consume_result_cb, cop); |
719 | GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop); | 727 | GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop); |
720 | GNUNET_SERVICE_client_continue (idp->client); | 728 | GNUNET_SERVICE_client_continue (idp->client); |
721 | } | 729 | } |
@@ -747,12 +755,14 @@ attr_store_cont (void *cls, int32_t success, const char *emsg) | |||
747 | struct SuccessResultMessage *acr_msg; | 755 | struct SuccessResultMessage *acr_msg; |
748 | 756 | ||
749 | ash->ns_qe = NULL; | 757 | ash->ns_qe = NULL; |
750 | GNUNET_CONTAINER_DLL_remove ( | 758 | GNUNET_CONTAINER_DLL_remove (ash->client->store_op_head, |
751 | ash->client->store_op_head, ash->client->store_op_tail, ash); | 759 | ash->client->store_op_tail, |
760 | ash); | ||
752 | 761 | ||
753 | if (GNUNET_SYSERR == success) { | 762 | if (GNUNET_SYSERR == success) { |
754 | GNUNET_log ( | 763 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
755 | GNUNET_ERROR_TYPE_ERROR, "Failed to store attribute %s\n", emsg); | 764 | "Failed to store attribute %s\n", |
765 | emsg); | ||
756 | cleanup_as_handle (ash); | 766 | cleanup_as_handle (ash); |
757 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 767 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
758 | return; | 768 | return; |
@@ -786,10 +796,10 @@ attr_store_task (void *cls) | |||
786 | // Give the ash a new id if unset | 796 | // Give the ash a new id if unset |
787 | if (0 == ash->claim->id) | 797 | if (0 == ash->claim->id) |
788 | ash->claim->id | 798 | ash->claim->id |
789 | = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | 799 | = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); |
790 | GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, buf); | 800 | GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, buf); |
791 | label = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, | 801 | label |
792 | sizeof (uint64_t)); | 802 | = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, sizeof (uint64_t)); |
793 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label); | 803 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label); |
794 | 804 | ||
795 | rd[0].data_size = buf_size; | 805 | rd[0].data_size = buf_size; |
@@ -797,8 +807,13 @@ attr_store_task (void *cls) | |||
797 | rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR; | 807 | rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR; |
798 | rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | 808 | rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; |
799 | rd[0].expiration_time = ash->exp.rel_value_us; | 809 | rd[0].expiration_time = ash->exp.rel_value_us; |
800 | ash->ns_qe = GNUNET_NAMESTORE_records_store ( | 810 | ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, |
801 | nsh, &ash->identity, label, 1, rd, &attr_store_cont, ash); | 811 | &ash->identity, |
812 | label, | ||
813 | 1, | ||
814 | rd, | ||
815 | &attr_store_cont, | ||
816 | ash); | ||
802 | GNUNET_free (buf); | 817 | GNUNET_free (buf); |
803 | } | 818 | } |
804 | 819 | ||
@@ -855,8 +870,9 @@ cleanup_adh (struct AttributeDeleteHandle *adh) | |||
855 | if (NULL != adh->claim) | 870 | if (NULL != adh->claim) |
856 | GNUNET_free (adh->claim); | 871 | GNUNET_free (adh->claim); |
857 | while (NULL != (le = adh->tickets_to_update_head)) { | 872 | while (NULL != (le = adh->tickets_to_update_head)) { |
858 | GNUNET_CONTAINER_DLL_remove ( | 873 | GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head, |
859 | adh->tickets_to_update_head, adh->tickets_to_update_tail, le); | 874 | adh->tickets_to_update_tail, |
875 | le); | ||
860 | if (NULL != le->label) | 876 | if (NULL != le->label) |
861 | GNUNET_free (le->label); | 877 | GNUNET_free (le->label); |
862 | if (NULL != le->data) | 878 | if (NULL != le->data) |
@@ -873,8 +889,9 @@ send_delete_response (struct AttributeDeleteHandle *adh, int32_t success) | |||
873 | struct GNUNET_MQ_Envelope *env; | 889 | struct GNUNET_MQ_Envelope *env; |
874 | struct SuccessResultMessage *acr_msg; | 890 | struct SuccessResultMessage *acr_msg; |
875 | 891 | ||
876 | GNUNET_CONTAINER_DLL_remove ( | 892 | GNUNET_CONTAINER_DLL_remove (adh->client->delete_op_head, |
877 | adh->client->delete_op_head, adh->client->delete_op_tail, adh); | 893 | adh->client->delete_op_tail, |
894 | adh); | ||
878 | 895 | ||
879 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n"); | 896 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n"); |
880 | env = GNUNET_MQ_msg (acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE); | 897 | env = GNUNET_MQ_msg (acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE); |
@@ -913,8 +930,9 @@ ticket_iter (void *cls, | |||
913 | le->rd_count = rd_count; | 930 | le->rd_count = rd_count; |
914 | le->label = GNUNET_strdup (label); | 931 | le->label = GNUNET_strdup (label); |
915 | GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data); | 932 | GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data); |
916 | GNUNET_CONTAINER_DLL_insert ( | 933 | GNUNET_CONTAINER_DLL_insert (adh->tickets_to_update_head, |
917 | adh->tickets_to_update_head, adh->tickets_to_update_tail, le); | 934 | adh->tickets_to_update_tail, |
935 | le); | ||
918 | } | 936 | } |
919 | GNUNET_NAMESTORE_zone_iterator_next (adh->ns_it, 1); | 937 | GNUNET_NAMESTORE_zone_iterator_next (adh->ns_it, 1); |
920 | } | 938 | } |
@@ -948,12 +966,15 @@ update_tickets (void *cls) | |||
948 | "Updating %s\n", | 966 | "Updating %s\n", |
949 | adh->tickets_to_update_head->label); | 967 | adh->tickets_to_update_head->label); |
950 | le = adh->tickets_to_update_head; | 968 | le = adh->tickets_to_update_head; |
951 | GNUNET_CONTAINER_DLL_remove ( | 969 | GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head, |
952 | adh->tickets_to_update_head, adh->tickets_to_update_tail, le); | 970 | adh->tickets_to_update_tail, |
971 | le); | ||
953 | struct GNUNET_GNSRECORD_Data rd[le->rd_count]; | 972 | struct GNUNET_GNSRECORD_Data rd[le->rd_count]; |
954 | struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1]; | 973 | struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1]; |
955 | GNUNET_GNSRECORD_records_deserialize ( | 974 | GNUNET_GNSRECORD_records_deserialize (le->data_size, |
956 | le->data_size, le->data, le->rd_count, rd); | 975 | le->data, |
976 | le->rd_count, | ||
977 | rd); | ||
957 | int j = 0; | 978 | int j = 0; |
958 | for (int i = 0; i < le->rd_count; i++) { | 979 | for (int i = 0; i < le->rd_count; i++) { |
959 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) | 980 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) |
@@ -962,8 +983,13 @@ update_tickets (void *cls) | |||
962 | rd_new[j] = rd[i]; | 983 | rd_new[j] = rd[i]; |
963 | j++; | 984 | j++; |
964 | } | 985 | } |
965 | adh->ns_qe = GNUNET_NAMESTORE_records_store ( | 986 | adh->ns_qe = GNUNET_NAMESTORE_records_store (nsh, |
966 | nsh, &adh->identity, le->label, j, rd_new, &ticket_updated, adh); | 987 | &adh->identity, |
988 | le->label, | ||
989 | j, | ||
990 | rd_new, | ||
991 | &ticket_updated, | ||
992 | adh); | ||
967 | GNUNET_free (le->label); | 993 | GNUNET_free (le->label); |
968 | GNUNET_free (le->data); | 994 | GNUNET_free (le->data); |
969 | GNUNET_free (le); | 995 | GNUNET_free (le); |
@@ -984,8 +1010,9 @@ ticket_iter_err (void *cls) | |||
984 | { | 1010 | { |
985 | struct AttributeDeleteHandle *adh = cls; | 1011 | struct AttributeDeleteHandle *adh = cls; |
986 | adh->ns_it = NULL; | 1012 | adh->ns_it = NULL; |
987 | GNUNET_log ( | 1013 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
988 | GNUNET_ERROR_TYPE_ERROR, "Namestore error on delete %s\n", adh->label); | 1014 | "Namestore error on delete %s\n", |
1015 | adh->label); | ||
989 | send_delete_response (adh, GNUNET_SYSERR); | 1016 | send_delete_response (adh, GNUNET_SYSERR); |
990 | cleanup_adh (adh); | 1017 | cleanup_adh (adh); |
991 | } | 1018 | } |
@@ -1012,8 +1039,9 @@ attr_delete_cont (void *cls, int32_t success, const char *emsg) | |||
1012 | struct AttributeDeleteHandle *adh = cls; | 1039 | struct AttributeDeleteHandle *adh = cls; |
1013 | adh->ns_qe = NULL; | 1040 | adh->ns_qe = NULL; |
1014 | if (GNUNET_SYSERR == success) { | 1041 | if (GNUNET_SYSERR == success) { |
1015 | GNUNET_log ( | 1042 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1016 | GNUNET_ERROR_TYPE_ERROR, "Error deleting attribute %s\n", adh->label); | 1043 | "Error deleting attribute %s\n", |
1044 | adh->label); | ||
1017 | send_delete_response (adh, GNUNET_SYSERR); | 1045 | send_delete_response (adh, GNUNET_SYSERR); |
1018 | cleanup_adh (adh); | 1046 | cleanup_adh (adh); |
1019 | return; | 1047 | return; |
@@ -1054,13 +1082,18 @@ handle_attribute_delete_message (void *cls, | |||
1054 | 1082 | ||
1055 | adh->r_id = ntohl (dam->id); | 1083 | adh->r_id = ntohl (dam->id); |
1056 | adh->identity = dam->identity; | 1084 | adh->identity = dam->identity; |
1057 | adh->label = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id, | 1085 | adh->label |
1058 | sizeof (uint64_t)); | 1086 | = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id, sizeof (uint64_t)); |
1059 | GNUNET_SERVICE_client_continue (idp->client); | 1087 | GNUNET_SERVICE_client_continue (idp->client); |
1060 | adh->client = idp; | 1088 | adh->client = idp; |
1061 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); | 1089 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); |
1062 | adh->ns_qe = GNUNET_NAMESTORE_records_store ( | 1090 | adh->ns_qe = GNUNET_NAMESTORE_records_store (nsh, |
1063 | nsh, &adh->identity, adh->label, 0, NULL, &attr_delete_cont, adh); | 1091 | &adh->identity, |
1092 | adh->label, | ||
1093 | 0, | ||
1094 | NULL, | ||
1095 | &attr_delete_cont, | ||
1096 | adh); | ||
1064 | } | 1097 | } |
1065 | 1098 | ||
1066 | 1099 | ||
@@ -1079,8 +1112,9 @@ attr_iter_error (void *cls) | |||
1079 | { | 1112 | { |
1080 | struct AttributeIterator *ai = cls; | 1113 | struct AttributeIterator *ai = cls; |
1081 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n"); | 1114 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n"); |
1082 | GNUNET_CONTAINER_DLL_remove ( | 1115 | GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, |
1083 | ai->client->attr_iter_head, ai->client->attr_iter_tail, ai); | 1116 | ai->client->attr_iter_tail, |
1117 | ai); | ||
1084 | cleanup_attribute_iter_handle (ai); | 1118 | cleanup_attribute_iter_handle (ai); |
1085 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 1119 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
1086 | } | 1120 | } |
@@ -1096,8 +1130,9 @@ attr_iter_finished (void *cls) | |||
1096 | arm->id = htonl (ai->request_id); | 1130 | arm->id = htonl (ai->request_id); |
1097 | arm->attr_len = htons (0); | 1131 | arm->attr_len = htons (0); |
1098 | GNUNET_MQ_send (ai->client->mq, env); | 1132 | GNUNET_MQ_send (ai->client->mq, env); |
1099 | GNUNET_CONTAINER_DLL_remove ( | 1133 | GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, |
1100 | ai->client->attr_iter_head, ai->client->attr_iter_tail, ai); | 1134 | ai->client->attr_iter_tail, |
1135 | ai); | ||
1101 | cleanup_attribute_iter_handle (ai); | 1136 | cleanup_attribute_iter_handle (ai); |
1102 | } | 1137 | } |
1103 | 1138 | ||
@@ -1123,8 +1158,9 @@ attr_iter_cb (void *cls, | |||
1123 | return; | 1158 | return; |
1124 | } | 1159 | } |
1125 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", label); | 1160 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", label); |
1126 | env = GNUNET_MQ_msg_extra ( | 1161 | env = GNUNET_MQ_msg_extra (arm, |
1127 | arm, rd->data_size, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); | 1162 | rd->data_size, |
1163 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); | ||
1128 | arm->id = htonl (ai->request_id); | 1164 | arm->id = htonl (ai->request_id); |
1129 | arm->attr_len = htons (rd->data_size); | 1165 | arm->attr_len = htons (rd->data_size); |
1130 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); | 1166 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); |
@@ -1221,8 +1257,9 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket) | |||
1221 | if (NULL == ticket) { | 1257 | if (NULL == ticket) { |
1222 | /* send empty response to indicate end of list */ | 1258 | /* send empty response to indicate end of list */ |
1223 | env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); | 1259 | env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); |
1224 | GNUNET_CONTAINER_DLL_remove ( | 1260 | GNUNET_CONTAINER_DLL_remove (ti->client->ticket_iter_head, |
1225 | ti->client->ticket_iter_head, ti->client->ticket_iter_tail, ti); | 1261 | ti->client->ticket_iter_tail, |
1262 | ti); | ||
1226 | } else { | 1263 | } else { |
1227 | env = GNUNET_MQ_msg_extra (trm, | 1264 | env = GNUNET_MQ_msg_extra (trm, |
1228 | sizeof (struct GNUNET_RECLAIM_Ticket), | 1265 | sizeof (struct GNUNET_RECLAIM_Ticket), |
@@ -1237,7 +1274,7 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket) | |||
1237 | 1274 | ||
1238 | static void | 1275 | static void |
1239 | handle_ticket_iteration_start ( | 1276 | handle_ticket_iteration_start ( |
1240 | void *cls, const struct TicketIterationStartMessage *tis_msg) | 1277 | void *cls, const struct TicketIterationStartMessage *tis_msg) |
1241 | { | 1278 | { |
1242 | struct IdpClient *client = cls; | 1279 | struct IdpClient *client = cls; |
1243 | struct TicketIteration *ti; | 1280 | struct TicketIteration *ti; |
@@ -1248,10 +1285,11 @@ handle_ticket_iteration_start ( | |||
1248 | ti->r_id = ntohl (tis_msg->id); | 1285 | ti->r_id = ntohl (tis_msg->id); |
1249 | ti->client = client; | 1286 | ti->client = client; |
1250 | 1287 | ||
1251 | GNUNET_CONTAINER_DLL_insert ( | 1288 | GNUNET_CONTAINER_DLL_insert (client->ticket_iter_head, |
1252 | client->ticket_iter_head, client->ticket_iter_tail, ti); | 1289 | client->ticket_iter_tail, |
1253 | ti->iter = RECLAIM_TICKETS_iteration_start ( | 1290 | ti); |
1254 | &tis_msg->identity, &ticket_iter_cb, ti); | 1291 | ti->iter |
1292 | = RECLAIM_TICKETS_iteration_start (&tis_msg->identity, &ticket_iter_cb, ti); | ||
1255 | GNUNET_SERVICE_client_continue (client->client); | 1293 | GNUNET_SERVICE_client_continue (client->client); |
1256 | } | 1294 | } |
1257 | 1295 | ||
@@ -1276,8 +1314,9 @@ handle_ticket_iteration_stop (void *cls, | |||
1276 | return; | 1314 | return; |
1277 | } | 1315 | } |
1278 | RECLAIM_TICKETS_iteration_stop (ti->iter); | 1316 | RECLAIM_TICKETS_iteration_stop (ti->iter); |
1279 | GNUNET_CONTAINER_DLL_remove ( | 1317 | GNUNET_CONTAINER_DLL_remove (client->ticket_iter_head, |
1280 | client->ticket_iter_head, client->ticket_iter_tail, ti); | 1318 | client->ticket_iter_tail, |
1319 | ti); | ||
1281 | GNUNET_free (ti); | 1320 | GNUNET_free (ti); |
1282 | GNUNET_SERVICE_client_continue (client->client); | 1321 | GNUNET_SERVICE_client_continue (client->client); |
1283 | } | 1322 | } |
@@ -1339,10 +1378,11 @@ run (void *cls, | |||
1339 | "reclaim", | 1378 | "reclaim", |
1340 | "TOKEN_EXPIRATION_INTERVAL", | 1379 | "TOKEN_EXPIRATION_INTERVAL", |
1341 | &token_expiration_interval)) { | 1380 | &token_expiration_interval)) { |
1342 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1381 | GNUNET_log ( |
1343 | "Time window for zone iteration: %s\n", | 1382 | GNUNET_ERROR_TYPE_DEBUG, |
1344 | GNUNET_STRINGS_relative_time_to_string ( | 1383 | "Time window for zone iteration: %s\n", |
1345 | token_expiration_interval, GNUNET_YES)); | 1384 | GNUNET_STRINGS_relative_time_to_string (token_expiration_interval, |
1385 | GNUNET_YES)); | ||
1346 | } else { | 1386 | } else { |
1347 | token_expiration_interval = DEFAULT_TOKEN_EXPIRATION_INTERVAL; | 1387 | token_expiration_interval = DEFAULT_TOKEN_EXPIRATION_INTERVAL; |
1348 | } | 1388 | } |
@@ -1380,8 +1420,9 @@ client_disconnect_cb (void *cls, | |||
1380 | GNUNET_free (iss); | 1420 | GNUNET_free (iss); |
1381 | } | 1421 | } |
1382 | while (NULL != (ct = idp->consume_op_head)) { | 1422 | while (NULL != (ct = idp->consume_op_head)) { |
1383 | GNUNET_CONTAINER_DLL_remove ( | 1423 | GNUNET_CONTAINER_DLL_remove (idp->consume_op_head, |
1384 | idp->consume_op_head, idp->consume_op_tail, ct); | 1424 | idp->consume_op_tail, |
1425 | ct); | ||
1385 | if (NULL != ct->ch) | 1426 | if (NULL != ct->ch) |
1386 | RECLAIM_TICKETS_consume_cancel (ct->ch); | 1427 | RECLAIM_TICKETS_consume_cancel (ct->ch); |
1387 | GNUNET_free (ct); | 1428 | GNUNET_free (ct); |
@@ -1406,8 +1447,9 @@ client_disconnect_cb (void *cls, | |||
1406 | GNUNET_free (rop); | 1447 | GNUNET_free (rop); |
1407 | } | 1448 | } |
1408 | while (NULL != (ti = idp->ticket_iter_head)) { | 1449 | while (NULL != (ti = idp->ticket_iter_head)) { |
1409 | GNUNET_CONTAINER_DLL_remove ( | 1450 | GNUNET_CONTAINER_DLL_remove (idp->ticket_iter_head, |
1410 | idp->ticket_iter_head, idp->ticket_iter_tail, ti); | 1451 | idp->ticket_iter_tail, |
1452 | ti); | ||
1411 | GNUNET_free (ti); | 1453 | GNUNET_free (ti); |
1412 | } | 1454 | } |
1413 | GNUNET_free (idp); | 1455 | GNUNET_free (idp); |
@@ -1438,58 +1480,56 @@ client_connect_cb (void *cls, | |||
1438 | * Define "main" method using service macro. | 1480 | * Define "main" method using service macro. |
1439 | */ | 1481 | */ |
1440 | GNUNET_SERVICE_MAIN ( | 1482 | GNUNET_SERVICE_MAIN ( |
1441 | "reclaim", | 1483 | "reclaim", |
1442 | GNUNET_SERVICE_OPTION_NONE, | 1484 | GNUNET_SERVICE_OPTION_NONE, |
1443 | &run, | 1485 | &run, |
1444 | &client_connect_cb, | 1486 | &client_connect_cb, |
1445 | &client_disconnect_cb, | 1487 | &client_disconnect_cb, |
1446 | NULL, | 1488 | NULL, |
1447 | GNUNET_MQ_hd_var_size (attribute_store_message, | 1489 | GNUNET_MQ_hd_var_size (attribute_store_message, |
1448 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, | 1490 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, |
1449 | struct AttributeStoreMessage, | 1491 | struct AttributeStoreMessage, |
1492 | NULL), | ||
1493 | GNUNET_MQ_hd_var_size (attribute_delete_message, | ||
1494 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, | ||
1495 | struct AttributeDeleteMessage, | ||
1496 | NULL), | ||
1497 | GNUNET_MQ_hd_fixed_size ( | ||
1498 | iteration_start, | ||
1499 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, | ||
1500 | struct AttributeIterationStartMessage, | ||
1501 | NULL), | ||
1502 | GNUNET_MQ_hd_fixed_size (iteration_next, | ||
1503 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, | ||
1504 | struct AttributeIterationNextMessage, | ||
1450 | NULL), | 1505 | NULL), |
1451 | GNUNET_MQ_hd_var_size (attribute_delete_message, | 1506 | GNUNET_MQ_hd_fixed_size (iteration_stop, |
1452 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, | 1507 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, |
1453 | struct AttributeDeleteMessage, | 1508 | struct AttributeIterationStopMessage, |
1454 | NULL), | 1509 | NULL), |
1455 | GNUNET_MQ_hd_fixed_size ( | 1510 | GNUNET_MQ_hd_var_size (issue_ticket_message, |
1456 | iteration_start, | 1511 | GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, |
1457 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, | 1512 | struct IssueTicketMessage, |
1458 | struct AttributeIterationStartMessage, | 1513 | NULL), |
1459 | NULL), | 1514 | GNUNET_MQ_hd_var_size (consume_ticket_message, |
1460 | GNUNET_MQ_hd_fixed_size ( | 1515 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, |
1461 | iteration_next, | 1516 | struct ConsumeTicketMessage, |
1462 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, | 1517 | NULL), |
1463 | struct AttributeIterationNextMessage, | 1518 | GNUNET_MQ_hd_fixed_size (ticket_iteration_start, |
1464 | NULL), | 1519 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, |
1465 | GNUNET_MQ_hd_fixed_size ( | 1520 | struct TicketIterationStartMessage, |
1466 | iteration_stop, | ||
1467 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, | ||
1468 | struct AttributeIterationStopMessage, | ||
1469 | NULL), | ||
1470 | GNUNET_MQ_hd_var_size (issue_ticket_message, | ||
1471 | GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, | ||
1472 | struct IssueTicketMessage, | ||
1473 | NULL), | 1521 | NULL), |
1474 | GNUNET_MQ_hd_var_size (consume_ticket_message, | 1522 | GNUNET_MQ_hd_fixed_size (ticket_iteration_next, |
1475 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, | 1523 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, |
1476 | struct ConsumeTicketMessage, | 1524 | struct TicketIterationNextMessage, |
1477 | NULL), | 1525 | NULL), |
1478 | GNUNET_MQ_hd_fixed_size (ticket_iteration_start, | 1526 | GNUNET_MQ_hd_fixed_size (ticket_iteration_stop, |
1479 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, | 1527 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, |
1480 | struct TicketIterationStartMessage, | 1528 | struct TicketIterationStopMessage, |
1481 | NULL), | ||
1482 | GNUNET_MQ_hd_fixed_size (ticket_iteration_next, | ||
1483 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, | ||
1484 | struct TicketIterationNextMessage, | ||
1485 | NULL), | ||
1486 | GNUNET_MQ_hd_fixed_size (ticket_iteration_stop, | ||
1487 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, | ||
1488 | struct TicketIterationStopMessage, | ||
1489 | NULL), | ||
1490 | GNUNET_MQ_hd_var_size (revoke_ticket_message, | ||
1491 | GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, | ||
1492 | struct RevokeTicketMessage, | ||
1493 | NULL), | 1529 | NULL), |
1494 | GNUNET_MQ_handler_end ()); | 1530 | GNUNET_MQ_hd_var_size (revoke_ticket_message, |
1531 | GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, | ||
1532 | struct RevokeTicketMessage, | ||
1533 | NULL), | ||
1534 | GNUNET_MQ_handler_end ()); | ||
1495 | /* end of gnunet-service-reclaim.c */ | 1535 | /* end of gnunet-service-reclaim.c */ |