GNUnet debian-0.26.1
 
Loading...
Searching...
No Matches
gnunet-service-reclaim_tickets.c File Reference
#include "gnunet-service-reclaim_tickets.h"
#include "gnunet_common.h"
#include "gnunet_gns_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_reclaim_service.h"
#include <string.h>
Include dependency graph for gnunet-service-reclaim_tickets.c:

Go to the source code of this file.

Data Structures

struct  TicketReference
 A reference to a ticket stored in GNS. More...
 
struct  RECLAIM_TICKETS_ConsumeHandle
 Handle to a consume operation. More...
 
struct  ParallelLookup
 Handle for a parallel GNS lookup job. More...
 
struct  TicketIssueHandle
 Ticket issue request handle. More...
 
struct  RECLAIM_TICKETS_Iterator
 Ticket iterator. More...
 
struct  RevokedAttributeEntry
 
struct  RECLAIM_TICKETS_RevokeHandle
 Ticket revocation request handle. More...
 

Macros

#define DEFAULT_TICKET_REFRESH_INTERVAL   GNUNET_TIME_UNIT_HOURS
 FIXME: the default ticket iteration interval should probably be the minimum attribute expiration.
 

Functions

static void cleanup_rvk (struct RECLAIM_TICKETS_RevokeHandle *rh)
 Cleanup revoke handle.
 
static void process_tickets (void *cls)
 For each ticket, store new, updated attribute references (Implementation further below)
 
static void ticket_processed (void *cls, enum GNUNET_ErrorCode ec)
 Finished storing updated attribute references.
 
static void rvk_ticket_update_finished (void *cls)
 Done collecting tickets.
 
static void rvk_ticket_update (void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 We need to update all other tickets with the new attribute IDs.
 
static void rvk_ns_iter_err (void *cls)
 Error iterating namestore.
 
static void rvk_ns_err (void *cls)
 Error storing new attribute in namestore.
 
static void move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rh)
 We change every attribute ID of the ticket attributes we want to revoke.
 
static void move_attrs_cont (void *cls)
 Delayed continuation for move_attrs.
 
static void del_attr_finished (void *cls, enum GNUNET_ErrorCode ec)
 Done deleting the old record.
 
static void move_attr_finished (void *cls, enum GNUNET_ErrorCode ec)
 Updated an attribute ID.
 
static void rvk_move_attr_cb (void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Got the referenced attribute.
 
static void remove_ticket_cont (void *cls, enum GNUNET_ErrorCode ec)
 Finished deleting ticket and attribute references.
 
static void revoke_attrs_cb (void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 We found the attribute references.
 
static void rvk_attrs_err_cb (void *cls)
 Failed to query namestore.
 
struct RECLAIM_TICKETS_RevokeHandleRECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_CRYPTO_BlindablePrivateKey *identity, RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls)
 Revoke a ticket.
 
void RECLAIM_TICKETS_revoke_cancel (struct RECLAIM_TICKETS_RevokeHandle *rh)
 Cancel a revocation.
 
static void cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth)
 Cleanup ticket consume handle.
 
static void process_parallel_lookup_result (void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
static void abort_parallel_lookups (void *cls)
 Cancel the lookups for attribute records.
 
static void lookup_authz_cb (void *cls, int is_gns, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
struct RECLAIM_TICKETS_ConsumeHandleRECLAIM_TICKETS_consume (const struct GNUNET_RECLAIM_Ticket *ticket, const char *rp_uri, RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls)
 Consume a ticket.
 
void RECLAIM_TICKETS_consume_cancel (struct RECLAIM_TICKETS_ConsumeHandle *cth)
 Cancel a consume operation.
 
static void cleanup_issue_handle (struct TicketIssueHandle *handle)
 Cleanup ticket consume handle.
 
static void store_ticket_issue_cont (void *cls, enum GNUNET_ErrorCode ec)
 Store finished, abort on error.
 
static void issue_ticket (struct TicketIssueHandle *ih)
 Issue a new ticket.
 
static void filter_tickets_error_cb (void *cls)
 Namestore error on issue.
 
static void filter_tickets_cb (void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Iterator over records.
 
static void filter_tickets_finished_cb (void *cls)
 Done iterating over tickets and we apparently did not find an existing, matching ticket.
 
void RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_BlindablePrivateKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const char *rp, RECLAIM_TICKETS_TicketResult cb, void *cb_cls)
 Issue a new reclaim ticket, thereby authorizing the audience to access the set of provided attributes.
 
static void cleanup_iter (struct RECLAIM_TICKETS_Iterator *iter)
 Cleanup ticket iterator.
 
static void collect_tickets_cb (void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Return each record of type GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET to the caller and proceed with the iteration.
 
static void collect_tickets_finished_cb (void *cls)
 Signal ticket iteration has finished.
 
static void collect_tickets_error_cb (void *cls)
 Cancel ticket iteration on namestore error.
 
void RECLAIM_TICKETS_iteration_next (struct RECLAIM_TICKETS_Iterator *iter)
 Continue ticket iteration.
 
void RECLAIM_TICKETS_iteration_stop (struct RECLAIM_TICKETS_Iterator *iter)
 Stop a running ticket iteration.
 
struct RECLAIM_TICKETS_IteratorRECLAIM_TICKETS_iteration_start (const struct GNUNET_CRYPTO_BlindablePrivateKey *identity, RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
 Iterate over all tickets issued by an identity.
 
int RECLAIM_TICKETS_init (const struct GNUNET_CONFIGURATION_Handle *c)
 Initialize tickets component.
 
void RECLAIM_TICKETS_deinit (void)
 Close handles and clean up.
 

Variables

static struct GNUNET_TIME_Relative ticket_refresh_interval
 Ticket expiration interval.
 
static struct GNUNET_NAMESTORE_Handlensh
 
static struct GNUNET_GNS_Handlegns
 
static struct GNUNET_STATISTICS_Handlestats
 

Macro Definition Documentation

◆ DEFAULT_TICKET_REFRESH_INTERVAL

#define DEFAULT_TICKET_REFRESH_INTERVAL   GNUNET_TIME_UNIT_HOURS

FIXME: the default ticket iteration interval should probably be the minimum attribute expiration.

Definition at line 39 of file gnunet-service-reclaim_tickets.c.

Function Documentation

◆ cleanup_rvk()

static void cleanup_rvk ( struct RECLAIM_TICKETS_RevokeHandle rh)
static

Cleanup revoke handle.

Parameters
rhthe ticket revocation handle

Definition at line 362 of file gnunet-service-reclaim_tickets.c.

363{
364 struct RevokedAttributeEntry *ae;
365 struct TicketRecordsEntry *le;
366
367 if (NULL != rh->ns_qe)
369 if (NULL != rh->ns_it)
371 while (NULL != (ae = rh->attrs_head))
372 {
374 GNUNET_free (ae);
375 }
376 while (NULL != (le = rh->tickets_to_update_head))
377 {
380 le);
381 if (NULL != le->data)
382 GNUNET_free (le->data);
383 if (NULL != le->label)
384 GNUNET_free (le->label);
385 GNUNET_free (le);
386 }
387 GNUNET_free (rh);
388}
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
struct RevokedAttributeEntry * attrs_tail
Revoked attributes.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct RevokedAttributeEntry * attrs_head
Revoked attributes.

References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::attrs_tail, TicketRecordsEntry::data, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_zone_iteration_stop(), TicketRecordsEntry::label, RECLAIM_TICKETS_RevokeHandle::ns_it, RECLAIM_TICKETS_RevokeHandle::ns_qe, and RECLAIM_TICKETS_RevokeHandle::tickets_to_update_head.

Referenced by del_attr_finished(), move_attr_finished(), process_tickets(), RECLAIM_TICKETS_revoke_cancel(), remove_ticket_cont(), rvk_attrs_err_cb(), rvk_ns_err(), and rvk_ns_iter_err().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_tickets()

static void process_tickets ( void *  cls)
static

For each ticket, store new, updated attribute references (Implementation further below)

For each ticket, store new, updated attribute references.

Parameters
clshandle to the operation

Definition at line 425 of file gnunet-service-reclaim_tickets.c.

426{
427 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
428 struct TicketRecordsEntry *le;
429 struct RevokedAttributeEntry *ae;
430
431 if (NULL == rvk->tickets_to_update_head)
432 {
434 "Finished updatding tickets, success\n");
435 rvk->cb (rvk->cb_cls, GNUNET_OK);
436 cleanup_rvk (rvk);
437 return;
438 }
439 le = rvk->tickets_to_update_head;
442 le);
443 {
446 le->data,
447 le->rd_count,
448 rd))
449 {
451 "Unable to deserialize ticket record(s)\n");
452 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
453 cleanup_rvk (rvk);
454 return;
455 }
456 for (int i = 0; i < le->rd_count; i++)
457 {
459 continue;
460 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
461 {
462 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
463 continue;
464 rd[i].data = &ae->new_id;
465 }
466 }
468 &rvk->identity,
469 le->label,
470 le->rd_count,
471 rd,
473 rvk);
474 }
475 GNUNET_free (le->label);
476 GNUNET_free (le->data);
477 GNUNET_free (le);
478}
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF
for reclaim records
static char * data
The data to insert into the dht.
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
static struct GNUNET_NAMESTORE_Handle * nsh
static void ticket_processed(void *cls, enum GNUNET_ErrorCode ec)
Finished storing updated attribute references.
int GNUNET_GNSRECORD_records_deserialize(size_t len, const char *src, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *dest)
Deserialize the given records to the given destination.
#define GNUNET_log(kind,...)
@ GNUNET_OK
@ GNUNET_SYSERR
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_BlindablePrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
Ticket revocation request handle.
struct GNUNET_CRYPTO_BlindablePrivateKey identity
Issuer Key.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
RECLAIM_TICKETS_RevokeCallback cb
Callback.
struct GNUNET_RECLAIM_Identifier old_id
Old ID of the attribute.
struct RevokedAttributeEntry * next
DLL.
struct GNUNET_RECLAIM_Identifier new_id
New ID of the attribute.
unsigned int rd_count
Record count.

