GNUnet  0.10.x
Data Structures | Macros | Functions | Variables
gnunet-service-reclaim_tickets.c File Reference

reclaim tickets More...

#include <inttypes.h>
#include "gnunet-service-reclaim_tickets.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
 
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
 

Functions

static void move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rh)
 
static void move_attrs_cont (void *cls)
 
static void cleanup_rvk (struct RECLAIM_TICKETS_RevokeHandle *rh)
 Cleanup revoke handle. More...
 
static void del_attr_finished (void *cls, int32_t success, const char *emsg)
 
static void move_attr_finished (void *cls, int32_t success, const char *emsg)
 
static void rvk_move_attr_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
static void rvk_ticket_update (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
static void process_tickets (void *cls)
 
static void ticket_processed (void *cls, int32_t success, const char *emsg)
 
static void rvk_ticket_update_finished (void *cls)
 
static void rvk_ns_iter_err (void *cls)
 
static void rvk_ns_err (void *cls)
 
static void remove_ticket_cont (void *cls, int32_t success, const char *emsg)
 
static void revoke_attrs_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
static void rvk_attrs_err_cb (void *cls)
 
struct RECLAIM_TICKETS_RevokeHandleRECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls)
 
void RECLAIM_TICKETS_revoke_cancel (struct RECLAIM_TICKETS_RevokeHandle *rh)
 
static void cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth)
 Cleanup ticket consume handle. More...
 
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)
 
static void lookup_authz_cb (void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
struct RECLAIM_TICKETS_ConsumeHandleRECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id, const struct GNUNET_RECLAIM_Ticket *ticket, RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls)
 
void RECLAIM_TICKETS_consume_cancel (struct RECLAIM_TICKETS_ConsumeHandle *cth)
 
static void cleanup_issue_handle (struct TicketIssueHandle *handle)
 Cleanup ticket consume handle. More...
 
static void store_ticket_issue_cont (void *cls, int32_t success, const char *emsg)
 
static void issue_ticket (struct TicketIssueHandle *ih)
 
static void filter_tickets_error_cb (void *cls)
 
static void filter_tickets_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
static void filter_tickets_finished_cb (void *cls)
 
void RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, RECLAIM_TICKETS_TicketResult cb, void *cb_cls)
 
static void cleanup_iter (struct RECLAIM_TICKETS_Iterator *iter)
 
static void collect_tickets_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
static void collect_tickets_finished_cb (void *cls)
 
static void collect_tickets_error_cb (void *cls)
 
void RECLAIM_TICKETS_iteration_next (struct RECLAIM_TICKETS_Iterator *iter)
 
void RECLAIM_TICKETS_iteration_stop (struct RECLAIM_TICKETS_Iterator *iter)
 
struct RECLAIM_TICKETS_IteratorRECLAIM_TICKETS_iteration_start (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
 
int RECLAIM_TICKETS_init (const struct GNUNET_CONFIGURATION_Handle *c)
 
void RECLAIM_TICKETS_deinit (void)
 

Variables

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

Detailed Description

reclaim tickets

Author
Martin Schanzenbach

Definition in file gnunet-service-reclaim_tickets.c.

Macro Definition Documentation

◆ DEFAULT_TICKET_REFRESH_INTERVAL

#define DEFAULT_TICKET_REFRESH_INTERVAL   GNUNET_TIME_UNIT_HOURS

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

Referenced by RECLAIM_TICKETS_init().

Function Documentation

◆ move_attrs()

static void move_attrs ( struct RECLAIM_TICKETS_RevokeHandle rh)
static

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

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, 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().

603 {
604  char *label;
605 
606  if (NULL == rvk->move_attr)
607  {
608  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n");
609  rvk->ns_it =
611  &rvk->identity,
613  rvk,
615  rvk,
617  rvk);
618  return;
619  }
620  label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
621  sizeof (uint64_t));
622  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving attribute %s\n", label);
623 
624  rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
625  &rvk->identity,
626  label,
627  &rvk_ns_err,
628  rvk,
630  rvk);
631  GNUNET_free (label);
632 }
static void rvk_move_attr_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT)...
static void rvk_ns_iter_err(void *cls)
static void rvk_ticket_update_finished(void *cls)
static struct GNUNET_NAMESTORE_Handle * nsh
#define GNUNET_log(kind,...)
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:988
static void rvk_ticket_update(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
static void rvk_ns_err(void *cls)
#define GNUNET_free(ptr)
Wrapper around free.
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

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

References move_attrs().

Referenced by del_attr_finished(), and rvk_move_attr_cb().

319 {
320  move_attrs ((struct RECLAIM_TICKETS_RevokeHandle *) cls);
321 }
Ticket revocation request handle.
static void move_attrs(struct RECLAIM_TICKETS_RevokeHandle *rh)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup_rvk()

static void cleanup_rvk ( struct RECLAIM_TICKETS_RevokeHandle rh)
static

Cleanup revoke handle.

Parameters
rhthe ticket revocation handle

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

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().

330 {
331  struct RevokedAttributeEntry *ae;
332  struct TicketRecordsEntry *le;
333  if (NULL != rh->ns_qe)
335  if (NULL != rh->ns_it)
337  while (NULL != (ae = rh->attrs_head))
338  {
340  GNUNET_free (ae);
341  }
342  while (NULL != (le = rh->tickets_to_update_head))
343  {
346  le);
347  if (NULL != le->data)
348  GNUNET_free (le->data);
349  if (NULL != le->label)
350  GNUNET_free (le->label);
351  GNUNET_free (le);
352  }
353  GNUNET_free (rh);
354 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct RevokedAttributeEntry * attrs_tail
Revoked attributes.
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 RevokedAttributeEntry * attrs_head
Revoked attributes.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
#define GNUNET_free(ptr)
Wrapper around free.
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,
int32_t  success,
const char *  emsg 
)
static

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

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_ERROR_TYPE_ERROR, 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().

