diff options
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index 30a84b3e8..d2cdc62a2 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -646,19 +646,33 @@ static void | |||
646 | send_ticket_result (const struct IdpClient *client, | 646 | send_ticket_result (const struct IdpClient *client, |
647 | uint32_t r_id, | 647 | uint32_t r_id, |
648 | const struct GNUNET_RECLAIM_Ticket *ticket, | 648 | const struct GNUNET_RECLAIM_Ticket *ticket, |
649 | const struct GNUNET_RECLAIM_PresentationList *presentations, | ||
649 | uint32_t success) | 650 | uint32_t success) |
650 | { | 651 | { |
651 | struct TicketResultMessage *irm; | 652 | struct TicketResultMessage *irm; |
652 | struct GNUNET_MQ_Envelope *env; | 653 | struct GNUNET_MQ_Envelope *env; |
654 | size_t pres_len = 0; | ||
653 | 655 | ||
654 | env = GNUNET_MQ_msg (irm, | 656 | if (NULL != presentations) |
655 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); | 657 | { |
658 | pres_len = | ||
659 | GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations); | ||
660 | } | ||
661 | env = GNUNET_MQ_msg_extra (irm, | ||
662 | pres_len, | ||
663 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); | ||
656 | if (NULL != ticket) | 664 | if (NULL != ticket) |
657 | { | 665 | { |
658 | irm->ticket = *ticket; | 666 | irm->ticket = *ticket; |
659 | } | 667 | } |
660 | // TODO add success member | 668 | // TODO add success member |
661 | irm->id = htonl (r_id); | 669 | irm->id = htonl (r_id); |
670 | irm->presentations_len = htons (pres_len); | ||
671 | if (NULL != presentations) | ||
672 | { | ||
673 | GNUNET_RECLAIM_presentation_list_serialize (presentations, | ||
674 | (char*) &irm[1]); | ||
675 | } | ||
662 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); | 676 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); |
663 | GNUNET_MQ_send (client->mq, env); | 677 | GNUNET_MQ_send (client->mq, env); |
664 | } | 678 | } |
@@ -669,12 +683,14 @@ send_ticket_result (const struct IdpClient *client, | |||
669 | * | 683 | * |
670 | * @param cls out ticket issue operation handle | 684 | * @param cls out ticket issue operation handle |
671 | * @param ticket the issued ticket | 685 | * @param ticket the issued ticket |
686 | * @param presentations newly created credential presentations (NULL on error) | ||
672 | * @param success issue success status (GNUNET_OK if successful) | 687 | * @param success issue success status (GNUNET_OK if successful) |
673 | * @param emsg error message (NULL of success is GNUNET_OK) | 688 | * @param emsg error message (NULL of success is GNUNET_OK) |
674 | */ | 689 | */ |
675 | static void | 690 | static void |
676 | issue_ticket_result_cb (void *cls, | 691 | issue_ticket_result_cb (void *cls, |
677 | struct GNUNET_RECLAIM_Ticket *ticket, | 692 | struct GNUNET_RECLAIM_Ticket *ticket, |
693 | struct GNUNET_RECLAIM_PresentationList *presentations, | ||
678 | int32_t success, | 694 | int32_t success, |
679 | const char *emsg) | 695 | const char *emsg) |
680 | { | 696 | { |
@@ -682,7 +698,7 @@ issue_ticket_result_cb (void *cls, | |||
682 | 698 | ||
683 | if (GNUNET_OK != success) | 699 | if (GNUNET_OK != success) |
684 | { | 700 | { |
685 | send_ticket_result (tio->client, tio->r_id, NULL, GNUNET_SYSERR); | 701 | send_ticket_result (tio->client, tio->r_id, NULL, NULL, GNUNET_SYSERR); |
686 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, | 702 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, |
687 | tio->client->issue_op_tail, | 703 | tio->client->issue_op_tail, |
688 | tio); | 704 | tio); |
@@ -690,7 +706,8 @@ issue_ticket_result_cb (void *cls, | |||
690 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg); | 706 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg); |
691 | return; | 707 | return; |
692 | } | 708 | } |
693 | send_ticket_result (tio->client, tio->r_id, ticket, GNUNET_SYSERR); | 709 | send_ticket_result (tio->client, tio->r_id, |
710 | ticket, presentations, GNUNET_SYSERR); | ||
694 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, | 711 | GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, |
695 | tio->client->issue_op_tail, | 712 | tio->client->issue_op_tail, |
696 | tio); | 713 | tio); |
@@ -871,7 +888,7 @@ consume_result_cb (void *cls, | |||
871 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); | 888 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); |
872 | crm->id = htonl (cop->r_id); | 889 | crm->id = htonl (cop->r_id); |
873 | crm->attrs_len = htons (attrs_len); | 890 | crm->attrs_len = htons (attrs_len); |
874 | crm->pres_len = htons (pres_len); | 891 | crm->presentations_len = htons (pres_len); |
875 | crm->identity = *identity; | 892 | crm->identity = *identity; |
876 | crm->result = htonl (success); | 893 | crm->result = htonl (success); |
877 | data_tmp = (char *) &crm[1]; | 894 | data_tmp = (char *) &crm[1]; |
@@ -1152,7 +1169,7 @@ cred_add_cb (void *cls, | |||
1152 | 1169 | ||
1153 | buf_size = GNUNET_RECLAIM_credential_serialize_get_size (ash->credential); | 1170 | buf_size = GNUNET_RECLAIM_credential_serialize_get_size (ash->credential); |
1154 | buf = GNUNET_malloc (buf_size); | 1171 | buf = GNUNET_malloc (buf_size); |
1155 | GNUNET_RECLAIM_presentation_serialize (ash->credential, buf); | 1172 | GNUNET_RECLAIM_credential_serialize (ash->credential, buf); |
1156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1157 | "Storing new credential under `%s'.\n", | 1174 | "Storing new credential under `%s'.\n", |
1158 | label); | 1175 | label); |
@@ -1611,8 +1628,8 @@ cred_delete_cont (void *cls, int32_t success, const char *emsg) | |||
1611 | * @dam message to check | 1628 | * @dam message to check |
1612 | */ | 1629 | */ |
1613 | static int | 1630 | static int |
1614 | check_cred_delete_message (void *cls, | 1631 | check_credential_delete_message (void *cls, |
1615 | const struct AttributeDeleteMessage *dam) | 1632 | const struct AttributeDeleteMessage *dam) |
1616 | { | 1633 | { |
1617 | uint16_t size; | 1634 | uint16_t size; |
1618 | 1635 | ||