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, const struct GNUNET_RECLAIM_PresentationList *presentations, 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, struct GNUNET_RECLAIM_PresentationList *presentations, 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_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_PresentationList *presentations, 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 cred_store_cont (void *cls, int32_t success, const char *emsg)
 Credential store result handler. More...
 
static void cred_error (void *cls)
 Error looking up potential credential. More...
 
static void cred_add_cb (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Check for existing record before storing credential. More...
 
static void cred_store_task (void *cls)
 Add a new credential. More...
 
static int check_credential_store_message (void *cls, const struct AttributeStoreMessage *sam)
 Check an credential store message. More...
 
static void handle_credential_store_message (void *cls, const struct AttributeStoreMessage *sam)
 Handle a credential store message. More...
 
static void send_delete_response (struct AttributeDeleteHandle *adh, int32_t success)
 Send a deletion success response. More...
 
static void consistency_iter (void *cls, const struct GNUNET_IDENTITY_PrivateKey *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 purge_attributes (void *cls)
 Delete all attributes which reference credentials that no longer exist. More...
 
static void offending_attr_delete_cont (void *cls, int32_t success, const char *emsg)
 
static void consistency_iter_fin (void *cls)
 Done collecting affected tickets, start updating. More...
 
static void consistency_iter_err (void *cls)
 Error collecting affected tickets. More...
 
static void start_consistency_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 cred_delete_cont (void *cls, int32_t success, const char *emsg)
 Credential deleted callback. More...
 
static int check_credential_delete_message (void *cls, const struct AttributeDeleteMessage *dam)
 Check credential delete message format. More...
 
static void handle_credential_delete_message (void *cls, const struct AttributeDeleteMessage *dam)
 Handle credential 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_IDENTITY_PrivateKey *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 cred_iter_finished (void *cls)
 Done iterating over credentials. More...
 
static void cred_iter_error (void *cls)
 Error iterating over credentials. More...
 
static void cred_iter_cb (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 Got record. More...
 
static void handle_credential_iteration_start (void *cls, const struct CredentialIterationStartMessage *ais_msg)
 Iterate over zone to get attributes. More...
 
static void handle_credential_iteration_stop (void *cls, const struct CredentialIterationStopMessage *ais_msg)
 Handle iteration stop message from client. More...
 
static void handle_credential_iteration_next (void *cls, const struct CredentialIterationNextMessage *ais_msg)
 Client requests next credential 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(credential_store_message, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_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(credential_delete_message, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_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(credential_iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, struct CredentialIterationStartMessage, NULL), GNUNET_MQ_hd_fixed_size(credential_iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, struct CredentialIterationNextMessage, NULL), GNUNET_MQ_hd_fixed_size(credential_iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP, struct CredentialIterationStopMessage, 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 489 of file gnunet-service-reclaim.c.

References AttributeDeleteHandle::claim, AttributeDeleteHandle::credential, TicketRecordsEntry::data, AttributeDeleteHandle::existing_attributes, AttributeDeleteHandle::existing_credentials, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_zone_iteration_stop(), GNUNET_RECLAIM_attribute_list_destroy(), GNUNET_RECLAIM_credential_list_destroy(), TicketRecordsEntry::label, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_it, AttributeDeleteHandle::ns_qe, AttributeDeleteHandle::tickets_to_update_head, and AttributeDeleteHandle::tickets_to_update_tail.

Referenced by attr_delete_cont(), cleanup_client(), consistency_iter_err(), cred_delete_cont(), offending_attr_delete_cont(), and update_tickets().

490 {
491  struct TicketRecordsEntry *le;
492 
493  if (NULL != adh->ns_it)
495  if (NULL != adh->ns_qe)
497  if (NULL != adh->label)
498  GNUNET_free (adh->label);
499  if (NULL != adh->claim)
500  GNUNET_free (adh->claim);
501  if (NULL != adh->credential)
502  GNUNET_free (adh->credential);
503  if (NULL != adh->existing_credentials)
505  if (NULL != adh->existing_attributes)
507  while (NULL != (le = adh->tickets_to_update_head))
508  {
511  le);
512  if (NULL != le->label)
513  GNUNET_free (le->label);
514  if (NULL != le->data)
515  GNUNET_free (le->data);
516  GNUNET_free (le);
517  }
518  GNUNET_free (adh);
519 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
struct GNUNET_RECLAIM_AttributeList * existing_attributes
Existing attributes.
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 GNUNET_RECLAIM_Credential * credential
The credential to delete.
void GNUNET_RECLAIM_credential_list_destroy(struct GNUNET_RECLAIM_CredentialList *credentials)
Destroy claim list.
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_CredentialList * existing_credentials
Existing credentials.
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 528 of file gnunet-service-reclaim.c.

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

Referenced by attr_store_cont(), cleanup_client(), cred_error(), and cred_store_cont().

529 {
530  if (NULL != ash->ns_qe)
532  if (NULL != ash->claim)
533  GNUNET_free (ash->claim);
534  if (NULL != ash->credential)
535  GNUNET_free (ash->credential);
536  GNUNET_free (ash);
537 }
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
struct GNUNET_RECLAIM_Credential * credential
The credential to store.
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 546 of file gnunet-service-reclaim.c.

References ai, IdpClient::attr_iter_head, IdpClient::attr_iter_tail, ConsumeTicketOperation::ch, cleanup_adh(), cleanup_as_handle(), IdpClient::consume_op_head, IdpClient::consume_op_tail, IdpClient::cred_iter_head, IdpClient::cred_iter_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 client_disconnect_cb().

547 {
548  struct Iterator *ai;
549  struct TicketIteration *ti;
550  struct TicketRevocationOperation *rop;
551  struct TicketIssueOperation *iss;
552  struct ConsumeTicketOperation *ct;
553  struct AttributeStoreHandle *as;
554  struct AttributeDeleteHandle *adh;
555 
556  while (NULL != (iss = idp->issue_op_head))
557  {
559  GNUNET_free (iss);
560  }
561  while (NULL != (ct = idp->consume_op_head))
562  {
564  idp->consume_op_tail,
565  ct);
566  if (NULL != ct->ch)
568  GNUNET_free (ct);
569  }
570  while (NULL != (as = idp->store_op_head))
571  {
573  cleanup_as_handle (as);
574  }
575  while (NULL != (adh = idp->delete_op_head))
576  {
578  cleanup_adh (adh);
579  }
580 
581  while (NULL != (ai = idp->attr_iter_head))
582  {
584  GNUNET_free (ai);
585  }
586  while (NULL != (ai = idp->cred_iter_head))
587  {
589  ai);
590  GNUNET_free (ai);
591  }
592 
593  while (NULL != (rop = idp->revoke_op_head))
594  {
596  if (NULL != rop->rh)
598  GNUNET_free (rop);
599  }
600  while (NULL != (ti = idp->ticket_iter_head))
601  {
603  idp->ticket_iter_tail,
604  ti);
605  if (NULL != ti->iter)
607  GNUNET_free (ti);
608  }
609  GNUNET_free (idp);
610 }
#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 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.
struct Iterator * cred_iter_head
Head of the DLL of Credential iteration operations in progress initiated by this client.
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.
void RECLAIM_TICKETS_revoke_cancel(struct RECLAIM_TICKETS_RevokeHandle *rh)
Cancel a revocation.
struct Iterator * cred_iter_tail
Tail of the DLL of Credential iteration operations in progress initiated by this client.
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 617 of file gnunet-service-reclaim.c.

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

Referenced by do_shutdown().

618 {
619  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
620 
622  if (NULL != timeout_task)
624  if (NULL != nsh)
626 }
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
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.
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 635 of file gnunet-service-reclaim.c.

References cleanup(), GNUNET_ERROR_TYPE_INFO, and GNUNET_log.

Referenced by attr_store_cont(), cred_error(), cred_store_cont(), and run().

636 {
637  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n");
638  cleanup ();
639 }
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,
const struct GNUNET_RECLAIM_PresentationList presentations,
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 651 of file gnunet-service-reclaim.c.

References env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_RECLAIM_presentation_list_serialize(), GNUNET_RECLAIM_presentation_list_serialize_get_size(), TicketResultMessage::id, IdpClient::mq, TicketResultMessage::presentations_len, ticket, and TicketResultMessage::ticket.

Referenced by issue_ticket_result_cb().

656 {
657  struct TicketResultMessage *irm;
658  struct GNUNET_MQ_Envelope *env;
659  size_t pres_len = 0;
660 
661  if (NULL != presentations)
662  {
663  pres_len =
665  }
666  env = GNUNET_MQ_msg_extra (irm,
667  pres_len,
669  if (NULL != ticket)
670  {
671  irm->ticket = *ticket;
672  }
673  // TODO add success member
674  irm->id = htonl (r_id);
675  irm->presentations_len = htons (pres_len);
676  if (NULL != presentations)
677  {
679  (char*) &irm[1]);
680  }
681  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
682  GNUNET_MQ_send (client->mq, env);
683 }
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:473
uint32_t presentations_len
Length of new presentations created.
Definition: reclaim.h:468
struct GNUNET_MQ_Handle * mq
Message queue for transmission to client.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
#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
size_t GNUNET_RECLAIM_presentation_list_serialize_get_size(const struct GNUNET_RECLAIM_PresentationList *presentations)
Get required size for serialization buffer.
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
size_t GNUNET_RECLAIM_presentation_list_serialize(const struct GNUNET_RECLAIM_PresentationList *presentations, char *result)
Serialize a presentation list.
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,
struct GNUNET_RECLAIM_PresentationList presentations,
int32_t  success,
const char *  emsg 
)
static

Issue ticket result.

Parameters
clsout ticket issue operation handle
ticketthe issued ticket
presentationsnewly created credential presentations (NULL on error)
successissue success status (GNUNET_OK if successful)
emsgerror message (NULL of success is GNUNET_OK)

Definition at line 696 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().

701 {
702  struct TicketIssueOperation *tio = cls;
703 
704  if (GNUNET_OK != success)
705  {
706  send_ticket_result (tio->client, tio->r_id, NULL, NULL, GNUNET_SYSERR);
708  tio->client->issue_op_tail,
709  tio);
710  GNUNET_free (tio);
711  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg);
712  return;
713  }
714  send_ticket_result (tio->client, tio->r_id,
715  ticket, presentations, GNUNET_SYSERR);
717  tio->client->issue_op_tail,
718  tio);
719  GNUNET_free (tio);
720 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static void send_ticket_result(const struct IdpClient *client, uint32_t r_id, const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_RECLAIM_PresentationList *presentations, uint32_t success)
Sends a ticket result message to the client.
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,...)
#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 731 of file gnunet-service-reclaim.c.

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