358 {
359  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
360  rvk->ns_qe = NULL;
361  if (GNUNET_SYSERR == success)
362  {
364  "Error removing attribute: %s\n",
365  emsg);
366  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
367  cleanup_rvk (rvk);
368  return;
369  }
370  rvk->move_attr = rvk->move_attr->next;
372 }
Ticket revocation request handle.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct RevokedAttributeEntry * next
DLL.
struct RevokedAttributeEntry * move_attr
Current attribute to move.
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:1273
static void move_attrs_cont(void *cls)
RECLAIM_TICKETS_RevokeCallback cb
Callback.
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
#define GNUNET_log(kind,...)
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,
int32_t  success,
const char *  emsg 
)
static

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

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

Referenced by rvk_move_attr_cb().

376 {
377  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
378  char *label;
379  rvk->ns_qe = NULL;
380  if (GNUNET_SYSERR == success)
381  {
382  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error moving attribute: %s\n", emsg);
383  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
384  cleanup_rvk (rvk);
385  return;
386  }
388  sizeof (uint64_t));
389  GNUNET_assert (NULL != label);
390  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
392  &rvk->identity,
393  label,
394  0,
395  NULL,
397  rvk);
398  GNUNET_free (label);
399 }
Ticket revocation request handle.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
static void del_attr_finished(void *cls, int32_t success, const char *emsg)
struct RevokedAttributeEntry * move_attr
Current attribute to move.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
RECLAIM_TICKETS_RevokeCallback cb
Callback.
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static struct GNUNET_NAMESTORE_Handle * nsh
#define GNUNET_log(kind,...)
uint64_t old_id
Old ID of the attribute.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:988
#define GNUNET_free(ptr)
Wrapper around free.
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_EcdsaPrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

find a new place for this attribute

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

References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::attrs_tail, claim, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_CONTAINER_DLL_remove, GNUNET_CRYPTO_QUALITY_STRONG, GNUNET_CRYPTO_random_u64(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_records_store(), GNUNET_RECLAIM_ATTRIBUTE_deserialize(), GNUNET_RECLAIM_ATTRIBUTE_serialize(), GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size(), GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_ATTRIBUTE_Claim::id, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::move_attr, move_attr_finished(), move_attrs_cont(), GNUNET_RECLAIM_ATTRIBUTE_Claim::name, RevokedAttributeEntry::new_id, RevokedAttributeEntry::next, and RECLAIM_TICKETS_RevokeHandle::ns_qe.

Referenced by move_attrs().

408 {
409  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
411  struct GNUNET_GNSRECORD_Data new_rd;
412  struct RevokedAttributeEntry *le;
413  char *new_label;
414  char *attr_data;
415  rvk->ns_qe = NULL;
416  if (0 == rd_count)
417  {
419  "The attribute %s no longer exists!\n",
420  label);
421  le = rvk->move_attr;
422  rvk->move_attr = le->next;
424  GNUNET_free (le);
426  return;
427  }
429  rvk->move_attr->new_id =
431  new_rd = *rd;
434  "Attribute to update: Name=%s, ID=%" PRIu64 "\n",
435  claim->name,
436  claim->id);
437  claim->id = rvk->move_attr->new_id;
438  new_rd.data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (claim);
439  attr_data = GNUNET_malloc (rd->data_size);
440  new_rd.data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize (claim, attr_data);
441  new_rd.data = attr_data;
443  sizeof (uint64_t));
444  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
446  &rvk->identity,
447  new_label,
448  1,
449  &new_rd,
451  rvk);
452  GNUNET_free (new_label);
453  GNUNET_free (claim);
454  GNUNET_free (attr_data);
455 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
const char * name
The name of the attribute.
Ticket revocation request handle.
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Random on unsigned 64-bit values.
static void move_attr_finished(void *cls, int32_t success, const char *emsg)
uint64_t new_id
New ID of the attribute.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct RevokedAttributeEntry * attrs_tail
Revoked attributes.
size_t data_size
Number of bytes in data.
struct RevokedAttributeEntry * next
DLL.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
struct RevokedAttributeEntry * move_attr
Current attribute to move.
const void * data
Binary value stored in the DNS record.
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:1273
static void move_attrs_cont(void *cls)
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
struct RevokedAttributeEntry * attrs_head
Revoked attributes.
static struct GNUNET_NAMESTORE_Handle * nsh
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size(const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
Get required size for serialization buffer.
#define GNUNET_log(kind,...)
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize(const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, char *result)
Serialize an attribute.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
Claim to store.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:988
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * GNUNET_RECLAIM_ATTRIBUTE_deserialize(const char *data, size_t data_size)
Deserialize an attribute.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
High-quality operations are desired.
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_EcdsaPrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Let everything point to the old record

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

References RECLAIM_TICKETS_RevokeHandle::attrs_head, TicketRecordsEntry::data, data, TicketRecordsEntry::data_size, GNUNET_CONTAINER_DLL_insert, GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_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, process_tickets(), TicketRecordsEntry::rd_count, RECLAIM_TICKETS_RevokeHandle::tickets_to_update_head, and RECLAIM_TICKETS_RevokeHandle::tickets_to_update_tail.

Referenced by move_attrs().

464 {
465  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
466  struct TicketRecordsEntry *le;
467  struct RevokedAttributeEntry *ae;
468  int has_changed = GNUNET_NO;
469 
471  for (int i = 0; i < rd_count; i++)
472  {
473  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
474  continue;
475  for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
476  {
477  if (0 != memcmp (rd[i].data, &ae->old_id, sizeof (uint64_t)))
478  continue;
479  has_changed = GNUNET_YES;
480  break;
481  }
482  if (GNUNET_YES == has_changed)
483  break;
484  }
485  if (GNUNET_YES == has_changed)
486  {
487  le = GNUNET_new (struct TicketRecordsEntry);
488  le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
489  le->data = GNUNET_malloc (le->data_size);
490  le->rd_count = rd_count;
491  le->label = GNUNET_strdup (label);
492  GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
495  le);
496  }
498 }
GNUNET_NETWORK_STRUCT_END 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.
Ticket revocation request handle.
#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.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF
Record type for reclaim records.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_new(type)
Allocate a struct or union of the given type.
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...
struct RevokedAttributeEntry * next
DLL.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
unsigned int rd_count
Record count.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
struct RevokedAttributeEntry * attrs_head
Revoked attributes.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
#define GNUNET_YES
Definition: gnunet_common.h:80
uint64_t old_id
Old ID of the attribute.
uint32_t data
The data value.
#define GNUNET_malloc(size)
Wrapper around malloc.
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

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

