aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-service-reclaim.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-05 15:09:28 +0200
commitc4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch)
treecac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/reclaim/gnunet-service-reclaim.c
parentfbb71d527c7d6babf269a8fefce1db291b9f7068 (diff)
downloadgnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz
gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c1191
1 files changed, 603 insertions, 588 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index 23a5db1ed..440656343 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -58,7 +58,8 @@ struct IdpClient;
58/** 58/**
59 * A ticket iteration operation. 59 * A ticket iteration operation.
60 */ 60 */
61struct TicketIteration { 61struct TicketIteration
62{
62 /** 63 /**
63 * DLL 64 * DLL
64 */ 65 */
@@ -89,7 +90,8 @@ struct TicketIteration {
89/** 90/**
90 * An attribute iteration operation. 91 * An attribute iteration operation.
91 */ 92 */
92struct AttributeIterator { 93struct AttributeIterator
94{
93 /** 95 /**
94 * Next element in the DLL 96 * Next element in the DLL
95 */ 97 */
@@ -125,7 +127,8 @@ struct AttributeIterator {
125/** 127/**
126 * An idp client 128 * An idp client
127 */ 129 */
128struct IdpClient { 130struct IdpClient
131{
129 /** 132 /**
130 * DLL 133 * DLL
131 */ 134 */
@@ -224,7 +227,8 @@ struct IdpClient {
224/** 227/**
225 * Handle for attribute deletion request 228 * Handle for attribute deletion request
226 */ 229 */
227struct AttributeDeleteHandle { 230struct AttributeDeleteHandle
231{
228 /** 232 /**
229 * DLL 233 * DLL
230 */ 234 */
@@ -286,7 +290,8 @@ struct AttributeDeleteHandle {
286/** 290/**
287 * Handle for attribute store request 291 * Handle for attribute store request
288 */ 292 */
289struct AttributeStoreHandle { 293struct AttributeStoreHandle
294{
290 /** 295 /**
291 * DLL 296 * DLL
292 */ 297 */
@@ -337,7 +342,8 @@ struct AttributeStoreHandle {
337/** 342/**
338 * Handle for ticket consume request 343 * Handle for ticket consume request
339 */ 344 */
340struct ConsumeTicketOperation { 345struct ConsumeTicketOperation
346{
341 /** 347 /**
342 * DLL 348 * DLL
343 */ 349 */
@@ -368,7 +374,8 @@ struct ConsumeTicketOperation {
368/** 374/**
369 * Ticket revocation request handle 375 * Ticket revocation request handle
370 */ 376 */
371struct TicketRevocationOperation { 377struct TicketRevocationOperation
378{
372 /** 379 /**
373 * DLL 380 * DLL
374 */ 381 */
@@ -399,7 +406,8 @@ struct TicketRevocationOperation {
399/** 406/**
400 * Ticket issue operation handle 407 * Ticket issue operation handle
401 */ 408 */
402struct TicketIssueOperation { 409struct TicketIssueOperation
410{
403 /** 411 /**
404 * DLL 412 * DLL
405 */ 413 */
@@ -439,30 +447,30 @@ static struct IdpClient *client_list_tail = NULL;
439 * @param adh the attribute to cleanup 447 * @param adh the attribute to cleanup
440 */ 448 */
441static void 449static void
442cleanup_adh(struct AttributeDeleteHandle *adh) 450cleanup_adh (struct AttributeDeleteHandle *adh)
443{ 451{
444 struct TicketRecordsEntry *le; 452 struct TicketRecordsEntry *le;
445 453
446 if (NULL != adh->ns_it) 454 if (NULL != adh->ns_it)
447 GNUNET_NAMESTORE_zone_iteration_stop(adh->ns_it); 455 GNUNET_NAMESTORE_zone_iteration_stop (adh->ns_it);
448 if (NULL != adh->ns_qe) 456 if (NULL != adh->ns_qe)
449 GNUNET_NAMESTORE_cancel(adh->ns_qe); 457 GNUNET_NAMESTORE_cancel (adh->ns_qe);
450 if (NULL != adh->label) 458 if (NULL != adh->label)
451 GNUNET_free(adh->label); 459 GNUNET_free (adh->label);
452 if (NULL != adh->claim) 460 if (NULL != adh->claim)
453 GNUNET_free(adh->claim); 461 GNUNET_free (adh->claim);
454 while (NULL != (le = adh->tickets_to_update_head)) 462 while (NULL != (le = adh->tickets_to_update_head))
455 { 463 {
456 GNUNET_CONTAINER_DLL_remove(adh->tickets_to_update_head, 464 GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head,
457 adh->tickets_to_update_tail, 465 adh->tickets_to_update_tail,
458 le); 466 le);
459 if (NULL != le->label) 467 if (NULL != le->label)
460 GNUNET_free(le->label); 468 GNUNET_free (le->label);
461 if (NULL != le->data) 469 if (NULL != le->data)
462 GNUNET_free(le->data); 470 GNUNET_free (le->data);
463 GNUNET_free(le); 471 GNUNET_free (le);
464 } 472 }
465 GNUNET_free(adh); 473 GNUNET_free (adh);
466} 474}
467 475
468 476
@@ -472,13 +480,13 @@ cleanup_adh(struct AttributeDeleteHandle *adh)
472 * @param handle handle to clean up 480 * @param handle handle to clean up
473 */ 481 */
474static void 482static void
475cleanup_as_handle(struct AttributeStoreHandle *ash) 483cleanup_as_handle (struct AttributeStoreHandle *ash)
476{ 484{
477 if (NULL != ash->ns_qe) 485 if (NULL != ash->ns_qe)
478 GNUNET_NAMESTORE_cancel(ash->ns_qe); 486 GNUNET_NAMESTORE_cancel (ash->ns_qe);
479 if (NULL != ash->claim) 487 if (NULL != ash->claim)
480 GNUNET_free(ash->claim); 488 GNUNET_free (ash->claim);
481 GNUNET_free(ash); 489 GNUNET_free (ash);
482} 490}
483 491
484 492
@@ -488,7 +496,7 @@ cleanup_as_handle(struct AttributeStoreHandle *ash)
488 * @param idp the client to clean up 496 * @param idp the client to clean up
489 */ 497 */
490static void 498static void
491cleanup_client(struct IdpClient *idp) 499cleanup_client (struct IdpClient *idp)
492{ 500{
493 struct AttributeIterator *ai; 501 struct AttributeIterator *ai;
494 struct TicketIteration *ti; 502 struct TicketIteration *ti;
@@ -499,52 +507,52 @@ cleanup_client(struct IdpClient *idp)
499 struct AttributeDeleteHandle *adh; 507 struct AttributeDeleteHandle *adh;
500 508
501 while (NULL != (iss = idp->issue_op_head)) 509 while (NULL != (iss = idp->issue_op_head))
502 { 510 {
503 GNUNET_CONTAINER_DLL_remove(idp->issue_op_head, idp->issue_op_tail, iss); 511 GNUNET_CONTAINER_DLL_remove (idp->issue_op_head, idp->issue_op_tail, iss);
504 GNUNET_free(iss); 512 GNUNET_free (iss);
505 } 513 }
506 while (NULL != (ct = idp->consume_op_head)) 514 while (NULL != (ct = idp->consume_op_head))
507 { 515 {
508 GNUNET_CONTAINER_DLL_remove(idp->consume_op_head, 516 GNUNET_CONTAINER_DLL_remove (idp->consume_op_head,
509 idp->consume_op_tail, 517 idp->consume_op_tail,
510 ct); 518 ct);
511 if (NULL != ct->ch) 519 if (NULL != ct->ch)
512 RECLAIM_TICKETS_consume_cancel(ct->ch); 520 RECLAIM_TICKETS_consume_cancel (ct->ch);
513 GNUNET_free(ct); 521 GNUNET_free (ct);
514 } 522 }
515 while (NULL != (as = idp->store_op_head)) 523 while (NULL != (as = idp->store_op_head))
516 { 524 {
517 GNUNET_CONTAINER_DLL_remove(idp->store_op_head, idp->store_op_tail, as); 525 GNUNET_CONTAINER_DLL_remove (idp->store_op_head, idp->store_op_tail, as);
518 cleanup_as_handle(as); 526 cleanup_as_handle (as);
519 } 527 }
520 while (NULL != (adh = idp->delete_op_head)) 528 while (NULL != (adh = idp->delete_op_head))
521 { 529 {
522 GNUNET_CONTAINER_DLL_remove(idp->delete_op_head, idp->delete_op_tail, adh); 530 GNUNET_CONTAINER_DLL_remove (idp->delete_op_head, idp->delete_op_tail, adh);
523 cleanup_adh(adh); 531 cleanup_adh (adh);
524 } 532 }
525 533
526 while (NULL != (ai = idp->attr_iter_head)) 534 while (NULL != (ai = idp->attr_iter_head))
527 { 535 {
528 GNUNET_CONTAINER_DLL_remove(idp->attr_iter_head, idp->attr_iter_tail, ai); 536 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
529 GNUNET_free(ai); 537 GNUNET_free (ai);
530 } 538 }
531 while (NULL != (rop = idp->revoke_op_head)) 539 while (NULL != (rop = idp->revoke_op_head))
532 { 540 {
533 GNUNET_CONTAINER_DLL_remove(idp->revoke_op_head, idp->revoke_op_tail, rop); 541 GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, idp->revoke_op_tail, rop);
534 if (NULL != rop->rh) 542 if (NULL != rop->rh)
535 RECLAIM_TICKETS_revoke_cancel(rop->rh); 543 RECLAIM_TICKETS_revoke_cancel (rop->rh);
536 GNUNET_free(rop); 544 GNUNET_free (rop);
537 } 545 }
538 while (NULL != (ti = idp->ticket_iter_head)) 546 while (NULL != (ti = idp->ticket_iter_head))
539 { 547 {
540 GNUNET_CONTAINER_DLL_remove(idp->ticket_iter_head, 548 GNUNET_CONTAINER_DLL_remove (idp->ticket_iter_head,
541 idp->ticket_iter_tail, 549 idp->ticket_iter_tail,
542 ti); 550 ti);
543 if (NULL != ti->iter) 551 if (NULL != ti->iter)
544 RECLAIM_TICKETS_iteration_stop(ti->iter); 552 RECLAIM_TICKETS_iteration_stop (ti->iter);
545 GNUNET_free(ti); 553 GNUNET_free (ti);
546 } 554 }
547 GNUNET_free(idp); 555 GNUNET_free (idp);
548} 556}
549 557
550 558
@@ -552,24 +560,24 @@ cleanup_client(struct IdpClient *idp)
552 * Cleanup task 560 * Cleanup task
553 */ 561 */
554static void 562static void
555cleanup() 563cleanup ()
556{ 564{
557 struct IdpClient *cl; 565 struct IdpClient *cl;
558 566
559 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n"); 567 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
560 568
561 while (NULL != (cl = client_list_head)) 569 while (NULL != (cl = client_list_head))
562 { 570 {
563 GNUNET_CONTAINER_DLL_remove(client_list_head, 571 GNUNET_CONTAINER_DLL_remove (client_list_head,
564 client_list_tail, 572 client_list_tail,
565 cl); 573 cl);
566 cleanup_client(cl); 574 cleanup_client (cl);
567 } 575 }
568 RECLAIM_TICKETS_deinit(); 576 RECLAIM_TICKETS_deinit ();
569 if (NULL != timeout_task) 577 if (NULL != timeout_task)
570 GNUNET_SCHEDULER_cancel(timeout_task); 578 GNUNET_SCHEDULER_cancel (timeout_task);
571 if (NULL != nsh) 579 if (NULL != nsh)
572 GNUNET_NAMESTORE_disconnect(nsh); 580 GNUNET_NAMESTORE_disconnect (nsh);
573} 581}
574 582
575 583
@@ -579,10 +587,10 @@ cleanup()
579 * @param cls NULL 587 * @param cls NULL
580 */ 588 */
581static void 589static void
582do_shutdown(void *cls) 590do_shutdown (void *cls)
583{ 591{
584 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Shutting down...\n"); 592 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n");
585 cleanup(); 593 cleanup ();
586} 594}
587 595
588 596
@@ -595,24 +603,24 @@ do_shutdown(void *cls)
595 * @param success the success status of the request 603 * @param success the success status of the request
596 */ 604 */
597static void 605static void
598send_ticket_result(const struct IdpClient *client, 606send_ticket_result (const struct IdpClient *client,
599 uint32_t r_id, 607 uint32_t r_id,
600 const struct GNUNET_RECLAIM_Ticket *ticket, 608 const struct GNUNET_RECLAIM_Ticket *ticket,
601 uint32_t success) 609 uint32_t success)
602{ 610{
603 struct TicketResultMessage *irm; 611 struct TicketResultMessage *irm;
604 struct GNUNET_MQ_Envelope *env; 612 struct GNUNET_MQ_Envelope *env;
605 613
606 env = GNUNET_MQ_msg(irm, 614 env = GNUNET_MQ_msg (irm,
607 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); 615 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
608 if (NULL != ticket) 616 if (NULL != ticket)
609 { 617 {
610 irm->ticket = *ticket; 618 irm->ticket = *ticket;
611 } 619 }
612 // TODO add success member 620 // TODO add success member
613 irm->id = htonl(r_id); 621 irm->id = htonl (r_id);
614 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); 622 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
615 GNUNET_MQ_send(client->mq, env); 623 GNUNET_MQ_send (client->mq, env);
616} 624}
617 625
618 626
@@ -625,28 +633,28 @@ send_ticket_result(const struct IdpClient *client,
625 * @param emsg error message (NULL of success is GNUNET_OK) 633 * @param emsg error message (NULL of success is GNUNET_OK)
626 */ 634 */
627static void 635static void
628issue_ticket_result_cb(void *cls, 636issue_ticket_result_cb (void *cls,
629 struct GNUNET_RECLAIM_Ticket *ticket, 637 struct GNUNET_RECLAIM_Ticket *ticket,
630 int32_t success, 638 int32_t success,
631 const char *emsg) 639 const char *emsg)
632{ 640{
633 struct TicketIssueOperation *tio = cls; 641 struct TicketIssueOperation *tio = cls;
634 642
635 if (GNUNET_OK != success) 643 if (GNUNET_OK != success)
636 { 644 {
637 send_ticket_result(tio->client, tio->r_id, NULL, GNUNET_SYSERR); 645 send_ticket_result (tio->client, tio->r_id, NULL, GNUNET_SYSERR);
638 GNUNET_CONTAINER_DLL_remove(tio->client->issue_op_head, 646 GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
639 tio->client->issue_op_tail, 647 tio->client->issue_op_tail,
640 tio); 648 tio);
641 GNUNET_free(tio); 649 GNUNET_free (tio);
642 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg); 650 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg);
643 return; 651 return;
644 } 652 }
645 send_ticket_result(tio->client, tio->r_id, ticket, GNUNET_SYSERR); 653 send_ticket_result (tio->client, tio->r_id, ticket, GNUNET_SYSERR);
646 GNUNET_CONTAINER_DLL_remove(tio->client->issue_op_head, 654 GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
647 tio->client->issue_op_tail, 655 tio->client->issue_op_tail,
648 tio); 656 tio);
649 GNUNET_free(tio); 657 GNUNET_free (tio);
650} 658}
651 659
652 660
@@ -658,16 +666,16 @@ issue_ticket_result_cb(void *cls,
658 * @return GNUNET_OK if message is ok 666 * @return GNUNET_OK if message is ok
659 */ 667 */
660static int 668static int
661check_issue_ticket_message(void *cls, const struct IssueTicketMessage *im) 669check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
662{ 670{
663 uint16_t size; 671 uint16_t size;
664 672
665 size = ntohs(im->header.size); 673 size = ntohs (im->header.size);
666 if (size <= sizeof(struct IssueTicketMessage)) 674 if (size <= sizeof(struct IssueTicketMessage))
667 { 675 {
668 GNUNET_break(0); 676 GNUNET_break (0);
669 return GNUNET_SYSERR; 677 return GNUNET_SYSERR;
670 } 678 }
671 return GNUNET_OK; 679 return GNUNET_OK;
672} 680}
673 681
@@ -679,27 +687,28 @@ check_issue_ticket_message(void *cls, const struct IssueTicketMessage *im)
679 * @param im the message 687 * @param im the message
680 */ 688 */
681static void 689static void
682handle_issue_ticket_message(void *cls, const struct IssueTicketMessage *im) 690handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
683{ 691{
684 struct TicketIssueOperation *tio; 692 struct TicketIssueOperation *tio;
685 struct IdpClient *idp = cls; 693 struct IdpClient *idp = cls;
686 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; 694 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
687 size_t attrs_len; 695 size_t attrs_len;
688 696
689 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n"); 697 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
690 tio = GNUNET_new(struct TicketIssueOperation); 698 tio = GNUNET_new (struct TicketIssueOperation);
691 attrs_len = ntohs(im->attr_len); 699 attrs_len = ntohs (im->attr_len);
692 attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize((char *)&im[1], attrs_len); 700 attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *) &im[1],
693 tio->r_id = ntohl(im->id); 701 attrs_len);
702 tio->r_id = ntohl (im->id);
694 tio->client = idp; 703 tio->client = idp;
695 GNUNET_CONTAINER_DLL_insert(idp->issue_op_head, idp->issue_op_tail, tio); 704 GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio);
696 RECLAIM_TICKETS_issue(&im->identity, 705 RECLAIM_TICKETS_issue (&im->identity,
697 attrs, 706 attrs,
698 &im->rp, 707 &im->rp,
699 &issue_ticket_result_cb, 708 &issue_ticket_result_cb,
700 tio); 709 tio);
701 GNUNET_SERVICE_client_continue(idp->client); 710 GNUNET_SERVICE_client_continue (idp->client);
702 GNUNET_RECLAIM_ATTRIBUTE_list_destroy(attrs); 711 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
703} 712}
704 713
705 714
@@ -715,22 +724,23 @@ handle_issue_ticket_message(void *cls, const struct IssueTicketMessage *im)
715 * @param success revocation result (GNUNET_OK if successful) 724 * @param success revocation result (GNUNET_OK if successful)
716 */ 725 */
717static void 726static void
718revoke_result_cb(void *cls, int32_t success) 727revoke_result_cb (void *cls, int32_t success)
719{ 728{
720 struct TicketRevocationOperation *rop = cls; 729 struct TicketRevocationOperation *rop = cls;
721 struct GNUNET_MQ_Envelope *env; 730 struct GNUNET_MQ_Envelope *env;
722 struct RevokeTicketResultMessage *trm; 731 struct RevokeTicketResultMessage *trm;
723 732
724 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending REVOKE_TICKET_RESULT message\n"); 733 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
734 "Sending REVOKE_TICKET_RESULT message\n");
725 rop->rh = NULL; 735 rop->rh = NULL;
726 env = GNUNET_MQ_msg(trm, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT); 736 env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT);
727 trm->id = htonl(rop->r_id); 737 trm->id = htonl (rop->r_id);
728 trm->success = htonl(success); 738 trm->success = htonl (success);
729 GNUNET_MQ_send(rop->client->mq, env); 739 GNUNET_MQ_send (rop->client->mq, env);
730 GNUNET_CONTAINER_DLL_remove(rop->client->revoke_op_head, 740 GNUNET_CONTAINER_DLL_remove (rop->client->revoke_op_head,
731 rop->client->revoke_op_tail, 741 rop->client->revoke_op_tail,
732 rop); 742 rop);
733 GNUNET_free(rop); 743 GNUNET_free (rop);
734} 744}
735 745
736 746
@@ -742,16 +752,16 @@ revoke_result_cb(void *cls, int32_t success)
742 * @return GNUNET_OK if message is ok 752 * @return GNUNET_OK if message is ok
743 */ 753 */
744static int 754static int
745check_revoke_ticket_message(void *cls, const struct RevokeTicketMessage *im) 755check_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *im)
746{ 756{
747 uint16_t size; 757 uint16_t size;
748 758
749 size = ntohs(im->header.size); 759 size = ntohs (im->header.size);
750 if (size != sizeof(struct RevokeTicketMessage)) 760 if (size != sizeof(struct RevokeTicketMessage))
751 { 761 {
752 GNUNET_break(0); 762 GNUNET_break (0);
753 return GNUNET_SYSERR; 763 return GNUNET_SYSERR;
754 } 764 }
755 return GNUNET_OK; 765 return GNUNET_OK;
756} 766}
757 767
@@ -763,19 +773,20 @@ check_revoke_ticket_message(void *cls, const struct RevokeTicketMessage *im)
763 * @param rm the message to handle 773 * @param rm the message to handle
764 */ 774 */
765static void 775static void
766handle_revoke_ticket_message(void *cls, const struct RevokeTicketMessage *rm) 776handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
767{ 777{
768 struct TicketRevocationOperation *rop; 778 struct TicketRevocationOperation *rop;
769 struct IdpClient *idp = cls; 779 struct IdpClient *idp = cls;
770 780
771 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n"); 781 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
772 rop = GNUNET_new(struct TicketRevocationOperation); 782 rop = GNUNET_new (struct TicketRevocationOperation);
773 rop->r_id = ntohl(rm->id); 783 rop->r_id = ntohl (rm->id);
774 rop->client = idp; 784 rop->client = idp;
775 GNUNET_CONTAINER_DLL_insert(idp->revoke_op_head, idp->revoke_op_tail, rop); 785 GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop);
776 rop->rh 786 rop->rh
777 = RECLAIM_TICKETS_revoke(&rm->ticket, &rm->identity, &revoke_result_cb, rop); 787 = RECLAIM_TICKETS_revoke (&rm->ticket, &rm->identity, &revoke_result_cb,
778 GNUNET_SERVICE_client_continue(idp->client); 788 rop);
789 GNUNET_SERVICE_client_continue (idp->client);
779} 790}
780 791
781 792
@@ -789,11 +800,11 @@ handle_revoke_ticket_message(void *cls, const struct RevokeTicketMessage *rm)
789 * @param emsg error message (NULL if success=GNUNET_OK) 800 * @param emsg error message (NULL if success=GNUNET_OK)
790 */ 801 */
791static void 802static void
792consume_result_cb(void *cls, 803consume_result_cb (void *cls,
793 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 804 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
794 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 805 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
795 int32_t success, 806 int32_t success,
796 const char *emsg) 807 const char *emsg)
797{ 808{
798 struct ConsumeTicketOperation *cop = cls; 809 struct ConsumeTicketOperation *cop = cls;
799 struct ConsumeTicketResultMessage *crm; 810 struct ConsumeTicketResultMessage *crm;
@@ -802,25 +813,26 @@ consume_result_cb(void *cls,
802 size_t attrs_len; 813 size_t attrs_len;
803 814
804 if (GNUNET_OK != success) 815 if (GNUNET_OK != success)
805 { 816 {
806 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg); 817 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
807 } 818 }
808 attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size(attrs); 819 attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
809 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending CONSUME_TICKET_RESULT message\n"); 820 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
810 env = GNUNET_MQ_msg_extra(crm, 821 "Sending CONSUME_TICKET_RESULT message\n");
811 attrs_len, 822 env = GNUNET_MQ_msg_extra (crm,
812 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); 823 attrs_len,
813 crm->id = htonl(cop->r_id); 824 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT);
814 crm->attrs_len = htons(attrs_len); 825 crm->id = htonl (cop->r_id);
826 crm->attrs_len = htons (attrs_len);
815 crm->identity = *identity; 827 crm->identity = *identity;
816 crm->result = htonl(success); 828 crm->result = htonl (success);
817 data_tmp = (char *)&crm[1]; 829 data_tmp = (char *) &crm[1];
818 GNUNET_RECLAIM_ATTRIBUTE_list_serialize(attrs, data_tmp); 830 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, data_tmp);
819 GNUNET_MQ_send(cop->client->mq, env); 831 GNUNET_MQ_send (cop->client->mq, env);
820 GNUNET_CONTAINER_DLL_remove(cop->client->consume_op_head, 832 GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head,
821 cop->client->consume_op_tail, 833 cop->client->consume_op_tail,
822 cop); 834 cop);
823 GNUNET_free(cop); 835 GNUNET_free (cop);
824} 836}
825 837
826 838
@@ -831,16 +843,16 @@ consume_result_cb(void *cls,
831 * @param cm the message to handle 843 * @param cm the message to handle
832 */ 844 */
833static int 845static int
834check_consume_ticket_message(void *cls, const struct ConsumeTicketMessage *cm) 846check_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
835{ 847{
836 uint16_t size; 848 uint16_t size;
837 849
838 size = ntohs(cm->header.size); 850 size = ntohs (cm->header.size);
839 if (size != sizeof(struct ConsumeTicketMessage)) 851 if (size != sizeof(struct ConsumeTicketMessage))
840 { 852 {
841 GNUNET_break(0); 853 GNUNET_break (0);
842 return GNUNET_SYSERR; 854 return GNUNET_SYSERR;
843 } 855 }
844 return GNUNET_OK; 856 return GNUNET_OK;
845} 857}
846 858
@@ -852,19 +864,20 @@ check_consume_ticket_message(void *cls, const struct ConsumeTicketMessage *cm)
852 * @cm the message to handle 864 * @cm the message to handle
853 */ 865 */
854static void 866static void
855handle_consume_ticket_message(void *cls, const struct ConsumeTicketMessage *cm) 867handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
856{ 868{
857 struct ConsumeTicketOperation *cop; 869 struct ConsumeTicketOperation *cop;
858 struct IdpClient *idp = cls; 870 struct IdpClient *idp = cls;
859 871
860 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n"); 872 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
861 cop = GNUNET_new(struct ConsumeTicketOperation); 873 cop = GNUNET_new (struct ConsumeTicketOperation);
862 cop->r_id = ntohl(cm->id); 874 cop->r_id = ntohl (cm->id);
863 cop->client = idp; 875 cop->client = idp;
864 cop->ch 876 cop->ch
865 = RECLAIM_TICKETS_consume(&cm->identity, &cm->ticket, &consume_result_cb, cop); 877 = RECLAIM_TICKETS_consume (&cm->identity, &cm->ticket, &consume_result_cb,
866 GNUNET_CONTAINER_DLL_insert(idp->consume_op_head, idp->consume_op_tail, cop); 878 cop);
867 GNUNET_SERVICE_client_continue(idp->client); 879 GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop);
880 GNUNET_SERVICE_client_continue (idp->client);
868} 881}
869 882
870/***************************************** 883/*****************************************
@@ -880,33 +893,33 @@ handle_consume_ticket_message(void *cls, const struct ConsumeTicketMessage *cm)
880 * @param emsg error message (NULL if success=GNUNET_OK) 893 * @param emsg error message (NULL if success=GNUNET_OK)
881 */ 894 */
882static void 895static void
883attr_store_cont(void *cls, int32_t success, const char *emsg) 896attr_store_cont (void *cls, int32_t success, const char *emsg)
884{ 897{
885 struct AttributeStoreHandle *ash = cls; 898 struct AttributeStoreHandle *ash = cls;
886 struct GNUNET_MQ_Envelope *env; 899 struct GNUNET_MQ_Envelope *env;
887 struct SuccessResultMessage *acr_msg; 900 struct SuccessResultMessage *acr_msg;
888 901
889 ash->ns_qe = NULL; 902 ash->ns_qe = NULL;
890 GNUNET_CONTAINER_DLL_remove(ash->client->store_op_head, 903 GNUNET_CONTAINER_DLL_remove (ash->client->store_op_head,
891 ash->client->store_op_tail, 904 ash->client->store_op_tail,
892 ash); 905 ash);
893 906
894 if (GNUNET_SYSERR == success) 907 if (GNUNET_SYSERR == success)
895 { 908 {
896 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 909 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
897 "Failed to store attribute %s\n", 910 "Failed to store attribute %s\n",
898 emsg); 911 emsg);
899 cleanup_as_handle(ash); 912 cleanup_as_handle (ash);
900 GNUNET_SCHEDULER_add_now(&do_shutdown, NULL); 913 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
901 return; 914 return;
902 } 915 }
903 916
904 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n"); 917 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
905 env = GNUNET_MQ_msg(acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE); 918 env = GNUNET_MQ_msg (acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE);
906 acr_msg->id = htonl(ash->r_id); 919 acr_msg->id = htonl (ash->r_id);
907 acr_msg->op_result = htonl(GNUNET_OK); 920 acr_msg->op_result = htonl (GNUNET_OK);
908 GNUNET_MQ_send(ash->client->mq, env); 921 GNUNET_MQ_send (ash->client->mq, env);
909 cleanup_as_handle(ash); 922 cleanup_as_handle (ash);
910} 923}
911 924
912 925
@@ -916,7 +929,7 @@ attr_store_cont(void *cls, int32_t success, const char *emsg)
916 * @param cls the AttributeStoreHandle 929 * @param cls the AttributeStoreHandle
917 */ 930 */
918static void 931static void
919attr_store_task(void *cls) 932attr_store_task (void *cls)
920{ 933{
921 struct AttributeStoreHandle *ash = cls; 934 struct AttributeStoreHandle *ash = cls;
922 struct GNUNET_GNSRECORD_Data rd[1]; 935 struct GNUNET_GNSRECORD_Data rd[1];
@@ -924,32 +937,32 @@ attr_store_task(void *cls)
924 char *label; 937 char *label;
925 size_t buf_size; 938 size_t buf_size;
926 939
927 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n"); 940 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
928 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size(ash->claim); 941 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (ash->claim);
929 buf = GNUNET_malloc(buf_size); 942 buf = GNUNET_malloc (buf_size);
930 // Give the ash a new id if unset 943 // Give the ash a new id if unset
931 if (0 == ash->claim->id) 944 if (0 == ash->claim->id)
932 ash->claim->id 945 ash->claim->id
933 = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); 946 = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
934 GNUNET_RECLAIM_ATTRIBUTE_serialize(ash->claim, buf); 947 GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim, buf);
935 label 948 label
936 = GNUNET_STRINGS_data_to_string_alloc(&ash->claim->id, sizeof(uint64_t)); 949 = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id, sizeof(uint64_t));
937 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label); 950 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
938 951
939 rd[0].data_size = buf_size; 952 rd[0].data_size = buf_size;
940 rd[0].data = buf; 953 rd[0].data = buf;
941 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR; 954 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR;
942 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 955 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
943 rd[0].expiration_time = ash->exp.rel_value_us; 956 rd[0].expiration_time = ash->exp.rel_value_us;
944 ash->ns_qe = GNUNET_NAMESTORE_records_store(nsh, 957 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
945 &ash->identity, 958 &ash->identity,
946 label, 959 label,
947 1, 960 1,
948 rd, 961 rd,
949 &attr_store_cont, 962 &attr_store_cont,
950 ash); 963 ash);
951 GNUNET_free(buf); 964 GNUNET_free (buf);
952 GNUNET_free(label); 965 GNUNET_free (label);
953} 966}
954 967
955 968
@@ -960,17 +973,17 @@ attr_store_task(void *cls)
960 * @param sam the message to check 973 * @param sam the message to check
961 */ 974 */
962static int 975static int
963check_attribute_store_message(void *cls, 976check_attribute_store_message (void *cls,
964 const struct AttributeStoreMessage *sam) 977 const struct AttributeStoreMessage *sam)
965{ 978{
966 uint16_t size; 979 uint16_t size;
967 980
968 size = ntohs(sam->header.size); 981 size = ntohs (sam->header.size);
969 if (size <= sizeof(struct AttributeStoreMessage)) 982 if (size <= sizeof(struct AttributeStoreMessage))
970 { 983 {
971 GNUNET_break(0); 984 GNUNET_break (0);
972 return GNUNET_SYSERR; 985 return GNUNET_SYSERR;
973 } 986 }
974 return GNUNET_OK; 987 return GNUNET_OK;
975} 988}
976 989
@@ -982,29 +995,30 @@ check_attribute_store_message(void *cls,
982 * @param sam the message to handle 995 * @param sam the message to handle
983 */ 996 */
984static void 997static void
985handle_attribute_store_message(void *cls, 998handle_attribute_store_message (void *cls,
986 const struct AttributeStoreMessage *sam) 999 const struct AttributeStoreMessage *sam)
987{ 1000{
988 struct AttributeStoreHandle *ash; 1001 struct AttributeStoreHandle *ash;
989 struct IdpClient *idp = cls; 1002 struct IdpClient *idp = cls;
990 size_t data_len; 1003 size_t data_len;
991 1004
992 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n"); 1005 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
993 1006
994 data_len = ntohs(sam->attr_len); 1007 data_len = ntohs (sam->attr_len);
995 1008
996 ash = GNUNET_new(struct AttributeStoreHandle); 1009 ash = GNUNET_new (struct AttributeStoreHandle);
997 ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize((char *)&sam[1], data_len); 1010 ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *) &sam[1],
1011 data_len);
998 1012
999 ash->r_id = ntohl(sam->id); 1013 ash->r_id = ntohl (sam->id);
1000 ash->identity = sam->identity; 1014 ash->identity = sam->identity;
1001 ash->exp.rel_value_us = GNUNET_ntohll(sam->exp); 1015 ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1002 GNUNET_CRYPTO_ecdsa_key_get_public(&sam->identity, &ash->identity_pkey); 1016 GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, &ash->identity_pkey);
1003 1017
1004 GNUNET_SERVICE_client_continue(idp->client); 1018 GNUNET_SERVICE_client_continue (idp->client);
1005 ash->client = idp; 1019 ash->client = idp;
1006 GNUNET_CONTAINER_DLL_insert(idp->store_op_head, idp->store_op_tail, ash); 1020 GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash);
1007 GNUNET_SCHEDULER_add_now(&attr_store_task, ash); 1021 GNUNET_SCHEDULER_add_now (&attr_store_task, ash);
1008} 1022}
1009 1023
1010 1024
@@ -1015,20 +1029,20 @@ handle_attribute_store_message(void *cls,
1015 * @param success the success status 1029 * @param success the success status
1016 */ 1030 */
1017static void 1031static void
1018send_delete_response(struct AttributeDeleteHandle *adh, int32_t success) 1032send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
1019{ 1033{
1020 struct GNUNET_MQ_Envelope *env; 1034 struct GNUNET_MQ_Envelope *env;
1021 struct SuccessResultMessage *acr_msg; 1035 struct SuccessResultMessage *acr_msg;
1022 1036
1023 GNUNET_CONTAINER_DLL_remove(adh->client->delete_op_head, 1037 GNUNET_CONTAINER_DLL_remove (adh->client->delete_op_head,
1024 adh->client->delete_op_tail, 1038 adh->client->delete_op_tail,
1025 adh); 1039 adh);
1026 1040
1027 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n"); 1041 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1028 env = GNUNET_MQ_msg(acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE); 1042 env = GNUNET_MQ_msg (acr_msg, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE);
1029 acr_msg->id = htonl(adh->r_id); 1043 acr_msg->id = htonl (adh->r_id);
1030 acr_msg->op_result = htonl(success); 1044 acr_msg->op_result = htonl (success);
1031 GNUNET_MQ_send(adh->client->mq, env); 1045 GNUNET_MQ_send (adh->client->mq, env);
1032} 1046}
1033 1047
1034 1048
@@ -1043,41 +1057,41 @@ send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
1043 * @param rd record data 1057 * @param rd record data
1044 */ 1058 */
1045static void 1059static void
1046ticket_iter(void *cls, 1060ticket_iter (void *cls,
1047 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1061 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1048 const char *label, 1062 const char *label,
1049 unsigned int rd_count, 1063 unsigned int rd_count,
1050 const struct GNUNET_GNSRECORD_Data *rd) 1064 const struct GNUNET_GNSRECORD_Data *rd)
1051{ 1065{
1052 struct AttributeDeleteHandle *adh = cls; 1066 struct AttributeDeleteHandle *adh = cls;
1053 struct TicketRecordsEntry *le; 1067 struct TicketRecordsEntry *le;
1054 int has_changed = GNUNET_NO; 1068 int has_changed = GNUNET_NO;
1055 1069
1056 for (int i = 0; i < rd_count; i++) 1070 for (int i = 0; i < rd_count; i++)
1057 { 1071 {
1058 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type) 1072 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
1059 continue; 1073 continue;
1060 if (0 != memcmp(rd[i].data, &adh->claim->id, sizeof(uint64_t))) 1074 if (0 != memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t)))
1061 continue; 1075 continue;
1062 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 1076 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1063 "Attribute to delete found (%s)\n", 1077 "Attribute to delete found (%s)\n",
1064 adh->label); 1078 adh->label);
1065 has_changed = GNUNET_YES; 1079 has_changed = GNUNET_YES;
1066 break; 1080 break;
1067 } 1081 }
1068 if (GNUNET_YES == has_changed) 1082 if (GNUNET_YES == has_changed)
1069 { 1083 {
1070 le = GNUNET_new(struct TicketRecordsEntry); 1084 le = GNUNET_new (struct TicketRecordsEntry);
1071 le->data_size = GNUNET_GNSRECORD_records_get_size(rd_count, rd); 1085 le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
1072 le->data = GNUNET_malloc(le->data_size); 1086 le->data = GNUNET_malloc (le->data_size);
1073 le->rd_count = rd_count; 1087 le->rd_count = rd_count;
1074 le->label = GNUNET_strdup(label); 1088 le->label = GNUNET_strdup (label);
1075 GNUNET_GNSRECORD_records_serialize(rd_count, rd, le->data_size, le->data); 1089 GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
1076 GNUNET_CONTAINER_DLL_insert(adh->tickets_to_update_head, 1090 GNUNET_CONTAINER_DLL_insert (adh->tickets_to_update_head,
1077 adh->tickets_to_update_tail, 1091 adh->tickets_to_update_tail,
1078 le); 1092 le);
1079 } 1093 }
1080 GNUNET_NAMESTORE_zone_iterator_next(adh->ns_it, 1); 1094 GNUNET_NAMESTORE_zone_iterator_next (adh->ns_it, 1);
1081} 1095}
1082 1096
1083 1097
@@ -1086,7 +1100,7 @@ ticket_iter(void *cls,
1086 * @param cls our deletion handle 1100 * @param cls our deletion handle
1087 */ 1101 */
1088static void 1102static void
1089update_tickets(void *cls); 1103update_tickets (void *cls);
1090 1104
1091 1105
1092/** 1106/**
@@ -1097,12 +1111,12 @@ update_tickets(void *cls);
1097 * @param emsg error message (NULL if success=GNUNET_OK) 1111 * @param emsg error message (NULL if success=GNUNET_OK)
1098 */ 1112 */
1099static void 1113static void
1100ticket_updated(void *cls, int32_t success, const char *emsg) 1114ticket_updated (void *cls, int32_t success, const char *emsg)
1101{ 1115{
1102 struct AttributeDeleteHandle *adh = cls; 1116 struct AttributeDeleteHandle *adh = cls;
1103 1117
1104 adh->ns_qe = NULL; 1118 adh->ns_qe = NULL;
1105 GNUNET_SCHEDULER_add_now(&update_tickets, adh); 1119 GNUNET_SCHEDULER_add_now (&update_tickets, adh);
1106} 1120}
1107 1121
1108 1122
@@ -1114,58 +1128,58 @@ ticket_updated(void *cls, int32_t success, const char *emsg)
1114 * @param cls our attribute deletion handle 1128 * @param cls our attribute deletion handle
1115 */ 1129 */
1116static void 1130static void
1117update_tickets(void *cls) 1131update_tickets (void *cls)
1118{ 1132{
1119 struct AttributeDeleteHandle *adh = cls; 1133 struct AttributeDeleteHandle *adh = cls;
1120 struct TicketRecordsEntry *le; 1134 struct TicketRecordsEntry *le;
1121 1135
1122 if (NULL == adh->tickets_to_update_head) 1136 if (NULL == adh->tickets_to_update_head)
1123 { 1137 {
1124 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 1138 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1125 "Finished updatding tickets, success\n"); 1139 "Finished updatding tickets, success\n");
1126 send_delete_response(adh, GNUNET_OK); 1140 send_delete_response (adh, GNUNET_OK);
1127 cleanup_adh(adh); 1141 cleanup_adh (adh);
1128 return; 1142 return;
1129 } 1143 }
1130 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 1144 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1131 "Updating %s\n", 1145 "Updating %s\n",
1132 adh->tickets_to_update_head->label); 1146 adh->tickets_to_update_head->label);
1133 le = adh->tickets_to_update_head; 1147 le = adh->tickets_to_update_head;
1134 GNUNET_CONTAINER_DLL_remove(adh->tickets_to_update_head, 1148 GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head,
1135 adh->tickets_to_update_tail, 1149 adh->tickets_to_update_tail,
1136 le); 1150 le);
1137 struct GNUNET_GNSRECORD_Data rd[le->rd_count]; 1151 struct GNUNET_GNSRECORD_Data rd[le->rd_count];
1138 struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1]; 1152 struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1];
1139 if (GNUNET_OK != GNUNET_GNSRECORD_records_deserialize(le->data_size, 1153 if (GNUNET_OK != GNUNET_GNSRECORD_records_deserialize (le->data_size,
1140 le->data, 1154 le->data,
1141 le->rd_count, 1155 le->rd_count,
1142 rd)) 1156 rd))
1143 { 1157 {
1144 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 1158 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1145 "Unable to deserialize record data!\n"); 1159 "Unable to deserialize record data!\n");
1146 send_delete_response(adh, GNUNET_SYSERR); 1160 send_delete_response (adh, GNUNET_SYSERR);
1147 cleanup_adh(adh); 1161 cleanup_adh (adh);
1148 return; 1162 return;
1149 } 1163 }
1150 int j = 0; 1164 int j = 0;
1151 for (int i = 0; i < le->rd_count; i++) 1165 for (int i = 0; i < le->rd_count; i++)
1152 { 1166 {
1153 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type) 1167 if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF == rd[i].record_type)
1154 && (0 == memcmp(rd[i].data, &adh->claim->id, sizeof(uint64_t)))) 1168 && (0 == memcmp (rd[i].data, &adh->claim->id, sizeof(uint64_t))))
1155 continue; 1169 continue;
1156 rd_new[j] = rd[i]; 1170 rd_new[j] = rd[i];
1157 j++; 1171 j++;
1158 } 1172 }
1159 adh->ns_qe = GNUNET_NAMESTORE_records_store(nsh, 1173 adh->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1160 &adh->identity, 1174 &adh->identity,
1161 le->label, 1175 le->label,
1162 j, 1176 j,
1163 rd_new, 1177 rd_new,
1164 &ticket_updated, 1178 &ticket_updated,
1165 adh); 1179 adh);
1166 GNUNET_free(le->label); 1180 GNUNET_free (le->label);
1167 GNUNET_free(le->data); 1181 GNUNET_free (le->data);
1168 GNUNET_free(le); 1182 GNUNET_free (le);
1169} 1183}
1170 1184
1171 1185
@@ -1175,12 +1189,12 @@ update_tickets(void *cls)
1175 * @param cls our attribute deletion handle 1189 * @param cls our attribute deletion handle
1176 */ 1190 */
1177static void 1191static void
1178ticket_iter_fin(void *cls) 1192ticket_iter_fin (void *cls)
1179{ 1193{
1180 struct AttributeDeleteHandle *adh = cls; 1194 struct AttributeDeleteHandle *adh = cls;
1181 1195
1182 adh->ns_it = NULL; 1196 adh->ns_it = NULL;
1183 GNUNET_SCHEDULER_add_now(&update_tickets, adh); 1197 GNUNET_SCHEDULER_add_now (&update_tickets, adh);
1184} 1198}
1185 1199
1186 1200
@@ -1190,16 +1204,16 @@ ticket_iter_fin(void *cls)
1190 * @param cls our attribute deletion handle 1204 * @param cls our attribute deletion handle
1191 */ 1205 */
1192static void 1206static void
1193ticket_iter_err(void *cls) 1207ticket_iter_err (void *cls)
1194{ 1208{
1195 struct AttributeDeleteHandle *adh = cls; 1209 struct AttributeDeleteHandle *adh = cls;
1196 1210
1197 adh->ns_it = NULL; 1211 adh->ns_it = NULL;
1198 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 1212 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1199 "Namestore error on delete %s\n", 1213 "Namestore error on delete %s\n",
1200 adh->label); 1214 adh->label);
1201 send_delete_response(adh, GNUNET_SYSERR); 1215 send_delete_response (adh, GNUNET_SYSERR);
1202 cleanup_adh(adh); 1216 cleanup_adh (adh);
1203} 1217}
1204 1218
1205 1219
@@ -1210,18 +1224,18 @@ ticket_iter_err(void *cls)
1210 * @param cls attribute deletion handle 1224 * @param cls attribute deletion handle
1211 */ 1225 */
1212static void 1226static void
1213start_ticket_update(void *cls) 1227start_ticket_update (void *cls)
1214{ 1228{
1215 struct AttributeDeleteHandle *adh = cls; 1229 struct AttributeDeleteHandle *adh = cls;
1216 1230
1217 adh->ns_it = GNUNET_NAMESTORE_zone_iteration_start(nsh, 1231 adh->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh,
1218 &adh->identity, 1232 &adh->identity,
1219 &ticket_iter_err, 1233 &ticket_iter_err,
1220 adh, 1234 adh,
1221 &ticket_iter, 1235 &ticket_iter,
1222 adh, 1236 adh,
1223 &ticket_iter_fin, 1237 &ticket_iter_fin,
1224 adh); 1238 adh);
1225} 1239}
1226 1240
1227 1241
@@ -1233,22 +1247,22 @@ start_ticket_update(void *cls)
1233 * @param emsg error message (NULL if success=GNUNET_OK) 1247 * @param emsg error message (NULL if success=GNUNET_OK)
1234 */ 1248 */
1235static void 1249static void
1236attr_delete_cont(void *cls, int32_t success, const char *emsg) 1250attr_delete_cont (void *cls, int32_t success, const char *emsg)
1237{ 1251{
1238 struct AttributeDeleteHandle *adh = cls; 1252 struct AttributeDeleteHandle *adh = cls;
1239 1253
1240 adh->ns_qe = NULL; 1254 adh->ns_qe = NULL;
1241 if (GNUNET_SYSERR == success) 1255 if (GNUNET_SYSERR == success)
1242 { 1256 {
1243 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 1257 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1244 "Error deleting attribute %s\n", 1258 "Error deleting attribute %s\n",
1245 adh->label); 1259 adh->label);
1246 send_delete_response(adh, GNUNET_SYSERR); 1260 send_delete_response (adh, GNUNET_SYSERR);
1247 cleanup_adh(adh); 1261 cleanup_adh (adh);
1248 return; 1262 return;
1249 } 1263 }
1250 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n"); 1264 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1251 GNUNET_SCHEDULER_add_now(&start_ticket_update, adh); 1265 GNUNET_SCHEDULER_add_now (&start_ticket_update, adh);
1252} 1266}
1253 1267
1254 1268
@@ -1259,17 +1273,17 @@ attr_delete_cont(void *cls, int32_t success, const char *emsg)
1259 * @dam message to check 1273 * @dam message to check
1260 */ 1274 */
1261static int 1275static int
1262check_attribute_delete_message(void *cls, 1276check_attribute_delete_message (void *cls,
1263 const struct AttributeDeleteMessage *dam) 1277 const struct AttributeDeleteMessage *dam)
1264{ 1278{
1265 uint16_t size; 1279 uint16_t size;
1266 1280
1267 size = ntohs(dam->header.size); 1281 size = ntohs (dam->header.size);
1268 if (size <= sizeof(struct AttributeDeleteMessage)) 1282 if (size <= sizeof(struct AttributeDeleteMessage))
1269 { 1283 {
1270 GNUNET_break(0); 1284 GNUNET_break (0);
1271 return GNUNET_SYSERR; 1285 return GNUNET_SYSERR;
1272 } 1286 }
1273 return GNUNET_OK; 1287 return GNUNET_OK;
1274} 1288}
1275 1289
@@ -1281,34 +1295,35 @@ check_attribute_delete_message(void *cls,
1281 * @param dam deletion message 1295 * @param dam deletion message
1282 */ 1296 */
1283static void 1297static void
1284handle_attribute_delete_message(void *cls, 1298handle_attribute_delete_message (void *cls,
1285 const struct AttributeDeleteMessage *dam) 1299 const struct AttributeDeleteMessage *dam)
1286{ 1300{
1287 struct AttributeDeleteHandle *adh; 1301 struct AttributeDeleteHandle *adh;
1288 struct IdpClient *idp = cls; 1302 struct IdpClient *idp = cls;
1289 size_t data_len; 1303 size_t data_len;
1290 1304
1291 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n"); 1305 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n");
1292 1306
1293 data_len = ntohs(dam->attr_len); 1307 data_len = ntohs (dam->attr_len);
1294 1308
1295 adh = GNUNET_new(struct AttributeDeleteHandle); 1309 adh = GNUNET_new (struct AttributeDeleteHandle);
1296 adh->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize((char *)&dam[1], data_len); 1310 adh->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char *) &dam[1],
1311 data_len);
1297 1312
1298 adh->r_id = ntohl(dam->id); 1313 adh->r_id = ntohl (dam->id);
1299 adh->identity = dam->identity; 1314 adh->identity = dam->identity;
1300 adh->label 1315 adh->label
1301 = GNUNET_STRINGS_data_to_string_alloc(&adh->claim->id, sizeof(uint64_t)); 1316 = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id, sizeof(uint64_t));
1302 GNUNET_SERVICE_client_continue(idp->client); 1317 GNUNET_SERVICE_client_continue (idp->client);
1303 adh->client = idp; 1318 adh->client = idp;
1304 GNUNET_CONTAINER_DLL_insert(idp->delete_op_head, idp->delete_op_tail, adh); 1319 GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh);
1305 adh->ns_qe = GNUNET_NAMESTORE_records_store(nsh, 1320 adh->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1306 &adh->identity, 1321 &adh->identity,
1307 adh->label, 1322 adh->label,
1308 0, 1323 0,
1309 NULL, 1324 NULL,
1310 &attr_delete_cont, 1325 &attr_delete_cont,
1311 adh); 1326 adh);
1312} 1327}
1313 1328
1314 1329
@@ -1323,21 +1338,21 @@ handle_attribute_delete_message(void *cls,
1323 * @param cls our iterator handle 1338 * @param cls our iterator handle
1324 */ 1339 */
1325static void 1340static void
1326attr_iter_finished(void *cls) 1341attr_iter_finished (void *cls)
1327{ 1342{
1328 struct AttributeIterator *ai = cls; 1343 struct AttributeIterator *ai = cls;
1329 struct GNUNET_MQ_Envelope *env; 1344 struct GNUNET_MQ_Envelope *env;
1330 struct AttributeResultMessage *arm; 1345 struct AttributeResultMessage *arm;
1331 1346
1332 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n"); 1347 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
1333 env = GNUNET_MQ_msg(arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); 1348 env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
1334 arm->id = htonl(ai->request_id); 1349 arm->id = htonl (ai->request_id);
1335 arm->attr_len = htons(0); 1350 arm->attr_len = htons (0);
1336 GNUNET_MQ_send(ai->client->mq, env); 1351 GNUNET_MQ_send (ai->client->mq, env);
1337 GNUNET_CONTAINER_DLL_remove(ai->client->attr_iter_head, 1352 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
1338 ai->client->attr_iter_tail, 1353 ai->client->attr_iter_tail,
1339 ai); 1354 ai);
1340 GNUNET_free(ai); 1355 GNUNET_free (ai);
1341} 1356}
1342 1357
1343/** 1358/**
@@ -1346,12 +1361,12 @@ attr_iter_finished(void *cls)
1346 * @param cls our attribute iteration handle 1361 * @param cls our attribute iteration handle
1347 */ 1362 */
1348static void 1363static void
1349attr_iter_error(void *cls) 1364attr_iter_error (void *cls)
1350{ 1365{
1351 struct AttributeIterator *ai = cls; 1366 struct AttributeIterator *ai = cls;
1352 1367
1353 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n"); 1368 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1354 attr_iter_finished(ai); 1369 attr_iter_finished (ai);
1355} 1370}
1356 1371
1357 1372
@@ -1365,11 +1380,11 @@ attr_iter_error(void *cls)
1365 * @param rd records 1380 * @param rd records
1366 */ 1381 */
1367static void 1382static void
1368attr_iter_cb(void *cls, 1383attr_iter_cb (void *cls,
1369 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 1384 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
1370 const char *label, 1385 const char *label,
1371 unsigned int rd_count, 1386 unsigned int rd_count,
1372 const struct GNUNET_GNSRECORD_Data *rd) 1387 const struct GNUNET_GNSRECORD_Data *rd)
1373{ 1388{
1374 struct AttributeIterator *ai = cls; 1389 struct AttributeIterator *ai = cls;
1375 struct AttributeResultMessage *arm; 1390 struct AttributeResultMessage *arm;
@@ -1377,27 +1392,27 @@ attr_iter_cb(void *cls,
1377 char *data_tmp; 1392 char *data_tmp;
1378 1393
1379 if (rd_count != 1) 1394 if (rd_count != 1)
1380 { 1395 {
1381 GNUNET_NAMESTORE_zone_iterator_next(ai->ns_it, 1); 1396 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
1382 return; 1397 return;
1383 } 1398 }
1384 1399
1385 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd->record_type) 1400 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd->record_type)
1386 { 1401 {
1387 GNUNET_NAMESTORE_zone_iterator_next(ai->ns_it, 1); 1402 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
1388 return; 1403 return;
1389 } 1404 }
1390 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", label); 1405 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", label);
1391 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n"); 1406 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
1392 env = GNUNET_MQ_msg_extra(arm, 1407 env = GNUNET_MQ_msg_extra (arm,
1393 rd->data_size, 1408 rd->data_size,
1394 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); 1409 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
1395 arm->id = htonl(ai->request_id); 1410 arm->id = htonl (ai->request_id);
1396 arm->attr_len = htons(rd->data_size); 1411 arm->attr_len = htons (rd->data_size);
1397 GNUNET_CRYPTO_ecdsa_key_get_public(zone, &arm->identity); 1412 GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
1398 data_tmp = (char *)&arm[1]; 1413 data_tmp = (char *) &arm[1];
1399 GNUNET_memcpy(data_tmp, rd->data, rd->data_size); 1414 GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1400 GNUNET_MQ_send(ai->client->mq, env); 1415 GNUNET_MQ_send (ai->client->mq, env);
1401} 1416}
1402 1417
1403 1418
@@ -1408,29 +1423,29 @@ attr_iter_cb(void *cls,
1408 * @param ais_msg the iteration message to start 1423 * @param ais_msg the iteration message to start
1409 */ 1424 */
1410static void 1425static void
1411handle_iteration_start(void *cls, 1426handle_iteration_start (void *cls,
1412 const struct AttributeIterationStartMessage *ais_msg) 1427 const struct AttributeIterationStartMessage *ais_msg)
1413{ 1428{
1414 struct IdpClient *idp = cls; 1429 struct IdpClient *idp = cls;
1415 struct AttributeIterator *ai; 1430 struct AttributeIterator *ai;
1416 1431
1417 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1432 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1418 "Received ATTRIBUTE_ITERATION_START message\n"); 1433 "Received ATTRIBUTE_ITERATION_START message\n");
1419 ai = GNUNET_new(struct AttributeIterator); 1434 ai = GNUNET_new (struct AttributeIterator);
1420 ai->request_id = ntohl(ais_msg->id); 1435 ai->request_id = ntohl (ais_msg->id);
1421 ai->client = idp; 1436 ai->client = idp;
1422 ai->identity = ais_msg->identity; 1437 ai->identity = ais_msg->identity;
1423 1438
1424 GNUNET_CONTAINER_DLL_insert(idp->attr_iter_head, idp->attr_iter_tail, ai); 1439 GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, idp->attr_iter_tail, ai);
1425 ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start(nsh, 1440 ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh,
1426 &ai->identity, 1441 &ai->identity,
1427 &attr_iter_error, 1442 &attr_iter_error,
1428 ai, 1443 ai,
1429 &attr_iter_cb, 1444 &attr_iter_cb,
1430 ai, 1445 ai,
1431 &attr_iter_finished, 1446 &attr_iter_finished,
1432 ai); 1447 ai);
1433 GNUNET_SERVICE_client_continue(idp->client); 1448 GNUNET_SERVICE_client_continue (idp->client);
1434} 1449}
1435 1450
1436 1451
@@ -1441,29 +1456,29 @@ handle_iteration_start(void *cls,
1441 * @param ais_msg the stop message 1456 * @param ais_msg the stop message
1442 */ 1457 */
1443static void 1458static void
1444handle_iteration_stop(void *cls, 1459handle_iteration_stop (void *cls,
1445 const struct AttributeIterationStopMessage *ais_msg) 1460 const struct AttributeIterationStopMessage *ais_msg)
1446{ 1461{
1447 struct IdpClient *idp = cls; 1462 struct IdpClient *idp = cls;
1448 struct AttributeIterator *ai; 1463 struct AttributeIterator *ai;
1449 uint32_t rid; 1464 uint32_t rid;
1450 1465
1451 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1466 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1452 "Received `%s' message\n", 1467 "Received `%s' message\n",
1453 "ATTRIBUTE_ITERATION_STOP"); 1468 "ATTRIBUTE_ITERATION_STOP");
1454 rid = ntohl(ais_msg->id); 1469 rid = ntohl (ais_msg->id);
1455 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next) 1470 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1456 if (ai->request_id == rid) 1471 if (ai->request_id == rid)
1457 break; 1472 break;
1458 if (NULL == ai) 1473 if (NULL == ai)
1459 { 1474 {
1460 GNUNET_break(0); 1475 GNUNET_break (0);
1461 GNUNET_SERVICE_client_drop(idp->client); 1476 GNUNET_SERVICE_client_drop (idp->client);
1462 return; 1477 return;
1463 } 1478 }
1464 GNUNET_CONTAINER_DLL_remove(idp->attr_iter_head, idp->attr_iter_tail, ai); 1479 GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai);
1465 GNUNET_free(ai); 1480 GNUNET_free (ai);
1466 GNUNET_SERVICE_client_continue(idp->client); 1481 GNUNET_SERVICE_client_continue (idp->client);
1467} 1482}
1468 1483
1469 1484
@@ -1474,27 +1489,27 @@ handle_iteration_stop(void *cls,
1474 * @param ais_msg the message 1489 * @param ais_msg the message
1475 */ 1490 */
1476static void 1491static void
1477handle_iteration_next(void *cls, 1492handle_iteration_next (void *cls,
1478 const struct AttributeIterationNextMessage *ais_msg) 1493 const struct AttributeIterationNextMessage *ais_msg)
1479{ 1494{
1480 struct IdpClient *idp = cls; 1495 struct IdpClient *idp = cls;
1481 struct AttributeIterator *ai; 1496 struct AttributeIterator *ai;
1482 uint32_t rid; 1497 uint32_t rid;
1483 1498
1484 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1499 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1485 "Received ATTRIBUTE_ITERATION_NEXT message\n"); 1500 "Received ATTRIBUTE_ITERATION_NEXT message\n");
1486 rid = ntohl(ais_msg->id); 1501 rid = ntohl (ais_msg->id);
1487 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next) 1502 for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1488 if (ai->request_id == rid) 1503 if (ai->request_id == rid)
1489 break; 1504 break;
1490 if (NULL == ai) 1505 if (NULL == ai)
1491 { 1506 {
1492 GNUNET_break(0); 1507 GNUNET_break (0);
1493 GNUNET_SERVICE_client_drop(idp->client); 1508 GNUNET_SERVICE_client_drop (idp->client);
1494 return; 1509 return;
1495 } 1510 }
1496 GNUNET_NAMESTORE_zone_iterator_next(ai->ns_it, 1); 1511 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
1497 GNUNET_SERVICE_client_continue(idp->client); 1512 GNUNET_SERVICE_client_continue (idp->client);
1498} 1513}
1499 1514
1500/****************************************************** 1515/******************************************************
@@ -1508,29 +1523,29 @@ handle_iteration_next(void *cls,
1508 * @param ticket the ticket 1523 * @param ticket the ticket
1509 */ 1524 */
1510static void 1525static void
1511ticket_iter_cb(void *cls, struct GNUNET_RECLAIM_Ticket *ticket) 1526ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
1512{ 1527{
1513 struct TicketIteration *ti = cls; 1528 struct TicketIteration *ti = cls;
1514 struct GNUNET_MQ_Envelope *env; 1529 struct GNUNET_MQ_Envelope *env;
1515 struct TicketResultMessage *trm; 1530 struct TicketResultMessage *trm;
1516 1531
1517 env = GNUNET_MQ_msg(trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); 1532 env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
1518 if (NULL == ticket) 1533 if (NULL == ticket)
1519 { 1534 {
1520 /* send empty response to indicate end of list */ 1535 /* send empty response to indicate end of list */
1521 GNUNET_CONTAINER_DLL_remove(ti->client->ticket_iter_head, 1536 GNUNET_CONTAINER_DLL_remove (ti->client->ticket_iter_head,
1522 ti->client->ticket_iter_tail, 1537 ti->client->ticket_iter_tail,
1523 ti); 1538 ti);
1524 } 1539 }
1525 else 1540 else
1526 { 1541 {
1527 trm->ticket = *ticket; 1542 trm->ticket = *ticket;
1528 } 1543 }
1529 trm->id = htonl(ti->r_id); 1544 trm->id = htonl (ti->r_id);
1530 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); 1545 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
1531 GNUNET_MQ_send(ti->client->mq, env); 1546 GNUNET_MQ_send (ti->client->mq, env);
1532 if (NULL == ticket) 1547 if (NULL == ticket)
1533 GNUNET_free(ti); 1548 GNUNET_free (ti);
1534} 1549}
1535 1550
1536 1551
@@ -1541,25 +1556,25 @@ ticket_iter_cb(void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
1541 * @param tis_msg the iteration request message 1556 * @param tis_msg the iteration request message
1542 */ 1557 */
1543static void 1558static void
1544handle_ticket_iteration_start( 1559handle_ticket_iteration_start (
1545 void *cls, 1560 void *cls,
1546 const struct TicketIterationStartMessage *tis_msg) 1561 const struct TicketIterationStartMessage *tis_msg)
1547{ 1562{
1548 struct IdpClient *client = cls; 1563 struct IdpClient *client = cls;
1549 struct TicketIteration *ti; 1564 struct TicketIteration *ti;
1550 1565
1551 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1566 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1552 "Received TICKET_ITERATION_START message\n"); 1567 "Received TICKET_ITERATION_START message\n");
1553 ti = GNUNET_new(struct TicketIteration); 1568 ti = GNUNET_new (struct TicketIteration);
1554 ti->r_id = ntohl(tis_msg->id); 1569 ti->r_id = ntohl (tis_msg->id);
1555 ti->client = client; 1570 ti->client = client;
1556 1571
1557 GNUNET_CONTAINER_DLL_insert(client->ticket_iter_head, 1572 GNUNET_CONTAINER_DLL_insert (client->ticket_iter_head,
1558 client->ticket_iter_tail, 1573 client->ticket_iter_tail,
1559 ti); 1574 ti);
1560 ti->iter 1575 ti->iter
1561 = RECLAIM_TICKETS_iteration_start(&tis_msg->identity, &ticket_iter_cb, ti); 1576 = RECLAIM_TICKETS_iteration_start (&tis_msg->identity, &ticket_iter_cb, ti);
1562 GNUNET_SERVICE_client_continue(client->client); 1577 GNUNET_SERVICE_client_continue (client->client);
1563} 1578}
1564 1579
1565 1580
@@ -1570,32 +1585,32 @@ handle_ticket_iteration_start(
1570 * @param tis_msg the stop message 1585 * @param tis_msg the stop message
1571 */ 1586 */
1572static void 1587static void
1573handle_ticket_iteration_stop(void *cls, 1588handle_ticket_iteration_stop (void *cls,
1574 const struct TicketIterationStopMessage *tis_msg) 1589 const struct TicketIterationStopMessage *tis_msg)
1575{ 1590{
1576 struct IdpClient *client = cls; 1591 struct IdpClient *client = cls;
1577 struct TicketIteration *ti; 1592 struct TicketIteration *ti;
1578 uint32_t rid; 1593 uint32_t rid;
1579 1594
1580 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1595 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1581 "Received `%s' message\n", 1596 "Received `%s' message\n",
1582 "TICKET_ITERATION_STOP"); 1597 "TICKET_ITERATION_STOP");
1583 rid = ntohl(tis_msg->id); 1598 rid = ntohl (tis_msg->id);
1584 for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next) 1599 for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
1585 if (ti->r_id == rid) 1600 if (ti->r_id == rid)
1586 break; 1601 break;
1587 if (NULL == ti) 1602 if (NULL == ti)
1588 { 1603 {
1589 GNUNET_break(0); 1604 GNUNET_break (0);
1590 GNUNET_SERVICE_client_drop(client->client); 1605 GNUNET_SERVICE_client_drop (client->client);
1591 return; 1606 return;
1592 } 1607 }
1593 RECLAIM_TICKETS_iteration_stop(ti->iter); 1608 RECLAIM_TICKETS_iteration_stop (ti->iter);
1594 GNUNET_CONTAINER_DLL_remove(client->ticket_iter_head, 1609 GNUNET_CONTAINER_DLL_remove (client->ticket_iter_head,
1595 client->ticket_iter_tail, 1610 client->ticket_iter_tail,
1596 ti); 1611 ti);
1597 GNUNET_free(ti); 1612 GNUNET_free (ti);
1598 GNUNET_SERVICE_client_continue(client->client); 1613 GNUNET_SERVICE_client_continue (client->client);
1599} 1614}
1600 1615
1601 1616
@@ -1606,27 +1621,27 @@ handle_ticket_iteration_stop(void *cls,
1606 * @param tis_msg the message 1621 * @param tis_msg the message
1607 */ 1622 */
1608static void 1623static void
1609handle_ticket_iteration_next(void *cls, 1624handle_ticket_iteration_next (void *cls,
1610 const struct TicketIterationNextMessage *tis_msg) 1625 const struct TicketIterationNextMessage *tis_msg)
1611{ 1626{
1612 struct IdpClient *client = cls; 1627 struct IdpClient *client = cls;
1613 struct TicketIteration *ti; 1628 struct TicketIteration *ti;
1614 uint32_t rid; 1629 uint32_t rid;
1615 1630
1616 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 1631 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1617 "Received TICKET_ITERATION_NEXT message\n"); 1632 "Received TICKET_ITERATION_NEXT message\n");
1618 rid = ntohl(tis_msg->id); 1633 rid = ntohl (tis_msg->id);
1619 for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next) 1634 for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
1620 if (ti->r_id == rid) 1635 if (ti->r_id == rid)
1621 break; 1636 break;
1622 if (NULL == ti) 1637 if (NULL == ti)
1623 { 1638 {
1624 GNUNET_break(0); 1639 GNUNET_break (0);
1625 GNUNET_SERVICE_client_drop(client->client); 1640 GNUNET_SERVICE_client_drop (client->client);
1626 return; 1641 return;
1627 } 1642 }
1628 RECLAIM_TICKETS_iteration_next(ti->iter); 1643 RECLAIM_TICKETS_iteration_next (ti->iter);
1629 GNUNET_SERVICE_client_continue(client->client); 1644 GNUNET_SERVICE_client_continue (client->client);
1630} 1645}
1631 1646
1632 1647
@@ -1638,28 +1653,28 @@ handle_ticket_iteration_next(void *cls,
1638 * @param server the service handle 1653 * @param server the service handle
1639 */ 1654 */
1640static void 1655static void
1641run(void *cls, 1656run (void *cls,
1642 const struct GNUNET_CONFIGURATION_Handle *c, 1657 const struct GNUNET_CONFIGURATION_Handle *c,
1643 struct GNUNET_SERVICE_Handle *server) 1658 struct GNUNET_SERVICE_Handle *server)
1644{ 1659{
1645 cfg = c; 1660 cfg = c;
1646 1661
1647 if (GNUNET_OK != RECLAIM_TICKETS_init(cfg)) 1662 if (GNUNET_OK != RECLAIM_TICKETS_init (cfg))
1648 { 1663 {
1649 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 1664 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1650 "Unable to initialize TICKETS subsystem.\n"); 1665 "Unable to initialize TICKETS subsystem.\n");
1651 GNUNET_SCHEDULER_shutdown(); 1666 GNUNET_SCHEDULER_shutdown ();
1652 return; 1667 return;
1653 } 1668 }
1654 // Connect to identity and namestore services 1669 // Connect to identity and namestore services
1655 nsh = GNUNET_NAMESTORE_connect(cfg); 1670 nsh = GNUNET_NAMESTORE_connect (cfg);
1656 if (NULL == nsh) 1671 if (NULL == nsh)
1657 { 1672 {
1658 GNUNET_log_strerror(GNUNET_ERROR_TYPE_ERROR, 1673 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
1659 "error connecting to namestore"); 1674 "error connecting to namestore");
1660 } 1675 }
1661 1676
1662 GNUNET_SCHEDULER_add_shutdown(&do_shutdown, NULL); 1677 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
1663} 1678}
1664 1679
1665 1680
@@ -1671,17 +1686,17 @@ run(void *cls,
1671 * @param app_ctx @a client 1686 * @param app_ctx @a client
1672 */ 1687 */
1673static void 1688static void
1674client_disconnect_cb(void *cls, 1689client_disconnect_cb (void *cls,
1675 struct GNUNET_SERVICE_Client *client, 1690 struct GNUNET_SERVICE_Client *client,
1676 void *app_ctx) 1691 void *app_ctx)
1677{ 1692{
1678 struct IdpClient *idp = app_ctx; 1693 struct IdpClient *idp = app_ctx;
1679 1694
1680 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); 1695 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
1681 GNUNET_CONTAINER_DLL_remove(client_list_head, 1696 GNUNET_CONTAINER_DLL_remove (client_list_head,
1682 client_list_tail, 1697 client_list_tail,
1683 idp); 1698 idp);
1684 cleanup_client(idp); 1699 cleanup_client (idp);
1685} 1700}
1686 1701
1687 1702
@@ -1694,19 +1709,19 @@ client_disconnect_cb(void *cls,
1694 * @return internal namestore client structure for this client 1709 * @return internal namestore client structure for this client
1695 */ 1710 */
1696static void * 1711static void *
1697client_connect_cb(void *cls, 1712client_connect_cb (void *cls,
1698 struct GNUNET_SERVICE_Client *client, 1713 struct GNUNET_SERVICE_Client *client,
1699 struct GNUNET_MQ_Handle *mq) 1714 struct GNUNET_MQ_Handle *mq)
1700{ 1715{
1701 struct IdpClient *idp; 1716 struct IdpClient *idp;
1702 1717
1703 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client); 1718 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
1704 idp = GNUNET_new(struct IdpClient); 1719 idp = GNUNET_new (struct IdpClient);
1705 idp->client = client; 1720 idp->client = client;
1706 idp->mq = mq; 1721 idp->mq = mq;
1707 GNUNET_CONTAINER_DLL_insert(client_list_head, 1722 GNUNET_CONTAINER_DLL_insert (client_list_head,
1708 client_list_tail, 1723 client_list_tail,
1709 idp); 1724 idp);
1710 return idp; 1725 return idp;
1711} 1726}
1712 1727
@@ -1714,57 +1729,57 @@ client_connect_cb(void *cls,
1714/** 1729/**
1715 * Define "main" method using service macro. 1730 * Define "main" method using service macro.
1716 */ 1731 */
1717GNUNET_SERVICE_MAIN( 1732GNUNET_SERVICE_MAIN (
1718 "reclaim", 1733 "reclaim",
1719 GNUNET_SERVICE_OPTION_NONE, 1734 GNUNET_SERVICE_OPTION_NONE,
1720 &run, 1735 &run,
1721 &client_connect_cb, 1736 &client_connect_cb,
1722 &client_disconnect_cb, 1737 &client_disconnect_cb,
1723 NULL, 1738 NULL,
1724 GNUNET_MQ_hd_var_size(attribute_store_message, 1739 GNUNET_MQ_hd_var_size (attribute_store_message,
1725 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, 1740 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
1726 struct AttributeStoreMessage, 1741 struct AttributeStoreMessage,
1727 NULL), 1742 NULL),
1728 GNUNET_MQ_hd_var_size(attribute_delete_message, 1743 GNUNET_MQ_hd_var_size (attribute_delete_message,
1729 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, 1744 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE,
1730 struct AttributeDeleteMessage, 1745 struct AttributeDeleteMessage,
1731 NULL), 1746 NULL),
1732 GNUNET_MQ_hd_fixed_size( 1747 GNUNET_MQ_hd_fixed_size (
1733 iteration_start, 1748 iteration_start,
1734 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, 1749 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
1735 struct AttributeIterationStartMessage, 1750 struct AttributeIterationStartMessage,
1736 NULL), 1751 NULL),
1737 GNUNET_MQ_hd_fixed_size(iteration_next, 1752 GNUNET_MQ_hd_fixed_size (iteration_next,
1738 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, 1753 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
1739 struct AttributeIterationNextMessage, 1754 struct AttributeIterationNextMessage,
1740 NULL), 1755 NULL),
1741 GNUNET_MQ_hd_fixed_size(iteration_stop, 1756 GNUNET_MQ_hd_fixed_size (iteration_stop,
1742 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, 1757 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
1743 struct AttributeIterationStopMessage, 1758 struct AttributeIterationStopMessage,
1744 NULL), 1759 NULL),
1745 GNUNET_MQ_hd_var_size(issue_ticket_message, 1760 GNUNET_MQ_hd_var_size (issue_ticket_message,
1746 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, 1761 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
1747 struct IssueTicketMessage, 1762 struct IssueTicketMessage,
1748 NULL), 1763 NULL),
1749 GNUNET_MQ_hd_var_size(consume_ticket_message, 1764 GNUNET_MQ_hd_var_size (consume_ticket_message,
1750 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, 1765 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
1751 struct ConsumeTicketMessage, 1766 struct ConsumeTicketMessage,
1752 NULL), 1767 NULL),
1753 GNUNET_MQ_hd_fixed_size(ticket_iteration_start, 1768 GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
1754 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, 1769 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
1755 struct TicketIterationStartMessage, 1770 struct TicketIterationStartMessage,
1756 NULL), 1771 NULL),
1757 GNUNET_MQ_hd_fixed_size(ticket_iteration_next, 1772 GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
1758 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, 1773 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
1759 struct TicketIterationNextMessage, 1774 struct TicketIterationNextMessage,
1760 NULL), 1775 NULL),
1761 GNUNET_MQ_hd_fixed_size(ticket_iteration_stop, 1776 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
1762 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, 1777 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
1763 struct TicketIterationStopMessage, 1778 struct TicketIterationStopMessage,
1764 NULL), 1779 NULL),
1765 GNUNET_MQ_hd_var_size(revoke_ticket_message, 1780 GNUNET_MQ_hd_var_size (revoke_ticket_message,
1766 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, 1781 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
1767 struct RevokeTicketMessage, 1782 struct RevokeTicketMessage,
1768 NULL), 1783 NULL),
1769 GNUNET_MQ_handler_end()); 1784 GNUNET_MQ_handler_end ());
1770/* end of gnunet-service-reclaim.c */ 1785/* end of gnunet-service-reclaim.c */