732 {
733  uint16_t size;
734 
735  size = ntohs (im->header.size);
736  if (size <= sizeof(struct IssueTicketMessage))
737  {
738  GNUNET_break (0);
739  return GNUNET_SYSERR;
740  }
741  return GNUNET_OK;
742 }
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 752 of file gnunet-service-reclaim.c.

References IssueTicketMessage::attr_len, GNUNET_RECLAIM_AttributeListEntry::attribute, 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(), idp, IdpClient::issue_op_head, IdpClient::issue_op_tail, issue_ticket_result_cb(), GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_Attribute::name, GNUNET_RECLAIM_AttributeListEntry::next, TicketIssueOperation::r_id, RECLAIM_TICKETS_issue(), and tio.

753 {
754  struct TicketIssueOperation *tio;
755  struct IdpClient *idp = cls;
756  struct GNUNET_RECLAIM_AttributeList *attrs;
758  size_t attrs_len;
759 
760  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
761  tio = GNUNET_new (struct TicketIssueOperation);
762  attrs_len = ntohs (im->attr_len);
763  attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1],
764  attrs_len);
765  for (le = attrs->list_head; NULL != le; le = le->next)
767  "List entry: %s\n", le->attribute->name);
768 
769  tio->r_id = ntohl (im->id);
770  tio->client = idp;
773  attrs,
774  &im->rp,
776  tio);
779 }
static struct GNUNET_CADET_ListTunnels * tio
Active tunnel listing operation.
Definition: gnunet-cadet.c:112
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.
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attribute_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:382
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
static void issue_ticket_result_cb(void *cls, struct GNUNET_RECLAIM_Ticket *ticket, struct GNUNET_RECLAIM_PresentationList *presentations, int32_t success, const char *emsg)
Issue ticket result.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_SERVICE_Client * client
The client.
void RECLAIM_TICKETS_issue(const struct GNUNET_IDENTITY_PrivateKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_IDENTITY_PublicKey *audience, RECLAIM_TICKETS_TicketResult cb, void *cb_cls)
Issue a new reclaim ticket, thereby authorizing the audience to access the set of provided attributes...
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
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
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:2244
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
struct GNUNET_IDENTITY_PublicKey rp
Requesting party.
Definition: reclaim.h:387
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 793 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().

794 {
795  struct TicketRevocationOperation *rop = cls;
796  struct GNUNET_MQ_Envelope *env;
797  struct RevokeTicketResultMessage *trm;
798 
800  "Sending REVOKE_TICKET_RESULT message\n");
801  rop->rh = NULL;
803  trm->id = htonl (rop->r_id);
804  trm->success = htonl (success);
805  GNUNET_MQ_send (rop->client->mq, env);
807  rop->client->revoke_op_tail,
808  rop);
809  GNUNET_free (rop);
810 }
#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 821 of file gnunet-service-reclaim.c.

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

822 {
823  uint16_t size;
824 
825  size = ntohs (im->header.size);
826  if (size != sizeof(struct RevokeTicketMessage))
827  {
828  GNUNET_break (0);
829  return GNUNET_SYSERR;
830  }
831  return GNUNET_OK;
832 }
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 842 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, idp, TicketRevocationOperation::r_id, RECLAIM_TICKETS_revoke(), IdpClient::revoke_op_head, IdpClient::revoke_op_tail, revoke_result_cb(), TicketRevocationOperation::rh, and RevokeTicketMessage::ticket.

843 {
844  struct TicketRevocationOperation *rop;
845  struct IdpClient *idp = cls;
846 
847  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
848  rop = GNUNET_new (struct TicketRevocationOperation);
849  rop->r_id = ntohl (rm->id);
850  rop->client = idp;
852  rop->rh
854  rop);
856 }
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
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:415
struct TicketRevocationOperation * revoke_op_head
Head of DLL of ticket revocation ops.
Ticket revocation request handle.
#define GNUNET_log(kind,...)
struct RECLAIM_TICKETS_RevokeHandle * RECLAIM_TICKETS_revoke(const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_IDENTITY_PrivateKey *identity, RECLAIM_TICKETS_RevokeCallback cb, void *cb_cls)
Revoke a ticket.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2244
Here is the call graph for this function:

◆ consume_result_cb()