References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), data, GNUNET_GNSRECORD_Data::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_ATTR_REF, GNUNET_log, GNUNET_NAMESTORE_records_store(), GNUNET_OK, GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::identity, RevokedAttributeEntry::new_id, RevokedAttributeEntry::next, RECLAIM_TICKETS_RevokeHandle::ns_qe, RevokedAttributeEntry::old_id, 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(), rvk_ticket_update_finished(), and ticket_processed().

515 {
516  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
517  struct TicketRecordsEntry *le;
518  struct RevokedAttributeEntry *ae;
519  if (NULL == rvk->tickets_to_update_head)
520  {
522  "Finished updatding tickets, success\n");
523  rvk->cb (rvk->cb_cls, GNUNET_OK);
524  cleanup_rvk (rvk);
525  return;
526  }
527  le = rvk->tickets_to_update_head;
530  le);
531  struct GNUNET_GNSRECORD_Data rd[le->rd_count];
533  le->data,
534  le->rd_count,
535  rd))
536  {
538  "Unable to deserialize ticket record(s)\n");
539  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
540  cleanup_rvk (rvk);
541  return;
542  }
543  for (int i = 0; i < le->rd_count; i++)
544  {
546  continue;
547  for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
548  {
549  if (0 != memcmp (rd[i].data, &ae->old_id, sizeof (uint64_t)))
550  continue;
551  rd[i].data = &ae->new_id;
552  }
553  }
555  &rvk->identity,
556  le->label,
557  le->rd_count,
558  rd,
560  rvk);
561  GNUNET_free (le->label);
562  GNUNET_free (le->data);
563  GNUNET_free (le);
564 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Ticket revocation request handle.
static void ticket_processed(void *cls, int32_t success, const char *emsg)
uint64_t new_id
New ID of the attribute.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF
Record type for reclaim records.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
struct RevokedAttributeEntry * next
DLL.
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.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
unsigned int rd_count
Record count.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
RECLAIM_TICKETS_RevokeCallback cb
Callback.
struct RevokedAttributeEntry * attrs_head
Revoked attributes.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static struct GNUNET_NAMESTORE_Handle * nsh
uint32_t record_type
Type of the GNS/DNS record.
#define GNUNET_log(kind,...)
uint64_t old_id
Old ID of the attribute.
uint32_t data
The data value.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_processed()

static void ticket_processed ( void *  cls,
int32_t  success,
const char *  emsg 
)
static

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

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

Referenced by process_tickets().

507 {
508  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
509  rvk->ns_qe = NULL;
511 }
Ticket revocation request handle.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
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:1273
static void process_tickets(void *cls)
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

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

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

Referenced by move_attrs().

568 {
569  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
570  rvk->ns_it = NULL;
572 }
Ticket revocation request handle.
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:1273
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
static void process_tickets(void *cls)
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

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

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::move_attr, RECLAIM_TICKETS_RevokeHandle::ns_it, and RevokedAttributeEntry::old_id.

Referenced by move_attrs().

577 {
578  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
579  rvk->ns_it = NULL;
581  "Namestore error on revocation (id=%" PRIu64 "\n",
582  rvk->move_attr->old_id);
583  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
584  cleanup_rvk (rvk);
585 }
Ticket revocation request handle.
struct RevokedAttributeEntry * move_attr
Current attribute to move.
RECLAIM_TICKETS_RevokeCallback cb
Callback.
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
#define GNUNET_log(kind,...)
uint64_t old_id
Old ID of the attribute.
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

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

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SYSERR, RECLAIM_TICKETS_RevokeHandle::move_attr, RECLAIM_TICKETS_RevokeHandle::ns_qe, and RevokedAttributeEntry::old_id.

Referenced by move_attrs().

590 {
591  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
592  rvk->ns_qe = NULL;
594  "Namestore error on revocation (id=%" PRIu64 "\n",
595  rvk->move_attr->old_id);
596  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
597  cleanup_rvk (rvk);
598 }
Ticket revocation request handle.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct RevokedAttributeEntry * move_attr
Current attribute to move.
RECLAIM_TICKETS_RevokeCallback cb
Callback.
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
#define GNUNET_log(kind,...)
uint64_t old_id
Old ID of the attribute.
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,
int32_t  success,
const char *  emsg 
)
static

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

References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, cleanup_rvk(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, 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().

637 {
638  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
639  rvk->ns_qe = NULL;
640  if (GNUNET_SYSERR == success)
641  {
642  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", emsg);
643  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
644  cleanup_rvk (rvk);
645  return;
646  }
647  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleted ticket\n");
648  if (0 == rvk->ticket_attrs)
649  {
651  "No attributes to move... strange\n");
652  rvk->cb (rvk->cb_cls, GNUNET_OK);
653  cleanup_rvk (rvk);
654  return;
655  }
656  rvk->move_attr = rvk->attrs_head;
657  move_attrs (rvk);
658 }
Ticket revocation request handle.
static void move_attrs(struct RECLAIM_TICKETS_RevokeHandle *rh)
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
struct RevokedAttributeEntry * move_attr
Current attribute to move.
RECLAIM_TICKETS_RevokeCallback cb
Callback.
struct RevokedAttributeEntry * attrs_head
Revoked attributes.
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
#define GNUNET_log(kind,...)
unsigned int ticket_attrs
Number of attributes in ticket.
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_EcdsaPrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Now, remove ticket

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

References RECLAIM_TICKETS_RevokeHandle::attrs_head, RECLAIM_TICKETS_RevokeHandle::attrs_tail, data, GNUNET_CONTAINER_DLL_insert, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF, GNUNET_NAMESTORE_records_store(), GNUNET_new, RECLAIM_TICKETS_RevokeHandle::identity, RECLAIM_TICKETS_RevokeHandle::ns_qe, RevokedAttributeEntry::old_id, remove_ticket_cont(), and RECLAIM_TICKETS_RevokeHandle::ticket_attrs.

Referenced by RECLAIM_TICKETS_revoke().

