GNUnet  0.11.x
Data Structures | Functions | Variables
gnunet-service-reclaim.c File Reference

reclaim Service More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet-service-reclaim_tickets.h"
#include "gnunet_constants.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_reclaim_lib.h"
#include "gnunet_reclaim_service.h"
#include "gnunet_signatures.h"
#include "reclaim.h"
Include dependency graph for gnunet-service-reclaim.c:

Go to the source code of this file.

Data Structures

struct  TicketIteration
 A ticket iteration operation. More...
 
struct  Iterator
 An attribute iteration operation. More...
 
struct  IdpClient
 An idp client. More...
 
struct  AttributeDeleteHandle
 Handle for attribute deletion request. More...
 
struct  AttributeStoreHandle
 Handle for attribute store request. More...
 
struct  ConsumeTicketOperation
 Handle for ticket consume request. More...
 
struct  TicketRevocationOperation
 Ticket revocation request handle. More...
 
struct  TicketIssueOperation
 Ticket issue operation handle. More...
 

Functions

static void cleanup_adh (struct AttributeDeleteHandle *adh)
 Cleanup attribute delete handle. More...
 
static void cleanup_as_handle (struct AttributeStoreHandle *ash)
 Cleanup attribute store handle. More...
 
static void cleanup_client (struct IdpClient *idp)
 Cleanup client. More...
 
static void cleanup ()
 Cleanup task. More...
 
static void do_shutdown (void *cls)
 Shutdown task. More...
 
static void send_ticket_result (const struct IdpClient *client, uint32_t r_id, const struct GNUNET_RECLAIM_Ticket *ticket, uint32_t success)
 Sends a ticket result message to the client. More...
 
static void issue_ticket_result_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket, int32_t success, const char *emsg)
 Issue ticket result. More...
 
static int check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
 Check issue ticket message. More...
 
static void handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
 Handle ticket issue message. More...
 
static void revoke_result_cb (void *cls, int32_t success)
 Handles revocation result. More...
 
static int check_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *im)
 Check revocation message format. More...
 
static void handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
 Handle a revocation message to a ticket. More...
 
static void consume_result_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_AttestationList *attests, int32_t success, const char *emsg)
 Handle a ticket consume result. More...
 
static int check_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
 Check a consume ticket message. More...
 
static void handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
 Handle a consume ticket message. More...
 
static void attr_store_cont (void *cls, int32_t success, const char *emsg)
 Attribute store result handler. More...
 
static void attr_store_task (void *cls)
 Add a new attribute. More...
 
static int check_attribute_store_message (void *cls, const struct AttributeStoreMessage *sam)
 Check an attribute store message. More...
 
static void handle_attribute_store_message (void *cls, const struct AttributeStoreMessage *sam)
 Handle an attribute store message. More...
 
static void attest_store_cont (void *cls, int32_t success, const char *emsg)
 Attestation store result handler. More...
 
static void attest_error (void *cls)
 Error looking up potential attestation. More...
 
static void attest_add_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Check for existing record before storing attestation. More...
 
static void attest_store_task (void *cls)
 Add a new attestation. More...
 
static int check_attestation_store_message (void *cls, const struct AttributeStoreMessage *sam)
 Check an attestation store message. More...
 
static void handle_attestation_store_message (void *cls, const struct AttributeStoreMessage *sam)
 Handle an attestation store message. More...
 
static void send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
 Send a deletion success response. More...
 
static void ticket_iter (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Namestore iteration within attribute deletion. More...
 
static void update_tickets (void *cls)
 Recursion prototype for function. More...
 
static void ticket_updated (void *cls, int32_t success, const char *emsg)
 Callback called when a ticket was updated. More...
 
static void ticket_iter_fin (void *cls)
 Done collecting affected tickets, start updating. More...
 
static void ticket_iter_err (void *cls)
 Error collecting affected tickets. More...
 
static void start_ticket_update (void *cls)
 Start processing tickets which may still contain reference to deleted attribute. More...
 
static void attr_delete_cont (void *cls, int32_t success, const char *emsg)
 Attribute deleted callback. More...
 
static int check_attribute_delete_message (void *cls, const struct AttributeDeleteMessage *dam)
 Check attribute delete message format. More...
 
static void handle_attribute_delete_message (void *cls, const struct AttributeDeleteMessage *dam)
 Handle attribute deletion. More...
 
static void attest_delete_cont (void *cls, int32_t success, const char *emsg)
 Attestation deleted callback. More...
 
static int check_attestation_delete_message (void *cls, const struct AttributeDeleteMessage *dam)
 Check attestation delete message format. More...
 
static void handle_attestation_delete_message (void *cls, const struct AttributeDeleteMessage *dam)
 Handle attestation deletion. More...
 
static void attr_iter_finished (void *cls)
 Done iterating over attributes. More...
 
static void attr_iter_error (void *cls)
 Error iterating over attributes. More...
 
static void attr_iter_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Got record. More...
 
static void handle_iteration_start (void *cls, const struct AttributeIterationStartMessage *ais_msg)
 Iterate over zone to get attributes. More...
 
static void handle_iteration_stop (void *cls, const struct AttributeIterationStopMessage *ais_msg)
 Handle iteration stop message from client. More...
 
static void handle_iteration_next (void *cls, const struct AttributeIterationNextMessage *ais_msg)
 Client requests next attribute from iterator. More...
 
static void attest_iter_finished (void *cls)
 Done iterating over attestations. More...
 
static void attest_iter_error (void *cls)
 Error iterating over attestations. More...
 
static void attest_iter_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Got record. More...
 
static void handle_attestation_iteration_start (void *cls, const struct AttestationIterationStartMessage *ais_msg)
 Iterate over zone to get attributes. More...
 
static void handle_attestation_iteration_stop (void *cls, const struct AttestationIterationStopMessage *ais_msg)
 Handle iteration stop message from client. More...
 
static void handle_attestation_iteration_next (void *cls, const struct AttestationIterationNextMessage *ais_msg)
 Client requests next attestation from iterator. More...
 
static void ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
 Got a ticket. More...
 
static void handle_ticket_iteration_start (void *cls, const struct TicketIterationStartMessage *tis_msg)
 Client requests a ticket iteration. More...
 
static void handle_ticket_iteration_stop (void *cls, const struct TicketIterationStopMessage *tis_msg)
 Client has had enough tickets. More...
 
static void handle_ticket_iteration_next (void *cls, const struct TicketIterationNextMessage *tis_msg)
 Client requests next result. More...
 
static void run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *server)
 Main function that will be run. More...
 
static void client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx)
 Called whenever a client is disconnected. More...
 
static void * client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
 Add a client to our list of active clients. More...
 
 GNUNET_SERVICE_MAIN ("reclaim", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_var_size(attribute_store_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, struct AttributeStoreMessage, NULL), GNUNET_MQ_hd_var_size(attestation_store_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE, struct AttributeStoreMessage, NULL), GNUNET_MQ_hd_var_size(attribute_delete_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, struct AttributeDeleteMessage, NULL), GNUNET_MQ_hd_var_size(attestation_delete_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE, struct AttributeDeleteMessage, NULL), GNUNET_MQ_hd_fixed_size(iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, struct AttributeIterationStartMessage, NULL), GNUNET_MQ_hd_fixed_size(iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, struct AttributeIterationNextMessage, NULL), GNUNET_MQ_hd_fixed_size(iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, struct AttributeIterationStopMessage, NULL), GNUNET_MQ_hd_fixed_size(attestation_iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START, struct AttestationIterationStartMessage, NULL), GNUNET_MQ_hd_fixed_size(attestation_iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT, struct AttestationIterationNextMessage, NULL), GNUNET_MQ_hd_fixed_size(attestation_iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP, struct AttestationIterationStopMessage, NULL), GNUNET_MQ_hd_var_size(issue_ticket_message, GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, struct IssueTicketMessage, NULL), GNUNET_MQ_hd_var_size(consume_ticket_message, GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, struct ConsumeTicketMessage, NULL), GNUNET_MQ_hd_fixed_size(ticket_iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, struct TicketIterationStartMessage, NULL), GNUNET_MQ_hd_fixed_size(ticket_iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, struct TicketIterationNextMessage, NULL), GNUNET_MQ_hd_fixed_size(ticket_iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, struct TicketIterationStopMessage, NULL), GNUNET_MQ_hd_var_size(revoke_ticket_message, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, struct RevokeTicketMessage, NULL), GNUNET_MQ_handler_end())
 Define "main" method using service macro. More...
 

Variables

static struct GNUNET_NAMESTORE_Handlensh
 Namestore handle. More...
 
static struct GNUNET_SCHEDULER_Tasktimeout_task
 Timeout task. More...
 
static const struct GNUNET_CONFIGURATION_Handlecfg
 Our configuration. More...
 
static struct IdpClientclient_list_head = NULL
 Client list. More...
 
static struct IdpClientclient_list_tail = NULL
 Client list. More...
 

Detailed Description

reclaim Service

Author
Martin Schanzenbach

Definition in file gnunet-service-reclaim.c.

Function Documentation

◆ cleanup_adh()

static void cleanup_adh ( struct AttributeDeleteHandle adh)
static

Cleanup attribute delete handle.

Parameters
adhthe attribute to cleanup

Definition at line 479 of file gnunet-service-reclaim.c.

References AttributeDeleteHandle::attest, AttributeDeleteHandle::claim, TicketRecordsEntry::data, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_zone_iteration_stop(), TicketRecordsEntry::label, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_it, AttributeDeleteHandle::ns_qe, AttributeDeleteHandle::tickets_to_update_head, and AttributeDeleteHandle::tickets_to_update_tail.

Referenced by attest_delete_cont(), attr_delete_cont(), cleanup_client(), ticket_iter_err(), and update_tickets().

480 {
481  struct TicketRecordsEntry *le;
482 
483  if (NULL != adh->ns_it)
485  if (NULL != adh->ns_qe)
487  if (NULL != adh->label)
488  GNUNET_free (adh->label);
489  if (NULL != adh->claim)
490  GNUNET_free (adh->claim);
491  if (NULL != adh->attest)
492  GNUNET_free (adh->attest);
493  while (NULL != (le = adh->tickets_to_update_head))
494  {
497  le);
498  if (NULL != le->label)
499  GNUNET_free (le->label);
500  if (NULL != le->data)
501  GNUNET_free (le->data);
502  GNUNET_free (le);
503  }
504  GNUNET_free (adh);
505 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_RECLAIM_Attestation * attest
The attestation to delete.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
void GNUNET_NAMESTORE_zone_iteration_stop(struct GNUNET_NAMESTORE_ZoneIterator *it)
Stops iteration and releases the namestore handle for further calls.
char * label
Attribute label.
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup_as_handle()

static void cleanup_as_handle ( struct AttributeStoreHandle ash)
static

Cleanup attribute store handle.

Parameters
handlehandle to clean up

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

References AttributeStoreHandle::attest, AttributeStoreHandle::claim, GNUNET_free, GNUNET_NAMESTORE_cancel(), and AttributeStoreHandle::ns_qe.

Referenced by attest_error(), attest_store_cont(), attr_store_cont(), and cleanup_client().

515 {
516  if (NULL != ash->ns_qe)
518  if (NULL != ash->claim)
519  GNUNET_free (ash->claim);
520  if (NULL != ash->attest)
521  GNUNET_free (ash->attest);
522  GNUNET_free (ash);
523 }
struct GNUNET_RECLAIM_Attestation * attest
The attestation to store.
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct GNUNET_RECLAIM_Attribute * claim
The attribute to store.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup_client()

static void cleanup_client ( struct IdpClient idp)
static

Cleanup client.

Parameters
idpthe client to clean up

Definition at line 532 of file gnunet-service-reclaim.c.

References ai, IdpClient::attest_iter_head, IdpClient::attest_iter_tail, IdpClient::attr_iter_head, IdpClient::attr_iter_tail, ConsumeTicketOperation::ch, cleanup_adh(), cleanup_as_handle(), IdpClient::consume_op_head, IdpClient::consume_op_tail, IdpClient::delete_op_head, IdpClient::delete_op_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_free, IdpClient::issue_op_head, IdpClient::issue_op_tail, TicketIteration::iter, RECLAIM_TICKETS_consume_cancel(), RECLAIM_TICKETS_iteration_stop(), RECLAIM_TICKETS_revoke_cancel(), IdpClient::revoke_op_head, IdpClient::revoke_op_tail, TicketRevocationOperation::rh, IdpClient::store_op_head, IdpClient::store_op_tail, IdpClient::ticket_iter_head, and IdpClient::ticket_iter_tail.