static void consume_result_cb ( void *  cls,
const struct GNUNET_IDENTITY_PublicKey identity,
const struct GNUNET_RECLAIM_AttributeList attrs,
const struct GNUNET_RECLAIM_PresentationList presentations,
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 869 of file gnunet-service-reclaim.c.

References 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_attribute_list_serialize(), GNUNET_RECLAIM_attribute_list_serialize_get_size(), GNUNET_RECLAIM_presentation_list_serialize(), GNUNET_RECLAIM_presentation_list_serialize_get_size(), ConsumeTicketResultMessage::id, identity, ConsumeTicketResultMessage::identity, IdpClient::mq, ConsumeTicketResultMessage::presentations_len, ConsumeTicketOperation::r_id, and ConsumeTicketResultMessage::result.

Referenced by handle_consume_ticket_message().

875 {
876  struct ConsumeTicketOperation *cop = cls;
877  struct ConsumeTicketResultMessage *crm;
878  struct GNUNET_MQ_Envelope *env;
879  char *data_tmp;
880  size_t attrs_len = 0;
881  size_t pres_len = 0;
882 
883  if (GNUNET_OK != success)
884  {
885  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
886  }
888  pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations);
890  "Sending CONSUME_TICKET_RESULT message\n");
891  env = GNUNET_MQ_msg_extra (crm,
892  attrs_len + pres_len,
894  crm->id = htonl (cop->r_id);
895  crm->attrs_len = htons (attrs_len);
896  crm->presentations_len = htons (pres_len);
897  crm->identity = *identity;
898  crm->result = htonl (success);
899  data_tmp = (char *) &crm[1];
900  GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp);
901  data_tmp += attrs_len;
902  GNUNET_RECLAIM_presentation_list_serialize (presentations, data_tmp);
903  GNUNET_MQ_send (cop->client->mq, env);
905  cop->client->consume_op_tail,
906  cop);
907  GNUNET_free (cop);
908 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Attribute list is returned from the idp.
Definition: reclaim.h:507
#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:517
uint32_t result
Result.
Definition: reclaim.h:522
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
struct GNUNET_IDENTITY_PublicKey identity
The public key of the identity.
Definition: reclaim.h:542
size_t GNUNET_RECLAIM_presentation_list_serialize_get_size(const struct GNUNET_RECLAIM_PresentationList *presentations)
Get required size for serialization buffer.
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.
uint16_t presentations_len
Length of presentation data.
Definition: reclaim.h:532
uint16_t attrs_len
Length of serialized attribute data.
Definition: reclaim.h:527
#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_presentation_list_serialize(const struct GNUNET_RECLAIM_PresentationList *presentations, char *result)
Serialize a presentation list.
#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 918 of file gnunet-service-reclaim.c.

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

919 {
920  uint16_t size;
921 
922  size = ntohs (cm->header.size);
923  if (size != sizeof(struct ConsumeTicketMessage))
924  {
925  GNUNET_break (0);
926  return GNUNET_SYSERR;
927  }
928  return GNUNET_OK;
929 }
Ticket consume message.
Definition: reclaim.h:481
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:486

◆ 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 939 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, idp, ConsumeTicketOperation::r_id, RECLAIM_TICKETS_consume(), and ConsumeTicketMessage::ticket.

940 {
941  struct ConsumeTicketOperation *cop;
942  struct IdpClient *idp = cls;
943 
944  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
945  cop = GNUNET_new (struct ConsumeTicketOperation);
946  cop->r_id = ntohl (cm->id);
947  cop->client = idp;
948  cop->ch
950  cop);
953 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:496
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.
static void consume_result_cb(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_AttributeList *attrs, const struct GNUNET_RECLAIM_PresentationList *presentations, int32_t success, const char *emsg)
Handle a ticket consume result.
struct GNUNET_SERVICE_Client * client
The client.
struct RECLAIM_TICKETS_ConsumeHandle * RECLAIM_TICKETS_consume(const struct GNUNET_IDENTITY_PrivateKey *id, const struct GNUNET_RECLAIM_Ticket *ticket, RECLAIM_TICKETS_ConsumeCallback cb, void *cb_cls)
Consume a ticket.
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:501
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
struct ConsumeTicketOperation * consume_op_tail
Tail of DLL of ticket consume ops.
#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:2244
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:491
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 969 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().

970 {
971  struct AttributeStoreHandle *ash = cls;
972  struct GNUNET_MQ_Envelope *env;
973  struct SuccessResultMessage *acr_msg;
974 
975  ash->ns_qe = NULL;
977  ash->client->store_op_tail,
978  ash);
979 
980  if (GNUNET_SYSERR == success)
981  {
983  "Failed to store attribute %s\n",
984  emsg);
985  cleanup_as_handle (ash);
987  return;
988  }
989 
990  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
992  acr_msg->id = htonl (ash->r_id);
993  acr_msg->op_result = htonl (GNUNET_OK);
994  GNUNET_MQ_send (ash->client->mq, env);
995  cleanup_as_handle (ash);
996 }
#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 1005 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().

1006 {
1007  struct AttributeStoreHandle *ash = cls;
1008  struct GNUNET_GNSRECORD_Data rd[1];
1009  char *buf;
1010  char *label;
1011  size_t buf_size;
1012 
1013  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
1015  buf = GNUNET_malloc (buf_size);
1016  // Give the ash a new id if unset
1017  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->claim->id))
1020  label
1022  sizeof (ash->claim->id));
1023  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1024 
1025  rd[0].data_size = buf_size;
1026  rd[0].data = buf;
1027  rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE;
1029  rd[0].expiration_time = ash->exp.rel_value_us;
1031  &ash->identity,
1032  label,
1033  1,
1034  rd,
1035  &attr_store_cont,
1036  ash);
1037  GNUNET_free (buf);
1038  GNUNET_free (label);
1039 }
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.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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.
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_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).
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
#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:937
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 1049 of file gnunet-service-reclaim.c.

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

1051 {
1052  uint16_t size;
1053 
1054  size = ntohs (sam->header.size);
1055  if (size <= sizeof(struct AttributeStoreMessage))
1056  {
1057  GNUNET_break (0);
1058  return GNUNET_SYSERR;
1059  }
1060  return GNUNET_OK;
1061 }
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 1071 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_ERROR_TYPE_DEBUG, GNUNET_IDENTITY_key_get_public(), GNUNET_log, GNUNET_new, GNUNET_ntohll(), GNUNET_RECLAIM_attribute_deserialize(), GNUNET_SCHEDULER_add_now(), GNUNET_SERVICE_client_continue(), AttributeStoreHandle::identity, AttributeStoreHandle::identity_pkey, idp, AttributeStoreHandle::r_id, GNUNET_TIME_Relative::rel_value_us, IdpClient::store_op_head, and IdpClient::store_op_tail.

1073 {
1074  struct AttributeStoreHandle *ash;
1075  struct IdpClient *idp = cls;
1076  size_t data_len;
1077 
1078  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
1079 
1080  data_len = ntohs (sam->attr_len);
1081 
1082  ash = GNUNET_new (struct AttributeStoreHandle);
1083  GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1],
1084  data_len,
1085  &ash->claim);
1086 
1087  ash->r_id = ntohl (sam->id);
1088  ash->identity = sam->identity;
1089  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1091 
1093  ash->client = idp;
1096 }
ssize_t GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size, struct GNUNET_RECLAIM_Attribute **attr)
Deserialize an attribute.
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_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
struct GNUNET_IDENTITY_PublicKey identity_pkey
Identity pubkey.
Handle for attribute store request.
struct AttributeStoreHandle * store_op_tail
Tail of DLL of attribute store ops.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: identity_api.c:175
struct IdpClient * client
Client connection.
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:55
uint64_t exp
The expiration interval of the attribute.
Definition: reclaim.h:60
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
#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:2244
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
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:65
Here is the call graph for this function:

◆ cred_store_cont()

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

Credential store result handler.

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

Definition at line 1107 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 cred_add_cb().

1108 {
1109  struct AttributeStoreHandle *ash = cls;
1110  struct GNUNET_MQ_Envelope *env;
1111  struct SuccessResultMessage *acr_msg;
1112 
1113  ash->ns_qe = NULL;
1115  ash->client->store_op_tail,
1116  ash);
1117 
1118  if (GNUNET_SYSERR == success)
1119  {
1121  "Failed to store credential: %s\n",
1122  emsg);
1123  cleanup_as_handle (ash);
1125  return;
1126  }
1127 
1128  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1130  acr_msg->id = htonl (ash->r_id);
1131  acr_msg->op_result = htonl (GNUNET_OK);
1132  GNUNET_MQ_send (ash->client->mq, env);
1133  cleanup_as_handle (ash);
1134 }
#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:

◆ cred_error()

static void cred_error ( void *  cls)
static

Error looking up potential credential.

Abort.

Parameters
clsour attribute store handle

Definition at line 1143 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 cred_store_task().

1144 {
1145  struct AttributeStoreHandle *ash = cls;
1147  "Failed to check for existing credential.\n");
1148  cleanup_as_handle (ash);
1150  return;
1151 }
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:

◆ cred_add_cb()

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

Check for existing record before storing credential.

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

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

