aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-service-reclaim.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-05-22 16:25:38 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-05-22 16:25:38 +0200
commitb2e257ecb9c82b19f6ab23431faa3605718d3f01 (patch)
tree767b8cf35d6e1c9a741ee7e87f33dc852a6593cc /src/reclaim/gnunet-service-reclaim.c
parentf9c41505dd2ad80d08d6b516c534df0a66ea55fc (diff)
downloadgnunet-b2e257ecb9c82b19f6ab23431faa3605718d3f01.tar.gz
gnunet-b2e257ecb9c82b19f6ab23431faa3605718d3f01.zip
clang-format and cleanup
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c197
1 files changed, 54 insertions, 143 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index 1447f71f6..ffc67c5ae 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -28,34 +28,12 @@
28#include "gnunet-service-reclaim_tickets.h" 28#include "gnunet-service-reclaim_tickets.h"
29#include "gnunet_constants.h" 29#include "gnunet_constants.h"
30#include "gnunet_gnsrecord_lib.h" 30#include "gnunet_gnsrecord_lib.h"
31#include "gnunet_identity_service.h"
32#include "gnunet_namestore_service.h"
33#include "gnunet_protocols.h" 31#include "gnunet_protocols.h"
34#include "gnunet_reclaim_attribute_lib.h" 32#include "gnunet_reclaim_attribute_lib.h"
35#include "gnunet_reclaim_service.h" 33#include "gnunet_reclaim_service.h"
36#include "gnunet_signatures.h" 34#include "gnunet_signatures.h"
37#include "reclaim.h" 35#include "reclaim.h"
38 36
39/**
40 * First pass state
41 */
42#define STATE_INIT 0
43
44/**
45 * Normal operation state
46 */
47#define STATE_POST_INIT 1
48
49/**
50 * Minimum interval between updates
51 */
52#define MIN_WAIT_TIME GNUNET_TIME_UNIT_MINUTES
53
54
55/**
56 * Identity handle
57 */
58static struct GNUNET_IDENTITY_Handle *identity_handle;
59 37
60/** 38/**
61 * Namestore handle 39 * Namestore handle
@@ -68,11 +46,6 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
68static struct GNUNET_SCHEDULER_Task *timeout_task; 46static struct GNUNET_SCHEDULER_Task *timeout_task;
69 47
70/** 48/**
71 * Update task
72 */
73static struct GNUNET_SCHEDULER_Task *update_task;
74
75/**
76 * Our configuration. 49 * Our configuration.
77 */ 50 */
78static const struct GNUNET_CONFIGURATION_Handle *cfg; 51static const struct GNUNET_CONFIGURATION_Handle *cfg;
@@ -399,33 +372,6 @@ struct ConsumeTicketOperation
399 372
400 373
401/** 374/**
402 * Updated attribute IDs
403 */
404struct TicketAttributeUpdateEntry
405{
406 /**
407 * DLL
408 */
409 struct TicketAttributeUpdateEntry *next;
410
411 /**
412 * DLL
413 */
414 struct TicketAttributeUpdateEntry *prev;
415
416 /**
417 * The old ID
418 */
419 uint64_t old_id;
420
421 /**
422 * The new ID
423 */
424 uint64_t new_id;
425};
426
427
428/**
429 * Ticket revocation request handle 375 * Ticket revocation request handle
430 */ 376 */
431struct TicketRevocationOperation 377struct TicketRevocationOperation
@@ -485,35 +431,6 @@ struct TicketIssueOperation
485 431
486 432
487/** 433/**
488 * DLL for ego handles to egos containing the RECLAIM_ATTRS in a
489 * map in json_t format
490 *
491 */
492struct EgoEntry
493{
494 /**
495 * DLL
496 */
497 struct EgoEntry *next;
498
499 /**
500 * DLL
501 */
502 struct EgoEntry *prev;
503
504 /**
505 * Ego handle
506 */
507 struct GNUNET_IDENTITY_Ego *ego;
508
509 /**
510 * Attribute map. Contains the attributes as json_t
511 */
512 struct GNUNET_CONTAINER_MultiHashMap *attr_map;
513};
514
515
516/**
517 * Client list 434 * Client list
518 */ 435 */
519static struct IdpClient *client_list_head = NULL; 436static struct IdpClient *client_list_head = NULL;
@@ -649,10 +566,6 @@ cleanup ()
649 RECLAIM_TICKETS_deinit (); 566 RECLAIM_TICKETS_deinit ();
650 if (NULL != timeout_task) 567 if (NULL != timeout_task)
651 GNUNET_SCHEDULER_cancel (timeout_task); 568 GNUNET_SCHEDULER_cancel (timeout_task);
652 if (NULL != update_task)
653 GNUNET_SCHEDULER_cancel (update_task);
654 if (NULL != identity_handle)
655 GNUNET_IDENTITY_disconnect (identity_handle);
656 if (NULL != nsh) 569 if (NULL != nsh)
657 GNUNET_NAMESTORE_disconnect (nsh); 570 GNUNET_NAMESTORE_disconnect (nsh);
658} 571}
@@ -1600,8 +1513,8 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
1600 */ 1513 */
1601static void 1514static void
1602handle_ticket_iteration_start ( 1515handle_ticket_iteration_start (
1603 void *cls, 1516 void *cls,
1604 const struct TicketIterationStartMessage *tis_msg) 1517 const struct TicketIterationStartMessage *tis_msg)
1605{ 1518{
1606 struct IdpClient *client = cls; 1519 struct IdpClient *client = cls;
1607 struct TicketIteration *ti; 1520 struct TicketIteration *ti;
@@ -1713,8 +1626,6 @@ run (void *cls,
1713 "error connecting to namestore"); 1626 "error connecting to namestore");
1714 } 1627 }
1715 1628
1716 identity_handle = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
1717
1718 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); 1629 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
1719} 1630}
1720 1631
@@ -1769,56 +1680,56 @@ client_connect_cb (void *cls,
1769 * Define "main" method using service macro. 1680 * Define "main" method using service macro.
1770 */ 1681 */
1771GNUNET_SERVICE_MAIN ( 1682GNUNET_SERVICE_MAIN (
1772 "reclaim", 1683 "reclaim",
1773 GNUNET_SERVICE_OPTION_NONE, 1684 GNUNET_SERVICE_OPTION_NONE,
1774 &run, 1685 &run,
1775 &client_connect_cb, 1686 &client_connect_cb,
1776 &client_disconnect_cb, 1687 &client_disconnect_cb,
1777 NULL, 1688 NULL,
1778 GNUNET_MQ_hd_var_size (attribute_store_message, 1689 GNUNET_MQ_hd_var_size (attribute_store_message,
1779 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, 1690 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
1780 struct AttributeStoreMessage, 1691 struct AttributeStoreMessage,
1781 NULL), 1692 NULL),
1782 GNUNET_MQ_hd_var_size (attribute_delete_message, 1693 GNUNET_MQ_hd_var_size (attribute_delete_message,
1783 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, 1694 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE,
1784 struct AttributeDeleteMessage, 1695 struct AttributeDeleteMessage,
1785 NULL), 1696 NULL),
1786 GNUNET_MQ_hd_fixed_size ( 1697 GNUNET_MQ_hd_fixed_size (
1787 iteration_start, 1698 iteration_start,
1788 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, 1699 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
1789 struct AttributeIterationStartMessage, 1700 struct AttributeIterationStartMessage,
1790 NULL), 1701 NULL),
1791 GNUNET_MQ_hd_fixed_size (iteration_next, 1702 GNUNET_MQ_hd_fixed_size (iteration_next,
1792 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, 1703 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
1793 struct AttributeIterationNextMessage, 1704 struct AttributeIterationNextMessage,
1794 NULL), 1705 NULL),
1795 GNUNET_MQ_hd_fixed_size (iteration_stop, 1706 GNUNET_MQ_hd_fixed_size (iteration_stop,
1796 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, 1707 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
1797 struct AttributeIterationStopMessage, 1708 struct AttributeIterationStopMessage,
1798 NULL), 1709 NULL),
1799 GNUNET_MQ_hd_var_size (issue_ticket_message, 1710 GNUNET_MQ_hd_var_size (issue_ticket_message,
1800 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, 1711 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
1801 struct IssueTicketMessage, 1712 struct IssueTicketMessage,
1802 NULL), 1713 NULL),
1803 GNUNET_MQ_hd_var_size (consume_ticket_message, 1714 GNUNET_MQ_hd_var_size (consume_ticket_message,
1804 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, 1715 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
1805 struct ConsumeTicketMessage, 1716 struct ConsumeTicketMessage,
1806 NULL), 1717 NULL),
1807 GNUNET_MQ_hd_fixed_size (ticket_iteration_start, 1718 GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
1808 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, 1719 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
1809 struct TicketIterationStartMessage, 1720 struct TicketIterationStartMessage,
1810 NULL), 1721 NULL),
1811 GNUNET_MQ_hd_fixed_size (ticket_iteration_next, 1722 GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
1812 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, 1723 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
1813 struct TicketIterationNextMessage, 1724 struct TicketIterationNextMessage,
1814 NULL), 1725 NULL),
1815 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop, 1726 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
1816 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, 1727 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
1817 struct TicketIterationStopMessage, 1728 struct TicketIterationStopMessage,
1818 NULL), 1729 NULL),
1819 GNUNET_MQ_hd_var_size (revoke_ticket_message, 1730 GNUNET_MQ_hd_var_size (revoke_ticket_message,
1820 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, 1731 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
1821 struct RevokeTicketMessage, 1732 struct RevokeTicketMessage,
1822 NULL), 1733 NULL),
1823 GNUNET_MQ_handler_end ()); 1734 GNUNET_MQ_handler_end ());
1824/* end of gnunet-service-reclaim.c */ 1735/* end of gnunet-service-reclaim.c */