Referenced by cleanup(), and client_disconnect_cb().

533 {
534  struct Iterator *ai;
535  struct TicketIteration *ti;
536  struct TicketRevocationOperation *rop;
537  struct TicketIssueOperation *iss;
538  struct ConsumeTicketOperation *ct;
539  struct AttributeStoreHandle *as;
540  struct AttributeDeleteHandle *adh;
541 
542  while (NULL != (iss = idp->issue_op_head))
543  {
545  GNUNET_free (iss);
546  }
547  while (NULL != (ct = idp->consume_op_head))
548  {
550  idp->consume_op_tail,
551  ct);
552  if (NULL != ct->ch)
554  GNUNET_free (ct);
555  }
556  while (NULL != (as = idp->store_op_head))
557  {
559  cleanup_as_handle (as);
560  }
561  while (NULL != (adh = idp->delete_op_head))
562  {
564  cleanup_adh (adh);
565  }
566 
567  while (NULL != (ai = idp->attr_iter_head))
568  {
570  GNUNET_free (ai);
571  }
572  while (NULL != (ai = idp->attest_iter_head))
573  {
575  ai);
576  GNUNET_free (ai);
577  }
578 
579  while (NULL != (rop = idp->revoke_op_head))
580  {
582  if (NULL != rop->rh)
584  GNUNET_free (rop);
585  }
586  while (NULL != (ti = idp->ticket_iter_head))
587  {
589  idp->ticket_iter_tail,
590  ti);
591  if (NULL != ti->iter)
593  GNUNET_free (ti);
594  }
595  GNUNET_free (idp);
596 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle for attribute deletion request.
struct TicketIteration * ticket_iter_tail
Tail of DLL of ticket iteration ops.
struct ConsumeTicketOperation * consume_op_head
Head of DLL of ticket consume ops.
Ticket issue operation handle.
void RECLAIM_TICKETS_iteration_stop(struct RECLAIM_TICKETS_Iterator *iter)
Stop a running ticket iteration.
struct RECLAIM_TICKETS_Iterator * iter
The ticket iterator.
struct TicketRevocationOperation * revoke_op_tail
Tail of DLL of ticket revocation ops.
struct Iterator * attr_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
An attribute iteration operation.
struct Iterator * attest_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
struct TicketIssueOperation * issue_op_head
Head of DLL of ticket issue ops.
struct AttributeStoreHandle * store_op_head
Head of DLL of attribute store ops.
struct RECLAIM_TICKETS_RevokeHandle * rh
Revocation handle.
struct TicketIteration * ticket_iter_head
Head of DLL of ticket iteration ops.
static void cleanup_as_handle(struct AttributeStoreHandle *ash)
Cleanup attribute store handle.
Handle for attribute store request.
struct AttributeStoreHandle * store_op_tail
Tail of DLL of attribute store ops.
void RECLAIM_TICKETS_consume_cancel(struct RECLAIM_TICKETS_ConsumeHandle *cth)
Cancel a consume operation.
struct RECLAIM_TICKETS_ConsumeHandle * ch
Ticket consume handle.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
struct ConsumeTicketOperation * consume_op_tail
Tail of DLL of ticket consume ops.
struct TicketRevocationOperation * revoke_op_head
Head of DLL of ticket revocation ops.
struct Iterator * attest_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
void RECLAIM_TICKETS_revoke_cancel(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cancel a revocation.
struct AttributeDeleteHandle * delete_op_head
Head of DLL of attribute delete ops.
struct TicketIssueOperation * issue_op_tail
Tail of DLL of ticket issue ops.
A ticket iteration operation.
Ticket revocation request handle.
struct AttributeDeleteHandle * delete_op_tail
Tail of DLL of attribute delete ops.
Handle for ticket consume request.
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
struct Iterator * attr_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup()

static void cleanup ( )
static

Cleanup task.

Definition at line 603 of file gnunet-service-reclaim.c.

References cleanup_client(), GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMESTORE_disconnect(), GNUNET_SCHEDULER_cancel(), and RECLAIM_TICKETS_deinit().

Referenced by do_shutdown().

604 {
605  struct IdpClient *cl;
606 
607  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
608 
609  while (NULL != (cl = client_list_head))
610  {
613  cl);
614  cleanup_client (cl);
615  }
617  if (NULL != timeout_task)
619  if (NULL != nsh)
621 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
An idp client.
static void cleanup_client(struct IdpClient *idp)
Cleanup client.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
static struct IdpClient * client_list_head
Client list.
void RECLAIM_TICKETS_deinit(void)
Close handles and clean up.
static struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task.
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
static struct IdpClient * client_list_tail
Client list.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:972
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_shutdown()

static void do_shutdown ( void *  cls)
static

Shutdown task.

Parameters
clsNULL

Definition at line 630 of file gnunet-service-reclaim.c.

References cleanup(), GNUNET_ERROR_TYPE_INFO, and GNUNET_log.

Referenced by attest_error(), attest_store_cont(), attr_store_cont(), and run().

631 {
632  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n");
633  cleanup ();
634 }
static void cleanup()
Cleanup task.
#define GNUNET_log(kind,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_ticket_result()

static void send_ticket_result ( const struct IdpClient client,
uint32_t  r_id,
const struct GNUNET_RECLAIM_Ticket ticket,
uint32_t  success 
)
static

Sends a ticket result message to the client.

Parameters
clientthe client to send to
r_idthe request message ID to reply to
ticketthe ticket to include (may be NULL)
successthe success status of the request

Definition at line 646 of file gnunet-service-reclaim.c.

References env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), TicketResultMessage::id, IdpClient::mq, ticket, and TicketResultMessage::ticket.

Referenced by issue_ticket_result_cb().

650 {
651  struct TicketResultMessage *irm;
652  struct GNUNET_MQ_Envelope *env;
653 
654  env = GNUNET_MQ_msg (irm,
656  if (NULL != ticket)
657  {
658  irm->ticket = *ticket;
659  }
660  // TODO add success member
661  irm->id = htonl (r_id);
662  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
663  GNUNET_MQ_send (client->mq, env);
664 }
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:463
Ticket result message.
Definition: reclaim.h:453
struct GNUNET_RECLAIM_Ticket ticket
The new ticket.
Definition: reclaim.h:468
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_log(kind,...)
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
Here is the call graph for this function:
Here is the caller graph for this function:

◆ issue_ticket_result_cb()

static void issue_ticket_result_cb ( void *  cls,
struct GNUNET_RECLAIM_Ticket ticket,
int32_t  success,
const char *  emsg 
)
static

Issue ticket result.

Parameters
clsout ticket issue operation handle
ticketthe issued ticket
successissue success status (GNUNET_OK if successful)
emsgerror message (NULL of success is GNUNET_OK)

Definition at line 676 of file gnunet-service-reclaim.c.

References TicketIssueOperation::client, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, IdpClient::issue_op_head, IdpClient::issue_op_tail, TicketIssueOperation::r_id, send_ticket_result(), and tio.

Referenced by handle_issue_ticket_message().

680 {
681  struct TicketIssueOperation *tio = cls;
682 
683  if (GNUNET_OK != success)
684  {
685  send_ticket_result (tio->client, tio->r_id, NULL, GNUNET_SYSERR);
687  tio->client->issue_op_tail,
688  tio);
689  GNUNET_free (tio);
690  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg);
691  return;
692  }
693  send_ticket_result (tio->client, tio->r_id, ticket, GNUNET_SYSERR);
695  tio->client->issue_op_tail,
696  tio);
697  GNUNET_free (tio);
698 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static struct GNUNET_CADET_ListTunnels * tio
Active tunnel listing operation.
Definition: gnunet-cadet.c:112
struct IdpClient * client
Client connection.
Ticket issue operation handle.
struct TicketIssueOperation * issue_op_head
Head of DLL of ticket issue ops.
uint32_t r_id
request id
struct TicketIssueOperation * issue_op_tail
Tail of DLL of ticket issue ops.
#define GNUNET_log(kind,...)
static void send_ticket_result(const struct IdpClient *client, uint32_t r_id, const struct GNUNET_RECLAIM_Ticket *ticket, uint32_t success)
Sends a ticket result message to the client.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_issue_ticket_message()

static int check_issue_ticket_message ( void *  cls,
const struct IssueTicketMessage im 
)
static

Check issue ticket message.

unused message to check

Returns
GNUNET_OK if message is ok

Definition at line 709 of file gnunet-service-reclaim.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, IssueTicketMessage::header, size, and GNUNET_MessageHeader::size.

710 {
711  uint16_t size;
712 
713  size = ntohs (im->header.size);
714  if (size <= sizeof(struct IssueTicketMessage))
715  {
716  GNUNET_break (0);
717  return GNUNET_SYSERR;
718  }
719  return GNUNET_OK;
720 }
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET.
Definition: reclaim.h:372
Ticket issue message.
Definition: reclaim.h:367
static unsigned int size
Size of the "table".
Definition: peer.c:67

◆ handle_issue_ticket_message()

static void handle_issue_ticket_message ( void *  cls,
const struct IssueTicketMessage im 
)
static

Handle ticket issue message.

Parameters
clsour client
imthe message

Definition at line 730 of file gnunet-service-reclaim.c.

References IssueTicketMessage::attr_len, IdpClient::client, TicketIssueOperation::client, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_RECLAIM_attribute_list_deserialize(), GNUNET_RECLAIM_attribute_list_destroy(), GNUNET_SERVICE_client_continue(), IdpClient::issue_op_head, IdpClient::issue_op_tail, issue_ticket_result_cb(), TicketIssueOperation::r_id, RECLAIM_TICKETS_issue(), and tio.

731 {
732  struct TicketIssueOperation *tio;
733  struct IdpClient *idp = cls;
734  struct GNUNET_RECLAIM_AttributeList *attrs;
735  size_t attrs_len;
736 
737  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
738  tio = GNUNET_new (struct TicketIssueOperation);
739  attrs_len = ntohs (im->attr_len);
740  attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1],
741  attrs_len);
742  tio->r_id = ntohl (im->id);
743  tio->client = idp;
746  attrs,
747  &im->rp,
749  tio);
752 }
struct GNUNET_CRYPTO_EcdsaPublicKey rp
Requesting party.
Definition: reclaim.h:387
static struct GNUNET_CADET_ListTunnels * tio
Active tunnel listing operation.
Definition: gnunet-cadet.c:112
void RECLAIM_TICKETS_issue(const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, RECLAIM_TICKETS_TicketResult cb, void *cb_cls)
Issue a new reclaim ticket, thereby authorizing the audience to access the set of provided attributes...
struct IdpClient * client
Client connection.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
An idp client.
Ticket issue operation handle.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attribute_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
A list of GNUNET_RECLAIM_Attribute structures.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct TicketIssueOperation * issue_op_head
Head of DLL of ticket issue ops.
uint32_t r_id
request id
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:382
struct GNUNET_SERVICE_Client * client
The client.
static void issue_ticket_result_cb(void *cls, struct GNUNET_RECLAIM_Ticket *ticket, int32_t success, const char *emsg)
Issue ticket result.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:377
uint32_t attr_len
length of serialized attribute list
Definition: reclaim.h:392
struct TicketIssueOperation * issue_op_tail
Tail of DLL of ticket issue ops.
#define GNUNET_log(kind,...)
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ revoke_result_cb()

static void revoke_result_cb ( void *  cls,
int32_t  success 
)
static

Handles revocation result.

Parameters
clsour revocation operation handle
successrevocation result (GNUNET_OK if successful)

Definition at line 766 of file gnunet-service-reclaim.c.

References TicketRevocationOperation::client, env, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), RevokeTicketResultMessage::id, IdpClient::mq, TicketRevocationOperation::r_id, IdpClient::revoke_op_head, IdpClient::revoke_op_tail, TicketRevocationOperation::rh, and RevokeTicketResultMessage::success.

Referenced by handle_revoke_ticket_message().