References buf, cred_store_cont(), AttributeStoreHandle::credential, 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_CREDENTIAL, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_records_store(), GNUNET_RECLAIM_credential_serialize(), GNUNET_RECLAIM_credential_serialize_get_size(), AttributeStoreHandle::identity, AttributeStoreHandle::ns_qe, GNUNET_GNSRECORD_Data::record_type, and GNUNET_TIME_Relative::rel_value_us.

Referenced by cred_store_task().

1169 {
1170  struct AttributeStoreHandle *ash = cls;
1171  struct GNUNET_GNSRECORD_Data rd_new[1];
1172  char *buf;
1173  size_t buf_size;
1174 
1176  buf = GNUNET_malloc (buf_size);
1179  "Storing new credential under `%s'.\n",
1180  label);
1181  rd_new[0].data_size = buf_size;
1182  rd_new[0].data = buf;
1183  rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL;
1184  rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1185  rd_new[0].expiration_time = ash->exp.rel_value_us;
1187  &ash->identity,
1188  label,
1189  1,
1190  rd_new,
1191  &cred_store_cont,
1192  ash);
1193  GNUNET_free (buf);
1194  return;
1195 }
static void cred_store_cont(void *cls, int32_t success, const char *emsg)
Credential store result handler.
uint64_t rel_value_us
The actual value.
size_t GNUNET_RECLAIM_credential_serialize_get_size(const struct GNUNET_RECLAIM_Credential *credential)
Get required size for serialization buffer.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL
Record type for an attribute attestation.
struct GNUNET_RECLAIM_Credential * credential
The credential to store.
struct GNUNET_TIME_Relative exp
The attribute expiration interval.
Handle for attribute store request.
static char buf[2048]
size_t GNUNET_RECLAIM_credential_serialize(const struct GNUNET_RECLAIM_Credential *credential, char *result)
Serialize an credential.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
#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:

◆ cred_store_task()

static void cred_store_task ( void *  cls)
static

Add a new credential.

Parameters
clsthe AttributeStoreHandle

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

References cred_add_cb(), cred_error(), AttributeStoreHandle::credential, 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_Credential::id, AttributeStoreHandle::identity, and AttributeStoreHandle::ns_qe.

Referenced by handle_credential_store_message().

1205 {
1206  struct AttributeStoreHandle *ash = cls;
1207  char *label;
1208 
1209  // Give the ash a new id if unset
1213  sizeof (ash->credential->id));
1215  "Looking up existing data under label `%s'\n", label);
1217  &ash->identity,
1218  label,
1219  &cred_error,
1220  ash,
1221  &cred_add_cb,
1222  ash);
1223  GNUNET_free (label);
1224 }
static void cred_error(void *cls)
Error looking up potential credential.
struct GNUNET_RECLAIM_Identifier id
ID.
struct GNUNET_RECLAIM_Credential * credential
The credential to store.
Handle for attribute store request.
static void cred_add_cb(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Check for existing record before storing credential.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls)
Lookup an item in the namestore.
#define GNUNET_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:937
#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_credential_store_message()

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

Check an credential store message.

Parameters
clsunused
samthe message to check

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

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

1236 {
1237  uint16_t size;
1238 
1239  size = ntohs (sam->header.size);
1240  if (size <= sizeof(struct AttributeStoreMessage))
1241  {
1242  GNUNET_break (0);
1243  return GNUNET_SYSERR;
1244  }
1245  return GNUNET_OK;
1246 }
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_credential_store_message()

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

Handle a credential store message.

Parameters
clsour client
samthe message to handle

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

References AttributeStoreMessage::attr_len, IdpClient::client, AttributeStoreHandle::client, cred_store_task(), AttributeStoreHandle::credential, AttributeStoreHandle::exp, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_IDENTITY_key_get_public(), GNUNET_log, GNUNET_new, GNUNET_ntohll(), GNUNET_RECLAIM_credential_deserialize(), GNUNET_SCHEDULER_add_now(), GNUNET_SERVICE_client_continue(), AttributeStoreHandle::identity, AttributeStoreHandle::identity_pkey, idp, AttributeStoreHandle::r_id, GNUNET_TIME_Relative::rel_value_us, IdpClient::store_op_head, and IdpClient::store_op_tail.

1258 {
1259  struct AttributeStoreHandle *ash;
1260  struct IdpClient *idp = cls;
1261  size_t data_len;
1262 
1263  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n");
1264 
1265  data_len = ntohs (sam->attr_len);
1266 
1267  ash = GNUNET_new (struct AttributeStoreHandle);
1268  ash->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &sam[1],
1269  data_len);
1270 
1271  ash->r_id = ntohl (sam->id);
1272  ash->identity = sam->identity;
1273  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1275 
1277  ash->client = idp;
1280 }
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_deserialize(const char *data, size_t data_size)
Deserialize an credential.
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.
static void cred_store_task(void *cls)
Add a new credential.
#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.
struct GNUNET_RECLAIM_Credential * credential
The credential to store.
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
struct GNUNET_IDENTITY_PublicKey identity_pkey
Identity pubkey.
Handle for attribute store request.
struct AttributeStoreHandle * store_op_tail
Tail of DLL of attribute store ops.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: identity_api.c:175
struct IdpClient * client
Client connection.
uint32_t attr_len
The length of the attribute.
Definition: reclaim.h:55
uint64_t exp
The expiration interval of the attribute.
Definition: reclaim.h:60
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
#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:2244
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
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:65
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 1290 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 attr_delete_cont(), consistency_iter_err(), cred_delete_cont(), offending_attr_delete_cont(), and update_tickets().

1291 {
1292  struct GNUNET_MQ_Envelope *env;
1293  struct SuccessResultMessage *acr_msg;
1294 
1296  adh->client->delete_op_tail,
1297  adh);
1298 
1299  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1301  acr_msg->id = htonl (adh->r_id);
1302  acr_msg->op_result = htonl (success);
1303  GNUNET_MQ_send (adh->client->mq, env);
1304 }
#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:

◆ consistency_iter()

static void consistency_iter ( void *  cls,
const struct GNUNET_IDENTITY_PrivateKey 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 1318 of file gnunet-service-reclaim.c.

References GNUNET_RECLAIM_AttributeListEntry::attribute, GNUNET_RECLAIM_CredentialListEntry::credential, TicketRecordsEntry::data, data, TicketRecordsEntry::data_size, data_size, AttributeDeleteHandle::existing_attributes, AttributeDeleteHandle::existing_credentials, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE, GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_log, GNUNET_malloc, GNUNET_NAMESTORE_zone_iterator_next(), GNUNET_new, GNUNET_NO, GNUNET_RECLAIM_attribute_deserialize(), GNUNET_RECLAIM_credential_deserialize(), GNUNET_strdup, GNUNET_YES, TicketRecordsEntry::label, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_CredentialList::list_head, GNUNET_RECLAIM_AttributeList::list_tail, GNUNET_RECLAIM_CredentialList::list_tail, AttributeDeleteHandle::ns_it, TicketRecordsEntry::rd_count, AttributeDeleteHandle::tickets_to_update_head, AttributeDeleteHandle::tickets_to_update_tail, and update_tickets().

Referenced by start_consistency_update().

1323 {
1324  struct AttributeDeleteHandle *adh = cls;
1325  struct TicketRecordsEntry *le;
1328  int is_ticket = GNUNET_NO;
1329  for (int i = 0; i < rd_count; i++)
1330  {
1331  switch (rd[i].record_type) {
1335  rd[i].data_size,
1336  &ale->attribute);
1339  ale);
1340  break;
1344  rd[i].data_size);
1347  cle);
1348  break;
1351  "Ticket to delete found (%s)\n",
1352  label);
1353  is_ticket = GNUNET_YES;
1354  break;
1355  default:
1356  break;
1357  }
1358  if (GNUNET_YES == is_ticket)
1359  break;
1360  }
1361  if (GNUNET_YES == is_ticket)
1362  {
1363  le = GNUNET_new (struct TicketRecordsEntry);
1364  le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
1365  le->data = GNUNET_malloc (le->data_size);
1366  le->rd_count = rd_count;
1367  le->label = GNUNET_strdup (label);
1368  GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
1371  le);
1372  }
1374 }
Handle for attribute deletion request.
ssize_t GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size, struct GNUNET_RECLAIM_Attribute **attr)
Deserialize an attribute.
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 GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_deserialize(const char *data, size_t data_size)
Deserialize an credential.
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.
struct GNUNET_RECLAIM_Credential * credential
The credential.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
struct GNUNET_RECLAIM_CredentialListEntry * list_tail
List tail.
struct GNUNET_RECLAIM_AttributeList * existing_attributes
Existing attributes.
#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_.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL
Record type for an attribute attestation.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
unsigned int rd_count
Record count.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE
Record type for identity attributes (of RECLAIM).
struct GNUNET_RECLAIM_CredentialListEntry * list_head
List head.
struct GNUNET_RECLAIM_CredentialList * existing_credentials
Existing credentials.
#define GNUNET_log(kind,...)
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
Record type for local ticket references.
uint32_t data
The data value.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#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 1410 of file gnunet-service-reclaim.c.