668 {
669  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
670  struct RevokedAttributeEntry *le;
671  rvk->ns_qe = NULL;
672  for (int i = 0; i < rd_count; i++)
673  {
674  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
675  continue;
676  le = GNUNET_new (struct RevokedAttributeEntry);
677  le->old_id = *((uint64_t *) rd[i].data);
679  rvk->ticket_attrs++;
680  }
681 
684  &rvk->identity,
685  label,
686  0,
687  NULL,
689  rvk);
690 }
Ticket revocation request handle.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct RevokedAttributeEntry * attrs_tail
Revoked attributes.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF
Record type for reclaim records.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
struct RevokedAttributeEntry * attrs_head
Revoked attributes.
static struct GNUNET_NAMESTORE_Handle * nsh
static void remove_ticket_cont(void *cls, int32_t success, const char *emsg)
uint64_t old_id
Old ID of the attribute.
uint32_t data
The data value.
unsigned int ticket_attrs
Number of attributes in ticket.
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

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

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

Referenced by RECLAIM_TICKETS_revoke().

695 {
696  struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
697  rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
698  cleanup_rvk (rvk);
699 }
Ticket revocation request handle.
RECLAIM_TICKETS_RevokeCallback cb
Callback.
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
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_EcdsaPrivateKey identity,
RECLAIM_TICKETS_RevokeCallback  cb,
void *  cb_cls 
)

Get shared attributes

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

References RECLAIM_TICKETS_RevokeHandle::cb, RECLAIM_TICKETS_RevokeHandle::cb_cls, GNUNET_assert, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_free, GNUNET_NAMESTORE_records_lookup(), GNUNET_new, GNUNET_STRINGS_data_to_string_alloc(), identity, RECLAIM_TICKETS_RevokeHandle::identity, GNUNET_RECLAIM_Ticket::identity, RECLAIM_TICKETS_RevokeHandle::ns_qe, revoke_attrs_cb(), GNUNET_RECLAIM_Ticket::rnd, rvk_attrs_err_cb(), TicketReference::ticket, and RECLAIM_TICKETS_RevokeHandle::ticket.

Referenced by handle_revoke_ticket_message().

707 {
708  struct RECLAIM_TICKETS_RevokeHandle *rvk;
709  char *label;
710 
712  rvk->cb = cb;
713  rvk->cb_cls = cb_cls;
714  rvk->identity = *identity;
715  rvk->ticket = *ticket;
718  label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof (uint64_t));
719  GNUNET_assert (NULL != label);
721  identity,
722  label,
724  rvk,
726  rvk);
727  GNUNET_free (label);
728  return rvk;
729 }
Ticket revocation request handle.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void revoke_attrs_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
RECLAIM_TICKETS_RevokeCallback cb
Callback.
static void rvk_attrs_err_cb(void *cls)
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The ticket issuer (= the user)
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:241
uint64_t rnd
The ticket random (NBO)
static struct GNUNET_NAMESTORE_Handle * nsh
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:988
#define GNUNET_free(ptr)
Wrapper around free.
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)

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

References cleanup_rvk().

Referenced by cleanup_client().