767 {
768  struct TicketRevocationOperation *rop = cls;
769  struct GNUNET_MQ_Envelope *env;
770  struct RevokeTicketResultMessage *trm;
771 
773  "Sending REVOKE_TICKET_RESULT message\n");
774  rop->rh = NULL;
776  trm->id = htonl (rop->r_id);
777  trm->success = htonl (success);
778  GNUNET_MQ_send (rop->client->mq, env);
780  rop->client->revoke_op_tail,
781  rop);
782  GNUNET_free (rop);
783 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct TicketRevocationOperation * revoke_op_tail
Tail of DLL of ticket revocation ops.
#define GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
struct IdpClient * client
Client connection.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
struct RECLAIM_TICKETS_RevokeHandle * rh
Revocation handle.
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct TicketRevocationOperation * revoke_op_head
Head of DLL of ticket revocation ops.
Ticket revocation request handle.
Ticket revoke message.
Definition: reclaim.h:431
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:441
#define GNUNET_log(kind,...)
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
uint32_t success
Revocation result.
Definition: reclaim.h:446
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_revoke_ticket_message()

static int check_revoke_ticket_message ( void *  cls,
const struct RevokeTicketMessage im 
)
static

Check revocation message format.

Parameters
clsunused
imthe message to check
Returns
GNUNET_OK if message is ok

Definition at line 794 of file gnunet-service-reclaim.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, RevokeTicketMessage::header, size, and GNUNET_MessageHeader::size.

795 {
796  uint16_t size;
797 
798  size = ntohs (im->header.size);
799  if (size != sizeof(struct RevokeTicketMessage))
800  {
801  GNUNET_break (0);
802  return GNUNET_SYSERR;
803  }
804  return GNUNET_OK;
805 }
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET.
Definition: reclaim.h:405
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static unsigned int size
Size of the "table".
Definition: peer.c:67
Ticket revoke message.
Definition: reclaim.h:400

◆ handle_revoke_ticket_message()

static void handle_revoke_ticket_message ( void *  cls,
const struct RevokeTicketMessage rm 
)
static

Handle a revocation message to a ticket.

Parameters
clsour client
rmthe message to handle

Definition at line 815 of file gnunet-service-reclaim.c.

References IdpClient::client, TicketRevocationOperation::client, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_SERVICE_client_continue(), RevokeTicketMessage::id, RevokeTicketMessage::identity, TicketRevocationOperation::r_id, RECLAIM_TICKETS_revoke(), IdpClient::revoke_op_head, IdpClient::revoke_op_tail, revoke_result_cb(), TicketRevocationOperation::rh, and RevokeTicketMessage::ticket.

816 {
817  struct TicketRevocationOperation *rop;
818  struct IdpClient *idp = cls;
819 
820  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
821  rop = GNUNET_new (struct TicketRevocationOperation);
822  rop->r_id = ntohl (rm->id);
823  rop->client = idp;
825  rop->rh
827  rop);
829 }
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:415
static void revoke_result_cb(void *cls, int32_t success)
Handles revocation result.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp client.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:410
struct TicketRevocationOperation * revoke_op_tail
Tail of DLL of ticket revocation ops.
struct IdpClient * client
Client connection.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct RECLAIM_TICKETS_RevokeHandle * rh
Revocation handle.
struct GNUNET_SERVICE_Client * client
The client.
struct GNUNET_RECLAIM_Ticket ticket
The ticket to revoke.
Definition: reclaim.h:425
struct TicketRevocationOperation * revoke_op_head
Head of DLL of ticket revocation ops.
Ticket revocation request handle.
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)
Revoke a ticket.
#define GNUNET_log(kind,...)
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ consume_result_cb()

static void consume_result_cb ( void *  cls,
const struct GNUNET_CRYPTO_EcdsaPublicKey identity,
const struct GNUNET_RECLAIM_AttributeList attrs,
const struct GNUNET_RECLAIM_AttestationList attests,
int32_t  success,
const char *  emsg 
)
static

Handle a ticket consume result.

Parameters
clsour consume ticket operation handle
identitythe attribute authority
attrsthe attribute/claim list
successGNUNET_OK if successful
emsgerror message (NULL if success=GNUNET_OK)

Definition at line 842 of file gnunet-service-reclaim.c.

References ConsumeTicketResultMessage::attestations_len, ConsumeTicketResultMessage::attrs_len, ConsumeTicketOperation::client, IdpClient::consume_op_head, IdpClient::consume_op_tail, env, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_OK, GNUNET_RECLAIM_attestation_list_serialize(), GNUNET_RECLAIM_attestation_list_serialize_get_size(), GNUNET_RECLAIM_attribute_list_serialize(), GNUNET_RECLAIM_attribute_list_serialize_get_size(), ConsumeTicketResultMessage::id, identity, ConsumeTicketResultMessage::identity, IdpClient::mq, ConsumeTicketOperation::r_id, and ConsumeTicketResultMessage::result.

Referenced by handle_consume_ticket_message().

848 {
849  struct ConsumeTicketOperation *cop = cls;
850  struct ConsumeTicketResultMessage *crm;
851  struct GNUNET_MQ_Envelope *env;
852  char *data_tmp;
853  size_t attrs_len;
854  size_t attests_len;
855 
856  if (GNUNET_OK != success)
857  {
858  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
859  }
863  "Sending CONSUME_TICKET_RESULT message\n");
864  env = GNUNET_MQ_msg_extra (crm,
865  attrs_len + attests_len,
867  crm->id = htonl (cop->r_id);
868  crm->attrs_len = htons (attrs_len);
869  crm->attestations_len = htons (attests_len);
870  crm->identity = *identity;
871  crm->result = htonl (success);
872  data_tmp = (char *) &crm[1];
873  GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp);
874  data_tmp += attrs_len;
875  GNUNET_RECLAIM_attestation_list_serialize (attests, data_tmp);
876  GNUNET_MQ_send (cop->client->mq, env);
878  cop->client->consume_op_tail,
879  cop);
880  GNUNET_free (cop);
881 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
size_t GNUNET_RECLAIM_attestation_list_serialize(const struct GNUNET_RECLAIM_AttestationList *attrs, char *result)
Serialize an attribute list.
Attribute list is returned from the idp.
Definition: reclaim.h:500
#define GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT
struct ConsumeTicketOperation * consume_op_head
Head of DLL of ticket consume ops.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:510
uint32_t result
Result.
Definition: reclaim.h:515
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
uint16_t attestations_len
Length of attestation data.
Definition: reclaim.h:525
struct IdpClient * client
Client connection.
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
size_t GNUNET_RECLAIM_attribute_list_serialize(const struct GNUNET_RECLAIM_AttributeList *attrs, char *result)
Serialize an attribute list.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct ConsumeTicketOperation * consume_op_tail
Tail of DLL of ticket consume ops.
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The public key of the identity.
Definition: reclaim.h:535
uint16_t attrs_len
Length of serialized attribute data.
Definition: reclaim.h:520
#define GNUNET_log(kind,...)
Handle for ticket consume request.
size_t GNUNET_RECLAIM_attribute_list_serialize_get_size(const struct GNUNET_RECLAIM_AttributeList *attrs)
Get required size for serialization buffer.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
size_t GNUNET_RECLAIM_attestation_list_serialize_get_size(const struct GNUNET_RECLAIM_AttestationList *attestations)
Get required size for serialization buffer.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_consume_ticket_message()

static int check_consume_ticket_message ( void *  cls,
const struct ConsumeTicketMessage cm 
)
static

Check a consume ticket message.

Parameters
clsunused
cmthe message to handle

Definition at line 891 of file gnunet-service-reclaim.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, ConsumeTicketMessage::header, size, and GNUNET_MessageHeader::size.

892 {
893  uint16_t size;
894 
895  size = ntohs (cm->header.size);
896  if (size != sizeof(struct ConsumeTicketMessage))
897  {
898  GNUNET_break (0);
899  return GNUNET_SYSERR;
900  }
901  return GNUNET_OK;
902 }
Ticket consume message.
Definition: reclaim.h:474
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static unsigned int size
Size of the "table".
Definition: peer.c:67
struct GNUNET_MessageHeader header
Type will be GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET.
Definition: reclaim.h:479

◆ handle_consume_ticket_message()

static void handle_consume_ticket_message ( void *  cls,
const struct ConsumeTicketMessage cm 
)
static

Handle a consume ticket message.

Parameters
clsour client handle the message to handle

Definition at line 912 of file gnunet-service-reclaim.c.

References ConsumeTicketOperation::ch, IdpClient::client, ConsumeTicketOperation::client, IdpClient::consume_op_head, IdpClient::consume_op_tail, consume_result_cb(), GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_SERVICE_client_continue(), ConsumeTicketMessage::id, ConsumeTicketMessage::identity, ConsumeTicketOperation::r_id, RECLAIM_TICKETS_consume(), and ConsumeTicketMessage::ticket.

913 {
914  struct ConsumeTicketOperation *cop;
915  struct IdpClient *idp = cls;
916 
917  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
918  cop = GNUNET_new (struct ConsumeTicketOperation);
919  cop->r_id = ntohl (cm->id);
920  cop->client = idp;
921  cop->ch
923  cop);
926 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct ConsumeTicketOperation * consume_op_head
Head of DLL of ticket consume ops.
An idp client.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_SERVICE_Client * client
The client.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:489
static void consume_result_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_AttestationList *attests, int32_t success, const char *emsg)
Handle a ticket consume result.
struct IdpClient * client
Client connection.
struct RECLAIM_TICKETS_ConsumeHandle * ch
Ticket consume handle.
struct GNUNET_RECLAIM_Ticket ticket
The ticket to consume.
Definition: reclaim.h:494
struct ConsumeTicketOperation * consume_op_tail
Tail of DLL of ticket consume ops.
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)
Consume a ticket.
#define GNUNET_log(kind,...)
Handle for ticket consume request.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:484
Here is the call graph for this function:

◆ attr_store_cont()

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

Attribute store result handler.

Parameters
clsour attribute store handle
successGNUNET_OK if successful
emsgerror message (NULL if success=GNUNET_OK)

Definition at line 942 of file gnunet-service-reclaim.c.

References cleanup_as_handle(), AttributeStoreHandle::client, do_shutdown(), env, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, SuccessResultMessage::id, IdpClient::mq, AttributeStoreHandle::ns_qe, SuccessResultMessage::op_result, AttributeStoreHandle::r_id, IdpClient::store_op_head, and IdpClient::store_op_tail.

Referenced by attr_store_task().

943 {
944  struct AttributeStoreHandle *ash = cls;
945  struct GNUNET_MQ_Envelope *env;
946  struct SuccessResultMessage *acr_msg;
947 
948  ash->ns_qe = NULL;
950  ash->client->store_op_tail,
951  ash);
952 
953  if (GNUNET_SYSERR == success)
954  {
956  "Failed to store attribute %s\n",
957  emsg);
958  cleanup_as_handle (ash);
960  return;
961  }
962 
963  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
965  acr_msg->id = htonl (ash->r_id);
966  acr_msg->op_result = htonl (GNUNET_OK);
967  GNUNET_MQ_send (ash->client->mq, env);
968  cleanup_as_handle (ash);
969 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
int32_t op_result
GNUNET_SYSERR on failure, GNUNET_OK on success
Definition: reclaim.h:118
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
struct AttributeStoreHandle * store_op_head
Head of DLL of attribute store ops.
static void cleanup_as_handle(struct AttributeStoreHandle *ash)
Cleanup attribute store handle.
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
uint32_t r_id
request id
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:1296
Handle for attribute store request.
struct AttributeStoreHandle * store_op_tail
Tail of DLL of attribute store ops.
struct IdpClient * client
Client connection.
Attribute store/delete response message.
Definition: reclaim.h:103
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE
#define GNUNET_log(kind,...)
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
static void do_shutdown(void *cls)
Shutdown task.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:113
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attr_store_task()

static void attr_store_task ( void *  cls)
static

Add a new attribute.

Parameters
clsthe AttributeStoreHandle

Definition at line 978 of file gnunet-service-reclaim.c.