References GNUNET_RECLAIM_AttributeListEntry::attribute, cleanup_adh(), GNUNET_RECLAIM_CredentialListEntry::credential, GNUNET_RECLAIM_Presentation::credential_id, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, AttributeDeleteHandle::existing_attributes, AttributeDeleteHandle::existing_credentials, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_records_deserialize(), GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION, GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET, GNUNET_log, GNUNET_NAMESTORE_records_store(), GNUNET_OK, GNUNET_RECLAIM_id_is_equal, GNUNET_RECLAIM_presentation_deserialize(), GNUNET_SYSERR, GNUNET_YES, GNUNET_RECLAIM_Attribute::id, GNUNET_RECLAIM_Credential::id, AttributeDeleteHandle::identity, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_CredentialList::list_head, GNUNET_RECLAIM_Attribute::name, GNUNET_RECLAIM_Credential::name, GNUNET_RECLAIM_AttributeListEntry::next, GNUNET_RECLAIM_CredentialListEntry::next, AttributeDeleteHandle::ns_qe, purge_attributes(), send_delete_response(), ticket_updated(), AttributeDeleteHandle::tickets_to_update_head, and AttributeDeleteHandle::tickets_to_update_tail.

Referenced by consistency_iter(), purge_attributes(), and ticket_updated().

1411 {
1412  struct AttributeDeleteHandle *adh = cls;
1413  struct TicketRecordsEntry *le;
1414 
1415  if (NULL == adh->tickets_to_update_head)
1416  {
1418  "Finished updating tickets, success\n");
1420  cleanup_adh (adh);
1421  return;
1422  }
1423  le = adh->tickets_to_update_head;
1426  le);
1427  struct GNUNET_GNSRECORD_Data rd[le->rd_count];
1428  struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1];
1430  le->data,
1431  le->rd_count,
1432  rd))
1433  {
1435  "Unable to deserialize record data!\n");
1437  cleanup_adh (adh);
1438  return;
1439  }
1440  int j = 0;
1441  int i = 0;
1444  struct GNUNET_RECLAIM_Presentation *presentation;
1445  for (i = 0; i < le->rd_count; i++)
1446  {
1447  switch (rd[i].record_type) {
1449  for (ale = adh->existing_attributes->list_head; NULL != ale; ale = ale->next) {
1451  &ale->attribute->id)) {
1453  "Found attribute %s, readding...\n",
1454  ale->attribute->name);
1455  rd_new[j] = rd[i];
1456  j++;
1457  break; //Found and added
1458  }
1459  }
1460  break;
1462  presentation = GNUNET_RECLAIM_presentation_deserialize (rd[i].data,
1463  rd[i].data_size);
1464  for (cle = adh->existing_credentials->list_head; NULL != cle; cle = cle->next) {
1465  if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&presentation->credential_id,
1466  &cle->credential->id)) {
1468  "Found presentation for credential %s, readding...\n",
1469  cle->credential->name);
1470  rd_new[j] = rd[i];
1471  j++;
1472  break; //Found and added
1473  }
1474  }
1475  GNUNET_free (presentation);
1476  break;
1478  rd_new[j] = rd[i];
1479  j++;
1480  break; //Found and added
1481  default:
1482  GNUNET_break (0);
1483  }
1484  }
1486  "Updating ticket with %d entries (%d before)...\n",
1487  j, i);
1489  &adh->identity,
1490  le->label,
1491  j,
1492  rd_new,
1493  &ticket_updated,
1494  adh);
1495  GNUNET_free (le->label);
1496  GNUNET_free (le->data);
1497  GNUNET_free (le);
1498 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle for attribute deletion request.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
struct GNUNET_RECLAIM_Identifier id
ID.
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_Credential * credential
The credential.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
struct GNUNET_RECLAIM_AttributeList * existing_attributes
Existing attributes.
struct GNUNET_RECLAIM_CredentialListEntry * next
DLL.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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_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.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
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 credential_id
The credential id of which this is a presentation.
struct GNUNET_RECLAIM_Identifier id
ID.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION
Record type for a presentation of a credential (used in a ticket record set)
A credential presentation.
struct GNUNET_RECLAIM_CredentialListEntry * list_head
List head.
const char * name
The name of the credential.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_deserialize(const char *data, size_t data_size)
Deserialize a presentation.
static void ticket_updated(void *cls, int32_t success, const char *emsg)
Callback called when a ticket was updated.
#define GNUNET_RECLAIM_id_is_equal(a, b)
struct GNUNET_RECLAIM_CredentialList * existing_credentials
Existing credentials.
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET
Record type for local ticket references.
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
uint32_t data
The data value.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#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 1393 of file gnunet-service-reclaim.c.

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

Referenced by update_tickets().

1394 {
1395  struct AttributeDeleteHandle *adh = cls;
1396 
1397  adh->ns_qe = NULL;
1399 }
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:

◆ purge_attributes()

static void purge_attributes ( void *  cls)
static

Delete all attributes which reference credentials that no longer exist.

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

References GNUNET_RECLAIM_AttributeListEntry::attribute, GNUNET_RECLAIM_Attribute::credential, GNUNET_RECLAIM_CredentialListEntry::credential, AttributeDeleteHandle::existing_attributes, AttributeDeleteHandle::existing_credentials, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_NAMESTORE_records_store(), GNUNET_RECLAIM_id_is_equal, GNUNET_RECLAIM_id_is_zero, GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_YES, GNUNET_RECLAIM_Attribute::id, GNUNET_RECLAIM_Credential::id, AttributeDeleteHandle::identity, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_CredentialList::list_head, GNUNET_RECLAIM_AttributeList::list_tail, GNUNET_RECLAIM_AttributeListEntry::next, GNUNET_RECLAIM_CredentialListEntry::next, AttributeDeleteHandle::ns_qe, offending_attr_delete_cont(), and update_tickets().

Referenced by consistency_iter_fin(), offending_attr_delete_cont(), and update_tickets().

1534 {
1535  struct AttributeDeleteHandle *adh = cls;
1538 
1539  for (ale = adh->existing_attributes->list_head; NULL != ale; ale = ale->next)
1540  {
1541  if (GNUNET_YES ==
1543  continue;
1544 
1545  for (cle = adh->existing_credentials->list_head;
1546  NULL != cle; cle = cle->next) {
1547  if (GNUNET_YES !=
1549  &ale->attribute->credential))
1550  continue;
1551  break;
1552  }
1553  if (NULL == cle) {
1555  "Found attribute with missing credential\n");
1556  break;
1557  }
1558  }
1559  if (NULL == ale) {
1561  "Attributes consistent, updating tickets.\n");
1563  return;
1564  }
1566  "Attributes inconsistent, deleting offending attribute.\n");
1567  char *label
1569  sizeof(ale->attribute->id));
1570 
1572  &adh->identity,
1573  label,
1574  0,
1575  NULL,
1577  adh);
1580  ale);
1581  GNUNET_free (ale);
1582  GNUNET_free (label);
1583 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle for attribute deletion request.
static void update_tickets(void *cls)
Recursion prototype for function.
struct GNUNET_RECLAIM_Identifier id
ID.
struct GNUNET_RECLAIM_Credential * credential
The credential.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
struct GNUNET_RECLAIM_AttributeList * existing_attributes
Existing attributes.
struct GNUNET_RECLAIM_CredentialListEntry * next
DLL.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
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
struct GNUNET_RECLAIM_Identifier id
ID.
struct GNUNET_RECLAIM_CredentialListEntry * list_head
List head.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
#define GNUNET_RECLAIM_id_is_equal(a, b)
struct GNUNET_RECLAIM_CredentialList * existing_credentials
Existing credentials.
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
static void offending_attr_delete_cont(void *cls, int32_t success, const char *emsg)
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:937
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#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:

◆ offending_attr_delete_cont()

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

Definition at line 1508 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, purge_attributes(), and send_delete_response().

Referenced by purge_attributes().

1509 {
1510  struct AttributeDeleteHandle *adh = cls;
1511 
1512  adh->ns_qe = NULL;
1513  if (GNUNET_SYSERR == success)
1514  {
1516  "Error deleting attribute %s\n",
1517  adh->label);
1519  cleanup_adh (adh);
1520  return;
1521  }
1522  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Continuing consistency check...\n");
1524 }
Handle for attribute deletion request.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
static void purge_attributes(void *cls)
Delete all attributes which reference credentials that no longer exist.
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
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:

◆ consistency_iter_fin()

static void consistency_iter_fin ( void *  cls)
static

Done collecting affected tickets, start updating.

Parameters
clsour attribute deletion handle

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

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

Referenced by start_consistency_update().

1592 {
1593  struct AttributeDeleteHandle *adh = cls;
1594  adh->ns_it = NULL;
1596 }
Handle for attribute deletion request.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
static void purge_attributes(void *cls)
Delete all attributes which reference credentials that no longer exist.
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:

◆ consistency_iter_err()

static void consistency_iter_err ( void *  cls)
static

Error collecting affected tickets.

Abort.

Parameters
clsour attribute deletion handle

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

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

Referenced by start_consistency_update().

1606 {
1607  struct AttributeDeleteHandle *adh = cls;
1608 
1609  adh->ns_it = NULL;
1611  "Namestore error on consistency check\n");
1613  cleanup_adh (adh);
1614 }
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.
#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_consistency_update()

static void start_consistency_update ( void *  cls)
static

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

Parameters
clsattribute deletion handle

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

References consistency_iter(), consistency_iter_err(), consistency_iter_fin(), AttributeDeleteHandle::existing_attributes, AttributeDeleteHandle::existing_credentials, GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_new, AttributeDeleteHandle::identity, and AttributeDeleteHandle::ns_it.

Referenced by attr_delete_cont(), and cred_delete_cont().

1625 {
1626  struct AttributeDeleteHandle *adh = cls;
1627 
1630 
1632  &adh->identity,
1634  adh,
1636  adh,
1638  adh);
1639 }
Handle for attribute deletion request.
static void consistency_iter_fin(void *cls)
Done collecting affected tickets, start updating.
static void consistency_iter_err(void *cls)
Error collecting affected tickets.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
struct GNUNET_RECLAIM_AttributeList * existing_attributes
Existing attributes.
A list of GNUNET_RECLAIM_Attribute structures.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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 consistency_iter(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Namestore iteration within attribute deletion.
A list of GNUNET_RECLAIM_Credential structures.
struct GNUNET_RECLAIM_CredentialList * existing_credentials
Existing credentials.
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
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 1650 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_consistency_update().

Referenced by handle_attribute_delete_message().

1651 {
1652  struct AttributeDeleteHandle *adh = cls;
1653 
1654  adh->ns_qe = NULL;
1655  if (GNUNET_SYSERR == success)
1656  {
1658  "Error deleting attribute %s\n",
1659  adh->label);
1661  cleanup_adh (adh);
1662  return;
1663  }
1664  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1666 }
Handle for attribute deletion request.
static void start_consistency_update(void *cls)
Start processing tickets which may still contain reference to deleted attribute.
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
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 1676 of file gnunet-service-reclaim.c.

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

1678 {
1679  uint16_t size;
1680 
1681  size = ntohs (dam->header.size);
1682  if (size <= sizeof(struct AttributeDeleteMessage))
1683  {
1684  GNUNET_break (0);
1685  return GNUNET_SYSERR;
1686  }
1687  return GNUNET_OK;
1688 }
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 1698 of file gnunet-service-reclaim.c.

References attr_delete_cont(), AttributeDeleteMessage::attr_len, AttributeDeleteHandle::claim, IdpClient::client, AttributeDeleteHandle::client, AttributeDeleteHandle::credential, 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, idp, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_qe, and AttributeDeleteHandle::r_id.

1700 {
1701  struct AttributeDeleteHandle *adh;
1702  struct IdpClient *idp = cls;
1703  size_t data_len;
1704 
1705  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n");
1706 
1707  data_len = ntohs (dam->attr_len);
1708 
1709  adh = GNUNET_new (struct AttributeDeleteHandle);
1710  GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1],
1711  data_len,
1712  &adh->claim);
1713  adh->credential = NULL;
1714 
1715  adh->r_id = ntohl (dam->id);
1716  adh->identity = dam->identity;
1717  adh->label
1719  sizeof(adh->claim->id));
1721  adh->client = idp;
1724  &adh->identity,
1725  adh->label,
1726  0,
1727  NULL,
1729  adh);
1730 }
Handle for attribute deletion request.
ssize_t GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size, struct GNUNET_RECLAIM_Attribute **attr)
Deserialize an attribute.
static void attr_delete_cont(void *cls, int32_t success, const char *emsg)
Attribute deleted callback.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp client.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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.
#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_RECLAIM_Credential * credential
The credential to delete.
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
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
struct IdpClient * client
Client connection.
struct AttributeDeleteHandle * delete_op_head
Head of DLL of attribute delete ops.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:94
#define GNUNET_log(kind,...)
struct AttributeDeleteHandle * delete_op_tail
Tail of DLL of attribute delete ops.
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:937
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:2244
Here is the call graph for this function:

◆ cred_delete_cont()

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

Credential deleted callback.

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

Definition at line 1741 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_consistency_update().

Referenced by handle_credential_delete_message().

1742 {
1743  struct AttributeDeleteHandle *adh = cls;
1744 
1745  adh->ns_qe = NULL;
1746  if (GNUNET_SYSERR == success)
1747  {
1749  "Error deleting credential `%s'\n",
1750  adh->label);
1752  cleanup_adh (adh);
1753  return;
1754  }
1755  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1757 }
Handle for attribute deletion request.
static void start_consistency_update(void *cls)
Start processing tickets which may still contain reference to deleted attribute.
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
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_credential_delete_message()

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

Check credential delete message format.

unused message to check

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

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

1769 {
1770  uint16_t size;
1771 
1772  size = ntohs (dam->header.size);
1773  if (size <= sizeof(struct AttributeDeleteMessage))
1774  {
1775  GNUNET_break (0);
1776  return GNUNET_SYSERR;
1777  }
1778  return GNUNET_OK;
1779 }
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_credential_delete_message()

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

Handle credential deletion.

Parameters
clsour client
damdeletion message

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

References AttributeDeleteMessage::attr_len, AttributeDeleteHandle::claim, IdpClient::client, AttributeDeleteHandle::client, cred_delete_cont(), AttributeDeleteHandle::credential, 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_credential_deserialize(), GNUNET_SERVICE_client_continue(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_Credential::id, AttributeDeleteHandle::identity, idp, AttributeDeleteHandle::label, AttributeDeleteHandle::ns_qe, and AttributeDeleteHandle::r_id.

1791 {
1792  struct AttributeDeleteHandle *adh;
1793  struct IdpClient *idp = cls;
1794  size_t data_len;
1795 
1796  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n");
1797 
1798  data_len = ntohs (dam->attr_len);
1799 
1800  adh = GNUNET_new (struct AttributeDeleteHandle);
1801  adh->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &dam[1],
1802  data_len);
1803  adh->claim = NULL;
1804 
1805  adh->r_id = ntohl (dam->id);
1806  adh->identity = dam->identity;
1807  adh->label
1809  sizeof(adh->credential->id));
1811  adh->client = idp;
1814  &adh->identity,
1815  adh->label,
1816  0,
1817  NULL,
1819  adh);
1820 }
Handle for attribute deletion request.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_deserialize(const char *data, size_t data_size)
Deserialize an credential.
struct GNUNET_RECLAIM_Identifier id
ID.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp client.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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.
#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_RECLAIM_Credential * credential
The credential to delete.
char * label
Attribute label.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:84
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
struct IdpClient * client
Client connection.
struct AttributeDeleteHandle * delete_op_head
Head of DLL of attribute delete ops.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:94
#define GNUNET_log(kind,...)
struct AttributeDeleteHandle * delete_op_tail
Tail of DLL of attribute delete ops.
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:937
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
static void cred_delete_cont(void *cls, int32_t success, const char *emsg)
Credential deleted callback.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2244
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 1834 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().