References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), data, GNUNET_GNSRECORD_Data::data, TicketRecordsEntry::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_records_deserialize(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_log, GNUNET_NAMESTORE_record_set_store(), GNUNET_OK, GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::identity, TicketRecordsEntry::label, RevokedAttributeEntry::new_id, RevokedAttributeEntry::next, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, RevokedAttributeEntry::old_id, rd, rd_count, GNUNET_GNSRECORD_Data::record_type, ticket_processed(), RECLAIM_TICKETS_RevokeHandle::tickets_to_update_head, and RECLAIM_TICKETS_RevokeHandle::tickets_to_update_tail.

Referenced by rvk_ticket_update_finished(), and ticket_processed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_processed()

static void ticket_processed ( void *  cls,
enum GNUNET_ErrorCode  ec 
)
static

Finished storing updated attribute references.

Abort on error, else continue processing tickets

Parameters
clshandle to the operation
successresult of namestore operation
emsg(NULL on success)

Definition at line 410 of file gnunet-service-reclaim_tickets.c.

411{
412 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
413
414 rvk->ns_qe = NULL;
416}
static void process_tickets(void *cls)
For each ticket, store new, updated attribute references (Implementation further below)
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition scheduler.c:1304

References GNUNET_SCHEDULER_add_now(), RECLAIM_TICKETS_RevokeHandle::ns_qe, and process_tickets().

Referenced by process_tickets().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rvk_ticket_update_finished()

static void rvk_ticket_update_finished ( void *  cls)
static

Done collecting tickets.

Start processing.

Parameters
clshandle to the operation

Definition at line 487 of file gnunet-service-reclaim_tickets.c.

488{
489 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
490
491 rvk->ns_it = NULL;
493}

References GNUNET_SCHEDULER_add_now(), RECLAIM_TICKETS_RevokeHandle::ns_it, and process_tickets().

Referenced by move_attrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rvk_ticket_update()

static void rvk_ticket_update ( void *  cls,
const struct GNUNET_CRYPTO_BlindablePrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

We need to update all other tickets with the new attribute IDs.

We first collect them all. Processing after.

Parameters
clshandle to the operation
zoneticket issuer private key
labelticket rnd
rd_countsize of record set
rdrecord set

Let everything point to the old record

Definition at line 507 of file gnunet-service-reclaim_tickets.c.

512{
513 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
514 struct TicketRecordsEntry *le;
515 struct RevokedAttributeEntry *ae;
516 int has_changed = GNUNET_NO;
517
519 for (int i = 0; i < rd_count; i++)
520 {
522 continue;
523 for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
524 {
525 if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(ae->old_id)))
526 continue;
527 has_changed = GNUNET_YES;
528 break;
529 }
530 if (GNUNET_YES == has_changed)
531 break;
532 }
533 if (GNUNET_YES == has_changed)
534 {
535 le = GNUNET_new (struct TicketRecordsEntry);
537 le->data = GNUNET_malloc (le->data_size);
538 le->rd_count = rd_count;
539 le->label = GNUNET_strdup (label);
543 le);
544 }
546}
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
ssize_t GNUNET_GNSRECORD_records_serialize(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest)
Serialize the given records to the given destination buffer.
ssize_t GNUNET_GNSRECORD_records_get_size(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Calculate how many bytes we will need to serialize the given records.
@ GNUNET_YES
@ GNUNET_NO
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
void GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it, uint64_t limit)
Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_start for the next record.

References RECLAIM_TICKETS_RevokeHandle::attrs_head, data, TicketRecordsEntry::data, TicketRecordsEntry::data_size, GNUNET_CONTAINER_DLL_insert, GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_malloc, GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_new, GNUNET_NO, GNUNET_strdup, GNUNET_YES, TicketRecordsEntry::label, RevokedAttributeEntry::next, RECLAIM_TICKETS_RevokeHandle::ns_it, RevokedAttributeEntry::old_id, rd, rd_count, TicketRecordsEntry::rd_count, RECLAIM_TICKETS_RevokeHandle::tickets_to_update_head, and RECLAIM_TICKETS_RevokeHandle::tickets_to_update_tail.

Referenced by move_attrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rvk_ns_iter_err()

static void rvk_ns_iter_err ( void *  cls)
static

Error iterating namestore.

Abort.

Parameters
clshandle to the operation

Definition at line 555 of file gnunet-service-reclaim_tickets.c.

556{
557 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
558
559 rvk->ns_it = NULL;
560 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
561 cleanup_rvk (rvk);
562}

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_SYSERR, and RECLAIM_TICKETS_RevokeHandle::ns_it.

Referenced by move_attrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rvk_ns_err()

static void rvk_ns_err ( void *  cls)
static

Error storing new attribute in namestore.

Abort

Parameters
clshandle to the operation

Definition at line 571 of file gnunet-service-reclaim_tickets.c.

572{
573 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
574
575 rvk->ns_qe = NULL;
576 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
577 cleanup_rvk (rvk);
578}

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_SYSERR, and RECLAIM_TICKETS_RevokeHandle::ns_qe.

Referenced by move_attrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ move_attrs()

static void move_attrs ( struct RECLAIM_TICKETS_RevokeHandle rh)
static

We change every attribute ID of the ticket attributes we want to revoke.

When we are done, we need to update any other ticket which included references to any of the changed attributes.

Parameters
rhhandle to the operation

Definition at line 779 of file gnunet-service-reclaim_tickets.c.