References attr_store_cont(), buf, AttributeStoreHandle::claim, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, AttributeStoreHandle::exp, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_records_store(), GNUNET_RECLAIM_attribute_serialize(), GNUNET_RECLAIM_attribute_serialize_get_size(), GNUNET_RECLAIM_id_generate, GNUNET_RECLAIM_id_is_zero, GNUNET_STRINGS_data_to_string_alloc(), GNUNET_YES, GNUNET_RECLAIM_Attribute::id, AttributeStoreHandle::identity, AttributeStoreHandle::ns_qe, GNUNET_GNSRECORD_Data::record_type, and GNUNET_TIME_Relative::rel_value_us.

Referenced by handle_attribute_store_message().

979 {
980  struct AttributeStoreHandle *ash = cls;
981  struct GNUNET_GNSRECORD_Data rd[1];
982  char *buf;
983  char *label;
984  size_t buf_size;
985 
986  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
988  buf = GNUNET_malloc (buf_size);
989  // Give the ash a new id if unset
993  label
995  sizeof (ash->claim->id));
996  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
997 
998  rd[0].data_size = buf_size;
999  rd[0].data = buf;
1000  rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE;
1002  rd[0].expiration_time = ash->exp.rel_value_us;
1004  &ash->identity,
1005  label,
1006  1,
1007  rd,
1008  &attr_store_cont,
1009  ash);
1010  GNUNET_free (buf);
1011  GNUNET_free (label);
1012 }
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
uint64_t rel_value_us
The actual value.
static void attr_store_cont(void *cls, int32_t success, const char *emsg)
Attribute store result handler.
size_t GNUNET_RECLAIM_attribute_serialize(const struct GNUNET_RECLAIM_Attribute *attr, char *result)
Serialize an attribute.
size_t GNUNET_RECLAIM_attribute_serialize_get_size(const struct GNUNET_RECLAIM_Attribute *attr)
Get required size for serialization buffer.
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_TIME_Relative exp
The attribute expiration interval.
Handle for attribute store request.
static char buf[2048]
struct GNUNET_RECLAIM_Identifier id
ID.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE
Record type for identity attributes (of RECLAIM).
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:935
This expiration time of the record is a relative time (not an absolute time).
#define GNUNET_RECLAIM_id_generate(id)
struct GNUNET_RECLAIM_Attribute * claim
The attribute to store.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_RECLAIM_id_is_zero(a)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_attribute_store_message()

static int check_attribute_store_message ( void *  cls,
const struct AttributeStoreMessage sam 
)
static

Check an attribute store message.

Parameters
clsunused
samthe message to check

Definition at line 1022 of file gnunet-service-reclaim.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, AttributeStoreMessage::header, size, and GNUNET_MessageHeader::size.

1024 {
1025  uint16_t size;
1026 
1027  size = ntohs (sam->header.size);
1028  if (size <= sizeof(struct AttributeStoreMessage))
1029  {
1030  GNUNET_break (0);
1031  return GNUNET_SYSERR;
1032  }
1033  return GNUNET_OK;
1034 }
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
Use to store an identity attribute.
Definition: reclaim.h:40
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT.
Definition: reclaim.h:45
static unsigned int size
Size of the "table".
Definition: peer.c:67

◆ handle_attribute_store_message()

static void handle_attribute_store_message ( void *  cls,
const struct AttributeStoreMessage sam 
)
static

Handle an attribute store message.

Parameters
clsour client
samthe message to handle

Definition at line 1044 of file gnunet-service-reclaim.c.

References AttributeStoreMessage::attr_len, attr_store_task(), AttributeStoreHandle::claim, IdpClient::client, AttributeStoreHandle::client, AttributeStoreHandle::exp, GNUNET_CONTAINER_DLL_insert, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_ntohll(), GNUNET_RECLAIM_attribute_deserialize(), GNUNET_SCHEDULER_add_now(), GNUNET_SERVICE_client_continue(), AttributeStoreHandle::identity, AttributeStoreHandle::identity_pkey, AttributeStoreHandle::r_id, GNUNET_TIME_Relative::rel_value_us, IdpClient::store_op_head, and IdpClient::store_op_tail.

1046 {
1047  struct AttributeStoreHandle *ash;
1048  struct IdpClient *idp = cls;
1049  size_t data_len;
1050 
1051  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
1052 
1053  data_len = ntohs (sam->attr_len);
1054 
1055  ash = GNUNET_new (struct AttributeStoreHandle);
1056  ash->claim = GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1],
1057  data_len);
1058 
1059  ash->r_id = ntohl (sam->id);
1060  ash->identity = sam->identity;
1061  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1063 
1065  ash->client = idp;
1068 }
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:65
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.
An idp client.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct AttributeStoreHandle * store_op_head
Head of DLL of attribute store ops.
struct GNUNET_SERVICE_Client * client
The client.
uint32_t r_id
request id
static void attr_store_task(void *cls)
Add a new attribute.
struct GNUNET_TIME_Relative exp
The attribute expiration interval.
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size)
Deserialize an attribute.
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:1296
Handle for attribute store request.
struct AttributeStoreHandle * store_op_tail
Tail of DLL of attribute store ops.
struct IdpClient * client
Client connection.
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:55
struct GNUNET_CRYPTO_EcdsaPublicKey identity_pkey
Identity pubkey.
uint64_t exp
The expiration interval of the attribute.
Definition: reclaim.h:60
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:176
#define GNUNET_log(kind,...)
struct GNUNET_RECLAIM_Attribute * claim
The attribute to store.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:50
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:53
Here is the call graph for this function:

◆ attest_store_cont()

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

Attestation store result handler.

Parameters
clsour attribute store handle
successGNUNET_OK if successful
emsgerror message (NULL if success=GNUNET_OK)

Definition at line 1079 of file gnunet-service-reclaim.c.

References cleanup_as_handle(), AttributeStoreHandle::client, do_shutdown(), env, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, SuccessResultMessage::id, IdpClient::mq, AttributeStoreHandle::ns_qe, SuccessResultMessage::op_result, AttributeStoreHandle::r_id, IdpClient::store_op_head, and IdpClient::store_op_tail.

Referenced by attest_add_cb().

1080 {
1081  struct AttributeStoreHandle *ash = cls;
1082  struct GNUNET_MQ_Envelope *env;
1083  struct SuccessResultMessage *acr_msg;
1084 
1085  ash->ns_qe = NULL;
1087  ash->client->store_op_tail,
1088  ash);
1089 
1090  if (GNUNET_SYSERR == success)
1091  {
1093  "Failed to store attestation %s\n",
1094  emsg);
1095  cleanup_as_handle (ash);
1097  return;
1098  }
1099 
1100  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1102  acr_msg->id = htonl (ash->r_id);
1103  acr_msg->op_result = htonl (GNUNET_OK);
1104  GNUNET_MQ_send (ash->client->mq, env);
1105  cleanup_as_handle (ash);
1106 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
int32_t op_result
GNUNET_SYSERR on failure, GNUNET_OK on success
Definition: reclaim.h:118
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
struct AttributeStoreHandle * store_op_head
Head of DLL of attribute store ops.
static void cleanup_as_handle(struct AttributeStoreHandle *ash)
Cleanup attribute store handle.
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
uint32_t r_id
request id
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:1296
Handle for attribute store request.
struct AttributeStoreHandle * store_op_tail
Tail of DLL of attribute store ops.
struct IdpClient * client
Client connection.
Attribute store/delete response message.
Definition: reclaim.h:103
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE
#define GNUNET_log(kind,...)
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
static void do_shutdown(void *cls)
Shutdown task.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:113
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attest_error()

static void attest_error ( void *  cls)
static

Error looking up potential attestation.

Abort.

Parameters
clsour attribute store handle

Definition at line 1115 of file gnunet-service-reclaim.c.

References cleanup_as_handle(), do_shutdown(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, and GNUNET_SCHEDULER_add_now().

Referenced by attest_store_task().

1116 {
1117  struct AttributeStoreHandle *ash = cls;
1119  "Failed to check for existing Attestation\n");
1120  cleanup_as_handle (ash);
1122  return;
1123 }
static void cleanup_as_handle(struct AttributeStoreHandle *ash)
Cleanup attribute store 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:1296
Handle for attribute store request.
#define GNUNET_log(kind,...)
static void do_shutdown(void *cls)
Shutdown task.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attest_add_cb()

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

Check for existing record before storing attestation.

Parameters
clsour attribute store handle
zonezone we are iterating
labellabel of the records
rd_countrecord count
rdrecords

Definition at line 1136 of file gnunet-service-reclaim.c.

References AttributeStoreHandle::attest, attest_store_cont(), buf, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, AttributeStoreHandle::exp, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_records_store(), GNUNET_RECLAIM_attestation_serialize(), GNUNET_RECLAIM_attestation_serialize_get_size(), AttributeStoreHandle::identity, AttributeStoreHandle::ns_qe, GNUNET_GNSRECORD_Data::record_type, and GNUNET_TIME_Relative::rel_value_us.

Referenced by attest_store_task().

1141 {
1142  struct AttributeStoreHandle *ash = cls;
1143  char *buf;
1144  size_t buf_size;
1146  buf = GNUNET_malloc (buf_size);
1149  "Storing new Attestation\n");
1150  struct GNUNET_GNSRECORD_Data rd_new[1];
1151  rd_new[0].data_size = buf_size;
1152  rd_new[0].data = buf;
1153  rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION;
1154  rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1155  rd_new[0].expiration_time = ash->exp.rel_value_us;
1156  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1158  &ash->identity,
1159  label,
1160  1,
1161  rd_new,
1163  ash);
1164  GNUNET_free (buf);
1165  return;
1166 }
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
uint64_t rel_value_us
The actual value.
struct GNUNET_RECLAIM_Attestation * attest
The attestation to store.
size_t GNUNET_RECLAIM_attestation_serialize(const struct GNUNET_RECLAIM_Attestation *attestation, char *result)
Serialize an attestation.
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.
struct GNUNET_TIME_Relative exp
The attribute expiration interval.
Handle for attribute store request.
static char buf[2048]
size_t GNUNET_RECLAIM_attestation_serialize_get_size(const struct GNUNET_RECLAIM_Attestation *attestation)
Get required size for serialization buffer.
static void attest_store_cont(void *cls, int32_t success, const char *emsg)
Attestation store result handler.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION
Record type for an attribute attestation.
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
This expiration time of the record is a relative time (not an absolute time).
#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:

◆ attest_store_task()

static void attest_store_task ( void *  cls)
static

Add a new attestation.

Parameters
clsthe AttributeStoreHandle

Definition at line 1175 of file gnunet-service-reclaim.c.

References AttributeStoreHandle::attest, attest_add_cb(), attest_error(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NAMESTORE_records_lookup(), GNUNET_RECLAIM_id_generate, GNUNET_RECLAIM_id_is_zero, GNUNET_STRINGS_data_to_string_alloc(), GNUNET_YES, GNUNET_RECLAIM_Attestation::id, AttributeStoreHandle::identity, and AttributeStoreHandle::ns_qe.

Referenced by handle_attestation_store_message().

1176 {
1177  struct AttributeStoreHandle *ash = cls;
1178  char *label;
1179 
1180  // Give the ash a new id if unset
1184  sizeof (ash->attest->id));
1186  "Looking up existing data under label %s\n", label);
1187 // Test for the content of the existing ID
1189  &ash->identity,
1190  label,
1191  &attest_error,
1192  ash,
1193  &attest_add_cb,
1194  ash);
1195  GNUNET_free (label);
1196 }
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
static void attest_error(void *cls)
Error looking up potential attestation.
struct GNUNET_RECLAIM_Attestation * attest
The attestation to store.
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.
Handle for attribute store request.
struct GNUNET_RECLAIM_Identifier id
ID.
static void attest_add_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Check for existing record before storing attestation.
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:935
#define GNUNET_RECLAIM_id_generate(id)
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_RECLAIM_id_is_zero(a)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_attestation_store_message()

static int check_attestation_store_message ( void *  cls,
const struct AttributeStoreMessage sam 
)
static

Check an attestation store message.

Parameters
clsunused
samthe message to check

Definition at line 1206 of file gnunet-service-reclaim.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, AttributeStoreMessage::header, size, and GNUNET_MessageHeader::size.