1835 {
1836  struct Iterator *ai = cls;
1837  struct GNUNET_MQ_Envelope *env;
1838  struct AttributeResultMessage *arm;
1839 
1840  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
1842  arm->id = htonl (ai->request_id);
1843  arm->attr_len = htons (0);
1844  GNUNET_MQ_send (ai->client->mq, env);
1846  ai->client->attr_iter_tail,
1847  ai);
1848  GNUNET_free (ai);
1849 }
#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 1858 of file gnunet-service-reclaim.c.

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

Referenced by handle_iteration_start().

1859 {
1860  struct Iterator *ai = cls;
1861 
1862  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1863  attr_iter_finished (ai);
1864 }
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_IDENTITY_PrivateKey zone,
const char *  label,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Got record.

Return if it is an attribute.

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

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

References ai, AttributeResultMessage::attr_len, Iterator::client, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE, GNUNET_IDENTITY_key_get_public(), 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().

1882 {
1883  struct Iterator *ai = cls;
1884  struct GNUNET_MQ_Envelope *env;
1885  char *data_tmp;
1886 
1887  if ((rd_count != 1) ||
1889  {
1891  return;
1892  }
1893  struct AttributeResultMessage *arm;
1894  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
1895  label);
1897  "Sending ATTRIBUTE_RESULT message\n");
1898  env = GNUNET_MQ_msg_extra (arm,
1899  rd->data_size,
1901  arm->id = htonl (ai->request_id);
1902  arm->attr_len = htons (rd->data_size);
1904  data_tmp = (char *) &arm[1];
1905  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1906  GNUNET_MQ_send (ai->client->mq, env);
1907 }
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.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: identity_api.c:175
#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.
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,...)
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 GNUNET_IDENTITY_PublicKey identity
The public key of the identity.
Definition: reclaim.h:154
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 1917 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, idp, Iterator::ns_it, and Iterator::request_id.

1919 {
1920  struct IdpClient *idp = cls;
1921  struct Iterator *ai;
1922 
1924  "Received ATTRIBUTE_ITERATION_START message\n");
1925  ai = GNUNET_new (struct Iterator);
1926  ai->request_id = ntohl (ais_msg->id);
1927  ai->client = idp;
1928  ai->identity = ais_msg->identity;
1929 
1932  &ai->identity,
1933  &attr_iter_error,
1934  ai,
1935  &attr_iter_cb,
1936  ai,
1938  ai);
1940 }
struct GNUNET_IDENTITY_PrivateKey identity
Key of the zone we are iterating over.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp client.
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_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:215
static void attr_iter_cb(void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Got record.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:210
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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
Namestore iterator.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
#define GNUNET_log(kind,...)
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:2244
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 1950 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, idp, Iterator::next, and Iterator::request_id.

1952 {
1953  struct IdpClient *idp = cls;
1954  struct Iterator *ai;
1955  uint32_t rid;
1956 
1958  "Received `%s' message\n",
1959  "ATTRIBUTE_ITERATION_STOP");
1960  rid = ntohl (ais_msg->id);
1961  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1962  if (ai->request_id == rid)
1963  break;
1964  if (NULL == ai)
1965  {
1966  GNUNET_break (0);
1968  return;
1969  }
1971  GNUNET_free (ai);
1973 }
#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:2325
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
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:2244
#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 1983 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, idp, Iterator::next, Iterator::ns_it, and Iterator::request_id.

1985 {
1986  struct IdpClient *idp = cls;
1987  struct Iterator *ai;
1988  uint32_t rid;
1989 
1991  "Received ATTRIBUTE_ITERATION_NEXT message\n");
1992  rid = ntohl (ais_msg->id);
1993  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1994  if (ai->request_id == rid)
1995  break;
1996  if (NULL == ai)
1997  {
1998  GNUNET_break (0);
2000  return;
2001  }
2004 }
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:2325
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
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:2244
Here is the call graph for this function:

◆ cred_iter_finished()

static void cred_iter_finished ( void *  cls)
static

Done iterating over credentials.

Parameters
clsour iterator handle

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

References ai, Iterator::client, IdpClient::cred_iter_head, IdpClient::cred_iter_tail, CredentialResultMessage::credential_len, env, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), CredentialResultMessage::id, IdpClient::mq, and Iterator::request_id.

Referenced by cred_iter_error(), and handle_credential_iteration_start().

2019 {
2020  struct Iterator *ai = cls;
2021  struct GNUNET_MQ_Envelope *env;
2022  struct CredentialResultMessage *arm;
2023 
2024  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n");
2026  arm->id = htonl (ai->request_id);
2027  arm->credential_len = htons (0);
2028  GNUNET_MQ_send (ai->client->mq, env);
2030  ai->client->cred_iter_tail,
2031  ai);
2032  GNUNET_free (ai);
2033 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
uint16_t credential_len
Length of serialized attribute data.
Definition: reclaim.h:179
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT
An attribute iteration operation.
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.
struct Iterator * cred_iter_head
Head of the DLL of Credential iteration operations in progress initiated by this client.
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 * cred_iter_tail
Tail of the DLL of Credential 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
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
Credential is returned from the idp.
Definition: reclaim.h:164
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cred_iter_error()

static void cred_iter_error ( void *  cls)
static

Error iterating over credentials.

Abort.

Parameters
clsour attribute iteration handle

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

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

Referenced by handle_credential_iteration_start().

2043 {
2044  struct Iterator *ai = cls;
2045 
2046  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over credentials\n");
2047  cred_iter_finished (ai);
2048 }
An attribute iteration operation.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
#define GNUNET_log(kind,...)
static void cred_iter_finished(void *cls)
Done iterating over credentials.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cred_iter_cb()

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

Got record.

Return credential.

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

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