734 {
735  cleanup_rvk (rh);
736 }
static void cleanup_rvk(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cleanup revoke handle.
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 746 of file gnunet-service-reclaim_tickets.c.

References RECLAIM_TICKETS_ConsumeHandle::attrs, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_free_non_null, GNUNET_GNS_lookup_cancel(), GNUNET_RECLAIM_ATTRIBUTE_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, and RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail.

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

747 {
748  struct ParallelLookup *lu;
749  if (NULL != cth->lookup_request)
751  if (NULL != cth->kill_task)
753  while (NULL != (lu = cth->parallel_lookups_head))
754  {
755  if (NULL != lu->lookup_request)
760  lu);
761  GNUNET_free (lu);
762  }
763 
764  if (NULL != cth->attrs)
766  GNUNET_free (cth);
767 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * attrs
Attributes.
struct GNUNET_SCHEDULER_Task * kill_task
Kill task.
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
struct GNUNET_GNS_LookupRequest * lookup_request
void GNUNET_RECLAIM_ATTRIBUTE_list_destroy(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
Destroy claim list.
struct GNUNET_GNS_LookupRequest * lookup_request
LookupRequest.
void * GNUNET_GNS_lookup_cancel(struct GNUNET_GNS_LookupRequest *lr)
Cancel pending lookup request.
Definition: gns_api.c:309
struct ParallelLookup * parallel_lookups_tail
Lookup DLL.
struct ParallelLookup * parallel_lookups_head
Lookup DLL.
#define GNUNET_free(ptr)
Wrapper around free.
Handle for a parallel GNS lookup job.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
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 771 of file gnunet-service-reclaim_tickets.c.

References RECLAIM_TICKETS_ConsumeHandle::attrs, RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::claim, cleanup_cth(), GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR, GNUNET_log, GNUNET_new, GNUNET_OK, GNUNET_RECLAIM_ATTRIBUTE_deserialize(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_get_duration(), GNUNET_YES, ParallelLookup::handle, GNUNET_RECLAIM_Ticket::identity, ParallelLookup::label, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_head, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_tail, ParallelLookup::lookup_start_time, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_head, RECLAIM_TICKETS_ConsumeHandle::parallel_lookups_tail, GNUNET_GNSRECORD_Data::record_type, GNUNET_TIME_Relative::rel_value_us, and RECLAIM_TICKETS_ConsumeHandle::ticket.

Referenced by lookup_authz_cb().

774 {
775  struct ParallelLookup *parallel_lookup = cls;
776  struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
779  "Parallel lookup finished (count=%u)\n",
780  rd_count);
781 
784  parallel_lookup);
785  GNUNET_free (parallel_lookup->label);
786 
788  "attribute_lookup_time_total",
790  parallel_lookup->lookup_start_time)
791  .rel_value_us,
792  GNUNET_YES);
793  GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES);
794 
795 
796  GNUNET_free (parallel_lookup);
797  if (1 != rd_count)
798  GNUNET_break (0); // TODO
800  {
802  attr_le->claim =
805  cth->attrs->list_tail,
806  attr_le);
807  }
808  if (NULL != cth->parallel_lookups_head)
809  return; // Wait for more
810  /* Else we are done */
811 
812  cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL);
813  cleanup_cth (cth);
814 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
uint64_t rel_value_us
The actual value.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_tail
List tail.
struct GNUNET_TIME_Absolute lookup_start_time
Lookup time.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * attrs
Attributes.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR
Record type for identity attributes (of RECLAIM).
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
size_t data_size
Number of bytes in data.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct RECLAIM_TICKETS_ConsumeHandle * handle
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
const void * data
Binary value stored in the DNS record.
static void cleanup_cth(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cleanup ticket consume handle.
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The ticket issuer (= the user)
struct GNUNET_RECLAIM_Ticket ticket
Ticket.
uint32_t record_type
Type of the GNS/DNS record.
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:373
RECLAIM_TICKETS_ConsumeCallback cb
Callback.
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
struct ParallelLookup * parallel_lookups_tail
Lookup DLL.
static struct GNUNET_STATISTICS_Handle * stats
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * GNUNET_RECLAIM_ATTRIBUTE_deserialize(const char *data, size_t data_size)
Deserialize an attribute.
struct ParallelLookup * parallel_lookups_head
Lookup DLL.
#define GNUNET_free(ptr)
Wrapper around free.
Handle for a parallel GNS lookup job.
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

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

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().

819 {
820  struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
821  struct ParallelLookup *lu;
822  struct ParallelLookup *tmp;
823 
824  cth->kill_task = NULL;
825  for (lu = cth->parallel_lookups_head; NULL != lu;)
826  {
828  GNUNET_free (lu->label);
829  tmp = lu->next;
832  lu);
833  GNUNET_free (lu);
834  lu = tmp;
835  }
836  cth->cb (cth->cb_cls, NULL, NULL, GNUNET_SYSERR, "Aborted");
837 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_SCHEDULER_Task * kill_task
Kill task.
struct GNUNET_GNS_LookupRequest * lookup_request
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
struct ParallelLookup * next
RECLAIM_TICKETS_ConsumeCallback cb
Callback.
void * GNUNET_GNS_lookup_cancel(struct GNUNET_GNS_LookupRequest *lr)
Cancel pending lookup request.
Definition: gns_api.c:309
struct ParallelLookup * parallel_lookups_tail
Lookup DLL.
struct ParallelLookup * parallel_lookups_head
Lookup DLL.
#define GNUNET_free(ptr)
Wrapper around free.
Handle for a parallel GNS lookup job.
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,
uint32_t  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

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

References abort_parallel_lookups(), RECLAIM_TICKETS_ConsumeHandle::attrs, RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, cleanup_cth(), data, data_size, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF, GNUNET_log, GNUNET_new, GNUNET_OK, 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, GNUNET_RECLAIM_Ticket::identity, RECLAIM_TICKETS_ConsumeHandle::kill_task, ParallelLookup::label, 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, process_parallel_lookup_result(), GNUNET_TIME_Relative::rel_value_us, and RECLAIM_TICKETS_ConsumeHandle::ticket.

Referenced by RECLAIM_TICKETS_consume().

844 {
845  struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
846  struct ParallelLookup *parallel_lookup;
847  char *lbl;
848 
849  cth->lookup_request = NULL;
850 
852  "reclaim_authz_lookup_time_total",
854  cth->lookup_start_time)
855  .rel_value_us,
856  GNUNET_YES);
858  "reclaim_authz_lookups_count",
859  1,
860  GNUNET_YES);
861 
862  for (int i = 0; i < rd_count; i++)
863  {
864  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
865  continue;
867  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute ref found %s\n", lbl);
868  parallel_lookup = GNUNET_new (struct ParallelLookup);
869  parallel_lookup->handle = cth;
870  parallel_lookup->label = lbl;
871  parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get ();
872  parallel_lookup->lookup_request =
874  lbl,
875  &cth->ticket.identity,
879  parallel_lookup);
882  parallel_lookup);
883  }
884  if (NULL != cth->parallel_lookups_head)
885  {
889  cth);
890  return;
891  }
892  cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL);
893  cleanup_cth (cth);
894 }
static void abort_parallel_lookups(void *cls)
uint64_t rel_value_us
The actual value.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_TIME_UNIT_MINUTES
One minute.
struct GNUNET_TIME_Absolute lookup_start_time
Lookup time.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * attrs
Attributes.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR
Record type for identity attributes (of RECLAIM).
static void process_parallel_lookup_result(void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF
Record type for reclaim records.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
struct GNUNET_SCHEDULER_Task * kill_task
Kill task.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct RECLAIM_TICKETS_ConsumeHandle * handle
struct GNUNET_GNS_LookupRequest * lookup_request
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_Absolute lookup_start_time
Lookup time.
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:1246
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:439
static void cleanup_cth(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cleanup ticket consume handle.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The ticket issuer (= the user)
struct GNUNET_GNS_LookupRequest * lookup_request
LookupRequest.
struct GNUNET_RECLAIM_Ticket ticket
Ticket.
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:373
RECLAIM_TICKETS_ConsumeCallback cb
Callback.
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:80
Defaults, look in cache, then in DHT.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:988
struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup(struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_CRYPTO_EcdsaPublicKey *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:337
uint32_t data
The data value.
static size_t data_size
Number of bytes in data.
struct ParallelLookup * parallel_lookups_tail
Lookup DLL.
static struct GNUNET_STATISTICS_Handle * stats
static struct GNUNET_GNS_Handle * gns
struct ParallelLookup * parallel_lookups_head
Lookup DLL.
Handle for a parallel GNS lookup job.
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_CRYPTO_EcdsaPrivateKey id,
const struct GNUNET_RECLAIM_Ticket ticket,
RECLAIM_TICKETS_ConsumeCallback  cb,
void *  cb_cls 
)

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

References RECLAIM_TICKETS_ConsumeHandle::attrs, RECLAIM_TICKETS_ConsumeHandle::cb, RECLAIM_TICKETS_ConsumeHandle::cb_cls, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNS_LO_DEFAULT, GNUNET_GNS_lookup(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF, GNUNET_log, GNUNET_new, GNUNET_STRINGS_data_to_string_alloc(), GNUNET_TIME_absolute_get(), id, RECLAIM_TICKETS_ConsumeHandle::identity, GNUNET_RECLAIM_Ticket::identity, RECLAIM_TICKETS_ConsumeHandle::identity_pub, lookup_authz_cb(), RECLAIM_TICKETS_ConsumeHandle::lookup_request, RECLAIM_TICKETS_ConsumeHandle::lookup_start_time, GNUNET_RECLAIM_Ticket::rnd, TicketReference::ticket, and RECLAIM_TICKETS_ConsumeHandle::ticket.

Referenced by handle_consume_ticket_message().

902 {
903  struct RECLAIM_TICKETS_ConsumeHandle *cth;
904  char *label;
906 
907  cth->identity = *id;
910  cth->ticket = *ticket;
911  cth->cb = cb;
912  cth->cb_cls = cb_cls;
913  label =
914  GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof (uint64_t));
916  "Looking for AuthZ info under %s\n",
917  label);
919  cth->lookup_request =
921  label,
922  &cth->ticket.identity,
926  cth);
927  GNUNET_free (label);
928  return cth;
929 }
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * attrs
Attributes.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Audience Key.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF
Record type for reclaim records.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_TIME_Absolute lookup_start_time
Lookup time.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The ticket issuer (= the user)
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:241
uint64_t rnd
The ticket random (NBO)
struct GNUNET_GNS_LookupRequest * lookup_request
LookupRequest.
struct GNUNET_RECLAIM_Ticket ticket
Ticket.
RECLAIM_TICKETS_ConsumeCallback cb
Callback.
A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures.
#define GNUNET_log(kind,...)
Defaults, look in cache, then in DHT.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:988
struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup(struct GNUNET_GNS_Handle *handle, const char *name, const struct GNUNET_CRYPTO_EcdsaPublicKey *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:337
static void lookup_authz_cb(void *cls, uint32_t rd_count, const struct GNUNET_GNSRECORD_Data *rd)
static struct GNUNET_GNS_Handle * gns
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub
Audience Key.
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)

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