1208 {
1209  uint16_t size;
1210 
1211  size = ntohs (sam->header.size);
1212  if (size <= sizeof(struct AttributeStoreMessage))
1213  {
1214  GNUNET_break (0);
1215  return GNUNET_SYSERR;
1216  }
1217  return GNUNET_OK;
1218 }
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
Use to store an identity attribute.
Definition: reclaim.h:40
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT.
Definition: reclaim.h:45
static unsigned int size
Size of the "table".
Definition: peer.c:67

◆ handle_attestation_store_message()

static void handle_attestation_store_message ( void *  cls,
const struct AttributeStoreMessage sam 
)
static

Handle an attestation store message.

Parameters
clsour client
samthe message to handle

Definition at line 1228 of file gnunet-service-reclaim.c.

References AttributeStoreHandle::attest, attest_store_task(), AttributeStoreMessage::attr_len, IdpClient::client, AttributeStoreHandle::client, AttributeStoreHandle::exp, GNUNET_CONTAINER_DLL_insert, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_ntohll(), GNUNET_RECLAIM_attestation_deserialize(), GNUNET_SCHEDULER_add_now(), GNUNET_SERVICE_client_continue(), AttributeStoreHandle::identity, AttributeStoreHandle::identity_pkey, AttributeStoreHandle::r_id, GNUNET_TIME_Relative::rel_value_us, IdpClient::store_op_head, and IdpClient::store_op_tail.

1230 {
1231  struct AttributeStoreHandle *ash;
1232  struct IdpClient *idp = cls;
1233  size_t data_len;
1234 
1235  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTESTATION_STORE message\n");
1236 
1237  data_len = ntohs (sam->attr_len);
1238 
1239  ash = GNUNET_new (struct AttributeStoreHandle);
1240  ash->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &sam[1],
1241  data_len);
1242 
1243  ash->r_id = ntohl (sam->id);
1244  ash->identity = sam->identity;
1245  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1247 
1249  ash->client = idp;
1252 }
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:65
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_Attestation * attest
The attestation to store.
An idp client.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct AttributeStoreHandle * store_op_head
Head of DLL of attribute store ops.
struct GNUNET_SERVICE_Client * client
The client.
uint32_t r_id
request id
struct GNUNET_TIME_Relative exp
The attribute expiration interval.
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:1296
Handle for attribute store request.
struct AttributeStoreHandle * store_op_tail
Tail of DLL of attribute store ops.
struct IdpClient * client
Client connection.
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:55
struct GNUNET_RECLAIM_Attestation * GNUNET_RECLAIM_attestation_deserialize(const char *data, size_t data_size)
Deserialize an attestation.
struct GNUNET_CRYPTO_EcdsaPublicKey identity_pkey
Identity pubkey.
uint64_t exp
The expiration interval of the attribute.
Definition: reclaim.h:60
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:176
#define GNUNET_log(kind,...)
static void attest_store_task(void *cls)
Add a new attestation.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:50
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:53
Here is the call graph for this function:

◆ send_delete_response()

static void send_delete_response ( struct AttributeDeleteHandle adh,
int32_t  success 
)
static

Send a deletion success response.

Parameters
adhour attribute deletion handle
successthe success status

Definition at line 1262 of file gnunet-service-reclaim.c.

References AttributeDeleteHandle::client, IdpClient::delete_op_head, IdpClient::delete_op_tail, env, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE, GNUNET_MQ_msg, GNUNET_MQ_send(), SuccessResultMessage::id, IdpClient::mq, SuccessResultMessage::op_result, and AttributeDeleteHandle::r_id.

Referenced by attest_delete_cont(), attr_delete_cont(), ticket_iter_err(), and update_tickets().

1263 {
1264  struct GNUNET_MQ_Envelope *env;
1265  struct SuccessResultMessage *acr_msg;
1266 
1268  adh->client->delete_op_tail,
1269  adh);
1270 
1271  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1273  acr_msg->id = htonl (adh->r_id);
1274  acr_msg->op_result = htonl (success);
1275  GNUNET_MQ_send (adh->client->mq, env);
1276 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
int32_t op_result
GNUNET_SYSERR on failure, GNUNET_OK on success
Definition: reclaim.h:118
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
Attribute store/delete response message.
Definition: reclaim.h:103
struct IdpClient * client
Client connection.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct AttributeDeleteHandle * delete_op_head
Head of DLL of attribute delete ops.
#define GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE
#define GNUNET_log(kind,...)
struct AttributeDeleteHandle * delete_op_tail
Tail of DLL of attribute delete ops.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:113
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_iter()

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

Namestore iteration within attribute deletion.

We need to reissue tickets with the deleted attribute removed.

Parameters
clsour attribute deletion handle
zonethe private key of the ticket issuer
labelthe label of the record
rd_countnumber of records
rdrecord data

Definition at line 1290 of file gnunet-service-reclaim.c.

References AttributeDeleteHandle::attest, AttributeDeleteHandle::claim, TicketRecordsEntry::data, data, TicketRecordsEntry::data_size, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_ERROR, GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_new, GNUNET_NO, GNUNET_RECLAIM_id_is_equal, GNUNET_strdup, GNUNET_YES, GNUNET_RECLAIM_Attribute::id, GNUNET_RECLAIM_Attestation::id, TicketRecordsEntry::label, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_it, TicketRecordsEntry::rd_count, AttributeDeleteHandle::tickets_to_update_head, AttributeDeleteHandle::tickets_to_update_tail, and update_tickets().

Referenced by start_ticket_update().

1295 {
1296  struct AttributeDeleteHandle *adh = cls;
1297  struct TicketRecordsEntry *le;
1298  int has_changed = GNUNET_NO;
1299  for (int i = 0; i < rd_count; i++)
1300  {
1301  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
1302  continue;
1303  if (adh->claim != NULL)
1305  &adh->claim->id))
1306  continue;
1307  if (adh->attest != NULL)
1308  if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data,
1309  &adh->attest->id))
1310  continue;
1312  "Attribute or Attestation to delete found (%s)\n",
1313  adh->label);
1314  has_changed = GNUNET_YES;
1315  break;
1316  }
1317  if (GNUNET_YES == has_changed)
1318  {
1319  le = GNUNET_new (struct TicketRecordsEntry);
1320  le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
1321  le->data = GNUNET_malloc (le->data_size);
1322  le->rd_count = rd_count;
1323  le->label = GNUNET_strdup (label);
1324  GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
1327  le);
1328  }
1330 }
Handle for attribute deletion request.
struct GNUNET_RECLAIM_Attestation * attest
The attestation to delete.
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.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
#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_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...
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF
Record type for reclaim records.
unsigned int rd_count
Record count.
struct GNUNET_RECLAIM_Identifier id
ID.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
struct GNUNET_RECLAIM_Identifier id
ID.
char * label
Attribute label.
#define GNUNET_RECLAIM_id_is_equal(a, b)
#define GNUNET_log(kind,...)
uint32_t data
The data value.
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
#define GNUNET_malloc(size)
Wrapper around malloc.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_tickets()

static void update_tickets ( void *  cls)
static

Recursion prototype for function.

Update tickets: Remove shared attribute which has just been deleted.

Parameters
clsour deletion handle

This method is called recursively until all tickets are processed. Eventually, the updated tickets are stored using ``update_tickets''.

Parameters
clsour attribute deletion handle

Definition at line 1366 of file gnunet-service-reclaim.c.

References AttributeDeleteHandle::attest, AttributeDeleteHandle::claim, cleanup_adh(), data, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_records_deserialize(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_log, GNUNET_NAMESTORE_records_store(), GNUNET_OK, GNUNET_RECLAIM_id_is_equal, GNUNET_SYSERR, GNUNET_YES, GNUNET_RECLAIM_Attribute::id, GNUNET_RECLAIM_Attestation::id, AttributeDeleteHandle::identity, TicketRecordsEntry::label, AttributeDeleteHandle::ns_qe, GNUNET_GNSRECORD_Data::record_type, send_delete_response(), ticket_updated(), AttributeDeleteHandle::tickets_to_update_head, and AttributeDeleteHandle::tickets_to_update_tail.

Referenced by ticket_iter(), ticket_iter_fin(), and ticket_updated().

1367 {
1368  struct AttributeDeleteHandle *adh = cls;
1369  struct TicketRecordsEntry *le;
1370 
1371  if (NULL == adh->tickets_to_update_head)
1372  {
1374  "Finished updating tickets, success\n");
1376  cleanup_adh (adh);
1377  return;
1378  }
1380  "Updating %s\n",
1382  le = adh->tickets_to_update_head;
1385  le);
1386  struct GNUNET_GNSRECORD_Data rd[le->rd_count];
1387  struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1];
1389  le->data,
1390  le->rd_count,
1391  rd))
1392  {
1394  "Unable to deserialize record data!\n");
1396  cleanup_adh (adh);
1397  return;
1398  }
1399  int j = 0;
1400  for (int i = 0; i < le->rd_count; i++)
1401  {
1402  if (adh->claim != NULL)
1405  &adh->claim->id)))
1406  continue;
1407  if (adh->attest != NULL)
1408  if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1409  && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
1410  &adh->attest->id)))
1411  continue;
1412  rd_new[j] = rd[i];
1413  j++;
1414  }
1416  &adh->identity,
1417  le->label,
1418  j,
1419  rd_new,
1420  &ticket_updated,
1421  adh);
1422  GNUNET_free (le->label);
1423  GNUNET_free (le->data);
1424  GNUNET_free (le);
1425 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle for attribute deletion request.
struct GNUNET_RECLAIM_Attestation * attest
The attestation to delete.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
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.
static void send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
Send a deletion success response.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF
Record type for reclaim records.
unsigned int rd_count
Record count.
struct GNUNET_RECLAIM_Identifier id
ID.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
struct GNUNET_RECLAIM_Identifier id
ID.
static void ticket_updated(void *cls, int32_t success, const char *emsg)
Callback called when a ticket was updated.
uint32_t record_type
Type of the GNS/DNS record.
#define GNUNET_RECLAIM_id_is_equal(a, b)
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
uint32_t data
The data value.
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_updated()

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

Callback called when a ticket was updated.

Parameters
clsour attribute deletion handle
successGNUNET_OK if successful
emsgerror message (NULL if success=GNUNET_OK)

Definition at line 1349 of file gnunet-service-reclaim.c.

References GNUNET_SCHEDULER_add_now(), AttributeDeleteHandle::ns_qe, and update_tickets().

Referenced by update_tickets().

1350 {
1351  struct AttributeDeleteHandle *adh = cls;
1352 
1353  adh->ns_qe = NULL;
1355 }
Handle for attribute deletion request.
static void update_tickets(void *cls)
Recursion prototype for function.
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:1296
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_iter_fin()

static void ticket_iter_fin ( void *  cls)
static

Done collecting affected tickets, start updating.

Parameters
clsour attribute deletion handle

Definition at line 1434 of file gnunet-service-reclaim.c.

References GNUNET_SCHEDULER_add_now(), AttributeDeleteHandle::ns_it, and update_tickets().

Referenced by start_ticket_update().

1435 {
1436  struct AttributeDeleteHandle *adh = cls;
1437  adh->ns_it = NULL;
1439 }
Handle for attribute deletion request.
static void update_tickets(void *cls)
Recursion prototype for function.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
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:1296
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_iter_err()

static void ticket_iter_err ( void *  cls)
static

Error collecting affected tickets.

Abort.

Parameters
clsour attribute deletion handle

Definition at line 1448 of file gnunet-service-reclaim.c.

References cleanup_adh(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SYSERR, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_it, and send_delete_response().

Referenced by start_ticket_update().

1449 {
1450  struct AttributeDeleteHandle *adh = cls;
1451 
1452  adh->ns_it = NULL;
1454  "Namestore error on delete %s\n",
1455  adh->label);
1457  cleanup_adh (adh);
1458 }
Handle for attribute deletion request.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
static void send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
Send a deletion success response.
char * label
Attribute label.
#define GNUNET_log(kind,...)
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_ticket_update()

static void start_ticket_update ( void *  cls)
static

Start processing tickets which may still contain reference to deleted attribute.

Parameters
clsattribute deletion handle

Definition at line 1468 of file gnunet-service-reclaim.c.

References GNUNET_NAMESTORE_zone_iteration_start(), AttributeDeleteHandle::identity, AttributeDeleteHandle::ns_it, ticket_iter(), ticket_iter_err(), and ticket_iter_fin().

