aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-service-reclaim.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-13 09:50:04 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-14 10:01:24 +0200
commit0a6ac045814213ff33e9317a40daf7250528249a (patch)
tree3828195017701a02ec0373cec12cf3cc6fad881c /src/reclaim/gnunet-service-reclaim.c
parent7a923f1b2d38d55ca921abb57980ccfd1340f634 (diff)
downloadgnunet-0a6ac045814213ff33e9317a40daf7250528249a.tar.gz
gnunet-0a6ac045814213ff33e9317a40daf7250528249a.zip
RECLAIM: Refactoring
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c971
1 files changed, 326 insertions, 645 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index c8ae8a238..51d8554e2 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -23,17 +23,17 @@
23 * @brief reclaim Service 23 * @brief reclaim Service
24 * 24 *
25 */ 25 */
26#include "platform.h" 26#include "gnunet-service-reclaim_tickets.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_constants.h" 27#include "gnunet_constants.h"
29#include "gnunet_protocols.h"
30#include "gnunet_identity_service.h"
31#include "gnunet_gnsrecord_lib.h" 28#include "gnunet_gnsrecord_lib.h"
29#include "gnunet_identity_service.h"
32#include "gnunet_namestore_service.h" 30#include "gnunet_namestore_service.h"
33#include "gnunet_reclaim_plugin.h" 31#include "gnunet_protocols.h"
34#include "gnunet_reclaim_attribute_lib.h" 32#include "gnunet_reclaim_attribute_lib.h"
33#include "gnunet_reclaim_plugin.h"
35#include "gnunet_signatures.h" 34#include "gnunet_signatures.h"
36#include "gnunet-service-reclaim_tickets.h" 35#include "gnunet_util_lib.h"
36#include "platform.h"
37#include "reclaim.h" 37#include "reclaim.h"
38 38
39/** 39/**
@@ -91,7 +91,6 @@ static struct GNUNET_SCHEDULER_Task *timeout_task;
91 */ 91 */
92static struct GNUNET_SCHEDULER_Task *update_task; 92static struct GNUNET_SCHEDULER_Task *update_task;
93 93
94
95/** 94/**
96 * Our configuration. 95 * Our configuration.
97 */ 96 */
@@ -105,8 +104,7 @@ struct IdpClient;
105/** 104/**
106 * A ticket iteration operation. 105 * A ticket iteration operation.
107 */ 106 */
108struct TicketIteration 107struct TicketIteration {
109{
110 /** 108 /**
111 * DLL 109 * DLL
112 */ 110 */
@@ -133,12 +131,10 @@ struct TicketIteration
133 struct RECLAIM_TICKETS_Iterator *iter; 131 struct RECLAIM_TICKETS_Iterator *iter;
134}; 132};
135 133
136
137/** 134/**
138 * An attribute iteration operation. 135 * An attribute iteration operation.
139 */ 136 */
140struct AttributeIterator 137struct AttributeIterator {
141{
142 /** 138 /**
143 * Next element in the DLL 139 * Next element in the DLL
144 */ 140 */
@@ -168,16 +164,12 @@ struct AttributeIterator
168 * The operation id fot the zone iteration in the response for the client 164 * The operation id fot the zone iteration in the response for the client
169 */ 165 */
170 uint32_t request_id; 166 uint32_t request_id;
171
172}; 167};
173 168
174
175
176/** 169/**
177 * An idp client 170 * An idp client
178 */ 171 */
179struct IdpClient 172struct IdpClient {
180{
181 173
182 /** 174 /**
183 * The client 175 * The client
@@ -252,11 +244,9 @@ struct IdpClient
252 * Tail of DLL of attribute store ops 244 * Tail of DLL of attribute store ops
253 */ 245 */
254 struct AttributeStoreHandle *store_op_tail; 246 struct AttributeStoreHandle *store_op_tail;
255
256}; 247};
257 248
258struct AttributeStoreHandle 249struct AttributeStoreHandle {
259{
260 /** 250 /**
261 * DLL 251 * DLL
262 */ 252 */
@@ -303,9 +293,7 @@ struct AttributeStoreHandle
303 uint32_t r_id; 293 uint32_t r_id;
304}; 294};
305 295
306 296struct ConsumeTicketOperation {
307struct ConsumeTicketOperation
308{
309 /** 297 /**
310 * DLL 298 * DLL
311 */ 299 */
@@ -332,12 +320,10 @@ struct ConsumeTicketOperation
332 struct RECLAIM_TICKETS_ConsumeHandle *ch; 320 struct RECLAIM_TICKETS_ConsumeHandle *ch;
333}; 321};
334 322
335
336/** 323/**
337 * Updated attribute IDs 324 * Updated attribute IDs
338 */ 325 */
339struct TicketAttributeUpdateEntry 326struct TicketAttributeUpdateEntry {
340{
341 /** 327 /**
342 * DLL 328 * DLL
343 */ 329 */
@@ -362,8 +348,7 @@ struct TicketAttributeUpdateEntry
362/** 348/**
363 * Ticket revocation request handle 349 * Ticket revocation request handle
364 */ 350 */
365struct TicketRevocationHandle 351struct TicketRevocationHandle {
366{
367 /** 352 /**
368 * DLL 353 * DLL
369 */ 354 */
@@ -430,13 +415,10 @@ struct TicketRevocationHandle
430 uint32_t r_id; 415 uint32_t r_id;
431}; 416};
432 417
433
434
435/** 418/**
436 * Ticket issue operation handle 419 * Ticket issue operation handle
437 */ 420 */
438struct TicketIssueOperation 421struct TicketIssueOperation {
439{
440 /** 422 /**
441 * DLL 423 * DLL
442 */ 424 */
@@ -458,14 +440,12 @@ struct TicketIssueOperation
458 uint32_t r_id; 440 uint32_t r_id;
459}; 441};
460 442
461
462/** 443/**
463 * DLL for ego handles to egos containing the RECLAIM_ATTRS in a 444 * DLL for ego handles to egos containing the RECLAIM_ATTRS in a
464 * map in json_t format 445 * map in json_t format
465 * 446 *
466 */ 447 */
467struct EgoEntry 448struct EgoEntry {
468{
469 /** 449 /**
470 * DLL 450 * DLL
471 */ 451 */
@@ -485,21 +465,17 @@ struct EgoEntry
485 * Attribute map. Contains the attributes as json_t 465 * Attribute map. Contains the attributes as json_t
486 */ 466 */
487 struct GNUNET_CONTAINER_MultiHashMap *attr_map; 467 struct GNUNET_CONTAINER_MultiHashMap *attr_map;
488
489}; 468};
490 469
491/** 470/**
492 * Cleanup task 471 * Cleanup task
493 */ 472 */
494static void 473static void cleanup ()
495cleanup()
496{ 474{
497 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 475 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
498 "Cleaning up\n");
499 476
500 RECLAIM_TICKETS_deinit (); 477 RECLAIM_TICKETS_deinit ();
501 GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, 478 GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, TKT_database));
502 TKT_database));
503 GNUNET_free (db_lib_name); 479 GNUNET_free (db_lib_name);
504 db_lib_name = NULL; 480 db_lib_name = NULL;
505 if (NULL != timeout_task) 481 if (NULL != timeout_task)
@@ -517,117 +493,89 @@ cleanup()
517 * 493 *
518 * @param cls NULL 494 * @param cls NULL
519 */ 495 */
520static void 496static void do_shutdown (void *cls)
521do_shutdown (void *cls)
522{ 497{
523 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 498 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n");
524 "Shutting down...\n"); 499 cleanup ();
525 cleanup();
526} 500}
527 501
528 502static int create_sym_key_from_ecdh (
529static int 503 const struct GNUNET_HashCode *new_key_hash,
530create_sym_key_from_ecdh (const struct GNUNET_HashCode *new_key_hash, 504 struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
531 struct GNUNET_CRYPTO_SymmetricSessionKey *skey, 505 struct GNUNET_CRYPTO_SymmetricInitializationVector *iv)
532 struct GNUNET_CRYPTO_SymmetricInitializationVector *iv)
533{ 506{
534 struct GNUNET_CRYPTO_HashAsciiEncoded new_key_hash_str; 507 struct GNUNET_CRYPTO_HashAsciiEncoded new_key_hash_str;
535 508
536 GNUNET_CRYPTO_hash_to_enc (new_key_hash, 509 GNUNET_CRYPTO_hash_to_enc (new_key_hash, &new_key_hash_str);
537 &new_key_hash_str); 510 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating symmetric rsa key from %s\n",
538 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating symmetric rsa key from %s\n", (char*)&new_key_hash_str); 511 (char *)&new_key_hash_str);
539 static const char ctx_key[] = "gnuid-aes-ctx-key"; 512 static const char ctx_key[] = "gnuid-aes-ctx-key";
540 GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), 513 GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey),
541 new_key_hash, sizeof (struct GNUNET_HashCode), 514 new_key_hash, sizeof (struct GNUNET_HashCode), ctx_key,
542 ctx_key, strlen (ctx_key), 515 strlen (ctx_key), NULL, 0);
543 NULL, 0);
544 static const char ctx_iv[] = "gnuid-aes-ctx-iv"; 516 static const char ctx_iv[] = "gnuid-aes-ctx-iv";
545 GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector), 517 GNUNET_CRYPTO_kdf (
546 new_key_hash, sizeof (struct GNUNET_HashCode), 518 iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector),
547 ctx_iv, strlen (ctx_iv), 519 new_key_hash, sizeof (struct GNUNET_HashCode), ctx_iv, strlen (ctx_iv),
548 NULL, 0); 520 NULL, 0);
549 return GNUNET_OK; 521 return GNUNET_OK;
550} 522}
551 523
552 524static void send_ticket_result (const struct IdpClient *client, uint32_t r_id,
553static void 525 const struct GNUNET_RECLAIM_Ticket *ticket,
554send_ticket_result (const struct IdpClient *client, 526 uint32_t success)
555 uint32_t r_id,
556 const struct GNUNET_RECLAIM_Ticket *ticket,
557 uint32_t success)
558{ 527{
559 struct TicketResultMessage *irm; 528 struct TicketResultMessage *irm;
560 struct GNUNET_MQ_Envelope *env; 529 struct GNUNET_MQ_Envelope *env;
561 struct GNUNET_RECLAIM_Ticket *ticket_buf; 530 struct GNUNET_RECLAIM_Ticket *ticket_buf;
562 531
563 if (NULL != ticket) 532 if (NULL != ticket) {
564 { 533 env = GNUNET_MQ_msg_extra (irm, sizeof (struct GNUNET_RECLAIM_Ticket),
565 env = GNUNET_MQ_msg_extra (irm,
566 sizeof (struct GNUNET_RECLAIM_Ticket),
567 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); 534 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
568 ticket_buf = (struct GNUNET_RECLAIM_Ticket *)&irm[1]; 535 ticket_buf = (struct GNUNET_RECLAIM_Ticket *)&irm[1];
569 *ticket_buf = *ticket; 536 *ticket_buf = *ticket;
570 } else { 537 } else {
571 env = GNUNET_MQ_msg (irm, 538 env = GNUNET_MQ_msg (irm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
572 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
573 } 539 }
574 //TODO add success member 540 // TODO add success member
575 irm->id = htonl (r_id); 541 irm->id = htonl (r_id);
576 GNUNET_MQ_send (client->mq, 542 GNUNET_MQ_send (client->mq, env);
577 env);
578} 543}
579 544
580 545static void issue_ticket_result_cb (void *cls,
581static void 546 struct GNUNET_RECLAIM_Ticket *ticket,
582issue_ticket_result_cb (void *cls, 547 uint32_t success, const char *emsg)
583 struct GNUNET_RECLAIM_Ticket *ticket,
584 uint32_t success,
585 const char* emsg)
586{ 548{
587 struct TicketIssueOperation *tio = cls; 549 struct TicketIssueOperation *tio = cls;
588 if (GNUNET_OK != success) 550 if (GNUNET_OK != success) {
589 { 551 send_ticket_result (tio->client, tio->r_id, NULL, GNUNET_SYSERR);
590 send_ticket_result (tio->client,
591 tio->r_id,
592 NULL,
593 GNUNET_SYSERR);
594 GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, 552 GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
595 tio->client->issue_op_tail, 553 tio->client->issue_op_tail, tio);
596 tio);
597 GNUNET_free (tio); 554 GNUNET_free (tio);
598 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 555 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg);
599 "Error issuing ticket: %s\n",
600 emsg);
601 return; 556 return;
602 } 557 }
603 send_ticket_result (tio->client, 558 send_ticket_result (tio->client, tio->r_id, ticket, GNUNET_SYSERR);
604 tio->r_id,
605 ticket,
606 GNUNET_SYSERR);
607 GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head, 559 GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
608 tio->client->issue_op_tail, 560 tio->client->issue_op_tail, tio);
609 tio);
610 GNUNET_free (tio); 561 GNUNET_free (tio);
611} 562}
612 563
613static int 564static int check_issue_ticket_message (void *cls,
614check_issue_ticket_message (void *cls, 565 const struct IssueTicketMessage *im)
615 const struct IssueTicketMessage *im)
616{ 566{
617 uint16_t size; 567 uint16_t size;
618 568
619 size = ntohs (im->header.size); 569 size = ntohs (im->header.size);
620 if (size <= sizeof (struct IssueTicketMessage)) 570 if (size <= sizeof (struct IssueTicketMessage)) {
621 {
622 GNUNET_break (0); 571 GNUNET_break (0);
623 return GNUNET_SYSERR; 572 return GNUNET_SYSERR;
624 } 573 }
625 return GNUNET_OK; 574 return GNUNET_OK;
626} 575}
627 576
628static void 577static void handle_issue_ticket_message (void *cls,
629handle_issue_ticket_message (void *cls, 578 const struct IssueTicketMessage *im)
630 const struct IssueTicketMessage *im)
631{ 579{
632 struct TicketIssueOperation *tio; 580 struct TicketIssueOperation *tio;
633 struct IdpClient *idp = cls; 581 struct IdpClient *idp = cls;
@@ -636,16 +584,11 @@ handle_issue_ticket_message (void *cls,
636 584
637 tio = GNUNET_new (struct TicketIssueOperation); 585 tio = GNUNET_new (struct TicketIssueOperation);
638 attrs_len = ntohs (im->attr_len); 586 attrs_len = ntohs (im->attr_len);
639 attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char*)&im[1], attrs_len); 587 attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *)&im[1], attrs_len);
640 tio->r_id = ntohl (im->id); 588 tio->r_id = ntohl (im->id);
641 tio->client = idp; 589 tio->client = idp;
642 GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, 590 GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio);
643 idp->issue_op_tail, 591 RECLAIM_TICKETS_issue (&im->identity, attrs, &im->rp, &issue_ticket_result_cb,
644 tio);
645 RECLAIM_TICKETS_issue (&im->identity,
646 attrs,
647 &im->rp,
648 &issue_ticket_result_cb,
649 tio); 592 tio);
650 GNUNET_SERVICE_client_continue (idp->client); 593 GNUNET_SERVICE_client_continue (idp->client);
651 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs); 594 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
@@ -660,8 +603,7 @@ handle_issue_ticket_message (void *cls,
660 * 603 *
661 * @param rh the ticket revocation handle 604 * @param rh the ticket revocation handle
662 */ 605 */
663static void 606static void cleanup_revoke_ticket_handle (struct TicketRevocationHandle *rh)
664cleanup_revoke_ticket_handle (struct TicketRevocationHandle *rh)
665{ 607{
666 if (NULL != rh->attrs) 608 if (NULL != rh->attrs)
667 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->attrs); 609 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->attrs);
@@ -690,88 +632,73 @@ serialize_authz_record (const struct GNUNET_RECLAIM_Ticket *ticket,
690 char *buf; 632 char *buf;
691 char *write_ptr; 633 char *write_ptr;
692 char attrs_str_len; 634 char attrs_str_len;
693 char* label; 635 char *label;
694 636
695 GNUNET_assert (NULL != attrs->list_head); 637 GNUNET_assert (NULL != attrs->list_head);
696 attrs_str_len = 0; 638 attrs_str_len = 0;
697 for (le = attrs->list_head; NULL != le; le = le->next) { 639 for (le = attrs->list_head; NULL != le; le = le->next) {
698 attrs_str_len += 15 + 1; //TODO propery calculate 640 attrs_str_len += 15 + 1; // TODO propery calculate
699 } 641 }
700 buf = GNUNET_malloc (attrs_str_len); 642 buf = GNUNET_malloc (attrs_str_len);
701 write_ptr = buf; 643 write_ptr = buf;
702 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 644 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Writing attributes\n");
703 "Writing attributes\n");
704 for (le = attrs->list_head; NULL != le; le = le->next) { 645 for (le = attrs->list_head; NULL != le; le = le->next) {
705 label = GNUNET_STRINGS_data_to_string_alloc (&le->claim->id, 646 label =
706 sizeof (uint64_t)); 647 GNUNET_STRINGS_data_to_string_alloc (&le->claim->id, sizeof (uint64_t));
707 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 648 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Adding attribute to record: %s\n",
708 "Adding attribute to record: %s\n", label); 649 label);
709 650
710 GNUNET_memcpy (write_ptr, 651 GNUNET_memcpy (write_ptr, label, strlen (label));
711 label,
712 strlen (label));
713 write_ptr[strlen (label)] = ','; 652 write_ptr[strlen (label)] = ',';
714 write_ptr += strlen (label) + 1; 653 write_ptr += strlen (label) + 1;
715 GNUNET_free (label); 654 GNUNET_free (label);
716 } 655 }
717 write_ptr--; 656 write_ptr--;
718 write_ptr[0] = '\0'; //replace last , with a 0-terminator 657 write_ptr[0] = '\0'; // replace last , with a 0-terminator
719 // ECDH keypair E = eG 658 // ECDH keypair E = eG
720 *ecdh_privkey = GNUNET_CRYPTO_ecdhe_key_create(); 659 *ecdh_privkey = GNUNET_CRYPTO_ecdhe_key_create ();
721 GNUNET_CRYPTO_ecdhe_key_get_public (*ecdh_privkey, 660 GNUNET_CRYPTO_ecdhe_key_get_public (*ecdh_privkey, &ecdh_pubkey);
722 &ecdh_pubkey);
723 enc_keyinfo = GNUNET_malloc (attrs_str_len); 661 enc_keyinfo = GNUNET_malloc (attrs_str_len);
724 // Derived key K = H(eB) 662 // Derived key K = H(eB)
725 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdh_ecdsa (*ecdh_privkey, 663 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdh_ecdsa (*ecdh_privkey,
726 &ticket->audience, 664 &ticket->audience,
727 &new_key_hash)); 665 &new_key_hash));
728 create_sym_key_from_ecdh (&new_key_hash, &skey, &iv); 666 create_sym_key_from_ecdh (&new_key_hash, &skey, &iv);
729 enc_size = GNUNET_CRYPTO_symmetric_encrypt (buf, 667 enc_size = GNUNET_CRYPTO_symmetric_encrypt (buf, attrs_str_len, &skey, &iv,
730 attrs_str_len,
731 &skey, &iv,
732 enc_keyinfo); 668 enc_keyinfo);
733 *result = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)+ 669 *result =
734 enc_size); 670 GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) + enc_size);
735 GNUNET_memcpy (*result, 671 GNUNET_memcpy (*result, &ecdh_pubkey,
736 &ecdh_pubkey,
737 sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); 672 sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
738 GNUNET_memcpy (*result + sizeof (struct GNUNET_CRYPTO_EcdhePublicKey), 673 GNUNET_memcpy (*result + sizeof (struct GNUNET_CRYPTO_EcdhePublicKey),
739 enc_keyinfo, 674 enc_keyinfo, enc_size);
740 enc_size);
741 GNUNET_free (enc_keyinfo); 675 GNUNET_free (enc_keyinfo);
742 GNUNET_free (buf); 676 GNUNET_free (buf);
743 return sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)+enc_size; 677 return sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) + enc_size;
744} 678}
745 679
746
747/** 680/**
748 * Send revocation result 681 * Send revocation result
749 * 682 *
750 * @param rh ticket revocation handle 683 * @param rh ticket revocation handle
751 * @param success GNUNET_OK if successful result 684 * @param success GNUNET_OK if successful result
752 */ 685 */
753static void 686static void send_revocation_finished (struct TicketRevocationHandle *rh,
754send_revocation_finished (struct TicketRevocationHandle *rh, 687 uint32_t success)
755 uint32_t success)
756{ 688{
757 struct GNUNET_MQ_Envelope *env; 689 struct GNUNET_MQ_Envelope *env;
758 struct RevokeTicketResultMessage *trm; 690 struct RevokeTicketResultMessage *trm;
759 691
760 GNUNET_break(TKT_database->delete_ticket (TKT_database->cls, 692 GNUNET_break (TKT_database->delete_ticket (TKT_database->cls, &rh->ticket));
761 &rh->ticket));
762 693
763 env = GNUNET_MQ_msg (trm, 694 env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT);
764 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT);
765 trm->id = htonl (rh->r_id); 695 trm->id = htonl (rh->r_id);
766 trm->success = htonl (success); 696 trm->success = htonl (success);
767 GNUNET_MQ_send (rh->client->mq, 697 GNUNET_MQ_send (rh->client->mq, env);
768 env);
769 GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head, 698 GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
770 rh->client->revoke_op_tail, 699 rh->client->revoke_op_tail, rh);
771 rh);
772} 700}
773 701
774
775/** 702/**
776 * Process ticket from database 703 * Process ticket from database
777 * 704 *
@@ -780,13 +707,10 @@ send_revocation_finished (struct TicketRevocationHandle *rh,
780 * @param attrs the attributes 707 * @param attrs the attributes
781 */ 708 */
782static void 709static void
783ticket_reissue_proc (void *cls, 710ticket_reissue_proc (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket,
784 const struct GNUNET_RECLAIM_Ticket *ticket,
785 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); 711 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
786 712
787static void 713static void revocation_reissue_tickets (struct TicketRevocationHandle *rh);
788revocation_reissue_tickets (struct TicketRevocationHandle *rh);
789
790 714
791static void reissue_next (void *cls) 715static void reissue_next (void *cls)
792{ 716{
@@ -794,19 +718,13 @@ static void reissue_next (void *cls)
794 revocation_reissue_tickets (rh); 718 revocation_reissue_tickets (rh);
795} 719}
796 720
797 721static void reissue_ticket_cont (void *cls, int32_t success, const char *emsg)
798static void
799reissue_ticket_cont (void *cls,
800 int32_t success,
801 const char *emsg)
802{ 722{
803 struct TicketRevocationHandle *rh = cls; 723 struct TicketRevocationHandle *rh = cls;
804 724
805 rh->ns_qe = NULL; 725 rh->ns_qe = NULL;
806 if (GNUNET_SYSERR == success) 726 if (GNUNET_SYSERR == success) {
807 { 727 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", "Unknown Error\n");
808 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n",
809 "Unknown Error\n");
810 send_revocation_finished (rh, GNUNET_SYSERR); 728 send_revocation_finished (rh, GNUNET_SYSERR);
811 cleanup_revoke_ticket_handle (rh); 729 cleanup_revoke_ticket_handle (rh);
812 return; 730 return;
@@ -815,7 +733,6 @@ reissue_ticket_cont (void *cls,
815 GNUNET_SCHEDULER_add_now (&reissue_next, rh); 733 GNUNET_SCHEDULER_add_now (&reissue_next, rh);
816} 734}
817 735
818
819/** 736/**
820 * Process ticket from database 737 * Process ticket from database
821 * 738 *
@@ -824,8 +741,7 @@ reissue_ticket_cont (void *cls,
824 * @param attrs the attributes 741 * @param attrs the attributes
825 */ 742 */
826static void 743static void
827ticket_reissue_proc (void *cls, 744ticket_reissue_proc (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket,
828 const struct GNUNET_RECLAIM_Ticket *ticket,
829 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs) 745 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
830{ 746{
831 struct TicketRevocationHandle *rh = cls; 747 struct TicketRevocationHandle *rh = cls;
@@ -838,30 +754,20 @@ ticket_reissue_proc (void *cls,
838 char *authz_record_data; 754 char *authz_record_data;
839 char *label; 755 char *label;
840 756
841 757 if (NULL == ticket) {
842 if (NULL == ticket) 758 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Iteration done\n");
843 {
844 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
845 "Iteration done\n");
846 return; 759 return;
847 } 760 }
848 761
849 if (0 == memcmp (&ticket->audience, 762 if (0 == memcmp (&ticket->audience, &rh->ticket.audience,
850 &rh->ticket.audience, 763 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) {
851 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
852 {
853 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 764 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
854 "Do not reissue for this identity.!\n"); 765 "Do not reissue for this identity.!\n");
855 label = GNUNET_STRINGS_data_to_string_alloc (&rh->ticket.rnd, 766 label = GNUNET_STRINGS_data_to_string_alloc (&rh->ticket.rnd,
856 sizeof (uint64_t)); 767 sizeof (uint64_t));
857 //Delete record 768 // Delete record
858 rh->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 769 rh->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &rh->identity, label, 0,
859 &rh->identity, 770 NULL, &reissue_ticket_cont, rh);
860 label,
861 0,
862 NULL,
863 &reissue_ticket_cont,
864 rh);
865 771
866 GNUNET_free (label); 772 GNUNET_free (label);
867 return; 773 return;
@@ -871,38 +777,29 @@ ticket_reissue_proc (void *cls,
871 * Check if any attribute of this ticket intersects with a rollover attribute 777 * Check if any attribute of this ticket intersects with a rollover attribute
872 */ 778 */
873 reissue_ticket = GNUNET_NO; 779 reissue_ticket = GNUNET_NO;
874 for (le = attrs->list_head; NULL != le; le = le->next) 780 for (le = attrs->list_head; NULL != le; le = le->next) {
875 { 781 for (tue = rh->attr_updates_head; NULL != tue; tue = tue->next) {
876 for (tue = rh->attr_updates_head; 782 if (tue->old_id == le->claim->id) {
877 NULL != tue;
878 tue = tue->next)
879 {
880 if (tue->old_id == le->claim->id)
881 {
882 reissue_ticket = GNUNET_YES; 783 reissue_ticket = GNUNET_YES;
883 le->claim->id = tue->new_id; 784 le->claim->id = tue->new_id;
884 } 785 }
885 } 786 }
886 } 787 }
887 788
888 if (GNUNET_NO == reissue_ticket) 789 if (GNUNET_NO == reissue_ticket) {
889 { 790 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Skipping ticket.\n");
890 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
891 "Skipping ticket.\n");
892 791
893 rh->offset++; 792 rh->offset++;
894 GNUNET_SCHEDULER_add_now (&reissue_next, rh); 793 GNUNET_SCHEDULER_add_now (&reissue_next, rh);
895 return; 794 return;
896 } 795 }
897 796
898 //Create new ABE key for RP 797 // Create new ABE key for RP
899 798
900 /* If this is the RP we want to revoke attributes of, the do so */ 799 /* If this is the RP we want to revoke attributes of, the do so */
901 800
902 //TODO rename function 801 // TODO rename function
903 authz_record_len = serialize_authz_record (ticket, 802 authz_record_len = serialize_authz_record (ticket, attrs, &ecdhe_privkey,
904 attrs,
905 &ecdhe_privkey,
906 &authz_record_data); 803 &authz_record_data);
907 code_record[0].data = authz_record_data; 804 code_record[0].data = authz_record_data;
908 code_record[0].data_size = authz_record_len; 805 code_record[0].data_size = authz_record_len;
@@ -910,46 +807,30 @@ ticket_reissue_proc (void *cls,
910 code_record[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ; 807 code_record[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ;
911 code_record[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 808 code_record[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
912 809
913 label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, 810 label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof (uint64_t));
914 sizeof (uint64_t)); 811 // Publish record
915 //Publish record 812 rh->ns_qe = GNUNET_NAMESTORE_records_store (
916 rh->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 813 nsh, &rh->identity, label, 1, code_record, &reissue_ticket_cont, rh);
917 &rh->identity,
918 label,
919 1,
920 code_record,
921 &reissue_ticket_cont,
922 rh);
923 GNUNET_free (ecdhe_privkey); 814 GNUNET_free (ecdhe_privkey);
924 GNUNET_free (label); 815 GNUNET_free (label);
925 GNUNET_free (authz_record_data); 816 GNUNET_free (authz_record_data);
926} 817}
927 818
928
929/* Prototype for below function */ 819/* Prototype for below function */
930static void 820static void attr_reenc_cont (void *cls, int32_t success, const char *emsg);
931attr_reenc_cont (void *cls,
932 int32_t success,
933 const char *emsg);
934 821
935static void 822static void revocation_reissue_tickets (struct TicketRevocationHandle *rh)
936revocation_reissue_tickets (struct TicketRevocationHandle *rh)
937{ 823{
938 int ret; 824 int ret;
939 /* Done, issue new keys */ 825 /* Done, issue new keys */
940 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 826 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
941 "Revocation Phase III: Reissuing Tickets\n"); 827 "Revocation Phase III: Reissuing Tickets\n");
942 if (GNUNET_SYSERR == (ret = TKT_database->iterate_tickets (TKT_database->cls, 828 if (GNUNET_SYSERR == (ret = TKT_database->iterate_tickets (
943 &rh->ticket.identity, 829 TKT_database->cls, &rh->ticket.identity, GNUNET_NO,
944 GNUNET_NO, 830 rh->offset, &ticket_reissue_proc, rh))) {
945 rh->offset,
946 &ticket_reissue_proc,
947 rh)))
948 {
949 GNUNET_break (0); 831 GNUNET_break (0);
950 } 832 }
951 if (GNUNET_NO == ret) 833 if (GNUNET_NO == ret) {
952 {
953 send_revocation_finished (rh, GNUNET_OK); 834 send_revocation_finished (rh, GNUNET_OK);
954 cleanup_revoke_ticket_handle (rh); 835 cleanup_revoke_ticket_handle (rh);
955 return; 836 return;
@@ -959,8 +840,7 @@ revocation_reissue_tickets (struct TicketRevocationHandle *rh)
959/** 840/**
960 * Failed to check for attribute 841 * Failed to check for attribute
961 */ 842 */
962static void 843static void check_attr_error (void *cls)
963check_attr_error (void *cls)
964{ 844{
965 struct TicketRevocationHandle *rh = cls; 845 struct TicketRevocationHandle *rh = cls;
966 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 846 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -970,156 +850,121 @@ check_attr_error (void *cls)
970 cleanup_revoke_ticket_handle (rh); 850 cleanup_revoke_ticket_handle (rh);
971} 851}
972 852
973
974/** 853/**
975 * Revoke next attribte by reencryption with 854 * Revoke next attribte by reencryption with
976 * new ABE master 855 * new ABE master
977 */ 856 */
978static void 857static void reenc_next_attribute (void *cls);
979reenc_next_attribute (void *cls);
980 858
981/** 859/**
982 * Check for existing attribute and overwrite 860 * Check for existing attribute and overwrite
983 */ 861 */
984static void 862static void check_attr_cb (void *cls,
985check_attr_cb (void *cls, 863 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
986 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 864 const char *label, unsigned int rd_count,
987 const char *label, 865 const struct GNUNET_GNSRECORD_Data *rd_old)
988 unsigned int rd_count,
989 const struct GNUNET_GNSRECORD_Data *rd_old)
990{ 866{
991 struct TicketRevocationHandle *rh = cls; 867 struct TicketRevocationHandle *rh = cls;
992 struct TicketAttributeUpdateEntry *tue; 868 struct TicketAttributeUpdateEntry *tue;
993 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 869 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
994 struct GNUNET_GNSRECORD_Data rd[1]; 870 struct GNUNET_GNSRECORD_Data rd[1];
995 char* buf; 871 char *buf;
996 size_t buf_size; 872 size_t buf_size;
997 char* new_label; 873 char *new_label;
998 874
999 rh->ns_qe = NULL; 875 rh->ns_qe = NULL;
1000 if (1 != rd_count) { 876 if (1 != rd_count) {
1001 le = rh->attrs->list_head; 877 le = rh->attrs->list_head;
1002 GNUNET_CONTAINER_DLL_remove (rh->attrs->list_head, 878 GNUNET_CONTAINER_DLL_remove (rh->attrs->list_head, rh->attrs->list_tail,
1003 rh->attrs->list_tail,
1004 le); 879 le);
1005 GNUNET_assert (NULL != rh->rvk_attrs); 880 GNUNET_assert (NULL != rh->rvk_attrs);
1006 GNUNET_CONTAINER_DLL_insert (rh->rvk_attrs->list_head, 881 GNUNET_CONTAINER_DLL_insert (rh->rvk_attrs->list_head,
1007 rh->rvk_attrs->list_tail, 882 rh->rvk_attrs->list_tail, le);
1008 le); 883 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Re-encrypting next attribute\n");
1009 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 884 GNUNET_SCHEDULER_add_now (&reenc_next_attribute, rh);
1010 "Re-encrypting next attribute\n");
1011 GNUNET_SCHEDULER_add_now (&reenc_next_attribute,
1012 rh);
1013 return; 885 return;
1014 } 886 }
1015 887
1016 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (rh->attrs->list_head->claim); 888 buf_size =
889 GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (rh->attrs->list_head->claim);
1017 buf = GNUNET_malloc (buf_size); 890 buf = GNUNET_malloc (buf_size);
1018 rh->attrs->list_head->claim->version++; 891 rh->attrs->list_head->claim->version++;
1019 GNUNET_RECLAIM_ATTRIBUTE_serialize (rh->attrs->list_head->claim, 892 GNUNET_RECLAIM_ATTRIBUTE_serialize (rh->attrs->list_head->claim, buf);
1020 buf);
1021 tue = GNUNET_new (struct TicketAttributeUpdateEntry); 893 tue = GNUNET_new (struct TicketAttributeUpdateEntry);
1022 tue->old_id = rh->attrs->list_head->claim->id; 894 tue->old_id = rh->attrs->list_head->claim->id;
1023 tue->new_id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, 895 tue->new_id =
1024 UINT64_MAX); 896 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
1025 GNUNET_CONTAINER_DLL_insert (rh->attr_updates_head, 897 GNUNET_CONTAINER_DLL_insert (rh->attr_updates_head, rh->attr_updates_tail,
1026 rh->attr_updates_tail,
1027 tue); 898 tue);
1028 rh->attrs->list_head->claim->id = tue->new_id; 899 rh->attrs->list_head->claim->id = tue->new_id;
1029 new_label = GNUNET_STRINGS_data_to_string_alloc (&tue->new_id, 900 new_label =
1030 sizeof (uint64_t)); 901 GNUNET_STRINGS_data_to_string_alloc (&tue->new_id, sizeof (uint64_t));
1031 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 902 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "New attr id %s\n", new_label);
1032 "New attr id %s\n", new_label);
1033 rd[0].data_size = buf_size; 903 rd[0].data_size = buf_size;
1034 rd[0].data = buf; 904 rd[0].data = buf;
1035 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR; 905 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR;
1036 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 906 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1037 rd[0].expiration_time = rd_old[0].expiration_time; 907 rd[0].expiration_time = rd_old[0].expiration_time;
1038 rh->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 908 rh->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &rh->identity, new_label, 1,
1039 &rh->identity, 909 rd, &attr_reenc_cont, rh);
1040 new_label,
1041 1,
1042 rd,
1043 &attr_reenc_cont,
1044 rh);
1045} 910}
1046 911
1047
1048/** 912/**
1049 * Revoke next attribte by reencryption with 913 * Revoke next attribte by reencryption with
1050 * new ABE master 914 * new ABE master
1051 */ 915 */
1052static void 916static void reenc_next_attribute (void *cls)
1053reenc_next_attribute (void *cls)
1054{ 917{
1055 struct TicketRevocationHandle *rh = cls; 918 struct TicketRevocationHandle *rh = cls;
1056 char *label; 919 char *label;
1057 if (NULL == rh->attrs->list_head) 920 if (NULL == rh->attrs->list_head) {
1058 {
1059 revocation_reissue_tickets (rh); 921 revocation_reissue_tickets (rh);
1060 return; 922 return;
1061 } 923 }
1062 /* First check if attribute still exists */ 924 /* First check if attribute still exists */
1063 label = GNUNET_STRINGS_data_to_string_alloc (&rh->attrs->list_head->claim->id, 925 label = GNUNET_STRINGS_data_to_string_alloc (&rh->attrs->list_head->claim->id,
1064 sizeof (uint64_t)); 926 sizeof (uint64_t));
1065 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ID: %lu\n", rh->attrs->list_head->claim->id); 927 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ID: %lu\n",
1066 rh->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, 928 rh->attrs->list_head->claim->id);
1067 &rh->identity, 929 rh->ns_qe = GNUNET_NAMESTORE_records_lookup (
1068 label, 930 nsh, &rh->identity, label, &check_attr_error, rh, &check_attr_cb, rh);
1069 &check_attr_error,
1070 rh,
1071 &check_attr_cb,
1072 rh);
1073 GNUNET_free (label); 931 GNUNET_free (label);
1074} 932}
1075 933
1076
1077/** 934/**
1078 * Namestore callback after revoked attribute 935 * Namestore callback after revoked attribute
1079 * is stored 936 * is stored
1080 */ 937 */
1081static void 938static void attr_reenc_cont (void *cls, int32_t success, const char *emsg)
1082attr_reenc_cont (void *cls,
1083 int32_t success,
1084 const char *emsg)
1085{ 939{
1086 struct TicketRevocationHandle *rh = cls; 940 struct TicketRevocationHandle *rh = cls;
1087 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 941 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
1088 942
1089 rh->ns_qe = NULL; 943 rh->ns_qe = NULL;
1090 if (GNUNET_SYSERR == success) 944 if (GNUNET_SYSERR == success) {
1091 { 945 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to reencrypt attribute %s\n",
1092 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1093 "Failed to reencrypt attribute %s\n",
1094 emsg); 946 emsg);
1095 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 947 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1096 return; 948 return;
1097 } 949 }
1098 if (NULL == rh->attrs->list_head) 950 if (NULL == rh->attrs->list_head) {
1099 {
1100 revocation_reissue_tickets (rh); 951 revocation_reissue_tickets (rh);
1101 return; 952 return;
1102 } 953 }
1103 le = rh->attrs->list_head; 954 le = rh->attrs->list_head;
1104 GNUNET_CONTAINER_DLL_remove (rh->attrs->list_head, 955 GNUNET_CONTAINER_DLL_remove (rh->attrs->list_head, rh->attrs->list_tail, le);
1105 rh->attrs->list_tail,
1106 le);
1107 GNUNET_assert (NULL != rh->rvk_attrs); 956 GNUNET_assert (NULL != rh->rvk_attrs);
1108 GNUNET_CONTAINER_DLL_insert (rh->rvk_attrs->list_head, 957 GNUNET_CONTAINER_DLL_insert (rh->rvk_attrs->list_head,
1109 rh->rvk_attrs->list_tail, 958 rh->rvk_attrs->list_tail, le);
1110 le);
1111
1112 959
1113 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 960 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Re-encrypting next attribute\n");
1114 "Re-encrypting next attribute\n");
1115 reenc_next_attribute (rh); 961 reenc_next_attribute (rh);
1116} 962}
1117 963
1118 964
1119static void 965static void process_attributes_to_update (
1120process_attributes_to_update (void *cls, 966 void *cls, const struct GNUNET_RECLAIM_Ticket *ticket,
1121 const struct GNUNET_RECLAIM_Ticket *ticket, 967 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
1122 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
1123{ 968{
1124 struct TicketRevocationHandle *rh = cls; 969 struct TicketRevocationHandle *rh = cls;
1125 970
@@ -1127,8 +972,7 @@ process_attributes_to_update (void *cls,
1127 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 972 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1128 "Revocation Phase I: Collecting attributes\n"); 973 "Revocation Phase I: Collecting attributes\n");
1129 /* Reencrypt all attributes with new key */ 974 /* Reencrypt all attributes with new key */
1130 if (NULL == rh->attrs->list_head) 975 if (NULL == rh->attrs->list_head) {
1131 {
1132 /* No attributes to reencrypt */ 976 /* No attributes to reencrypt */
1133 send_revocation_finished (rh, GNUNET_OK); 977 send_revocation_finished (rh, GNUNET_OK);
1134 cleanup_revoke_ticket_handle (rh); 978 cleanup_revoke_ticket_handle (rh);
@@ -1138,65 +982,52 @@ process_attributes_to_update (void *cls,
1138 "Revocation Phase II: Re-encrypting attributes\n"); 982 "Revocation Phase II: Re-encrypting attributes\n");
1139 reenc_next_attribute (rh); 983 reenc_next_attribute (rh);
1140 } 984 }
1141
1142} 985}
1143 986
1144 987static int check_revoke_ticket_message (void *cls,
1145static int 988 const struct RevokeTicketMessage *im)
1146check_revoke_ticket_message(void *cls,
1147 const struct RevokeTicketMessage *im)
1148{ 989{
1149 uint16_t size; 990 uint16_t size;
1150 991
1151 size = ntohs (im->header.size); 992 size = ntohs (im->header.size);
1152 if (size <= sizeof (struct RevokeTicketMessage)) 993 if (size <= sizeof (struct RevokeTicketMessage)) {
1153 {
1154 GNUNET_break (0); 994 GNUNET_break (0);
1155 return GNUNET_SYSERR; 995 return GNUNET_SYSERR;
1156 } 996 }
1157 return GNUNET_OK; 997 return GNUNET_OK;
1158} 998}
1159 999
1160static void 1000static void handle_revoke_ticket_message (void *cls,
1161handle_revoke_ticket_message (void *cls, 1001 const struct RevokeTicketMessage *rm)
1162 const struct RevokeTicketMessage *rm)
1163{ 1002{
1164 struct TicketRevocationHandle *rh; 1003 struct TicketRevocationHandle *rh;
1165 struct IdpClient *idp = cls; 1004 struct IdpClient *idp = cls;
1166 struct GNUNET_RECLAIM_Ticket *ticket; 1005 struct GNUNET_RECLAIM_Ticket *ticket;
1167 1006
1168 rh = GNUNET_new (struct TicketRevocationHandle); 1007 rh = GNUNET_new (struct TicketRevocationHandle);
1169 ticket = (struct GNUNET_RECLAIM_Ticket*)&rm[1]; 1008 ticket = (struct GNUNET_RECLAIM_Ticket *)&rm[1];
1170 rh->rvk_attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList); 1009 rh->rvk_attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
1171 rh->ticket = *ticket; 1010 rh->ticket = *ticket;
1172 rh->r_id = ntohl (rm->id); 1011 rh->r_id = ntohl (rm->id);
1173 rh->client = idp; 1012 rh->client = idp;
1174 rh->identity = rm->identity; 1013 rh->identity = rm->identity;
1175 GNUNET_CRYPTO_ecdsa_key_get_public (&rh->identity, 1014 GNUNET_CRYPTO_ecdsa_key_get_public (&rh->identity, &rh->ticket.identity);
1176 &rh->ticket.identity); 1015 GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rh);
1177 GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head,
1178 idp->revoke_op_tail,
1179 rh);
1180 /** 1016 /**
1181 * TODO replace with GNS storage 1017 * TODO replace with GNS storage
1182 */ 1018 */
1183 TKT_database->get_ticket_attributes (TKT_database->cls, 1019 TKT_database->get_ticket_attributes (TKT_database->cls, &rh->ticket,
1184 &rh->ticket, 1020 &process_attributes_to_update, rh);
1185 &process_attributes_to_update,
1186 rh);
1187 GNUNET_SERVICE_client_continue (idp->client); 1021 GNUNET_SERVICE_client_continue (idp->client);
1188
1189} 1022}
1190 1023
1191static int 1024static int check_consume_ticket_message (void *cls,
1192check_consume_ticket_message (void *cls, 1025 const struct ConsumeTicketMessage *cm)
1193 const struct ConsumeTicketMessage *cm)
1194{ 1026{
1195 uint16_t size; 1027 uint16_t size;
1196 1028
1197 size = ntohs (cm->header.size); 1029 size = ntohs (cm->header.size);
1198 if (size <= sizeof (struct ConsumeTicketMessage)) 1030 if (size <= sizeof (struct ConsumeTicketMessage)) {
1199 {
1200 GNUNET_break (0); 1031 GNUNET_break (0);
1201 return GNUNET_SYSERR; 1032 return GNUNET_SYSERR;
1202 } 1033 }
@@ -1207,42 +1038,33 @@ static void
1207consume_result_cb (void *cls, 1038consume_result_cb (void *cls,
1208 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1039 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
1209 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 1040 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
1210 uint32_t success, 1041 uint32_t success, const char *emsg)
1211 const char *emsg)
1212{ 1042{
1213 struct ConsumeTicketOperation *cop = cls; 1043 struct ConsumeTicketOperation *cop = cls;
1214 struct ConsumeTicketResultMessage *crm; 1044 struct ConsumeTicketResultMessage *crm;
1215 struct GNUNET_MQ_Envelope *env; 1045 struct GNUNET_MQ_Envelope *env;
1216 char *data_tmp; 1046 char *data_tmp;
1217 size_t attrs_len; 1047 size_t attrs_len;
1218 if (GNUNET_OK != success) 1048 if (GNUNET_OK != success) {
1219 { 1049 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
1220 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1221 "Error consuming ticket: %s\n",
1222 emsg);
1223 } 1050 }
1224 attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); 1051 attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
1225 env = GNUNET_MQ_msg_extra (crm, 1052 env = GNUNET_MQ_msg_extra (crm, attrs_len,
1226 attrs_len,
1227 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); 1053 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT);
1228 crm->id = htonl (cop->r_id); 1054 crm->id = htonl (cop->r_id);
1229 crm->attrs_len = htons (attrs_len); 1055 crm->attrs_len = htons (attrs_len);
1230 crm->identity = *identity; 1056 crm->identity = *identity;
1231 crm->result = htonl (success); 1057 crm->result = htonl (success);
1232 data_tmp = (char *) &crm[1]; 1058 data_tmp = (char *)&crm[1];
1233 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, 1059 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, data_tmp);
1234 data_tmp);
1235 GNUNET_MQ_send (cop->client->mq, env); 1060 GNUNET_MQ_send (cop->client->mq, env);
1236 GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head, 1061 GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head,
1237 cop->client->consume_op_tail, 1062 cop->client->consume_op_tail, cop);
1238 cop);
1239 GNUNET_free (cop); 1063 GNUNET_free (cop);
1240
1241} 1064}
1242 1065
1243static void 1066static void
1244handle_consume_ticket_message (void *cls, 1067handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
1245 const struct ConsumeTicketMessage *cm)
1246{ 1068{
1247 struct ConsumeTicketOperation *cop; 1069 struct ConsumeTicketOperation *cop;
1248 struct GNUNET_RECLAIM_Ticket *ticket; 1070 struct GNUNET_RECLAIM_Ticket *ticket;
@@ -1251,14 +1073,10 @@ handle_consume_ticket_message (void *cls,
1251 cop = GNUNET_new (struct ConsumeTicketOperation); 1073 cop = GNUNET_new (struct ConsumeTicketOperation);
1252 cop->r_id = ntohl (cm->id); 1074 cop->r_id = ntohl (cm->id);
1253 cop->client = idp; 1075 cop->client = idp;
1254 ticket = (struct GNUNET_RECLAIM_Ticket*)&cm[1]; 1076 ticket = (struct GNUNET_RECLAIM_Ticket *)&cm[1];
1255 cop->ch = RECLAIM_TICKETS_consume (&cm->identity, 1077 cop->ch =
1256 ticket, 1078 RECLAIM_TICKETS_consume (&cm->identity, ticket, &consume_result_cb, cop);
1257 &consume_result_cb, 1079 GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop);
1258 cop);
1259 GNUNET_CONTAINER_DLL_insert (idp->consume_op_head,
1260 idp->consume_op_tail,
1261 cop);
1262 GNUNET_SERVICE_client_continue (idp->client); 1080 GNUNET_SERVICE_client_continue (idp->client);
1263} 1081}
1264 1082
@@ -1271,8 +1089,7 @@ handle_consume_ticket_message (void *cls,
1271 * 1089 *
1272 * @param handle handle to clean up 1090 * @param handle handle to clean up
1273 */ 1091 */
1274static void 1092static void cleanup_as_handle (struct AttributeStoreHandle *ash)
1275cleanup_as_handle (struct AttributeStoreHandle *ash)
1276{ 1093{
1277 if (NULL != ash->ns_qe) 1094 if (NULL != ash->ns_qe)
1278 GNUNET_NAMESTORE_cancel (ash->ns_qe); 1095 GNUNET_NAMESTORE_cancel (ash->ns_qe);
@@ -1281,10 +1098,7 @@ cleanup_as_handle (struct AttributeStoreHandle *ash)
1281 GNUNET_free (ash); 1098 GNUNET_free (ash);
1282} 1099}
1283 1100
1284static void 1101static void attr_store_cont (void *cls, int32_t success, const char *emsg)
1285attr_store_cont (void *cls,
1286 int32_t success,
1287 const char *emsg)
1288{ 1102{
1289 struct AttributeStoreHandle *ash = cls; 1103 struct AttributeStoreHandle *ash = cls;
1290 struct GNUNET_MQ_Envelope *env; 1104 struct GNUNET_MQ_Envelope *env;
@@ -1292,13 +1106,10 @@ attr_store_cont (void *cls,
1292 1106
1293 ash->ns_qe = NULL; 1107 ash->ns_qe = NULL;
1294 GNUNET_CONTAINER_DLL_remove (ash->client->store_op_head, 1108 GNUNET_CONTAINER_DLL_remove (ash->client->store_op_head,
1295 ash->client->store_op_tail, 1109 ash->client->store_op_tail, ash);
1296 ash);
1297 1110
1298 if (GNUNET_SYSERR == success) 1111 if (GNUNET_SYSERR == success) {
1299 { 1112 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to store attribute %s\n",
1300 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1301 "Failed to store attribute %s\n",
1302 emsg); 1113 emsg);
1303 cleanup_as_handle (ash); 1114 cleanup_as_handle (ash);
1304 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 1115 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
@@ -1311,8 +1122,7 @@ attr_store_cont (void *cls,
1311 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE); 1122 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE);
1312 acr_msg->id = htonl (ash->r_id); 1123 acr_msg->id = htonl (ash->r_id);
1313 acr_msg->op_result = htonl (GNUNET_OK); 1124 acr_msg->op_result = htonl (GNUNET_OK);
1314 GNUNET_MQ_send (ash->client->mq, 1125 GNUNET_MQ_send (ash->client->mq, env);
1315 env);
1316 cleanup_as_handle (ash); 1126 cleanup_as_handle (ash);
1317} 1127}
1318 1128
@@ -1321,61 +1131,49 @@ attr_store_cont (void *cls,
1321 * 1131 *
1322 * @param cls the AttributeStoreHandle 1132 * @param cls the AttributeStoreHandle
1323 */ 1133 */
1324static void 1134static void attr_store_task (void *cls)
1325attr_store_task (void *cls)
1326{ 1135{
1327 struct AttributeStoreHandle *ash = cls; 1136 struct AttributeStoreHandle *ash = cls;
1328 struct GNUNET_GNSRECORD_Data rd[1]; 1137 struct GNUNET_GNSRECORD_Data rd[1];
1329 char* buf; 1138 char *buf;
1330 char* label; 1139 char *label;
1331 size_t buf_size; 1140 size_t buf_size;
1332 1141
1333 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1142 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
1334 "Storing attribute\n");
1335 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (ash->claim); 1143 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (ash->claim);
1336 buf = GNUNET_malloc (buf_size); 1144 buf = GNUNET_malloc (buf_size);
1337 //Give the ash a new id 1145 // Give the ash a new id
1338 ash->claim->id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, 1146 ash->claim->id =
1339 UINT64_MAX); 1147 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
1340 GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, 1148 GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, buf);
1341 buf); 1149 label =
1342 label = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, 1150 GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, sizeof (uint64_t));
1343 sizeof (uint64_t)); 1151 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1344 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1345 "Encrypting with label %s\n", label);
1346 1152
1347 rd[0].data_size = buf_size; 1153 rd[0].data_size = buf_size;
1348 rd[0].data = buf; 1154 rd[0].data = buf;
1349 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR; 1155 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR;
1350 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 1156 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1351 rd[0].expiration_time = ash->exp.rel_value_us; 1157 rd[0].expiration_time = ash->exp.rel_value_us;
1352 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, 1158 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &ash->identity, label, 1,
1353 &ash->identity, 1159 rd, &attr_store_cont, ash);
1354 label,
1355 1,
1356 rd,
1357 &attr_store_cont,
1358 ash);
1359 GNUNET_free (buf); 1160 GNUNET_free (buf);
1360} 1161}
1361 1162
1362
1363static int 1163static int
1364check_attribute_store_message(void *cls, 1164check_attribute_store_message (void *cls,
1365 const struct AttributeStoreMessage *sam) 1165 const struct AttributeStoreMessage *sam)
1366{ 1166{
1367 uint16_t size; 1167 uint16_t size;
1368 1168
1369 size = ntohs (sam->header.size); 1169 size = ntohs (sam->header.size);
1370 if (size <= sizeof (struct AttributeStoreMessage)) 1170 if (size <= sizeof (struct AttributeStoreMessage)) {
1371 {
1372 GNUNET_break (0); 1171 GNUNET_break (0);
1373 return GNUNET_SYSERR; 1172 return GNUNET_SYSERR;
1374 } 1173 }
1375 return GNUNET_OK; 1174 return GNUNET_OK;
1376} 1175}
1377 1176
1378
1379static void 1177static void
1380handle_attribute_store_message (void *cls, 1178handle_attribute_store_message (void *cls,
1381 const struct AttributeStoreMessage *sam) 1179 const struct AttributeStoreMessage *sam)
@@ -1383,26 +1181,21 @@ handle_attribute_store_message (void *cls,
1383 struct AttributeStoreHandle *ash; 1181 struct AttributeStoreHandle *ash;
1384 struct IdpClient *idp = cls; 1182 struct IdpClient *idp = cls;
1385 size_t data_len; 1183 size_t data_len;
1386 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1184 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
1387 "Received ATTRIBUTE_STORE message\n");
1388 1185
1389 data_len = ntohs (sam->attr_len); 1186 data_len = ntohs (sam->attr_len);
1390 1187
1391 ash = GNUNET_new (struct AttributeStoreHandle); 1188 ash = GNUNET_new (struct AttributeStoreHandle);
1392 ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char*)&sam[1], 1189 ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *)&sam[1], data_len);
1393 data_len);
1394 1190
1395 ash->r_id = ntohl (sam->id); 1191 ash->r_id = ntohl (sam->id);
1396 ash->identity = sam->identity; 1192 ash->identity = sam->identity;
1397 ash->exp.rel_value_us = GNUNET_ntohll (sam->exp); 1193 ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1398 GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, 1194 GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, &ash->identity_pkey);
1399 &ash->identity_pkey);
1400 1195
1401 GNUNET_SERVICE_client_continue (idp->client); 1196 GNUNET_SERVICE_client_continue (idp->client);
1402 ash->client = idp; 1197 ash->client = idp;
1403 GNUNET_CONTAINER_DLL_insert (idp->store_op_head, 1198 GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash);
1404 idp->store_op_tail,
1405 ash);
1406 GNUNET_SCHEDULER_add_now (&attr_store_task, ash); 1199 GNUNET_SCHEDULER_add_now (&attr_store_task, ash);
1407} 1200}
1408 1201
@@ -1410,85 +1203,66 @@ handle_attribute_store_message (void *cls,
1410 * Attrubute iteration 1203 * Attrubute iteration
1411 *************************************************/ 1204 *************************************************/
1412 1205
1413static void 1206static void cleanup_attribute_iter_handle (struct AttributeIterator *ai)
1414cleanup_attribute_iter_handle (struct AttributeIterator *ai)
1415{ 1207{
1416 GNUNET_free (ai); 1208 GNUNET_free (ai);
1417} 1209}
1418 1210
1419static void 1211static void attr_iter_error (void *cls)
1420attr_iter_error (void *cls)
1421{ 1212{
1422 struct AttributeIterator *ai = cls; 1213 struct AttributeIterator *ai = cls;
1423 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1214 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1424 "Failed to iterate over attributes\n");
1425 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, 1215 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
1426 ai->client->attr_iter_tail, 1216 ai->client->attr_iter_tail, ai);
1427 ai);
1428 cleanup_attribute_iter_handle (ai); 1217 cleanup_attribute_iter_handle (ai);
1429 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 1218 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
1430} 1219}
1431 1220
1432static void 1221static void attr_iter_finished (void *cls)
1433attr_iter_finished (void *cls)
1434{ 1222{
1435 struct AttributeIterator *ai = cls; 1223 struct AttributeIterator *ai = cls;
1436 struct GNUNET_MQ_Envelope *env; 1224 struct GNUNET_MQ_Envelope *env;
1437 struct AttributeResultMessage *arm; 1225 struct AttributeResultMessage *arm;
1438 1226
1439 env = GNUNET_MQ_msg (arm, 1227 env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
1440 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
1441 arm->id = htonl (ai->request_id); 1228 arm->id = htonl (ai->request_id);
1442 arm->attr_len = htons (0); 1229 arm->attr_len = htons (0);
1443 GNUNET_MQ_send (ai->client->mq, env); 1230 GNUNET_MQ_send (ai->client->mq, env);
1444 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, 1231 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
1445 ai->client->attr_iter_tail, 1232 ai->client->attr_iter_tail, ai);
1446 ai);
1447 cleanup_attribute_iter_handle (ai); 1233 cleanup_attribute_iter_handle (ai);
1448} 1234}
1449 1235
1450static void 1236static void attr_iter_cb (void *cls,
1451attr_iter_cb (void *cls, 1237 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1452 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1238 const char *label, unsigned int rd_count,
1453 const char *label, 1239 const struct GNUNET_GNSRECORD_Data *rd)
1454 unsigned int rd_count,
1455 const struct GNUNET_GNSRECORD_Data *rd)
1456{ 1240{
1457 struct AttributeIterator *ai = cls; 1241 struct AttributeIterator *ai = cls;
1458 struct AttributeResultMessage *arm; 1242 struct AttributeResultMessage *arm;
1459 struct GNUNET_MQ_Envelope *env; 1243 struct GNUNET_MQ_Envelope *env;
1460 char* data_tmp; 1244 char *data_tmp;
1461 1245
1462 if (rd_count != 1) 1246 if (rd_count != 1) {
1463 { 1247 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
1464 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
1465 1);
1466 return; 1248 return;
1467 } 1249 }
1468 1250
1469 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd->record_type) 1251 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd->record_type) {
1470 { 1252 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
1471 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
1472 1);
1473 return; 1253 return;
1474 } 1254 }
1475 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1255 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", label);
1476 "Found attribute under: %s\n", label); 1256 env = GNUNET_MQ_msg_extra (arm, rd->data_size,
1477 env = GNUNET_MQ_msg_extra (arm,
1478 rd->data_size,
1479 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); 1257 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
1480 arm->id = htonl (ai->request_id); 1258 arm->id = htonl (ai->request_id);
1481 arm->attr_len = htons (rd->data_size); 1259 arm->attr_len = htons (rd->data_size);
1482 GNUNET_CRYPTO_ecdsa_key_get_public (zone, 1260 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
1483 &arm->identity); 1261 data_tmp = (char *)&arm[1];
1484 data_tmp = (char *) &arm[1]; 1262 GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1485 GNUNET_memcpy (data_tmp,
1486 rd->data,
1487 rd->data_size);
1488 GNUNET_MQ_send (ai->client->mq, env); 1263 GNUNET_MQ_send (ai->client->mq, env);
1489} 1264}
1490 1265
1491
1492static void 1266static void
1493handle_iteration_start (void *cls, 1267handle_iteration_start (void *cls,
1494 const struct AttributeIterationStartMessage *ais_msg) 1268 const struct AttributeIterationStartMessage *ais_msg)
@@ -1503,21 +1277,13 @@ handle_iteration_start (void *cls,
1503 ai->client = idp; 1277 ai->client = idp;
1504 ai->identity = ais_msg->identity; 1278 ai->identity = ais_msg->identity;
1505 1279
1506 GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, 1280 GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, idp->attr_iter_tail, ai);
1507 idp->attr_iter_tail, 1281 ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (
1508 ai); 1282 nsh, &ai->identity, &attr_iter_error, ai, &attr_iter_cb, ai,
1509 ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh, 1283 &attr_iter_finished, ai);
1510 &ai->identity,
1511 &attr_iter_error,
1512 ai,
1513 &attr_iter_cb,
1514 ai,
1515 &attr_iter_finished,
1516 ai);
1517 GNUNET_SERVICE_client_continue (idp->client); 1284 GNUNET_SERVICE_client_continue (idp->client);
1518} 1285}
1519 1286
1520
1521static void 1287static void
1522handle_iteration_stop (void *cls, 1288handle_iteration_stop (void *cls,
1523 const struct AttributeIterationStopMessage *ais_msg) 1289 const struct AttributeIterationStopMessage *ais_msg)
@@ -1526,27 +1292,22 @@ handle_iteration_stop (void *cls,
1526 struct AttributeIterator *ai; 1292 struct AttributeIterator *ai;
1527 uint32_t rid; 1293 uint32_t rid;
1528 1294
1529 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1295 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
1530 "Received `%s' message\n",
1531 "ATTRIBUTE_ITERATION_STOP"); 1296 "ATTRIBUTE_ITERATION_STOP");
1532 rid = ntohl (ais_msg->id); 1297 rid = ntohl (ais_msg->id);
1533 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next) 1298 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1534 if (ai->request_id == rid) 1299 if (ai->request_id == rid)
1535 break; 1300 break;
1536 if (NULL == ai) 1301 if (NULL == ai) {
1537 {
1538 GNUNET_break (0); 1302 GNUNET_break (0);
1539 GNUNET_SERVICE_client_drop (idp->client); 1303 GNUNET_SERVICE_client_drop (idp->client);
1540 return; 1304 return;
1541 } 1305 }
1542 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, 1306 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
1543 idp->attr_iter_tail,
1544 ai);
1545 GNUNET_free (ai); 1307 GNUNET_free (ai);
1546 GNUNET_SERVICE_client_continue (idp->client); 1308 GNUNET_SERVICE_client_continue (idp->client);
1547} 1309}
1548 1310
1549
1550static void 1311static void
1551handle_iteration_next (void *cls, 1312handle_iteration_next (void *cls,
1552 const struct AttributeIterationNextMessage *ais_msg) 1313 const struct AttributeIterationNextMessage *ais_msg)
@@ -1561,14 +1322,12 @@ handle_iteration_next (void *cls,
1561 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next) 1322 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1562 if (ai->request_id == rid) 1323 if (ai->request_id == rid)
1563 break; 1324 break;
1564 if (NULL == ai) 1325 if (NULL == ai) {
1565 {
1566 GNUNET_break (0); 1326 GNUNET_break (0);
1567 GNUNET_SERVICE_client_drop (idp->client); 1327 GNUNET_SERVICE_client_drop (idp->client);
1568 return; 1328 return;
1569 } 1329 }
1570 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1330 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
1571 1);
1572 GNUNET_SERVICE_client_continue (idp->client); 1331 GNUNET_SERVICE_client_continue (idp->client);
1573} 1332}
1574 1333
@@ -1576,37 +1335,29 @@ handle_iteration_next (void *cls,
1576 * Ticket iteration 1335 * Ticket iteration
1577 ******************************************************/ 1336 ******************************************************/
1578 1337
1579static void 1338static void ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
1580ticket_iter_cb (void *cls,
1581 struct GNUNET_RECLAIM_Ticket *ticket)
1582{ 1339{
1583 struct TicketIteration *ti = cls; 1340 struct TicketIteration *ti = cls;
1584 struct GNUNET_MQ_Envelope *env; 1341 struct GNUNET_MQ_Envelope *env;
1585 struct TicketResultMessage *trm; 1342 struct TicketResultMessage *trm;
1586 1343
1587 if (NULL == ticket) 1344 if (NULL == ticket) {
1588 {
1589 /* send empty response to indicate end of list */ 1345 /* send empty response to indicate end of list */
1590 env = GNUNET_MQ_msg (trm, 1346 env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
1591 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
1592 GNUNET_CONTAINER_DLL_remove (ti->client->ticket_iter_head, 1347 GNUNET_CONTAINER_DLL_remove (ti->client->ticket_iter_head,
1593 ti->client->ticket_iter_tail, 1348 ti->client->ticket_iter_tail, ti);
1594 ti);
1595 } else { 1349 } else {
1596 env = GNUNET_MQ_msg_extra (trm, 1350 env = GNUNET_MQ_msg_extra (trm, sizeof (struct GNUNET_RECLAIM_Ticket),
1597 sizeof (struct GNUNET_RECLAIM_Ticket),
1598 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); 1351 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
1599 } 1352 }
1600 trm->id = htonl (ti->r_id); 1353 trm->id = htonl (ti->r_id);
1601 GNUNET_MQ_send (ti->client->mq, 1354 GNUNET_MQ_send (ti->client->mq, env);
1602 env);
1603 if (NULL == ticket) 1355 if (NULL == ticket)
1604 GNUNET_free (ti); 1356 GNUNET_free (ti);
1605} 1357}
1606 1358
1607static void 1359static void handle_ticket_iteration_start (
1608handle_ticket_iteration_start (void *cls, 1360 void *cls, const struct TicketIterationStartMessage *tis_msg)
1609 const struct TicketIterationStartMessage *tis_msg)
1610{ 1361{
1611 struct IdpClient *client = cls; 1362 struct IdpClient *client = cls;
1612 struct TicketIteration *ti; 1363 struct TicketIteration *ti;
@@ -1618,15 +1369,12 @@ handle_ticket_iteration_start (void *cls,
1618 ti->client = client; 1369 ti->client = client;
1619 1370
1620 GNUNET_CONTAINER_DLL_insert (client->ticket_iter_head, 1371 GNUNET_CONTAINER_DLL_insert (client->ticket_iter_head,
1621 client->ticket_iter_tail, 1372 client->ticket_iter_tail, ti);
1622 ti); 1373 ti->iter =
1623 ti->iter = RECLAIM_TICKETS_iteration_start (&tis_msg->identity, 1374 RECLAIM_TICKETS_iteration_start (&tis_msg->identity, &ticket_iter_cb, ti);
1624 &ticket_iter_cb,
1625 ti);
1626 GNUNET_SERVICE_client_continue (client->client); 1375 GNUNET_SERVICE_client_continue (client->client);
1627} 1376}
1628 1377
1629
1630static void 1378static void
1631handle_ticket_iteration_stop (void *cls, 1379handle_ticket_iteration_stop (void *cls,
1632 const struct TicketIterationStopMessage *tis_msg) 1380 const struct TicketIterationStopMessage *tis_msg)
@@ -1635,28 +1383,24 @@ handle_ticket_iteration_stop (void *cls,
1635 struct TicketIteration *ti; 1383 struct TicketIteration *ti;
1636 uint32_t rid; 1384 uint32_t rid;
1637 1385
1638 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1386 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
1639 "Received `%s' message\n",
1640 "TICKET_ITERATION_STOP"); 1387 "TICKET_ITERATION_STOP");
1641 rid = ntohl (tis_msg->id); 1388 rid = ntohl (tis_msg->id);
1642 for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next) 1389 for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
1643 if (ti->r_id == rid) 1390 if (ti->r_id == rid)
1644 break; 1391 break;
1645 if (NULL == ti) 1392 if (NULL == ti) {
1646 {
1647 GNUNET_break (0); 1393 GNUNET_break (0);
1648 GNUNET_SERVICE_client_drop (client->client); 1394 GNUNET_SERVICE_client_drop (client->client);
1649 return; 1395 return;
1650 } 1396 }
1651 RECLAIM_TICKETS_iteration_stop (ti->iter); 1397 RECLAIM_TICKETS_iteration_stop (ti->iter);
1652 GNUNET_CONTAINER_DLL_remove (client->ticket_iter_head, 1398 GNUNET_CONTAINER_DLL_remove (client->ticket_iter_head,
1653 client->ticket_iter_tail, 1399 client->ticket_iter_tail, ti);
1654 ti);
1655 GNUNET_free (ti); 1400 GNUNET_free (ti);
1656 GNUNET_SERVICE_client_continue (client->client); 1401 GNUNET_SERVICE_client_continue (client->client);
1657} 1402}
1658 1403
1659
1660static void 1404static void
1661handle_ticket_iteration_next (void *cls, 1405handle_ticket_iteration_next (void *cls,
1662 const struct TicketIterationNextMessage *tis_msg) 1406 const struct TicketIterationNextMessage *tis_msg)
@@ -1671,8 +1415,7 @@ handle_ticket_iteration_next (void *cls,
1671 for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next) 1415 for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
1672 if (ti->r_id == rid) 1416 if (ti->r_id == rid)
1673 break; 1417 break;
1674 if (NULL == ti) 1418 if (NULL == ti) {
1675 {
1676 GNUNET_break (0); 1419 GNUNET_break (0);
1677 GNUNET_SERVICE_client_drop (client->client); 1420 GNUNET_SERVICE_client_drop (client->client);
1678 return; 1421 return;
@@ -1681,9 +1424,6 @@ handle_ticket_iteration_next (void *cls,
1681 GNUNET_SERVICE_client_continue (client->client); 1424 GNUNET_SERVICE_client_continue (client->client);
1682} 1425}
1683 1426
1684
1685
1686
1687/** 1427/**
1688 * Main function that will be run 1428 * Main function that will be run
1689 * 1429 *
@@ -1691,65 +1431,46 @@ handle_ticket_iteration_next (void *cls,
1691 * @param c the configuration used 1431 * @param c the configuration used
1692 * @param server the service handle 1432 * @param server the service handle
1693 */ 1433 */
1694static void 1434static void run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c,
1695run (void *cls, 1435 struct GNUNET_SERVICE_Handle *server)
1696 const struct GNUNET_CONFIGURATION_Handle *c,
1697 struct GNUNET_SERVICE_Handle *server)
1698{ 1436{
1699 char *database; 1437 char *database;
1700 cfg = c; 1438 cfg = c;
1701 1439
1702 1440 if (GNUNET_OK != RECLAIM_TICKETS_init (cfg)) {
1703 if (GNUNET_OK != RECLAIM_TICKETS_init (cfg))
1704 {
1705 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1441 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1706 "Unable to initialized TICKETS subsystem.\n"); 1442 "Unable to initialized TICKETS subsystem.\n");
1707 GNUNET_SCHEDULER_shutdown (); 1443 GNUNET_SCHEDULER_shutdown ();
1708 return; 1444 return;
1709 } 1445 }
1710 //Connect to identity and namestore services 1446 // Connect to identity and namestore services
1711 nsh = GNUNET_NAMESTORE_connect (cfg); 1447 nsh = GNUNET_NAMESTORE_connect (cfg);
1712 if (NULL == nsh) 1448 if (NULL == nsh) {
1713 { 1449 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
1714 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to namestore"); 1450 "error connecting to namestore");
1715 } 1451 }
1716 1452
1717 identity_handle = GNUNET_IDENTITY_connect (cfg, 1453 identity_handle = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
1718 NULL,
1719 NULL);
1720 /* Loading DB plugin */ 1454 /* Loading DB plugin */
1721 if (GNUNET_OK != 1455 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (
1722 GNUNET_CONFIGURATION_get_value_string (cfg, 1456 cfg, "reclaim", "database", &database))
1723 "reclaim", 1457 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No database backend configured\n");
1724 "database", 1458 GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_reclaim_%s", database);
1725 &database)) 1459 TKT_database = GNUNET_PLUGIN_load (db_lib_name, (void *)cfg);
1726 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1727 "No database backend configured\n");
1728 GNUNET_asprintf (&db_lib_name,
1729 "libgnunet_plugin_reclaim_%s",
1730 database);
1731 TKT_database = GNUNET_PLUGIN_load (db_lib_name,
1732 (void *) cfg);
1733 GNUNET_free (database); 1460 GNUNET_free (database);
1734 if (NULL == TKT_database) 1461 if (NULL == TKT_database) {
1735 {
1736 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1462 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1737 "Could not load database backend `%s'\n", 1463 "Could not load database backend `%s'\n", db_lib_name);
1738 db_lib_name);
1739 GNUNET_SCHEDULER_shutdown (); 1464 GNUNET_SCHEDULER_shutdown ();
1740 return; 1465 return;
1741 } 1466 }
1742 1467
1743 if (GNUNET_OK == 1468 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (
1744 GNUNET_CONFIGURATION_get_value_time (cfg, 1469 cfg, "reclaim", "TOKEN_EXPIRATION_INTERVAL",
1745 "reclaim", 1470 &token_expiration_interval)) {
1746 "TOKEN_EXPIRATION_INTERVAL", 1471 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Time window for zone iteration: %s\n",
1747 &token_expiration_interval)) 1472 GNUNET_STRINGS_relative_time_to_string (
1748 { 1473 token_expiration_interval, GNUNET_YES));
1749 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1750 "Time window for zone iteration: %s\n",
1751 GNUNET_STRINGS_relative_time_to_string (token_expiration_interval,
1752 GNUNET_YES));
1753 } else { 1474 } else {
1754 token_expiration_interval = DEFAULT_TOKEN_EXPIRATION_INTERVAL; 1475 token_expiration_interval = DEFAULT_TOKEN_EXPIRATION_INTERVAL;
1755 } 1476 }
@@ -1764,10 +1485,9 @@ run (void *cls,
1764 * @param client identification of the client 1485 * @param client identification of the client
1765 * @param app_ctx @a client 1486 * @param app_ctx @a client
1766 */ 1487 */
1767static void 1488static void client_disconnect_cb (void *cls,
1768client_disconnect_cb (void *cls, 1489 struct GNUNET_SERVICE_Client *client,
1769 struct GNUNET_SERVICE_Client *client, 1490 void *app_ctx)
1770 void *app_ctx)
1771{ 1491{
1772 struct IdpClient *idp = app_ctx; 1492 struct IdpClient *idp = app_ctx;
1773 struct AttributeIterator *ai; 1493 struct AttributeIterator *ai;
@@ -1777,61 +1497,42 @@ client_disconnect_cb (void *cls,
1777 struct ConsumeTicketOperation *ct; 1497 struct ConsumeTicketOperation *ct;
1778 struct AttributeStoreHandle *as; 1498 struct AttributeStoreHandle *as;
1779 1499
1780 //TODO other operations 1500 // TODO other operations
1781 1501
1782 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1502 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
1783 "Client %p disconnected\n", 1503
1784 client); 1504 while (NULL != (iss = idp->issue_op_head)) {
1785 1505 GNUNET_CONTAINER_DLL_remove (idp->issue_op_head, idp->issue_op_tail, iss);
1786 while (NULL != (iss = idp->issue_op_head))
1787 {
1788 GNUNET_CONTAINER_DLL_remove (idp->issue_op_head,
1789 idp->issue_op_tail,
1790 iss);
1791 GNUNET_free (iss); 1506 GNUNET_free (iss);
1792 } 1507 }
1793 while (NULL != (ct = idp->consume_op_head)) 1508 while (NULL != (ct = idp->consume_op_head)) {
1794 { 1509 GNUNET_CONTAINER_DLL_remove (idp->consume_op_head, idp->consume_op_tail,
1795 GNUNET_CONTAINER_DLL_remove (idp->consume_op_head,
1796 idp->consume_op_tail,
1797 ct); 1510 ct);
1798 if (NULL != ct->ch) 1511 if (NULL != ct->ch)
1799 RECLAIM_TICKETS_consume_cancel (ct->ch); 1512 RECLAIM_TICKETS_consume_cancel (ct->ch);
1800 GNUNET_free (ct); 1513 GNUNET_free (ct);
1801 } 1514 }
1802 while (NULL != (as = idp->store_op_head)) 1515 while (NULL != (as = idp->store_op_head)) {
1803 { 1516 GNUNET_CONTAINER_DLL_remove (idp->store_op_head, idp->store_op_tail, as);
1804 GNUNET_CONTAINER_DLL_remove (idp->store_op_head,
1805 idp->store_op_tail,
1806 as);
1807 cleanup_as_handle (as); 1517 cleanup_as_handle (as);
1808 } 1518 }
1809 1519
1810 while (NULL != (ai = idp->attr_iter_head)) 1520 while (NULL != (ai = idp->attr_iter_head)) {
1811 { 1521 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
1812 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head,
1813 idp->attr_iter_tail,
1814 ai);
1815 cleanup_attribute_iter_handle (ai); 1522 cleanup_attribute_iter_handle (ai);
1816 } 1523 }
1817 while (NULL != (rh = idp->revoke_op_head)) 1524 while (NULL != (rh = idp->revoke_op_head)) {
1818 { 1525 GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, idp->revoke_op_tail, rh);
1819 GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head,
1820 idp->revoke_op_tail,
1821 rh);
1822 cleanup_revoke_ticket_handle (rh); 1526 cleanup_revoke_ticket_handle (rh);
1823 } 1527 }
1824 while (NULL != (ti = idp->ticket_iter_head)) 1528 while (NULL != (ti = idp->ticket_iter_head)) {
1825 { 1529 GNUNET_CONTAINER_DLL_remove (idp->ticket_iter_head, idp->ticket_iter_tail,
1826 GNUNET_CONTAINER_DLL_remove (idp->ticket_iter_head,
1827 idp->ticket_iter_tail,
1828 ti); 1530 ti);
1829 GNUNET_free (ti); 1531 GNUNET_free (ti);
1830 } 1532 }
1831 GNUNET_free (idp); 1533 GNUNET_free (idp);
1832} 1534}
1833 1535
1834
1835/** 1536/**
1836 * Add a client to our list of active clients. 1537 * Add a client to our list of active clients.
1837 * 1538 *
@@ -1840,72 +1541,52 @@ client_disconnect_cb (void *cls,
1840 * @param mq message queue for @a client 1541 * @param mq message queue for @a client
1841 * @return internal namestore client structure for this client 1542 * @return internal namestore client structure for this client
1842 */ 1543 */
1843static void * 1544static void *client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client,
1844client_connect_cb (void *cls, 1545 struct GNUNET_MQ_Handle *mq)
1845 struct GNUNET_SERVICE_Client *client,
1846 struct GNUNET_MQ_Handle *mq)
1847{ 1546{
1848 struct IdpClient *idp; 1547 struct IdpClient *idp;
1849 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1548 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
1850 "Client %p connected\n",
1851 client);
1852 idp = GNUNET_new (struct IdpClient); 1549 idp = GNUNET_new (struct IdpClient);
1853 idp->client = client; 1550 idp->client = client;
1854 idp->mq = mq; 1551 idp->mq = mq;
1855 return idp; 1552 return idp;
1856} 1553}
1857 1554
1858
1859
1860/** 1555/**
1861 * Define "main" method using service macro. 1556 * Define "main" method using service macro.
1862 */ 1557 */
1863GNUNET_SERVICE_MAIN 1558GNUNET_SERVICE_MAIN (
1864("reclaim", 1559 "reclaim", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb,
1865 GNUNET_SERVICE_OPTION_NONE, 1560 &client_disconnect_cb, NULL,
1866 &run, 1561 GNUNET_MQ_hd_var_size (attribute_store_message,
1867 &client_connect_cb, 1562 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
1868 &client_disconnect_cb, 1563 struct AttributeStoreMessage, NULL),
1869 NULL, 1564 GNUNET_MQ_hd_fixed_size (
1870 GNUNET_MQ_hd_var_size (attribute_store_message, 1565 iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
1871 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, 1566 struct AttributeIterationStartMessage, NULL),
1872 struct AttributeStoreMessage, 1567 GNUNET_MQ_hd_fixed_size (
1873 NULL), 1568 iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
1874 GNUNET_MQ_hd_fixed_size (iteration_start, 1569 struct AttributeIterationNextMessage, NULL),
1875 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, 1570 GNUNET_MQ_hd_fixed_size (
1876 struct AttributeIterationStartMessage, 1571 iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
1877 NULL), 1572 struct AttributeIterationStopMessage, NULL),
1878 GNUNET_MQ_hd_fixed_size (iteration_next, 1573 GNUNET_MQ_hd_var_size (issue_ticket_message,
1879 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, 1574 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
1880 struct AttributeIterationNextMessage, 1575 struct IssueTicketMessage, NULL),
1881 NULL), 1576 GNUNET_MQ_hd_var_size (consume_ticket_message,
1882 GNUNET_MQ_hd_fixed_size (iteration_stop, 1577 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
1883 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, 1578 struct ConsumeTicketMessage, NULL),
1884 struct AttributeIterationStopMessage, 1579 GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
1885 NULL), 1580 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
1886 GNUNET_MQ_hd_var_size (issue_ticket_message, 1581 struct TicketIterationStartMessage, NULL),
1887 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, 1582 GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
1888 struct IssueTicketMessage, 1583 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
1889 NULL), 1584 struct TicketIterationNextMessage, NULL),
1890 GNUNET_MQ_hd_var_size (consume_ticket_message, 1585 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
1891 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, 1586 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
1892 struct ConsumeTicketMessage, 1587 struct TicketIterationStopMessage, NULL),
1893 NULL), 1588 GNUNET_MQ_hd_var_size (revoke_ticket_message,
1894 GNUNET_MQ_hd_fixed_size (ticket_iteration_start, 1589 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
1895 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, 1590 struct RevokeTicketMessage, NULL),
1896 struct TicketIterationStartMessage, 1591 GNUNET_MQ_handler_end ());
1897 NULL),
1898 GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
1899 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
1900 struct TicketIterationNextMessage,
1901 NULL),
1902 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
1903 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
1904 struct TicketIterationStopMessage,
1905 NULL),
1906 GNUNET_MQ_hd_var_size (revoke_ticket_message,
1907 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
1908 struct RevokeTicketMessage,
1909 NULL),
1910 GNUNET_MQ_handler_end());
1911/* end of gnunet-service-reclaim.c */ 1592/* end of gnunet-service-reclaim.c */