References cleanup_cth().

Referenced by cleanup_client().

933 {
934  cleanup_cth (cth);
935  return;
936 }
static void cleanup_cth(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cleanup ticket consume handle.
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 948 of file gnunet-service-reclaim_tickets.c.

References GNUNET_free, GNUNET_NAMESTORE_cancel(), and TicketIssueHandle::ns_qe.

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

949 {
950  if (NULL != handle->ns_qe)
951  GNUNET_NAMESTORE_cancel (handle->ns_qe);
952  GNUNET_free (handle);
953 }
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
#define GNUNET_free(ptr)
Wrapper around free.
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,
int32_t  success,
const char *  emsg 
)
static

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

References TicketIssueHandle::cb, TicketIssueHandle::cb_cls, cleanup_issue_handle(), GNUNET_OK, GNUNET_SYSERR, handle, TicketIssueHandle::ns_qe, and TicketIssueHandle::ticket.

Referenced by issue_ticket().

958 {
959  struct TicketIssueHandle *handle = cls;
960 
961  handle->ns_qe = NULL;
962  if (GNUNET_SYSERR == success)
963  {
964  handle->cb (handle->cb_cls,
965  &handle->ticket,
967  "Error storing AuthZ ticket in GNS");
968  return;
969  }
970  handle->cb (handle->cb_cls, &handle->ticket, GNUNET_OK, NULL);
971  cleanup_issue_handle (handle);
972 }
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
static void cleanup_issue_handle(struct TicketIssueHandle *handle)
Cleanup ticket consume handle.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
Ticket issue request handle.
RECLAIM_TICKETS_TicketResult cb
Callback.
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

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

References TicketIssueHandle::attrs, GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::claim, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_free, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_malloc, GNUNET_NAMESTORE_records_store(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_ATTRIBUTE_Claim::id, TicketIssueHandle::identity, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_head, GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::next, TicketIssueHandle::ns_qe, GNUNET_GNSRECORD_Data::record_type, GNUNET_TIME_Relative::rel_value_us, GNUNET_RECLAIM_Ticket::rnd, store_ticket_issue_cont(), TicketIssueHandle::ticket, and ticket_refresh_interval.

Referenced by filter_tickets_finished_cb().

977 {
979  struct GNUNET_GNSRECORD_Data *attrs_record;
980  char *label;
981  size_t list_len = 1;
982  int i;
983 
984  for (le = ih->attrs->list_head; NULL != le; le = le->next)
985  list_len++;
986 
987  attrs_record =
988  GNUNET_malloc (list_len * sizeof (struct GNUNET_GNSRECORD_Data));
989  i = 0;
990  for (le = ih->attrs->list_head; NULL != le; le = le->next)
991  {
992  attrs_record[i].data = &le->claim->id;
993  attrs_record[i].data_size = sizeof (le->claim->id);
994  //FIXME: Should this be the attribute expiration time or ticket refresh intv
998  i++;
999  }
1000  attrs_record[i].data = &ih->ticket;
1001  attrs_record[i].data_size = sizeof (struct GNUNET_RECLAIM_Ticket);
1004  attrs_record[i].flags =
1006 
1007  label =
1008  GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof (uint64_t));
1009  // Publish record
1011  &ih->identity,
1012  label,
1013  list_len,
1014  attrs_record,
1016  ih);
1017  GNUNET_free (attrs_record);
1018  GNUNET_free (label);
1019 }
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
The authorization ticket.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
uint64_t rel_value_us
The actual value.
static struct GNUNET_TIME_Relative ticket_refresh_interval
Ticket expiration interval.
static void store_ticket_issue_cont(void *cls, int32_t success, const char *emsg)
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF
Record type for reclaim records.
size_t data_size
Number of bytes in data.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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.
const void * data
Binary value stored in the DNS record.
uint64_t expiration_time
Expiration time for the DNS record.
This is a private record of this peer and it should thus not be handed out to other peers...
uint64_t rnd
The ticket random (NBO)
static struct GNUNET_NAMESTORE_Handle * nsh
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * attrs
Attributes to issue.
uint32_t record_type
Type of the GNS/DNS record.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
Record type for local ticket references.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:988
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
This flag is currently unused; former RF_PENDING flag.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * next
DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
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

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

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