780{
781 char *label;
782
783 if (NULL == rvk->move_attr)
784 {
785 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n");
786 rvk->ns_it =
788 &rvk->identity,
790 rvk,
792 rvk,
794 rvk);
795 return;
796 }
797 label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
798 sizeof (rvk->move_attr->old_id));
799 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving claim %s\n", label);
800
802 &rvk->identity,
803 label,
804 &rvk_ns_err,
805 rvk,
807 rvk);
808 GNUNET_free (label);
809}
static void rvk_move_attr_cb(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got the referenced attribute.
static void rvk_ticket_update_finished(void *cls)
Done collecting tickets.
static void rvk_ns_err(void *cls)
Error storing new attribute in namestore.
static void rvk_ns_iter_err(void *cls)
Error iterating namestore.
static void rvk_ticket_update(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
We need to update all other tickets with the new attribute IDs.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_BlindablePrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls)
Lookup an item in the namestore.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition strings.c:807

References GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NAMESTORE_records_lookup(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_STRINGS_data_to_string_alloc(), RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::move_attr, RECLAIM_TICKETS_RevokeHandle::ns_it, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, RevokedAttributeEntry::old_id, rvk_move_attr_cb(), rvk_ns_err(), rvk_ns_iter_err(), rvk_ticket_update(), and rvk_ticket_update_finished().

Referenced by move_attrs_cont(), and remove_ticket_cont().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ move_attrs_cont()

static void move_attrs_cont ( void *  cls)
static

Delayed continuation for move_attrs.

Parameters
clshandle to the operation.

Definition at line 599 of file gnunet-service-reclaim_tickets.c.

600{
602}
static void move_attrs(struct RECLAIM_TICKETS_RevokeHandle *rh)
We change every attribute ID of the ticket attributes we want to revoke.

References move_attrs().

Referenced by del_attr_finished(), and rvk_move_attr_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ del_attr_finished()

static void del_attr_finished ( void *  cls,
enum GNUNET_ErrorCode  ec 
)
static

Done deleting the old record.

Abort on error. Else, continue updating attribute IDs.

Parameters
clshandle to the operation
successresult of the namestore operation
emsgerror message (NULL on success)

Definition at line 614 of file gnunet-service-reclaim_tickets.c.

615{
616 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
617
618 rvk->ns_qe = NULL;
619 if (GNUNET_EC_NONE != ec)
620 {
622 "Error removing attribute: %s\n",
624 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
625 cleanup_rvk (rvk);
626 return;
627 }
628 rvk->move_attr = rvk->move_attr->next;
630}
static void move_attrs_cont(void *cls)
Delayed continuation for move_attrs.
const char * GNUNET_ErrorCode_get_hint(enum GNUNET_ErrorCode ec)
Returns a hint for a given error code.
@ GNUNET_EC_NONE
No error (success).
struct RevokedAttributeEntry * move_attr
Current attribute to move.

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_EC_NONE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ErrorCode_get_hint(), GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::move_attr, move_attrs_cont(), RevokedAttributeEntry::next, and RECLAIM_TICKETS_RevokeHandle::ns_qe.

Referenced by move_attr_finished().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ move_attr_finished()

static void move_attr_finished ( void *  cls,
enum GNUNET_ErrorCode  ec 
)
static

Updated an attribute ID.

Abort on error if namestore operation failed. Else, we have to delete the old record.

Parameters
clshandle to the operation
successresult of the store operation
emsgerror message (NULL on success)

Definition at line 643 of file gnunet-service-reclaim_tickets.c.

644{
645 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
646 char *label;
647
648 rvk->ns_qe = NULL;
649 if (GNUNET_EC_NONE != ec)
650 {
652 "Error moving attribute: %s\n",
654 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
655 cleanup_rvk (rvk);
656 return;
657 }
659 sizeof(rvk->move_attr->old_id));
660 GNUNET_assert (NULL != label);
661 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
663 &rvk->identity,
664 label,
665 0,
666 NULL,
668 rvk);
669 GNUNET_free (label);
670}
static void del_attr_finished(void *cls, enum GNUNET_ErrorCode ec)
Done deleting the old record.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), del_attr_finished(), GNUNET_assert, GNUNET_EC_NONE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ErrorCode_get_hint(), GNUNET_free, GNUNET_log, GNUNET_NAMESTORE_record_set_store(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::move_attr, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, and RevokedAttributeEntry::old_id.

Referenced by rvk_move_attr_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rvk_move_attr_cb()

static void rvk_move_attr_cb ( void *  cls,
const struct GNUNET_CRYPTO_BlindablePrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Got the referenced attribute.

Updating the ID

Parameters
clshandle to the operation
zoneissuer identity
labelattribute ID
rd_countsize of record set (should be 1)
rdrecord set (the attribute)

find a new place for this attribute

Definition at line 683 of file gnunet-service-reclaim_tickets.c.

688{
689 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
690 struct GNUNET_GNSRECORD_Data new_rd[rd_count];
691 struct RevokedAttributeEntry *le;
692 char *new_label;
693 char *attr_data;
694
695 rvk->ns_qe = NULL;
696 if (0 == rd_count)
697 {
699 "The claim %s no longer exists!\n",
700 label);
701 le = rvk->move_attr;
702 rvk->move_attr = le->next;
704 GNUNET_free (le);
706 return;
707 }
709 new_label =
711 sizeof (rvk->move_attr->new_id));
712
713 attr_data = NULL;
714 // new_rd = *rd;
715 for (int i = 0; i < rd_count; i++)
716 {
717 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type)
718 {
722 rd[i].data_size,
723 &claim);
725 "Attribute to update: Name=%s\n",
726 claim->name);
727 claim->id = rvk->move_attr->new_id;
729 attr_data = GNUNET_malloc (rd[i].data_size);
730 new_rd[i].data_size = GNUNET_RECLAIM_attribute_serialize (claim,
731 attr_data);
732 new_rd[i].data = attr_data;
733 new_rd[i].record_type = rd[i].record_type;
734 new_rd[i].flags = rd[i].flags;
735 new_rd[i].expiration_time = rd[i].expiration_time;
736 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
738 }
739 else if (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL == rd[i].record_type)
740 {
743 rd[i].data_size);
745 "Credential to update: Name=%s\n",
746 credential->name);
747 credential->id = rvk->move_attr->new_id;
748 new_rd[i].data_size =
750 attr_data = GNUNET_malloc (rd[i].data_size);
751 new_rd[i].data_size = GNUNET_RECLAIM_credential_serialize (credential,
752 attr_data);
753 new_rd[i].data = attr_data;
754 new_rd[i].record_type = rd[i].record_type;
755 new_rd[i].flags = rd[i].flags;
756 new_rd[i].expiration_time = rd[i].expiration_time;
757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding credential %s\n",
758 new_label);
760 }
761 else
762 {
763 memcpy (&new_rd[i], &rd[i], sizeof (struct GNUNET_GNSRECORD_Data));
764 }
765 }
767 &rvk->identity,
768 new_label,
769 rd_count,
770 new_rd,
772 rvk);
773 GNUNET_free (new_label);
774 GNUNET_free (attr_data);
775}
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE
identity attribute
#define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL
Record type for an attribute attestation (e.g.
static size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
static void move_attr_finished(void *cls, enum GNUNET_ErrorCode ec)
Updated an attribute ID.
@ GNUNET_ERROR_TYPE_WARNING
#define GNUNET_RECLAIM_id_generate(id)
size_t GNUNET_RECLAIM_attribute_serialize_get_size(const struct GNUNET_RECLAIM_Attribute *attr)
Get required size for serialization buffer.
ssize_t GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size, struct GNUNET_RECLAIM_Attribute **attr)
Deserialize an attribute.
size_t GNUNET_RECLAIM_credential_serialize(const struct GNUNET_RECLAIM_Credential *credential, char *result)
Serialize an credential.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_deserialize(const char *data, size_t data_size)
Deserialize an credential.
size_t GNUNET_RECLAIM_credential_serialize_get_size(const struct GNUNET_RECLAIM_Credential *credential)
Get required size for serialization buffer.
size_t GNUNET_RECLAIM_attribute_serialize(const struct GNUNET_RECLAIM_Attribute *attr, char *result)
Serialize an attribute.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
uint64_t expiration_time
Expiration time for the DNS record.
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_Identifier id
ID.

References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::attrs_tail, claim, credential, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE, GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_record_set_store(), GNUNET_RECLAIM_attribute_deserialize(), GNUNET_RECLAIM_attribute_serialize(), GNUNET_RECLAIM_attribute_serialize_get_size(), GNUNET_RECLAIM_credential_deserialize(), GNUNET_RECLAIM_credential_serialize(), GNUNET_RECLAIM_credential_serialize_get_size(), GNUNET_RECLAIM_id_generate, GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_Identifier::id, GNUNET_RECLAIM_Attribute::id, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::move_attr, move_attr_finished(), move_attrs_cont(), GNUNET_RECLAIM_Attribute::name, RevokedAttributeEntry::new_id, RevokedAttributeEntry::next, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, rd, rd_count, and GNUNET_GNSRECORD_Data::record_type.

Referenced by move_attrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_ticket_cont()

static void remove_ticket_cont ( void *  cls,
enum GNUNET_ErrorCode  ec 
)
static

Finished deleting ticket and attribute references.

Abort on failure. Else, we start changing every attribute ID in the found attribute references so that access is no longer possible.

Parameters
clshandle to the operation
successNamestore operation return value
emsgerror message (NULL on success)

Definition at line 824 of file gnunet-service-reclaim_tickets.c.

825{
826 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
827
828 rvk->ns_qe = NULL;
829 if (GNUNET_EC_NONE != ec)
830 {
833 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
834 cleanup_rvk (rvk);
835 return;
836 }
837 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted ticket\n");
838 if (0 == rvk->ticket_attrs)
839 {
841 "No attributes to move... strange\n");
842 rvk->cb (rvk->cb_cls, GNUNET_OK);
843 cleanup_rvk (rvk);
844 return;
845 }
846 rvk->move_attr = rvk->attrs_head;
847 move_attrs (rvk);
848}
unsigned int ticket_attrs
Number of attributes in ticket.

References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_EC_NONE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_ErrorCode_get_hint(), GNUNET_log, GNUNET_OK, GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::move_attr, move_attrs(), RECLAIM_TICKETS_RevokeHandle::ns_qe, and RECLAIM_TICKETS_RevokeHandle::ticket_attrs.

Referenced by revoke_attrs_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ revoke_attrs_cb()

static void revoke_attrs_cb ( void *  cls,
const struct GNUNET_CRYPTO_BlindablePrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

We found the attribute references.

Store them for later and remove the record set.

Parameters
clshandle to the operation
zonethe issuer key
labelticket rnd
rd_countsize of record set
rdrecord set

Temporarily store attribute references. We need it later.

Remove attribute references

Definition at line 862 of file gnunet-service-reclaim_tickets.c.

868{
869 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
870 struct RevokedAttributeEntry *le;
871
872 rvk->ns_qe = NULL;
877 for (int i = 0; i < rd_count; i++)
878 {
880 continue;
881 le = GNUNET_new (struct RevokedAttributeEntry);
882 le->old_id = *((struct GNUNET_RECLAIM_Identifier *) rd[i].data);
884 rvk->ticket_attrs++;
885 }
886
889 &rvk->identity,
890 label,
891 0,
892 NULL,
894 rvk);
895}
static void remove_ticket_cont(void *cls, enum GNUNET_ErrorCode ec)
Finished deleting ticket and attribute references.
A reclaim identifier FIXME maybe put this in a different namespace.