Referenced by attest_delete_cont(), and attr_delete_cont().

1469 {
1470  struct AttributeDeleteHandle *adh = cls;
1471 
1473  &adh->identity,
1474  &ticket_iter_err,
1475  adh,
1476  &ticket_iter,
1477  adh,
1478  &ticket_iter_fin,
1479  adh);
1480 }
Handle for attribute deletion request.
static void ticket_iter_err(void *cls)
Error collecting affected tickets.
static void ticket_iter(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Namestore iteration within attribute deletion.
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_NAMESTORE_ZoneIterator * ns_it
Iterator.
static void ticket_iter_fin(void *cls)
Done collecting affected tickets, start updating.
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attr_delete_cont()

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

Attribute deleted callback.

Parameters
clsour handle
successsuccess status
emsgerror message (NULL if success=GNUNET_OK)

Definition at line 1491 of file gnunet-service-reclaim.c.

References cleanup_adh(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_qe, send_delete_response(), and start_ticket_update().

Referenced by handle_attribute_delete_message().

1492 {
1493  struct AttributeDeleteHandle *adh = cls;
1494 
1495  adh->ns_qe = NULL;
1496  if (GNUNET_SYSERR == success)
1497  {
1499  "Error deleting attribute %s\n",
1500  adh->label);
1502  cleanup_adh (adh);
1503  return;
1504  }
1505  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1507 }
Handle for attribute deletion request.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
static void send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
Send a deletion success response.
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:1296
static void start_ticket_update(void *cls)
Start processing tickets which may still contain reference to deleted attribute.
char * label
Attribute label.
#define GNUNET_log(kind,...)
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_attribute_delete_message()

static int check_attribute_delete_message ( void *  cls,
const struct AttributeDeleteMessage dam 
)
static

Check attribute delete message format.

unused message to check

Definition at line 1517 of file gnunet-service-reclaim.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, AttributeDeleteMessage::header, size, and GNUNET_MessageHeader::size.

1519 {
1520  uint16_t size;
1521 
1522  size = ntohs (dam->header.size);
1523  if (size <= sizeof(struct AttributeDeleteMessage))
1524  {
1525  GNUNET_break (0);
1526  return GNUNET_SYSERR;
1527  }
1528  return GNUNET_OK;
1529 }
Use to delete an identity attribute.
Definition: reclaim.h:74
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT.
Definition: reclaim.h:79
static unsigned int size
Size of the "table".
Definition: peer.c:67

◆ handle_attribute_delete_message()

static void handle_attribute_delete_message ( void *  cls,
const struct AttributeDeleteMessage dam 
)
static

Handle attribute deletion.

Parameters
clsour client
damdeletion message

Definition at line 1539 of file gnunet-service-reclaim.c.

References AttributeDeleteHandle::attest, attr_delete_cont(), AttributeDeleteMessage::attr_len, AttributeDeleteHandle::claim, IdpClient::client, AttributeDeleteHandle::client, IdpClient::delete_op_head, IdpClient::delete_op_tail, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMESTORE_records_store(), GNUNET_new, GNUNET_RECLAIM_attribute_deserialize(), GNUNET_SERVICE_client_continue(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_Attribute::id, AttributeDeleteHandle::identity, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_qe, and AttributeDeleteHandle::r_id.

1541 {
1542  struct AttributeDeleteHandle *adh;
1543  struct IdpClient *idp = cls;
1544  size_t data_len;
1545 
1546  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n");
1547 
1548  data_len = ntohs (dam->attr_len);
1549 
1550  adh = GNUNET_new (struct AttributeDeleteHandle);
1551  adh->claim = GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1],
1552  data_len);
1553  adh->attest = NULL;
1554 
1555  adh->r_id = ntohl (dam->id);
1556  adh->identity = dam->identity;
1557  adh->label
1559  sizeof(adh->claim->id));
1561  adh->client = idp;
1564  &adh->identity,
1565  adh->label,
1566  0,
1567  NULL,
1569  adh);
1570 }
Handle for attribute deletion request.
static void attr_delete_cont(void *cls, int32_t success, const char *emsg)
Attribute deleted callback.
struct GNUNET_RECLAIM_Attestation * attest
The attestation to delete.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp client.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:94
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:89
struct GNUNET_SERVICE_Client * client
The client.
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_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size)
Deserialize an attribute.
struct GNUNET_RECLAIM_Identifier id
ID.
char * label
Attribute label.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:84
struct IdpClient * client
Client connection.
struct AttributeDeleteHandle * delete_op_head
Head of DLL of attribute delete ops.
#define GNUNET_log(kind,...)
struct AttributeDeleteHandle * delete_op_tail
Tail of DLL of attribute delete ops.
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:935
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ attest_delete_cont()

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

Attestation deleted callback.

Parameters
clsour handle
successsuccess status
emsgerror message (NULL if success=GNUNET_OK)

Definition at line 1581 of file gnunet-service-reclaim.c.

References cleanup_adh(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_qe, send_delete_response(), and start_ticket_update().

Referenced by handle_attestation_delete_message().

1582 {
1583  struct AttributeDeleteHandle *adh = cls;
1584 
1585  adh->ns_qe = NULL;
1586  if (GNUNET_SYSERR == success)
1587  {
1589  "Error deleting attestation %s\n",
1590  adh->label);
1592  cleanup_adh (adh);
1593  return;
1594  }
1595  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1597 }
Handle for attribute deletion request.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
static void send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
Send a deletion success response.
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:1296
static void start_ticket_update(void *cls)
Start processing tickets which may still contain reference to deleted attribute.
char * label
Attribute label.
#define GNUNET_log(kind,...)
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_attestation_delete_message()

static int check_attestation_delete_message ( void *  cls,
const struct AttributeDeleteMessage dam 
)
static

Check attestation delete message format.

unused message to check

Definition at line 1607 of file gnunet-service-reclaim.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, AttributeDeleteMessage::header, size, and GNUNET_MessageHeader::size.

1609 {
1610  uint16_t size;
1611 
1612  size = ntohs (dam->header.size);
1613  if (size <= sizeof(struct AttributeDeleteMessage))
1614  {
1615  GNUNET_break (0);
1616  return GNUNET_SYSERR;
1617  }
1618  return GNUNET_OK;
1619 }
Use to delete an identity attribute.
Definition: reclaim.h:74
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT.
Definition: reclaim.h:79
static unsigned int size
Size of the "table".
Definition: peer.c:67

◆ handle_attestation_delete_message()

static void handle_attestation_delete_message ( void *  cls,
const struct AttributeDeleteMessage dam 
)
static

Handle attestation deletion.

Parameters
clsour client
damdeletion message

Definition at line 1629 of file gnunet-service-reclaim.c.

References AttributeDeleteHandle::attest, attest_delete_cont(), AttributeDeleteMessage::attr_len, AttributeDeleteHandle::claim, IdpClient::client, AttributeDeleteHandle::client, IdpClient::delete_op_head, IdpClient::delete_op_tail, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMESTORE_records_store(), GNUNET_new, GNUNET_RECLAIM_attestation_deserialize(), GNUNET_SERVICE_client_continue(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_Attestation::id, AttributeDeleteHandle::identity, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_qe, and AttributeDeleteHandle::r_id.

1631 {
1632  struct AttributeDeleteHandle *adh;
1633  struct IdpClient *idp = cls;
1634  size_t data_len;
1635 
1636  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTESTATION_DELETE message\n");
1637 
1638  data_len = ntohs (dam->attr_len);
1639 
1640  adh = GNUNET_new (struct AttributeDeleteHandle);
1641  adh->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &dam[1],
1642  data_len);
1643  adh->claim = NULL;
1644 
1645  adh->r_id = ntohl (dam->id);
1646  adh->identity = dam->identity;
1647  adh->label
1649  sizeof(adh->attest->id));
1651  adh->client = idp;
1654  &adh->identity,
1655  adh->label,
1656  0,
1657  NULL,
1659  adh);
1660 }
Handle for attribute deletion request.
struct GNUNET_RECLAIM_Attestation * attest
The attestation to delete.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp client.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:94
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
static void attest_delete_cont(void *cls, int32_t success, const char *emsg)
Attestation deleted callback.
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:89
struct GNUNET_SERVICE_Client * client
The client.
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_RECLAIM_Attestation * GNUNET_RECLAIM_attestation_deserialize(const char *data, size_t data_size)
Deserialize an attestation.
struct GNUNET_RECLAIM_Identifier id
ID.
char * label
Attribute label.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:84
struct IdpClient * client
Client connection.
struct AttributeDeleteHandle * delete_op_head
Head of DLL of attribute delete ops.
#define GNUNET_log(kind,...)
struct AttributeDeleteHandle * delete_op_tail
Tail of DLL of attribute delete ops.
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:935
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ attr_iter_finished()

static void attr_iter_finished ( void *  cls)
static

Done iterating over attributes.

Parameters
clsour iterator handle

Definition at line 1674 of file gnunet-service-reclaim.c.

References ai, IdpClient::attr_iter_head, IdpClient::attr_iter_tail, AttributeResultMessage::attr_len, Iterator::client, env, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), AttributeResultMessage::id, IdpClient::mq, and Iterator::request_id.

Referenced by attr_iter_error(), and handle_iteration_start().

1675 {
1676  struct Iterator *ai = cls;
1677  struct GNUNET_MQ_Envelope *env;
1678  struct AttributeResultMessage *arm;
1679 
1680  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
1682  arm->id = htonl (ai->request_id);
1683  arm->attr_len = htons (0);
1684  GNUNET_MQ_send (ai->client->mq, env);
1686  ai->client->attr_iter_tail,
1687  ai);
1688  GNUNET_free (ai);
1689 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:134
struct Iterator * attr_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
An attribute iteration operation.
struct IdpClient * client
IDP client which intiated this zone iteration.
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
Attribute is returned from the idp.
Definition: reclaim.h:124
uint16_t attr_len
Length of serialized attribute data.
Definition: reclaim.h:139
#define GNUNET_log(kind,...)
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
struct Iterator * attr_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attr_iter_error()

static void attr_iter_error ( void *  cls)
static

Error iterating over attributes.

Abort.

Parameters
clsour attribute iteration handle

Definition at line 1698 of file gnunet-service-reclaim.c.

References ai, attr_iter_finished(), GNUNET_ERROR_TYPE_ERROR, and GNUNET_log.

Referenced by handle_iteration_start().

1699 {
1700  struct Iterator *ai = cls;
1701 
1702  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1703  attr_iter_finished (ai);
1704 }
An attribute iteration operation.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
#define GNUNET_log(kind,...)
static void attr_iter_finished(void *cls)
Done iterating over attributes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attr_iter_cb()

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

Got record.

Return if it is an attribute or attestation.

Parameters
clsour attribute iterator
zonezone we are iterating
labellabel of the records
rd_countrecord count
rdrecords

Definition at line 1717 of file gnunet-service-reclaim.c.

References ai, AttributeResultMessage::attr_len, Iterator::client, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, env, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NAMESTORE_zone_iterator_next(), AttributeResultMessage::id, AttributeResultMessage::identity, IdpClient::mq, Iterator::ns_it, GNUNET_GNSRECORD_Data::record_type, and Iterator::request_id.

Referenced by handle_iteration_start().

1722 {
1723  struct Iterator *ai = cls;
1724  struct GNUNET_MQ_Envelope *env;
1725  char *data_tmp;
1726 
1727  if ((rd_count != 1) ||
1729  {
1731  return;
1732  }
1733  struct AttributeResultMessage *arm;
1734  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
1735  label);
1737  "Sending ATTRIBUTE_RESULT message\n");
1738  env = GNUNET_MQ_msg_extra (arm,
1739  rd->data_size,
1741  arm->id = htonl (ai->request_id);
1742  arm->attr_len = htons (rd->data_size);
1744  data_tmp = (char *) &arm[1];
1745  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1746  GNUNET_MQ_send (ai->client->mq, env);
1747 }
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:134
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
An attribute iteration operation.
size_t data_size
Number of bytes in data.
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 IdpClient * client
IDP client which intiated this zone iteration.
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
const void * data
Binary value stored in the DNS record.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE
Record type for identity attributes (of RECLAIM).
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
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:176
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
uint32_t record_type
Type of the GNS/DNS record.
Attribute is returned from the idp.
Definition: reclaim.h:124
uint16_t attr_len
Length of serialized attribute data.
Definition: reclaim.h:139
#define GNUNET_log(kind,...)
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The public key of the identity.
Definition: reclaim.h:154
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_iteration_start()