Referenced by RECLAIM_TICKETS_issue().

1027 {
1028  struct TicketIssueHandle *tih = cls;
1029  tih->ns_it = NULL;
1030  tih->cb (tih->cb_cls,
1031  &tih->ticket,
1032  GNUNET_SYSERR,
1033  "Error storing AuthZ ticket in GNS");
1034  cleanup_issue_handle (tih);
1035 }
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
static void cleanup_issue_handle(struct TicketIssueHandle *handle)
Cleanup ticket consume handle.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore Iterator.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
Ticket issue request handle.
RECLAIM_TICKETS_TicketResult cb
Callback.
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_EcdsaPrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

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

References TicketIssueHandle::attrs, GNUNET_RECLAIM_Ticket::audience, TicketIssueHandle::cb, TicketIssueHandle::cb_cls, GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::claim, cleanup_issue_handle(), data, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_log, GNUNET_NAMESTORE_zone_iteration_stop(), GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_OK, GNUNET_RECLAIM_ATTRIBUTE_Claim::id, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_head, GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::next, TicketIssueHandle::ns_it, TicketReference::ticket, and TicketIssueHandle::ticket.

Referenced by RECLAIM_TICKETS_issue().

1043 {
1044  struct TicketIssueHandle *tih = cls;
1045  struct GNUNET_RECLAIM_Ticket *ticket = NULL;
1046 
1047  // figure out the number of requested attributes
1049  unsigned int attr_cnt = 0;
1050  for (le = tih->attrs->list_head; NULL != le; le = le->next)
1051  attr_cnt++;
1052 
1053  // ticket search
1054  unsigned int found_attrs_cnt = 0;
1055 
1056  for (int i = 0; i < rd_count; i++)
1057  {
1058  // found ticket
1059  if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET == rd[i].record_type)
1060  {
1061  ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1062  // cmp audience
1063  if (0 == memcmp (&tih->ticket.audience,
1064  &ticket->audience,
1065  sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
1066  {
1067  tih->ticket = *ticket;
1068  continue;
1069  }
1070  ticket = NULL;
1071  }
1072 
1073  // cmp requested attributes with ticket attributes
1074  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF != rd[i].record_type)
1075  continue;
1076  for (le = tih->attrs->list_head; NULL != le; le = le->next)
1077  {
1078  // cmp attr_ref id with requested attr id
1080  " %" PRIu64 "\n %" PRIu64 "\n",
1081  *((uint64_t *) rd[i].data),
1082  le->claim->id);
1083 
1084 
1085  if (0 == memcmp (rd[i].data, &le->claim->id, sizeof (uint64_t)))
1086  found_attrs_cnt++;
1087  }
1088  }
1089 
1090  if (attr_cnt == found_attrs_cnt && NULL != ticket)
1091  {
1093  tih->cb (tih->cb_cls, &tih->ticket, GNUNET_OK, NULL);
1094  cleanup_issue_handle (tih);
1095  return;
1096  }
1097 
1098  // ticket not found in current record
1100 }
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
The authorization ticket.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF
Record type for reclaim records.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
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...
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static void cleanup_issue_handle(struct TicketIssueHandle *handle)
Cleanup ticket consume handle.
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore Iterator.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * attrs
Attributes to issue.
struct GNUNET_CRYPTO_EcdsaPublicKey audience
The ticket audience (= relying party)
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
#define GNUNET_log(kind,...)
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
Record type for local ticket references.
Ticket issue request handle.
RECLAIM_TICKETS_TicketResult cb
Callback.
uint32_t data
The data value.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * next
DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
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

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

References GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_CRYPTO_QUALITY_STRONG, GNUNET_CRYPTO_random_u64(), TicketIssueHandle::identity, GNUNET_RECLAIM_Ticket::identity, issue_ticket(), GNUNET_RECLAIM_Ticket::rnd, and TicketIssueHandle::ticket.

Referenced by RECLAIM_TICKETS_issue().

1105 {
1106  struct TicketIssueHandle *tih = cls;
1108  tih->ticket.rnd =
1110  issue_ticket (tih);
1111 }
static void issue_ticket(struct TicketIssueHandle *ih)
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Random on unsigned 64-bit values.
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The ticket issuer (= the user)
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:241
uint64_t rnd
The ticket random (NBO)
Ticket issue request handle.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
High-quality operations are desired.
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_EcdsaPrivateKey identity,
const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList attrs,
const struct GNUNET_CRYPTO_EcdsaPublicKey audience,
RECLAIM_TICKETS_TicketResult  cb,
void *  cb_cls 
)

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

References TicketIssueHandle::attrs, GNUNET_RECLAIM_Ticket::audience, 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, and TicketIssueHandle::ticket.

Referenced by handle_issue_ticket_message().

1119 {
1120  struct TicketIssueHandle *tih;
1121  tih = GNUNET_new (struct TicketIssueHandle);
1122  tih->cb = cb;
1123  tih->cb_cls = cb_cls;
1125  tih->identity = *identity;
1126  tih->ticket.audience = *audience;
1127 
1128  // check whether the ticket has already been issued
1129  tih->ns_it =
1131  &tih->identity,
1133  tih,
1135  tih,
1137  tih);
1138 }
static void filter_tickets_finished_cb(void *cls)
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT)...
struct GNUNET_RECLAIM_Ticket ticket
Ticket to issue.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void filter_tickets_error_cb(void *cls)
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore Iterator.
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
static struct GNUNET_NAMESTORE_Handle * nsh
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * attrs
Attributes to issue.
struct GNUNET_CRYPTO_EcdsaPublicKey audience
The ticket audience (= relying party)
Ticket issue request handle.
RECLAIM_TICKETS_TicketResult cb
Callback.
static void filter_tickets_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * GNUNET_RECLAIM_ATTRIBUTE_list_dup(const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
Make a (deep) copy of a claim list.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Issuer Key.
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

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

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().

1146 {
1147  if (NULL != iter->ns_it)
1149  GNUNET_free (iter);
1150 }
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.
#define GNUNET_free(ptr)
Wrapper around free.
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_EcdsaPrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

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

References RECLAIM_TICKETS_Iterator::cb, RECLAIM_TICKETS_Iterator::cb_cls, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_NAMESTORE_zone_iterator_next(), and RECLAIM_TICKETS_Iterator::ns_it.

Referenced by RECLAIM_TICKETS_iteration_start().

1159 {
1160  struct RECLAIM_TICKETS_Iterator *iter = cls;
1161 
1162  for (int i = 0; i < rd_count; i++)
1163  {
1164  if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET != rd[i].record_type)
1165  continue;
1166  iter->cb (iter->cb_cls, (struct GNUNET_RECLAIM_Ticket *) rd[i].data);
1167  return;
1168  }
1170 }
The authorization ticket.
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...
const void * data
Binary value stored in the DNS record.
RECLAIM_TICKETS_TicketIter cb
Iter callback.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
Record type for local ticket references.
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

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

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