References ai, Iterator::client, CredentialResultMessage::credential_len, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL, GNUNET_IDENTITY_key_get_public(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NAMESTORE_zone_iterator_next(), CredentialResultMessage::id, CredentialResultMessage::identity, IdpClient::mq, Iterator::ns_it, GNUNET_GNSRECORD_Data::record_type, and Iterator::request_id.

Referenced by handle_credential_iteration_start().

2066 {
2067  struct Iterator *ai = cls;
2068  struct GNUNET_MQ_Envelope *env;
2069  struct CredentialResultMessage *arm;
2070  char *data_tmp;
2071 
2072  if ((rd_count != 1) ||
2074  {
2076  return;
2077  }
2078  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found credential under: %s\n",
2079  label);
2081  "Sending CREDENTIAL_RESULT message\n");
2082  env = GNUNET_MQ_msg_extra (arm,
2083  rd->data_size,
2085  arm->id = htonl (ai->request_id);
2086  arm->credential_len = htons (rd->data_size);
2088  data_tmp = (char *) &arm[1];
2089  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
2090 
2091  GNUNET_MQ_send (ai->client->mq, env);
2092 }
uint16_t credential_len
Length of serialized attribute data.
Definition: reclaim.h:179
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT
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...
#define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL
Record type for an attribute attestation.
struct IdpClient * client
IDP client which intiated this zone iteration.
struct GNUNET_IDENTITY_PublicKey identity
The public key of the identity.
Definition: reclaim.h:189
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.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: identity_api.c:175
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Namestore iterator.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
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
uint32_t request_id
The operation id fot the zone iteration in the response for the client.
Credential is returned from the idp.
Definition: reclaim.h:164
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_credential_iteration_start()

static void handle_credential_iteration_start ( void *  cls,
const struct CredentialIterationStartMessage ais_msg 
)
static

Iterate over zone to get attributes.

Parameters
clsour client
ais_msgthe iteration message to start

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

References ai, Iterator::client, IdpClient::client, cred_iter_cb(), cred_iter_error(), cred_iter_finished(), IdpClient::cred_iter_head, IdpClient::cred_iter_tail, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_new, GNUNET_SERVICE_client_continue(), CredentialIterationStartMessage::id, Iterator::identity, CredentialIterationStartMessage::identity, idp, Iterator::ns_it, and Iterator::request_id.

2105 {
2106  struct IdpClient *idp = cls;
2107  struct Iterator *ai;
2108 
2110  "Received CREDENTIAL_ITERATION_START message\n");
2111  ai = GNUNET_new (struct Iterator);
2112  ai->request_id = ntohl (ais_msg->id);
2113  ai->client = idp;
2114  ai->identity = ais_msg->identity;
2115 
2117  ai);
2119  &ai->identity,
2120  &cred_iter_error,
2121  ai,
2122  &cred_iter_cb,
2123  ai,
2125  ai);
2127 }
struct GNUNET_IDENTITY_PrivateKey identity
Key of the zone we are iterating over.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
An idp 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.
static void cred_iter_error(void *cls)
Error iterating over credentials.
struct GNUNET_SERVICE_Client * client
The client.
struct Iterator * cred_iter_head
Head of the DLL of Credential iteration operations in progress initiated by this client.
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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
Namestore iterator.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:249
struct Iterator * cred_iter_tail
Tail of the DLL of Credential iteration operations in progress initiated by this client.
#define GNUNET_log(kind,...)
static void cred_iter_cb(void *cls, const struct GNUNET_IDENTITY_PrivateKey *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.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:254
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2244
static void cred_iter_finished(void *cls)
Done iterating over credentials.
Here is the call graph for this function:

◆ handle_credential_iteration_stop()

static void handle_credential_iteration_stop ( void *  cls,
const struct CredentialIterationStopMessage ais_msg 
)
static

Handle iteration stop message from client.

Parameters
clsthe client
ais_msgthe stop message

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

References ai, IdpClient::client, IdpClient::cred_iter_head, IdpClient::cred_iter_tail, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), CredentialIterationStopMessage::id, idp, Iterator::next, and Iterator::request_id.

2140 {
2141  struct IdpClient *idp = cls;
2142  struct Iterator *ai;
2143  uint32_t rid;
2144 
2146  "Received `%s' message\n",
2147  "CREDENTIAL_ITERATION_STOP");
2148  rid = ntohl (ais_msg->id);
2149  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2150  if (ai->request_id == rid)
2151  break;
2152  if (NULL == ai)
2153  {
2154  GNUNET_break (0);
2156  return;
2157  }
2159  ai);
2160  GNUNET_free (ai);
2162 }
#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:288
An idp 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.
struct Iterator * cred_iter_head
Head of the DLL of Credential iteration operations in progress initiated by this client.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2325
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
struct Iterator * cred_iter_tail
Tail of the DLL of Credential 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:2244
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:

◆ handle_credential_iteration_next()

static void handle_credential_iteration_next ( void *  cls,
const struct CredentialIterationNextMessage ais_msg 
)
static

Client requests next credential from iterator.

Parameters
clsthe client
ais_msgthe message

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

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

2175 {
2176  struct IdpClient *idp = cls;
2177  struct Iterator *ai;
2178  uint32_t rid;
2179 
2181  "Received CREDENTIAL_ITERATION_NEXT message\n");
2182  rid = ntohl (ais_msg->id);
2183  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2184  if (ai->request_id == rid)
2185  break;
2186  if (NULL == ai)
2187  {
2188  GNUNET_break (0);
2190  return;
2191  }
2194 }
An idp client.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:271
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.
struct Iterator * cred_iter_head
Head of the DLL of Credential iteration operations in progress initiated by this 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:2325
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
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:2244
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 2208 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().

2209 {
2210  struct TicketIteration *ti = cls;
2211  struct GNUNET_MQ_Envelope *env;
2212  struct TicketResultMessage *trm;
2213 
2215  if (NULL == ticket)
2216  {
2217  /* send empty response to indicate end of list */
2219  ti->client->ticket_iter_tail,
2220  ti);
2221  }
2222  else
2223  {
2224  trm->ticket = *ticket;
2225  }
2226  trm->id = htonl (ti->r_id);
2227  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
2228  GNUNET_MQ_send (ti->client->mq, env);
2229  if (NULL == ticket)
2230  GNUNET_free (ti);
2231 }
#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:473
#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 2241 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.

2244 {
2245  struct IdpClient *client = cls;
2246  struct TicketIteration *ti;
2247 
2249  "Received TICKET_ITERATION_START message\n");
2250  ti = GNUNET_new (struct TicketIteration);
2251  ti->r_id = ntohl (tis_msg->id);
2252  ti->client = client;
2253 
2255  client->ticket_iter_tail,
2256  ti);
2257  ti->iter
2260 }
struct TicketIteration * ticket_iter_tail
Tail of DLL of ticket iteration ops.
struct RECLAIM_TICKETS_Iterator * RECLAIM_TICKETS_iteration_start(const struct GNUNET_IDENTITY_PrivateKey *identity, RECLAIM_TICKETS_TicketIter cb, void *cb_cls)
Iterate over all tickets issued by an identity.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
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 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.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
Definition: reclaim.h:326
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:2244
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 2270 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.

2272 {
2273  struct IdpClient *client = cls;
2274  struct TicketIteration *ti;
2275  uint32_t rid;
2276 
2278  "Received `%s' message\n",
2279  "TICKET_ITERATION_STOP");
2280  rid = ntohl (tis_msg->id);
2281  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2282  if (ti->r_id == rid)
2283  break;
2284  if (NULL == ti)
2285  {
2286  GNUNET_break (0);
2288  return;
2289  }
2292  client->ticket_iter_tail,
2293  ti);
2294  GNUNET_free (ti);
2296 }
#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:2325
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:2244
#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 2306 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.

2308 {
2309  struct IdpClient *client = cls;
2310  struct TicketIteration *ti;
2311  uint32_t rid;
2312 
2314  "Received TICKET_ITERATION_NEXT message\n");
2315  rid = ntohl (tis_msg->id);
2316  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2317  if (ti->r_id == rid)
2318  break;
2319  if (NULL == ti)
2320  {
2321  GNUNET_break (0);
2323  return;
2324  }
2327 }
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:2325
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:2244
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 2338 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().

2341 {
2342  cfg = c;
2343 
2345  {
2347  "Unable to initialize TICKETS subsystem.\n");
2349  return;
2350  }
2351  // Connect to identity and namestore services
2353  if (NULL == nsh)
2354  {
2356  "error connecting to namestore");
2357  }
2358 
2360 }
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 2371 of file gnunet-service-reclaim.c.

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

Referenced by client_connect_cb().

2374 {
2375  struct IdpClient *idp = app_ctx;
2376 
2377  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
2380  idp);
2381  cleanup_client (idp);
2382 }
#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.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
#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 2394 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_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_CREDENTIAL_DELETE, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE, 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, idp, iteration_start(), mq, IdpClient::mq, and run().

2397 {
2398  struct IdpClient *idp;
2399 
2400  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
2401  idp = GNUNET_new (struct IdpClient);
2402  idp->client = client;
2403  idp->mq = mq;
2406  idp);
2407  return idp;
2408 }
#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.
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
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(credential_store_message, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_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(credential_delete_message, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_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(credential_iteration_start, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, struct CredentialIterationStartMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(credential_iteration_next, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, struct CredentialIterationNextMessage, NULL)  ,
GNUNET_MQ_hd_fixed_size(credential_iteration_stop, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP, struct CredentialIterationStopMessage, 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()   
)