References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::attrs_tail, data, GNUNET_CONTAINER_DLL_insert, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_NAMESTORE_record_set_store(), GNUNET_new, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, RevokedAttributeEntry::old_id, rd, rd_count, remove_ticket_cont(), and RECLAIM_TICKETS_RevokeHandle::ticket_attrs.

Referenced by RECLAIM_TICKETS_revoke().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rvk_attrs_err_cb()

static void rvk_attrs_err_cb ( void *  cls)
static

Failed to query namestore.

Abort operation

Parameters
clshandle to the operation

Definition at line 904 of file gnunet-service-reclaim_tickets.c.

905{
906 struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
907
908 rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
909 cleanup_rvk (rvk);
910}

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), and GNUNET_SYSERR.

Referenced by RECLAIM_TICKETS_revoke().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_revoke()

struct RECLAIM_TICKETS_RevokeHandle * RECLAIM_TICKETS_revoke ( const struct GNUNET_RECLAIM_Ticket ticket,
const struct GNUNET_CRYPTO_BlindablePrivateKey identity,
RECLAIM_TICKETS_RevokeCallback  cb,
void *  cb_cls 
)

Revoke a ticket.

We start by looking up attribute references in order to change attribute IDs.

Parameters
ticketticket to revoke
identityprivate key of issuer
cbrevocation status callback
cb_clscallback closure
Returns
handle to the operation

Get shared attributes

Definition at line 925 of file gnunet-service-reclaim_tickets.c.

930{
932 char *label;
933 char *tmp;
934
936 rvk->cb = cb;
937 rvk->cb_cls = cb_cls;
938 rvk->identity = *identity;
939 rvk->ticket = *ticket;
941 label = strtok (tmp, ".");
942 GNUNET_assert (NULL != label);
945 identity,
946 label,
948 rvk,
950 rvk);
951 GNUNET_free (tmp);
952 return rvk;
953}
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static void revoke_attrs_cb(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
We found the attribute references.
static void rvk_attrs_err_cb(void *cls)
Failed to query namestore.
char gns_name[63 *2+2]
The ticket.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_assert, GNUNET_free, GNUNET_NAMESTORE_records_lookup(), GNUNET_new, GNUNET_strdup, identity, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::ns_qe, nsh, revoke_attrs_cb(), rvk_attrs_err_cb(), ticket, and RECLAIM_TICKETS_RevokeHandle::ticket.

Referenced by handle_revoke_ticket_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_revoke_cancel()

void RECLAIM_TICKETS_revoke_cancel ( struct RECLAIM_TICKETS_RevokeHandle rh)

Cancel a revocation.

Parameters
rhhandle to the operation

Definition at line 962 of file gnunet-service-reclaim_tickets.c.

963{
964 GNUNET_assert (NULL != rh);
965 cleanup_rvk (rh);
966}

References cleanup_rvk(), and GNUNET_assert.

Referenced by cleanup_client().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup_cth()

static void cleanup_cth ( struct RECLAIM_TICKETS_ConsumeHandle cth)
static

Cleanup ticket consume handle.

Parameters
cththe handle to clean up

Definition at line 979 of file gnunet-service-reclaim_tickets.c.

980{
981 struct ParallelLookup *lu;
982
983 if (NULL != cth->lookup_request)
985 if (NULL != cth->kill_task)
987 while (NULL != (lu = cth->parallel_lookups_head))
988 {
989 if (NULL != lu->lookup_request)
991 GNUNET_free (lu->label);
994 lu);
995 GNUNET_free (lu);
996 }
997
998 if (NULL != cth->attrs)
1000 if (NULL != cth->presentations)
1002 GNUNET_free (cth);
1003}
void * GNUNET_GNS_lookup_with_tld_cancel(struct GNUNET_GNS_LookupWithTldRequest *ltr)
Cancel pending lookup request.
void * GNUNET_GNS_lookup_cancel(struct GNUNET_GNS_LookupRequest *lr)
Cancel pending lookup request.
Definition gns_api.c:313
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
void GNUNET_RECLAIM_presentation_list_destroy(struct GNUNET_RECLAIM_PresentationList *presentations)
Destroy presentations list.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition scheduler.c:980
Handle for a parallel GNS lookup job.
struct GNUNET_GNS_LookupRequest * lookup_request
struct GNUNET_RECLAIM_AttributeList * attrs
Attributes.
struct ParallelLookup * parallel_lookups_tail
Lookup DLL.
struct ParallelLookup * parallel_lookups_head
Lookup DLL.
struct GNUNET_GNS_LookupWithTldRequest * lookup_request
LookupRequest.
struct GNUNET_RECLAIM_PresentationList * presentations
Presentations.
struct GNUNET_SCHEDULER_Task * kill_task
Kill task.

References RECLAIM_TICKETS_ConsumeHandle::attrs, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_GNS_lookup_cancel(), GNUNET_GNS_lookup_with_tld_cancel(), GNUNET_RECLAIM_attribute_list_destroy(), GNUNET_RECLAIM_presentation_list_destroy(), GNUNET_SCHEDULER_cancel(), RECLAIM_TICKETS_ConsumeHandle::kill_task, ParallelLookup::label, RECLAIM_TICKETS_ConsumeHandle::lookup_request, ParallelLookup::lookup_request, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_head, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail, and RECLAIM_TICKETS_ConsumeHandle::presentations.

Referenced by lookup_authz_cb(), process_parallel_lookup_result(), and RECLAIM_TICKETS_consume_cancel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_parallel_lookup_result()