Referenced by RECLAIM_TICKETS_iteration_start().

1175 {
1176  struct RECLAIM_TICKETS_Iterator *iter = cls;
1177  iter->ns_it = NULL;
1178  iter->cb (iter->cb_cls, NULL);
1179  cleanup_iter (iter);
1180 }
static void cleanup_iter(struct RECLAIM_TICKETS_Iterator *iter)
RECLAIM_TICKETS_TicketIter cb
Iter callback.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.
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

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

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

Referenced by RECLAIM_TICKETS_iteration_start().

1185 {
1186  struct RECLAIM_TICKETS_Iterator *iter = cls;
1187  iter->ns_it = NULL;
1188  iter->cb (iter->cb_cls, NULL);
1189  cleanup_iter (iter);
1190 }
static void cleanup_iter(struct RECLAIM_TICKETS_Iterator *iter)
RECLAIM_TICKETS_TicketIter cb
Iter callback.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.
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)

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

References GNUNET_NAMESTORE_zone_iterator_next(), and RECLAIM_TICKETS_Iterator::ns_it.

Referenced by handle_ticket_iteration_next().

1195 {
1197 }
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...
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.
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)

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

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

Referenced by cleanup_client(), and handle_ticket_iteration_stop().

1202 {
1204  cleanup_iter (iter);
1205 }
static void cleanup_iter(struct RECLAIM_TICKETS_Iterator *iter)
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.
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_EcdsaPrivateKey identity,
RECLAIM_TICKETS_TicketIter  cb,
void *  cb_cls 
)

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

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, and RECLAIM_TICKETS_Iterator::ns_it.

Referenced by handle_ticket_iteration_start().

1213 {
1214  struct RECLAIM_TICKETS_Iterator *iter;
1215 
1216  iter = GNUNET_new (struct RECLAIM_TICKETS_Iterator);
1217  iter->cb = cb;
1218  iter->cb_cls = cb_cls;
1219  iter->ns_it =
1221  identity,
1223  iter,
1225  iter,
1227  iter);
1228  return iter;
1229 }
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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)
Starts a new zone iteration (used to periodically PUT all of our records into our DHT)...
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void collect_tickets_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
RECLAIM_TICKETS_TicketIter cb
Iter callback.
static void collect_tickets_error_cb(void *cls)
static struct GNUNET_NAMESTORE_Handle * nsh
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore queue entry.
static void collect_tickets_finished_cb(void *cls)
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)

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

References DEFAULT_TICKET_REFRESH_INTERVAL, 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, and ticket_refresh_interval.

Referenced by run().

1234 {
1235  // Get ticket expiration time (relative) from config
1236  if (GNUNET_OK ==
1238  "reclaim",
1239  "TICKET_REFRESH_INTERVAL",
1241  {
1243  "Configured refresh interval for tickets: %s\n",
1245  GNUNET_YES));
1246  }
1247  else
1248  {
1250  }
1251  // Connect to identity and namestore services
1253  if (NULL == nsh)
1254  {
1256  "error connecting to namestore");
1257  return GNUNET_SYSERR;
1258  }
1259  gns = GNUNET_GNS_connect (c);
1260  if (NULL == gns)
1261  {
1262  GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns");
1263  return GNUNET_SYSERR;
1264  }
1265  stats = GNUNET_STATISTICS_create ("reclaim", c);
1266  return GNUNET_OK;
1267 }
int 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_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
static struct GNUNET_TIME_Relative ticket_refresh_interval
Ticket expiration interval.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level &#39;level&#39; that indicates a failure of the command &#39;cmd&#39; with the mess...
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:727
struct GNUNET_GNS_Handle * GNUNET_GNS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the GNS service.
Definition: gns_api.c:263
#define DEFAULT_TICKET_REFRESH_INTERVAL
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
static struct GNUNET_NAMESTORE_Handle * nsh
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:80
static struct GNUNET_STATISTICS_Handle * stats
static struct GNUNET_GNS_Handle * gns
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RECLAIM_TICKETS_deinit()

void RECLAIM_TICKETS_deinit ( void  )

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

References GNUNET_GNS_disconnect(), GNUNET_NAMESTORE_disconnect(), GNUNET_NO, and GNUNET_STATISTICS_destroy().

Referenced by cleanup().

1271 {
1272  if (NULL != nsh)
1274  nsh = NULL;
1275  if (NULL != gns)
1277  gns = NULL;
1278  if (NULL != stats)
1279  {
1281  stats = NULL;
1282  }
1283 }
#define GNUNET_NO
Definition: gnunet_common.h:81
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
void GNUNET_GNS_disconnect(struct GNUNET_GNS_Handle *handle)
Shutdown connection with the GNS service.
Definition: gns_api.c:285
static struct GNUNET_NAMESTORE_Handle * nsh
static struct GNUNET_STATISTICS_Handle * stats
static struct GNUNET_GNS_Handle * gns
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 303 of file gnunet-service-reclaim_tickets.c.

Referenced by issue_ticket(), and RECLAIM_TICKETS_init().

◆ nsh

struct GNUNET_NAMESTORE_Handle* nsh
static

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

◆ gns

struct GNUNET_GNS_Handle* gns
static

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

◆ stats

struct GNUNET_STATISTICS_Handle* stats
static

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