static void handle_iteration_start ( void *  cls,
const struct AttributeIterationStartMessage ais_msg 
)
static

Iterate over zone to get attributes.

Parameters
clsour client
ais_msgthe iteration message to start

Definition at line 1757 of file gnunet-service-reclaim.c.

References ai, attr_iter_cb(), attr_iter_error(), attr_iter_finished(), IdpClient::attr_iter_head, IdpClient::attr_iter_tail, Iterator::client, IdpClient::client, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_new, GNUNET_SERVICE_client_continue(), AttributeIterationStartMessage::id, Iterator::identity, AttributeIterationStartMessage::identity, Iterator::ns_it, and Iterator::request_id.

1759 {
1760  struct IdpClient *idp = cls;
1761  struct Iterator *ai;
1762 
1764  "Received ATTRIBUTE_ITERATION_START message\n");
1765  ai = GNUNET_new (struct Iterator);
1766  ai->request_id = ntohl (ais_msg->id);
1767  ai->client = idp;
1768  ai->identity = ais_msg->identity;
1769 
1772  &ai->identity,
1773  &attr_iter_error,
1774  ai,
1775  &attr_iter_cb,
1776  ai,
1778  ai);
1780 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp client.
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 attr_iter_error(void *cls)
Error iterating over attributes.
struct Iterator * attr_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
An attribute iteration operation.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct IdpClient * client
IDP client which intiated this zone iteration.
struct GNUNET_SERVICE_Client * client
The client.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:215
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Key of the zone we are iterating over.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:210
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
#define GNUNET_log(kind,...)
static void attr_iter_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got record.
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
static void attr_iter_finished(void *cls)
Done iterating over attributes.
struct Iterator * attr_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ handle_iteration_stop()

static void handle_iteration_stop ( void *  cls,
const struct AttributeIterationStopMessage ais_msg 
)
static

Handle iteration stop message from client.

Parameters
clsthe client
ais_msgthe stop message

Definition at line 1790 of file gnunet-service-reclaim.c.

References ai, IdpClient::attr_iter_head, IdpClient::attr_iter_tail, IdpClient::client, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), AttributeIterationStopMessage::id, Iterator::next, and Iterator::request_id.

1792 {
1793  struct IdpClient *idp = cls;
1794  struct Iterator *ai;
1795  uint32_t rid;
1796 
1798  "Received `%s' message\n",
1799  "ATTRIBUTE_ITERATION_STOP");
1800  rid = ntohl (ais_msg->id);
1801  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1802  if (ai->request_id == rid)
1803  break;
1804  if (NULL == ai)
1805  {
1806  GNUNET_break (0);
1808  return;
1809  }
1811  GNUNET_free (ai);
1813 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
An idp client.
struct Iterator * attr_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
An attribute iteration operation.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_SERVICE_Client * client
The client.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:305
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2323
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
struct Iterator * next
Next element in the DLL.
#define GNUNET_log(kind,...)
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
struct Iterator * attr_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

◆ handle_iteration_next()

static void handle_iteration_next ( void *  cls,
const struct AttributeIterationNextMessage ais_msg 
)
static

Client requests next attribute from iterator.

Parameters
clsthe client
ais_msgthe message

Definition at line 1823 of file gnunet-service-reclaim.c.

References ai, IdpClient::attr_iter_head, IdpClient::client, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), AttributeIterationNextMessage::id, Iterator::next, Iterator::ns_it, and Iterator::request_id.

1825 {
1826  struct IdpClient *idp = cls;
1827  struct Iterator *ai;
1828  uint32_t rid;
1829 
1831  "Received ATTRIBUTE_ITERATION_NEXT message\n");
1832  rid = ntohl (ais_msg->id);
1833  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1834  if (ai->request_id == rid)
1835  break;
1836  if (NULL == ai)
1837  {
1838  GNUNET_break (0);
1840  return;
1841  }
1844 }
An idp client.
struct Iterator * attr_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
An attribute iteration operation.
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...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_SERVICE_Client * client
The client.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:232
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2323
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
struct Iterator * next
Next element in the DLL.
#define GNUNET_log(kind,...)
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ attest_iter_finished()

static void attest_iter_finished ( void *  cls)
static

Done iterating over attestations.

Parameters
clsour iterator handle

Definition at line 1858 of file gnunet-service-reclaim.c.

References ai, IdpClient::attest_iter_head, IdpClient::attest_iter_tail, AttestationResultMessage::attestation_len, Iterator::client, env, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), AttestationResultMessage::id, IdpClient::mq, and Iterator::request_id.

Referenced by attest_iter_error(), and handle_attestation_iteration_start().

1859 {
1860  struct Iterator *ai = cls;
1861  struct GNUNET_MQ_Envelope *env;
1862  struct AttestationResultMessage *arm;
1863 
1864  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTESTATION_RESULT message\n");
1866  arm->id = htonl (ai->request_id);
1867  arm->attestation_len = htons (0);
1868  GNUNET_MQ_send (ai->client->mq, env);
1870  ai->client->attest_iter_tail,
1871  ai);
1872  GNUNET_free (ai);
1873 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
An attribute iteration operation.
struct Iterator * attest_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
struct IdpClient * client
IDP client which intiated this zone iteration.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:174
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
uint16_t attestation_len
Length of serialized attribute data.
Definition: reclaim.h:179
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct Iterator * attest_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
#define GNUNET_log(kind,...)
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
Attestation is returned from the idp.
Definition: reclaim.h:164
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attest_iter_error()

static void attest_iter_error ( void *  cls)
static

Error iterating over attestations.

Abort.

Parameters
clsour attribute iteration handle

Definition at line 1882 of file gnunet-service-reclaim.c.

References ai, attest_iter_finished(), GNUNET_ERROR_TYPE_ERROR, and GNUNET_log.

Referenced by handle_attestation_iteration_start().

1883 {
1884  struct Iterator *ai = cls;
1885 
1886  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attestations\n");
1887  attest_iter_finished (ai);
1888 }
An attribute iteration operation.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
#define GNUNET_log(kind,...)
static void attest_iter_finished(void *cls)
Done iterating over attestations.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attest_iter_cb()

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

Got record.

Return attestation.

Parameters
clsour attribute iterator
zonezone we are iterating
labellabel of the records
rd_countrecord count
rdrecords

Definition at line 1901 of file gnunet-service-reclaim.c.

References ai, AttestationResultMessage::attestation_len, Iterator::client, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, env, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NAMESTORE_zone_iterator_next(), AttestationResultMessage::id, AttestationResultMessage::identity, IdpClient::mq, Iterator::ns_it, GNUNET_GNSRECORD_Data::record_type, and Iterator::request_id.

Referenced by handle_attestation_iteration_start().

1906 {
1907  struct Iterator *ai = cls;
1908  struct GNUNET_MQ_Envelope *env;
1909  struct AttestationResultMessage *arm;
1910  char *data_tmp;
1911 
1912  if ((rd_count != 1) ||
1914  {
1916  return;
1917  }
1918  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
1919  label);
1921  "Sending ATTESTATION_RESULT message\n");
1922  env = GNUNET_MQ_msg_extra (arm,
1923  rd->data_size,
1925  arm->id = htonl (ai->request_id);
1926  arm->attestation_len = htons (rd->data_size);
1928  data_tmp = (char *) &arm[1];
1929  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1930 
1931  GNUNET_MQ_send (ai->client->mq, env);
1932 }
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
An attribute iteration operation.
size_t data_size
Number of bytes in data.
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 IdpClient * client
IDP client which intiated this zone iteration.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:174
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Definition: gnunet_mq_lib.h:52
const void * data
Binary value stored in the DNS record.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
uint16_t attestation_len
Length of serialized attribute data.
Definition: reclaim.h:179
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The public key of the identity.
Definition: reclaim.h:189
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION
Record type for an attribute attestation.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
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:176
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
uint32_t record_type
Type of the GNS/DNS record.
#define GNUNET_log(kind,...)
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
Attestation is returned from the idp.
Definition: reclaim.h:164
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_attestation_iteration_start()

static void handle_attestation_iteration_start ( void *  cls,
const struct AttestationIterationStartMessage ais_msg 
)
static

Iterate over zone to get attributes.

Parameters
clsour client
ais_msgthe iteration message to start

Definition at line 1942 of file gnunet-service-reclaim.c.

References ai, attest_iter_cb(), attest_iter_error(), attest_iter_finished(), IdpClient::attest_iter_head, IdpClient::attest_iter_tail, Iterator::client, IdpClient::client, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_new, GNUNET_SERVICE_client_continue(), AttestationIterationStartMessage::id, Iterator::identity, AttestationIterationStartMessage::identity, Iterator::ns_it, and Iterator::request_id.

1945 {
1946  struct IdpClient *idp = cls;
1947  struct Iterator *ai;
1948 
1950  "Received ATTESTATION_ITERATION_START message\n");
1951  ai = GNUNET_new (struct Iterator);
1952  ai->request_id = ntohl (ais_msg->id);
1953  ai->client = idp;
1954  ai->identity = ais_msg->identity;
1955 
1957  ai);
1959  &ai->identity,
1961  ai,
1962  &attest_iter_cb,
1963  ai,
1965  ai);
1967 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp client.
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_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:254
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:249
An attribute iteration operation.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct Iterator * attest_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
struct IdpClient * client
IDP client which intiated this zone iteration.
struct GNUNET_SERVICE_Client * client
The client.
static void attest_iter_error(void *cls)
Error iterating over attestations.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Key of the zone we are iterating over.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
struct Iterator * attest_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
static void attest_iter_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got record.
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
static void attest_iter_finished(void *cls)
Done iterating over attestations.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ handle_attestation_iteration_stop()

static void handle_attestation_iteration_stop ( void *  cls,
const struct AttestationIterationStopMessage ais_msg 
)
static

Handle iteration stop message from client.

Parameters
clsthe client
ais_msgthe stop message

Definition at line 1977 of file gnunet-service-reclaim.c.

References ai, IdpClient::attest_iter_head, IdpClient::attest_iter_tail, IdpClient::client, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), AttestationIterationStopMessage::id, Iterator::next, and Iterator::request_id.

1980 {
1981  struct IdpClient *idp = cls;
1982  struct Iterator *ai;
1983  uint32_t rid;
1984 
1986  "Received `%s' message\n",
1987  "ATTESTATION_ITERATION_STOP");
1988  rid = ntohl (ais_msg->id);
1989  for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next)
1990  if (ai->request_id == rid)
1991  break;
1992  if (NULL == ai)
1993  {
1994  GNUNET_break (0);
1996  return;
1997  }
1999  ai);
2000  GNUNET_free (ai);
2002 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
An idp client.
An attribute iteration operation.
struct Iterator * attest_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_SERVICE_Client * client
The client.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:288
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2323
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
struct Iterator * attest_iter_tail
Tail of the DLL of Attribute iteration operations in progress initiated by this client.
struct Iterator * next
Next element in the DLL.
#define GNUNET_log(kind,...)
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

◆ handle_attestation_iteration_next()

static void handle_attestation_iteration_next ( void *  cls,
const struct AttestationIterationNextMessage ais_msg 
)
static

Client requests next attestation from iterator.

Parameters
clsthe client
ais_msgthe message

Definition at line 2012 of file gnunet-service-reclaim.c.

References ai, IdpClient::attest_iter_head, IdpClient::client, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), AttestationIterationNextMessage::id, Iterator::next, Iterator::ns_it, and Iterator::request_id.

2015 {
2016  struct IdpClient *idp = cls;
2017  struct Iterator *ai;
2018  uint32_t rid;
2019 
2021  "Received ATTESTATION_ITERATION_NEXT message\n");
2022  rid = ntohl (ais_msg->id);
2023  for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next)
2024  if (ai->request_id == rid)
2025  break;
2026  if (NULL == ai)
2027  {
2028  GNUNET_break (0);
2030  return;
2031  }
2034 }
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:271
An idp client.
An attribute iteration operation.
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 Iterator * attest_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_SERVICE_Client * client
The client.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2323
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
struct Iterator * next
Next element in the DLL.
#define GNUNET_log(kind,...)
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ ticket_iter_cb()