static void process_parallel_lookup_result ( void *  cls,
uint32_t  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Definition at line 1007 of file gnunet-service-reclaim_tickets.c.

1010{
1011 struct ParallelLookup *parallel_lookup = cls;
1012 struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
1013 struct GNUNET_RECLAIM_AttributeListEntry *attr_le;
1015
1017 "Parallel lookup finished (count=%u)\n",
1018 rd_count);
1019
1022 parallel_lookup);
1023 GNUNET_free (parallel_lookup->label);
1024
1026 "attribute_lookup_time_total",
1028 parallel_lookup->lookup_start_time)
1029 .rel_value_us,
1030 GNUNET_YES);
1031 GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES);
1032
1033
1034 GNUNET_free (parallel_lookup);
1035 if (0 == rd_count)
1036 GNUNET_break (0);
1037 // REMARK: It is possible now to find rd_count > 1
1038 for (int i = 0; i < rd_count; i++)
1039 {
1040 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd[i].record_type)
1041 continue;
1044 &attr_le->attribute);
1046 cth->attrs->list_tail,
1047 attr_le);
1048 }
1049 if (NULL != cth->parallel_lookups_head)
1050 return; // Wait for more
1051 /* Else we are done */
1053 );
1054 cth->cb (cth->cb_cls, &iss,
1055 cth->attrs, cth->presentations, GNUNET_OK, NULL);
1056 cleanup_cth (cth);
1057}
static struct GNUNET_STATISTICS_Handle * stats
static void cleanup_cth(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cleanup ticket consume handle.
enum GNUNET_GenericReturnValue GNUNET_GNS_parse_ztld(const char *name, struct GNUNET_CRYPTO_BlindablePublicKey *ztld_key)
Try to parse the zTLD into a public key.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
Definition time.c:438
An identity key as per LSD0001.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
uint64_t rel_value_us
The actual value.
struct GNUNET_TIME_Absolute lookup_start_time
Lookup time.
struct RECLAIM_TICKETS_ConsumeHandle * handle
RECLAIM_TICKETS_ConsumeCallback cb
Callback.
struct GNUNET_RECLAIM_Ticket ticket
Ticket.

References GNUNET_RECLAIM_AttributeListEntry::attribute, RECLAIM_TICKETS_ConsumeHandle::attrs, RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, cleanup_cth(), data, data_size, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNS_parse_ztld(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE, GNUNET_log, GNUNET_new, GNUNET_OK, GNUNET_RECLAIM_attribute_deserialize(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_get_duration(), GNUNET_YES, ParallelLookup::handle, ParallelLookup::label, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_AttributeList::list_tail, ParallelLookup::lookup_start_time, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_head, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail, RECLAIM_TICKETS_ConsumeHandle::presentations, rd, rd_count, GNUNET_TIME_Relative::rel_value_us, stats, and RECLAIM_TICKETS_ConsumeHandle::ticket.

Referenced by lookup_authz_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ abort_parallel_lookups()

static void abort_parallel_lookups ( void *  cls)
static

Cancel the lookups for attribute records.

Parameters
clshandle to the operation

Definition at line 1066 of file gnunet-service-reclaim_tickets.c.

1067{
1068 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1069 struct ParallelLookup *lu;
1070 struct ParallelLookup *tmp;
1071
1072 cth->kill_task = NULL;
1073 for (lu = cth->parallel_lookups_head; NULL != lu;)
1074 {
1076 GNUNET_free (lu->label);
1077 tmp = lu->next;
1080 lu);
1081 GNUNET_free (lu);
1082 lu = tmp;
1083 }
1084 cth->cb (cth->cb_cls, NULL, NULL, NULL, GNUNET_SYSERR, "Aborted");
1085}
struct ParallelLookup * next

References RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_GNS_lookup_cancel(), GNUNET_SYSERR, RECLAIM_TICKETS_ConsumeHandle::kill_task, ParallelLookup::label, ParallelLookup::lookup_request, ParallelLookup::next, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_head, and RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail.

Referenced by lookup_authz_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lookup_authz_cb()

static void lookup_authz_cb ( void *  cls,
int  is_gns,
uint32_t  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Check if record is a credential presentation or an attribute reference.

Return error

Return error

We started lookups. Add a timeout task. FIXME: Really needed here?

No references found, return empty attribute list

Definition at line 1089 of file gnunet-service-reclaim_tickets.c.

1093{
1094 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1096 struct ParallelLookup *parallel_lookup;
1097 const char *rp_uri = NULL;
1098 char *lbl;
1100
1101 cth->lookup_request = NULL;
1102
1103 GNUNET_assert (GNUNET_YES == is_gns);
1105 "reclaim_authz_lookup_time_total",
1107 cth->lookup_start_time)
1108 .rel_value_us,
1109 GNUNET_YES);
1111 "reclaim_authz_lookups_count",
1112 1,
1113 GNUNET_YES);
1114
1116 == GNUNET_GNS_parse_ztld (cth->ticket.gns_name, &iss));
1117 for (int i = 0; i < rd_count; i++)
1118 {
1123 switch (rd[i].record_type)
1124 {
1126 rp_uri = rd[i].data;
1127 break;
1130 ale->presentation =
1132 rd[i].data_size);
1135 ale);
1136 break;
1139 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ticket reference found %s\n", lbl);
1140 parallel_lookup = GNUNET_new (struct ParallelLookup);
1141 parallel_lookup->handle = cth;
1142 parallel_lookup->label = lbl;
1143 parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get ();
1144 parallel_lookup->lookup_request =
1146 lbl,
1147 &iss,
1151 parallel_lookup);
1154 parallel_lookup);
1155 break;
1156 default:
1158 "Ignoring unknown record type %d", rd[i].record_type);
1159 }
1160 }
1161 if (NULL == rp_uri)
1162 {
1164 "RP URI not found along references, ignoring...\n");
1168 cth->cb (cth->cb_cls, &iss,
1169 cth->attrs, NULL, GNUNET_NO, NULL);
1170 cleanup_cth (cth);
1171 return;
1172 }
1173 if (0 != strcmp (rp_uri, cth->rp_uri))
1174 {
1176 "RP URI does not match consume request: `%s' != `%s'\n",
1177 rp_uri, cth->rp_uri);
1181 cth->cb (cth->cb_cls, &iss,
1182 cth->attrs, NULL, GNUNET_NO, NULL);
1183 cleanup_cth (cth);
1184 return;
1185 }
1190 if (NULL != cth->parallel_lookups_head)
1191 {
1195 cth);
1196 return;
1197 }
1201 cth->cb (cth->cb_cls, &iss,
1202 cth->attrs, NULL, GNUNET_OK, NULL);
1203 cleanup_cth (cth);
1204}
#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION
Record type for a presentation of a credential.
static struct GNUNET_GNS_Handle * gns
static void abort_parallel_lookups(void *cls)
Cancel the lookups for attribute records.
static void process_parallel_lookup_result(void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
#define GNUNET_DNSPARSER_TYPE_TXT
struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup(struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_CRYPTO_BlindablePublicKey *zone, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS.
Definition gns_api.c:421
@ GNUNET_GNS_LO_DEFAULT
Defaults, look in cache, then in DHT.
#define GNUNET_GNSRECORD_TYPE_ANY
Record type indicating any record/'*'.
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_deserialize(const char *data, size_t data_size)
Deserialize a presentation.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition scheduler.c:1277
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition time.c:111
#define GNUNET_TIME_UNIT_MINUTES
One minute.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition time.c:486
struct GNUNET_RECLAIM_Presentation * presentation
The credential.
struct GNUNET_RECLAIM_PresentationListEntry * list_head
List head.
struct GNUNET_RECLAIM_PresentationListEntry * list_tail
List tail.
char rp_uri[GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN]
The ticket audience (= relying party) URI.
struct GNUNET_TIME_Absolute lookup_start_time
Lookup time.

References abort_parallel_lookups(), RECLAIM_TICKETS_ConsumeHandle::attrs, RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, cleanup_cth(), data, GNUNET_GNSRECORD_Data::data, data_size, gns, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup(), GNUNET_GNS_parse_ztld(), GNUNET_GNSRECORD_TYPE_ANY, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION, GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_RECLAIM_presentation_deserialize(), GNUNET_SCHEDULER_add_delayed(), GNUNET_STATISTICS_update(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_MINUTES, GNUNET_YES, ParallelLookup::handle, RECLAIM_TICKETS_ConsumeHandle::kill_task, ParallelLookup::label, GNUNET_RECLAIM_PresentationList::list_head, GNUNET_RECLAIM_PresentationList::list_tail, RECLAIM_TICKETS_ConsumeHandle::lookup_request, ParallelLookup::lookup_request, RECLAIM_TICKETS_ConsumeHandle::lookup_start_time, ParallelLookup::lookup_start_time, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_head, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail, GNUNET_RECLAIM_PresentationListEntry::presentation, RECLAIM_TICKETS_ConsumeHandle::presentations, process_parallel_lookup_result(), rd, rd_count, GNUNET_TIME_Relative::rel_value_us, RECLAIM_TICKETS_ConsumeHandle::rp_uri, stats, and RECLAIM_TICKETS_ConsumeHandle::ticket.

Referenced by RECLAIM_TICKETS_consume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_consume()

struct RECLAIM_TICKETS_ConsumeHandle * RECLAIM_TICKETS_consume ( const struct GNUNET_RECLAIM_Ticket ticket,
const char *  rp_uri,
RECLAIM_TICKETS_ConsumeCallback  cb,
void *  cb_cls 
)

Consume a ticket.

We first looking attribute references under the label ticket.rnd in GNS.

Parameters
idthe audience of the ticket
ticketthe ticket to consume
cbcallback to call with attributes of ticket
cb_clscallback closure
Returns
handle to the operation

Definition at line 1219 of file gnunet-service-reclaim_tickets.c.

1223{
1225
1227
1230 cth->ticket = *ticket;
1231 memcpy (cth->rp_uri, rp_uri, strlen (rp_uri) + 1);
1232 cth->cb = cb;
1233 cth->cb_cls = cb_cls;
1235 cth->lookup_request =
1241 cth);
1242 return cth;
1243}
static void lookup_authz_cb(void *cls, int is_gns, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
struct GNUNET_GNS_LookupWithTldRequest * GNUNET_GNS_lookup_with_tld(struct GNUNET_GNS_Handle *handle, const char *name, uint32_t type, enum GNUNET_GNS_LocalOptions options, GNUNET_GNS_LookupResultProcessor2 proc, void *proc_cls)
Perform an asynchronous lookup operation on the GNS, determining the zone using the TLD of the given ...
A list of GNUNET_RECLAIM_Attribute structures.
A list of GNUNET_RECLAIM_Presentation structures.

References RECLAIM_TICKETS_ConsumeHandle::attrs, RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, gns, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup_with_tld(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_new, GNUNET_TIME_absolute_get(), lookup_authz_cb(), RECLAIM_TICKETS_ConsumeHandle::lookup_request, RECLAIM_TICKETS_ConsumeHandle::lookup_start_time, RECLAIM_TICKETS_ConsumeHandle::presentations, RECLAIM_TICKETS_ConsumeHandle::rp_uri, ticket, and RECLAIM_TICKETS_ConsumeHandle::ticket.

Referenced by handle_consume_ticket_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_consume_cancel()

void RECLAIM_TICKETS_consume_cancel ( struct RECLAIM_TICKETS_ConsumeHandle cth)

Cancel a consume operation.

Parameters
cththe operation to cancel

Definition at line 1252 of file gnunet-service-reclaim_tickets.c.

1253{
1254 cleanup_cth (cth);
1255 return;
1256}

References cleanup_cth().

Referenced by cleanup_client().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup_issue_handle()

static void cleanup_issue_handle ( struct TicketIssueHandle handle)
static

Cleanup ticket consume handle.

Parameters
handlethe handle to clean up

Definition at line 1268 of file gnunet-service-reclaim_tickets.c.

1269{
1270 if (NULL != handle->ns_qe)
1273}
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition gnunet-vpn.c:35

References GNUNET_free, GNUNET_NAMESTORE_cancel(), and handle.

Referenced by filter_tickets_cb(), filter_tickets_error_cb(), and store_ticket_issue_cont().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ store_ticket_issue_cont()

static void store_ticket_issue_cont ( void *  cls,
enum GNUNET_ErrorCode  ec 
)
static

Store finished, abort on error.

Else, return new ticket to caller.

Parameters
clshandle to the operation
successstore operation result
emsgerror message (or NULL on success)

Definition at line 1285 of file gnunet-service-reclaim_tickets.c.

1286{
1287 struct TicketIssueHandle *handle = cls;
1288
1289 handle->ns_qe = NULL;
1290 if (GNUNET_EC_NONE != ec)
1291 {
1292 handle->cb (handle->cb_cls,
1293 &handle->ticket,
1294 NULL,
1296 "Error storing AuthZ ticket in GNS");
1297 return;
1298 }
1299 handle->cb (handle->cb_cls,
1300 &handle->ticket,
1301 handle->presentations,
1302 GNUNET_OK, NULL);
1304}
static void cleanup_issue_handle(struct TicketIssueHandle *handle)
Cleanup ticket consume handle.
Ticket issue request handle.

References cleanup_issue_handle(), GNUNET_EC_NONE, GNUNET_OK, GNUNET_SYSERR, and handle.

Referenced by issue_ticket().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ issue_ticket()

static void issue_ticket ( struct TicketIssueHandle ih)
static

Issue a new ticket.

We store references to attribute record labels and the ticket itself under the label base64(ticket.rnd).

Parameters
ihhandle to the operation containing relevant metadata

Definition at line 1315 of file gnunet-service-reclaim_tickets.c.

1316{
1319 struct GNUNET_GNSRECORD_Data *attrs_record;
1320 struct GNUNET_RECLAIM_Presentation *presentation;
1322 char *label;
1323 char *tkt_data;
1324 int i;
1325 int j;
1326 int attrs_count = 0;
1327
1328 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1329 attrs_count++;
1330
1331 // Worst case we have one presentation per attribute plus the ticket
1332 // plus the RP URI record
1333 attrs_record =
1334 GNUNET_malloc ((2 * attrs_count + 2)
1335 * sizeof(struct GNUNET_GNSRECORD_Data));
1336 i = 0;
1337 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1338 {
1340 "Adding list entry: %s\n", le->attribute->name);
1341
1342 attrs_record[i].data = &le->attribute->id;
1343 attrs_record[i].data_size = sizeof(le->attribute->id);
1347 i++;
1349 {
1351 "Attribute is backed by credential. Adding...\n");
1352 presentation = NULL;
1353 for (j = 0; j < i; j++)
1354 {
1355 if (attrs_record[j].record_type
1357 continue;
1359 attrs_record[j].data,
1360 attrs_record[j].
1361 data_size);
1362 if (NULL == presentation)
1363 {
1365 "Failed to deserialize presentation\n");
1366 continue;
1367 }
1368 if (0 == memcmp (&presentation->credential_id,
1369 &le->attribute->credential,
1370 sizeof (le->attribute->credential)))
1371 break;
1372 GNUNET_free (presentation);
1373 presentation = NULL;
1374 }
1375 if (NULL != presentation)
1376 {
1377 GNUNET_free (presentation);
1378 continue; // Skip as we have already added this credential presentation.
1379 }
1380 for (ple = ih->presentations->list_head; NULL != ple; ple = ple->next)
1381 {
1383 "Checking presentation....\n");
1384
1385 if (0 != memcmp (&le->attribute->credential,
1387 sizeof (le->attribute->credential)))
1388 {
1390 "Presentation does not match credential ID.\n");
1391 continue;
1392 }
1393 {
1394 char *pres_buf;
1395 size_t pres_size;
1396
1397 pres_size =
1399 pres_buf = GNUNET_malloc (pres_size);
1401 pres_buf);
1402 attrs_record[i].data = pres_buf;
1403 attrs_record[i].data_size = pres_size;
1404 attrs_record[i].expiration_time =
1406 attrs_record[i].record_type =
1409 i++;
1410 break;
1411 }
1412 }
1413 }
1414 }
1415
1416 label =
1418 sizeof(ih->rnd));
1420 &pub);
1421 {
1424 "Storing AuthZ information under %s in %s\n", label, str);
1425 sprintf (ih->ticket.gns_name, "%s.%s", label, str);
1426 GNUNET_free (str);
1427 }
1428
1429 attrs_record[i].data_size =
1430 strlen (ih->ticket.gns_name) + 1;
1431 tkt_data = GNUNET_malloc (attrs_record[i].data_size);
1432 memcpy (tkt_data, &ih->ticket, attrs_record[i].data_size);
1433 // The ticket: Could be removed?
1434 attrs_record[i].data = tkt_data;
1437 attrs_record[i].flags =
1439 i++;
1440 // The RP URI
1441 attrs_record[i].data_size = strlen (ih->rp_uri);
1442 attrs_record[i].data = ih->rp_uri;
1444 attrs_record[i].record_type = GNUNET_DNSPARSER_TYPE_TXT;
1445 attrs_record[i].flags =
1447 i++;
1448
1449 // Publish record
1451 &ih->identity,
1452 label,
1453 i,
1454 attrs_record,
1456 ih);
1457 for (j = 0; j < i; j++)
1458 {
1459 char *ptr = (char*) attrs_record[j].data;
1460 if (attrs_record[j].record_type
1462 continue;
1463 // Yes, we are allowed to do this because we allocated it above
1464 GNUNET_free (ptr);
1465 }
1466 GNUNET_free (tkt_data);
1467 GNUNET_free (attrs_record);
1468 GNUNET_free (label);
1469}
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
local ticket reference
static struct GNUNET_CRYPTO_EddsaPublicKey pub
static struct GNUNET_TIME_Relative ticket_refresh_interval
Ticket expiration interval.
static void store_ticket_issue_cont(void *cls, enum GNUNET_ErrorCode ec)
Store finished, abort on error.
@ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION
This expiration time of the record is a relative time (not an absolute time).
@ GNUNET_GNSRECORD_RF_PRIVATE
This is a private record of this peer and it should thus not be published.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_blindable_key_get_public(const struct GNUNET_CRYPTO_BlindablePrivateKey *privkey, struct GNUNET_CRYPTO_BlindablePublicKey *key)
Retrieves the public key representation of a private key.
char * GNUNET_CRYPTO_blindable_public_key_to_string(const struct GNUNET_CRYPTO_BlindablePublicKey *key)
Creates a (Base32) string representation of the public key.
size_t GNUNET_RECLAIM_presentation_serialize_get_size(const struct GNUNET_RECLAIM_Presentation *presentation)
Get required size for serialization buffer.
#define GNUNET_RECLAIM_id_is_zero(a)
size_t GNUNET_RECLAIM_presentation_serialize(const struct GNUNET_RECLAIM_Presentation *presentation, char *result)
Serialize a presentation.
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
struct GNUNET_RECLAIM_PresentationListEntry * next
DLL.
A credential presentation.
struct GNUNET_RECLAIM_Identifier credential_id
The credential id of which this is a presentation.
struct GNUNET_RECLAIM_AttributeList * attrs
Attributes to issue.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct GNUNET_RECLAIM_PresentationList * presentations
Presentations to add.
char rp_uri[GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN]
The ticket audience (= relying party) URI.
struct GNUNET_CRYPTO_BlindablePrivateKey identity
Issuer Key.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
const char * str
Definition time.c:1252

References GNUNET_RECLAIM_AttributeListEntry::attribute, TicketIssueHandle::attrs, GNUNET_RECLAIM_Attribute::credential, GNUNET_RECLAIM_Presentation::credential_id, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_RECLAIM_Ticket::gns_name, GNUNET_CRYPTO_blindable_key_get_public(), GNUNET_CRYPTO_blindable_public_key_to_string(), GNUNET_DNSPARSER_TYPE_TXT, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_record_set_store(), GNUNET_NO, GNUNET_RECLAIM_id_is_zero, GNUNET_RECLAIM_presentation_deserialize(), GNUNET_RECLAIM_presentation_serialize(), GNUNET_RECLAIM_presentation_serialize_get_size(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_Attribute::id, TicketIssueHandle::identity, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_PresentationList::list_head, GNUNET_RECLAIM_Attribute::name, GNUNET_RECLAIM_AttributeListEntry::next, GNUNET_RECLAIM_PresentationListEntry::next, TicketIssueHandle::ns_qe, nsh, GNUNET_RECLAIM_PresentationListEntry::presentation, TicketIssueHandle::presentations, pub, GNUNET_GNSRECORD_Data::record_type, GNUNET_TIME_Relative::rel_value_us, TicketIssueHandle::rnd, TicketIssueHandle::rp_uri, store_ticket_issue_cont(), str, TicketIssueHandle::ticket, and ticket_refresh_interval.

Referenced by filter_tickets_finished_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filter_tickets_error_cb()

static void filter_tickets_error_cb ( void *  cls)
static

Namestore error on issue.

Abort.

Parameters
clshandle to the operation

Definition at line 1483 of file gnunet-service-reclaim_tickets.c.

1484{
1485 struct TicketIssueHandle *tih = cls;
1486
1487 tih->ns_it = NULL;
1488 tih->cb (tih->cb_cls,
1489 &tih->ticket,
1490 NULL,
1492 "Error storing AuthZ ticket in GNS");
1494}
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore Iterator.
RECLAIM_TICKETS_TicketResult cb
Callback.

References TicketIssueHandle::cb, TicketIssueHandle::cb_cls, cleanup_issue_handle(), GNUNET_SYSERR, TicketIssueHandle::ns_it, and TicketIssueHandle::ticket.

Referenced by RECLAIM_TICKETS_issue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filter_tickets_cb()

static void filter_tickets_cb ( void *  cls,
const struct GNUNET_CRYPTO_BlindablePrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Iterator over records.

Check if any previously issued ticket already matches what we need to prevent duplicates and improve resolution synergy.

Parameters
clshandle to the operation
zoneissuer identity
labelticket rnd
rd_countsize of record set
rdrecord set

If we found a matching ticket, return that to the caller and we are done.

Definition at line 1510 of file gnunet-service-reclaim_tickets.c.

1515{
1516 struct TicketIssueHandle *tih = cls;
1518 struct GNUNET_RECLAIM_Presentation *presentation;
1519 struct GNUNET_RECLAIM_PresentationList *ticket_presentations;
1523 unsigned int attr_cnt = 0;
1524 unsigned int pres_cnt = 0;
1525 unsigned int found_attrs_cnt = 0;
1526 unsigned int found_pres_cnt = 0;
1527 int ticket_found = GNUNET_NO;
1528 int rp_uri_matches = GNUNET_NO;
1529
1530 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1531 {
1532 attr_cnt++;
1534 pres_cnt++;
1535 }
1536
1537 // ticket search
1538 found_attrs_cnt = 0;
1539 found_pres_cnt = 0;
1540 ticket_presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList);
1541
1542 for (int i = 0; i < rd_count; i++)
1543 {
1544 // found ticket
1545 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET == rd[i].record_type)
1546 {
1547 ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1548 tih->ticket = *ticket;
1549 ticket_found = GNUNET_YES;
1550 }
1551 if (GNUNET_DNSPARSER_TYPE_TXT == rd[i].record_type)
1552 {
1553 // cmp audience
1554 if (0 != strncmp (tih->rp_uri,
1555 rd[i].data,
1556 rd[i].data_size))
1557 continue;
1558 rp_uri_matches = GNUNET_YES;
1559 }
1560 // cmp requested attributes with ticket attributes
1561 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1562 {
1563 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1564 {
1566 &le->attribute->id))
1567 found_attrs_cnt++;
1568 }
1569 }
1570 if (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL == rd[i].record_type)
1571 {
1573 "Found credential...\n");
1574
1575 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1576 {
1578 rd[i].data_size);
1580 &le->attribute->credential
1581 ))
1582 {
1584 "No match.\n");
1585 GNUNET_free (cred);
1586 continue;
1587 }
1589 "Match, creating presentation...\n");
1591 cred,
1592 tih->attrs,
1593 &presentation))
1594 {
1596 "Unable to retrieve presentation from credential\n");
1597 GNUNET_free (cred);
1598 continue;
1599 }
1601 ple->presentation = presentation;
1604 ple);
1605 GNUNET_free (cred);
1606 break;
1607 }
1608 }
1609 if (GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION == rd[i].record_type)
1610 {
1611 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1612 {
1614 rd[i].data_size)
1615 ;
1616 if (NULL == presentation)
1617 {
1619 "Failed to deserialize presentation\n");
1620 continue;
1621 }
1623 &presentation->credential_id,
1624 &le->attribute->credential))
1625 {
1626 found_pres_cnt++;
1628 ple->presentation = presentation;
1629 GNUNET_CONTAINER_DLL_insert (ticket_presentations->list_head,
1630 ticket_presentations->list_tail,
1631 ple);
1632 }
1633 }
1634 }
1635 }
1636
1641 if ((attr_cnt == found_attrs_cnt) &&
1642 (pres_cnt == found_pres_cnt) &&
1643 (GNUNET_YES == ticket_found) &&
1644 (GNUNET_YES == rp_uri_matches))
1645 {
1647 tih->cb (tih->cb_cls, &tih->ticket, ticket_presentations, GNUNET_OK, NULL);
1648 GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations);
1650 return;
1651 }
1652 GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations);
1653 // ticket not found in current record, checking next record set
1655}
static gnutls_certificate_credentials_t cred
The credential.
#define GNUNET_RECLAIM_id_is_equal(a, b)
int GNUNET_RECLAIM_credential_get_presentation(const struct GNUNET_RECLAIM_Credential *cred, const struct GNUNET_RECLAIM_AttributeList *attrs, struct GNUNET_RECLAIM_Presentation **presentation)
Create a presentation from a credential and a lift of (selected) attributes in the credential.
The authorization ticket.