static void ticket_iter_cb ( void *  cls,
struct GNUNET_RECLAIM_Ticket ticket 
)
static

Got a ticket.

Return to client

Parameters
clsour ticket iterator
ticketthe ticket

Definition at line 2048 of file gnunet-service-reclaim.c.

References TicketIteration::client, env, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), TicketResultMessage::id, IdpClient::mq, TicketIteration::r_id, ticket, TicketResultMessage::ticket, IdpClient::ticket_iter_head, and IdpClient::ticket_iter_tail.

Referenced by handle_ticket_iteration_start().

2049 {
2050  struct TicketIteration *ti = cls;
2051  struct GNUNET_MQ_Envelope *env;
2052  struct TicketResultMessage *trm;
2053 
2055  if (NULL == ticket)
2056  {
2057  /* send empty response to indicate end of list */
2059  ti->client->ticket_iter_tail,
2060  ti);
2061  }
2062  else
2063  {
2064  trm->ticket = *ticket;
2065  }
2066  trm->id = htonl (ti->r_id);
2067  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
2068  GNUNET_MQ_send (ti->client->mq, env);
2069  if (NULL == ticket)
2070  GNUNET_free (ti);
2071 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct TicketIteration * ticket_iter_tail
Tail of DLL of ticket iteration ops.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:463
Ticket result message.
Definition: reclaim.h:453
struct GNUNET_RECLAIM_Ticket ticket
The new ticket.
Definition: reclaim.h:468
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
uint32_t r_id
The operation id fot the iteration in the response for the client.
struct IdpClient * client
Client which intiated this zone iteration.
struct TicketIteration * ticket_iter_head
Head of DLL of ticket iteration ops.
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
A ticket iteration operation.
#define GNUNET_log(kind,...)
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:355
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_ticket_iteration_start()

static void handle_ticket_iteration_start ( void *  cls,
const struct TicketIterationStartMessage tis_msg 
)
static

Client requests a ticket iteration.

Parameters
clsthe client
tis_msgthe iteration request message

Definition at line 2081 of file gnunet-service-reclaim.c.

References TicketIteration::client, IdpClient::client, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_SERVICE_client_continue(), TicketIterationStartMessage::id, TicketIterationStartMessage::identity, TicketIteration::iter, TicketIteration::r_id, RECLAIM_TICKETS_iteration_start(), ticket_iter_cb(), IdpClient::ticket_iter_head, and IdpClient::ticket_iter_tail.

2084 {
2085  struct IdpClient *client = cls;
2086  struct TicketIteration *ti;
2087 
2089  "Received TICKET_ITERATION_START message\n");
2090  ti = GNUNET_new (struct TicketIteration);
2091  ti->r_id = ntohl (tis_msg->id);
2092  ti->client = client;
2093 
2095  client->ticket_iter_tail,
2096  ti);
2097  ti->iter
2100 }
struct TicketIteration * ticket_iter_tail
Tail of DLL of ticket iteration ops.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_CRYPTO_EcdsaPrivateKey identity
Identity.
Definition: reclaim.h:326
An idp client.
struct RECLAIM_TICKETS_Iterator * iter
The ticket iterator.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
uint32_t r_id
The operation id fot the iteration in the response for the client.
struct RECLAIM_TICKETS_Iterator * RECLAIM_TICKETS_iteration_start(const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
Iterate over all tickets issued by an identity.
struct IdpClient * client
Client which intiated this zone iteration.
struct GNUNET_SERVICE_Client * client
The client.
struct TicketIteration * ticket_iter_head
Head of DLL of ticket iteration ops.
A ticket iteration operation.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:321
#define GNUNET_log(kind,...)
static void ticket_iter_cb(void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
Got a ticket.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ handle_ticket_iteration_stop()

static void handle_ticket_iteration_stop ( void *  cls,
const struct TicketIterationStopMessage tis_msg 
)
static

Client has had enough tickets.

Parameters
clsthe client
tis_msgthe stop message

Definition at line 2110 of file gnunet-service-reclaim.c.

References TicketIteration::client, IdpClient::client, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), TicketIterationStopMessage::id, TicketIteration::iter, TicketIteration::next, TicketIteration::r_id, RECLAIM_TICKETS_iteration_stop(), IdpClient::ticket_iter_head, and IdpClient::ticket_iter_tail.

2112 {
2113  struct IdpClient *client = cls;
2114  struct TicketIteration *ti;
2115  uint32_t rid;
2116 
2118  "Received `%s' message\n",
2119  "TICKET_ITERATION_STOP");
2120  rid = ntohl (tis_msg->id);
2121  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2122  if (ti->r_id == rid)
2123  break;
2124  if (NULL == ti)
2125  {
2126  GNUNET_break (0);
2128  return;
2129  }
2132  client->ticket_iter_tail,
2133  ti);
2134  GNUNET_free (ti);
2136 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct TicketIteration * ticket_iter_tail
Tail of DLL of ticket iteration ops.
An idp client.
void RECLAIM_TICKETS_iteration_stop(struct RECLAIM_TICKETS_Iterator *iter)
Stop a running ticket iteration.
struct RECLAIM_TICKETS_Iterator * iter
The ticket iterator.
uint32_t r_id
The operation id fot the iteration in the response for the client.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_SERVICE_Client * client
The client.
struct TicketIteration * ticket_iter_head
Head of DLL of ticket iteration ops.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2323
struct TicketIteration * next
DLL.
A ticket iteration operation.
#define GNUNET_log(kind,...)
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:360
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

◆ handle_ticket_iteration_next()

static void handle_ticket_iteration_next ( void *  cls,
const struct TicketIterationNextMessage tis_msg 
)
static

Client requests next result.

Parameters
clsthe client
tis_msgthe message

Definition at line 2146 of file gnunet-service-reclaim.c.

References TicketIteration::client, IdpClient::client, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), TicketIterationNextMessage::id, TicketIteration::iter, TicketIteration::next, TicketIteration::r_id, RECLAIM_TICKETS_iteration_next(), and IdpClient::ticket_iter_head.

2148 {
2149  struct IdpClient *client = cls;
2150  struct TicketIteration *ti;
2151  uint32_t rid;
2152 
2154  "Received TICKET_ITERATION_NEXT message\n");
2155  rid = ntohl (tis_msg->id);
2156  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2157  if (ti->r_id == rid)
2158  break;
2159  if (NULL == ti)
2160  {
2161  GNUNET_break (0);
2163  return;
2164  }
2167 }
An idp client.
struct RECLAIM_TICKETS_Iterator * iter
The ticket iterator.
uint32_t r_id
The operation id fot the iteration in the response for the client.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_SERVICE_Client * client
The client.
struct TicketIteration * ticket_iter_head
Head of DLL of ticket iteration ops.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:343
void RECLAIM_TICKETS_iteration_next(struct RECLAIM_TICKETS_Iterator *iter)
Continue ticket iteration.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2323
struct TicketIteration * next
DLL.
A ticket iteration operation.
#define GNUNET_log(kind,...)
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2242
Here is the call graph for this function:

◆ run()

static void run ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle c,
struct GNUNET_SERVICE_Handle server 
)
static

Main function that will be run.

Parameters
clsclosure
cthe configuration used
serverthe service handle

Definition at line 2178 of file gnunet-service-reclaim.c.

References do_shutdown(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_log_strerror, GNUNET_NAMESTORE_connect(), GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), and RECLAIM_TICKETS_init().

Referenced by client_connect_cb().

2181 {
2182  cfg = c;
2183 
2185  {
2187  "Unable to initialize TICKETS subsystem.\n");
2189  return;
2190  }
2191  // Connect to identity and namestore services
2193  if (NULL == nsh)
2194  {
2196  "error connecting to namestore");
2197  }
2198 
2200 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1331
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:531
#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...
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
static void do_shutdown(void *cls)
Shutdown task.
int RECLAIM_TICKETS_init(const struct GNUNET_CONFIGURATION_Handle *c)
Initialize tickets component.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ client_disconnect_cb()

static void client_disconnect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
void *  app_ctx 
)
static

Called whenever a client is disconnected.

Parameters
clsclosure
clientidentification of the client
app_ctxclient

Definition at line 2211 of file gnunet-service-reclaim.c.

References cleanup_client(), GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, and GNUNET_log.

Referenced by client_connect_cb().

2214 {
2215  struct IdpClient *idp = app_ctx;
2216 
2217  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
2220  idp);
2221  cleanup_client (idp);
2222 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
An idp client.
static void cleanup_client(struct IdpClient *idp)
Cleanup client.
static struct IdpClient * client_list_head
Client list.
#define GNUNET_log(kind,...)
static struct IdpClient * client_list_tail
Client list.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ client_connect_cb()

static void* client_connect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
struct GNUNET_MQ_Handle mq 
)
static

Add a client to our list of active clients.

Parameters
clsNULL
clientclient to add
mqmessage queue for client
Returns
internal namestore client structure for this client

Definition at line 2234 of file gnunet-service-reclaim.c.

References TicketIteration::client, IdpClient::client, client_disconnect_cb(), GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_new, GNUNET_SERVICE_MAIN(), GNUNET_SERVICE_OPTION_NONE, iteration_start(), mq, IdpClient::mq, and run().

2237 {
2238  struct IdpClient *idp;
2239 
2240  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
2241  idp = GNUNET_new (struct IdpClient);
2242  idp->client = client;
2243  idp->mq = mq;
2246  idp);
2247  return idp;
2248 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp client.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_SERVICE_Client * client
The client.
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
static struct IdpClient * client_list_head
Client list.
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
#define GNUNET_log(kind,...)
static struct IdpClient * client_list_tail
Client list.
Here is the call graph for this function:

◆ GNUNET_SERVICE_MAIN()

GNUNET_SERVICE_MAIN ( "reclaim"  ,
GNUNET_SERVICE_OPTION_NONE  ,
run,
client_connect_cb,
client_disconnect_cb,
NULL  ,
GNUNET_MQ_hd_var_size(attribute_store_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, struct AttributeStoreMessage, NULL)  ,
GNUNET_MQ_hd_var_size(attestation_store_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE, struct AttributeStoreMessage, NULL)  ,
GNUNET_MQ_hd_var_size(attribute_delete_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, struct AttributeDeleteMessage, NULL)  ,
GNUNET_MQ_hd_var_size(attestation_delete_message, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE, struct AttributeDeleteMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, struct AttributeIterationStartMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, struct AttributeIterationNextMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, struct AttributeIterationStopMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(attestation_iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START, struct AttestationIterationStartMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(attestation_iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT, struct AttestationIterationNextMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(attestation_iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP, struct AttestationIterationStopMessage, NULL)  ,
GNUNET_MQ_hd_var_size(issue_ticket_message, GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, struct IssueTicketMessage, NULL)  ,
GNUNET_MQ_hd_var_size(consume_ticket_message, GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, struct ConsumeTicketMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(ticket_iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, struct TicketIterationStartMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(ticket_iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, struct TicketIterationNextMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(ticket_iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, struct TicketIterationStopMessage, NULL)  ,
GNUNET_MQ_hd_var_size(revoke_ticket_message, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, struct RevokeTicketMessage, NULL)  ,
GNUNET_MQ_handler_end()   
)

Define "main" method using service macro.

Referenced by client_connect_cb().

Here is the caller graph for this function:

Variable Documentation

◆ nsh

struct GNUNET_NAMESTORE_Handle* nsh
static

Namestore handle.

Definition at line 41 of file gnunet-service-reclaim.c.

◆ timeout_task

struct GNUNET_SCHEDULER_Task* timeout_task
static

Timeout task.

Definition at line 46 of file gnunet-service-reclaim.c.

◆ cfg

const struct GNUNET_CONFIGURATION_Handle* cfg
static

Our configuration.

Definition at line 51 of file gnunet-service-reclaim.c.

◆ client_list_head

struct IdpClient* client_list_head = NULL
static

Client list.

Definition at line 465 of file gnunet-service-reclaim.c.

◆ client_list_tail

struct IdpClient* client_list_tail = NULL
static

Client list.

Definition at line 470 of file gnunet-service-reclaim.c.