References GNUNET_RECLAIM_AttributeListEntry::attribute, TicketIssueHandle::attrs, TicketIssueHandle::cb, TicketIssueHandle::cb_cls, cleanup_issue_handle(), cred, GNUNET_RECLAIM_Attribute::credential, GNUNET_RECLAIM_Presentation::credential_id, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_CONTAINER_DLL_insert, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL, GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_log, GNUNET_NAMESTORE_zone_iteration_stop(), GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_RECLAIM_credential_deserialize(), GNUNET_RECLAIM_credential_get_presentation(), GNUNET_RECLAIM_id_is_equal, GNUNET_RECLAIM_id_is_zero, GNUNET_RECLAIM_presentation_deserialize(), GNUNET_RECLAIM_presentation_list_destroy(), GNUNET_YES, GNUNET_RECLAIM_Attribute::id, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_PresentationList::list_head, GNUNET_RECLAIM_PresentationList::list_tail, GNUNET_RECLAIM_AttributeListEntry::next, TicketIssueHandle::ns_it, GNUNET_RECLAIM_PresentationListEntry::presentation, TicketIssueHandle::presentations, rd, rd_count, TicketIssueHandle::rp_uri, ticket, and TicketIssueHandle::ticket.

Referenced by RECLAIM_TICKETS_issue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filter_tickets_finished_cb()

static void filter_tickets_finished_cb ( void *  cls)
static

Done iterating over tickets and we apparently did not find an existing, matching ticket.

Continue by issuing a new ticket.

Parameters
clshandle to the operation

Definition at line 1666 of file gnunet-service-reclaim_tickets.c.

1667{
1668 struct TicketIssueHandle *tih = cls;
1669
1671 issue_ticket (tih);
1672}
static void issue_ticket(struct TicketIssueHandle *ih)
Issue a new ticket.

References GNUNET_RECLAIM_id_generate, issue_ticket(), and TicketIssueHandle::rnd.

Referenced by RECLAIM_TICKETS_issue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_issue()

void RECLAIM_TICKETS_issue ( const struct GNUNET_CRYPTO_BlindablePrivateKey identity,
const struct GNUNET_RECLAIM_AttributeList attrs,
const char *  rp,
RECLAIM_TICKETS_TicketResult  cb,
void *  cb_cls 
)

Issue a new reclaim ticket, thereby authorizing the audience to access the set of provided attributes.

Parameters
identitythe issuer
attrsthe attributes to share
audiencethe audience to share the attributes with
cbthe callback to call with the ticket result
cb_clsthe callback closure FIXME: Return handle??

Definition at line 1687 of file gnunet-service-reclaim_tickets.c.

1692{
1693 struct TicketIssueHandle *tih;
1694
1695 tih = GNUNET_new (struct TicketIssueHandle);
1696 tih->cb = cb;
1697 tih->cb_cls = cb_cls;
1700 tih->identity = *identity;
1701 memcpy (tih->rp_uri, rp, strlen (rp) + 1);
1702
1703 // First check whether the ticket has already been issued
1704 tih->ns_it =
1706 &tih->identity,
1708 tih,
1710 tih,
1712 tih);
1713}
static char * rp
Relying party.
static void filter_tickets_finished_cb(void *cls)
Done iterating over tickets and we apparently did not find an existing, matching ticket.
static void filter_tickets_cb(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Iterator over records.
static void filter_tickets_error_cb(void *cls)
Namestore error on issue.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attribute_list_dup(const struct GNUNET_RECLAIM_AttributeList *attrs)
Make a (deep) copy of a claim list.

References TicketIssueHandle::attrs, TicketIssueHandle::cb, TicketIssueHandle::cb_cls, filter_tickets_cb(), filter_tickets_error_cb(), filter_tickets_finished_cb(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_new, GNUNET_RECLAIM_attribute_list_dup(), identity, TicketIssueHandle::identity, TicketIssueHandle::ns_it, nsh, TicketIssueHandle::presentations, rp, and TicketIssueHandle::rp_uri.

Referenced by handle_issue_ticket_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup_iter()

static void cleanup_iter ( struct RECLAIM_TICKETS_Iterator iter)
static

Cleanup ticket iterator.

Parameters
iterhandle to the iteration

Definition at line 1726 of file gnunet-service-reclaim_tickets.c.

1727{
1728 if (NULL != iter->ns_it)
1730 GNUNET_free (iter);
1731}
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.

References GNUNET_free, GNUNET_NAMESTORE_zone_iteration_stop(), and RECLAIM_TICKETS_Iterator::ns_it.

Referenced by collect_tickets_error_cb(), collect_tickets_finished_cb(), and RECLAIM_TICKETS_iteration_stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ collect_tickets_cb()

static void collect_tickets_cb ( void *  cls,
const struct GNUNET_CRYPTO_BlindablePrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Return each record of type GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET to the caller and proceed with the iteration.

FIXME: Should we not proceed automatically here?

Parameters
clshandle to the iteration
zonethe ticket issuer
labelthe ticket rnd
rd_countnumber of records in record set
rdrecord set containing a ticket

Definition at line 1746 of file gnunet-service-reclaim_tickets.c.

1751{
1752 struct RECLAIM_TICKETS_Iterator *iter = cls;
1754 int ticket_found = GNUNET_NO;
1755 const char *rp_uri = NULL;
1756
1757 for (int i = 0; i < rd_count; i++)
1758 {
1759 if (GNUNET_DNSPARSER_TYPE_TXT == rd[i].record_type)
1760 rp_uri = rd[i].data;
1761 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET != rd[i].record_type)
1762 continue;
1763 if ((GNUNET_YES == ticket_found) && (NULL != rp_uri))
1764 break;
1765 ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1766 ticket_found = GNUNET_YES;
1767 }
1768 if ((GNUNET_YES == ticket_found) && (NULL != rp_uri))
1769 iter->cb (iter->cb_cls, ticket, rp_uri);
1771}
RECLAIM_TICKETS_TicketIter cb
Iter callback.

References RECLAIM_TICKETS_Iterator::cb, RECLAIM_TICKETS_Iterator::cb_cls, data, GNUNET_GNSRECORD_Data::data, GNUNET_DNSPARSER_TYPE_TXT, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_NO, GNUNET_YES, RECLAIM_TICKETS_Iterator::ns_it, rd, rd_count, and ticket.

Referenced by RECLAIM_TICKETS_iteration_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ collect_tickets_finished_cb()

static void collect_tickets_finished_cb ( void *  cls)
static

Signal ticket iteration has finished.

Parameters
clshandle to the iteration

Definition at line 1780 of file gnunet-service-reclaim_tickets.c.

1781{
1782 struct RECLAIM_TICKETS_Iterator *iter = cls;
1783
1784 iter->ns_it = NULL;
1785 iter->cb (iter->cb_cls, NULL, NULL);
1786 cleanup_iter (iter);
1787}
static void cleanup_iter(struct RECLAIM_TICKETS_Iterator *iter)
Cleanup ticket iterator.

References RECLAIM_TICKETS_Iterator::cb, RECLAIM_TICKETS_Iterator::cb_cls, cleanup_iter(), and RECLAIM_TICKETS_Iterator::ns_it.

Referenced by RECLAIM_TICKETS_iteration_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ collect_tickets_error_cb()

static void collect_tickets_error_cb ( void *  cls)
static

Cancel ticket iteration on namestore error.

Parameters
clsthe iteration handle

Definition at line 1796 of file gnunet-service-reclaim_tickets.c.

1797{
1798 struct RECLAIM_TICKETS_Iterator *iter = cls;
1799
1800 iter->ns_it = NULL;
1801 iter->cb (iter->cb_cls, NULL, NULL);
1802 cleanup_iter (iter);
1803}

References RECLAIM_TICKETS_Iterator::cb, RECLAIM_TICKETS_Iterator::cb_cls, cleanup_iter(), and RECLAIM_TICKETS_Iterator::ns_it.

Referenced by RECLAIM_TICKETS_iteration_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_iteration_next()

void RECLAIM_TICKETS_iteration_next ( struct RECLAIM_TICKETS_Iterator iter)

Continue ticket iteration.

Parameters
iterthe iteration to continue

Definition at line 1812 of file gnunet-service-reclaim_tickets.c.

1813{
1815}

References GNUNET_NAMESTORE_zone_iterator_next(), and RECLAIM_TICKETS_Iterator::ns_it.

Referenced by handle_ticket_iteration_next().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_iteration_stop()

void RECLAIM_TICKETS_iteration_stop ( struct RECLAIM_TICKETS_Iterator iter)

Stop a running ticket iteration.

Parameters
iteriteration to cancel

Definition at line 1824 of file gnunet-service-reclaim_tickets.c.

1825{
1827 cleanup_iter (iter);
1828}

References cleanup_iter(), GNUNET_NAMESTORE_zone_iteration_stop(), and RECLAIM_TICKETS_Iterator::ns_it.

Referenced by cleanup_client(), and handle_ticket_iteration_stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_iteration_start()

struct RECLAIM_TICKETS_Iterator * RECLAIM_TICKETS_iteration_start ( const struct GNUNET_CRYPTO_BlindablePrivateKey identity,
RECLAIM_TICKETS_TicketIter  cb,
void *  cb_cls 
)

Iterate over all tickets issued by an identity.

Parameters
identitythe issuing identity
cbticket callback function
cb_clscallback closure
Returns
a handle to the iteration

Definition at line 1840 of file gnunet-service-reclaim_tickets.c.

1844{
1845 struct RECLAIM_TICKETS_Iterator *iter;
1846
1847 iter = GNUNET_new (struct RECLAIM_TICKETS_Iterator);
1848 iter->cb = cb;
1849 iter->cb_cls = cb_cls;
1850 iter->ns_it =
1852 identity,
1854 iter,
1856 iter,
1858 iter);
1859 return iter;
1860}
static void collect_tickets_finished_cb(void *cls)
Signal ticket iteration has finished.
static void collect_tickets_error_cb(void *cls)
Cancel ticket iteration on namestore error.
static void collect_tickets_cb(void *cls, const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Return each record of type GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET to the caller and proceed with the it...

References RECLAIM_TICKETS_Iterator::cb, RECLAIM_TICKETS_Iterator::cb_cls, collect_tickets_cb(), collect_tickets_error_cb(), collect_tickets_finished_cb(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_new, identity, RECLAIM_TICKETS_Iterator::ns_it, and nsh.

Referenced by handle_ticket_iteration_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_init()

int RECLAIM_TICKETS_init ( const struct GNUNET_CONFIGURATION_Handle c)

Initialize tickets component.

Parameters
cthe configuration
Returns
GNUNET_SYSERR on error

Definition at line 1870 of file gnunet-service-reclaim_tickets.c.

1871{
1872 // Get ticket expiration time (relative) from config
1873 if (GNUNET_OK ==
1875 "reclaim",
1876 "TICKET_REFRESH_INTERVAL",
1878 {
1880 "Configured refresh interval for tickets: %s\n",
1882 GNUNET_YES));
1883 }
1884 else
1885 {
1887 }
1888 // Connect to identity and namestore services
1890 if (NULL == nsh)
1891 {
1893 "error connecting to namestore");
1894 return GNUNET_SYSERR;
1895 }
1896 gns = GNUNET_GNS_connect (c);
1897 if (NULL == gns)
1898 {
1899 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns");
1900 return GNUNET_SYSERR;
1901 }
1902 stats = GNUNET_STATISTICS_create ("reclaim", c);
1903 return GNUNET_OK;
1904}
#define DEFAULT_TICKET_REFRESH_INTERVAL
FIXME: the default ticket iteration interval should probably be the minimum attribute expiration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
Definition gns_api.c:267
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition strings.c:599

References DEFAULT_TICKET_REFRESH_INTERVAL, gns, GNUNET_CONFIGURATION_get_value_time(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_GNS_connect(), GNUNET_log, GNUNET_log_strerror, GNUNET_NAMESTORE_connect(), GNUNET_OK, GNUNET_STATISTICS_create(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_SYSERR, GNUNET_YES, nsh, stats, and ticket_refresh_interval.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_deinit()

void RECLAIM_TICKETS_deinit ( void  )

Close handles and clean up.

FIXME: cancel all pending operations (gns, ns etc)

Definition at line 1912 of file gnunet-service-reclaim_tickets.c.

1913{
1914 if (NULL != nsh)
1916 nsh = NULL;
1917 if (NULL != gns)
1919 gns = NULL;
1920 if (NULL != stats)
1921 {
1923 stats = NULL;
1924 }
1925}
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
Definition gns_api.c:289
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).

References gns, GNUNET_GNS_disconnect(), GNUNET_NAMESTORE_disconnect(), GNUNET_NO, GNUNET_STATISTICS_destroy(), nsh, and stats.

Referenced by cleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ticket_refresh_interval

struct GNUNET_TIME_Relative ticket_refresh_interval
static

Ticket expiration interval.

Definition at line 341 of file gnunet-service-reclaim_tickets.c.

Referenced by issue_ticket(), and RECLAIM_TICKETS_init().

◆ nsh

◆ gns

◆ stats