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 ticket_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 ticket_iter_fin (void *cls)
 Done collecting affected tickets, start updating. More...
 
static void ticket_iter_err (void *cls)
 Error collecting affected tickets. More...
 
static void start_ticket_update (void *cls)
 Start processing tickets which may still contain reference to deleted attribute. More...
 
static void attr_delete_cont (void *cls, int32_t success, const char *emsg)
 Attribute deleted callback. More...
 
static int check_attribute_delete_message (void *cls, const struct AttributeDeleteMessage *dam)
 Check attribute delete message format. More...
 
static void handle_attribute_delete_message (void *cls, const struct AttributeDeleteMessage *dam)
 Handle attribute deletion. More...
 
static void 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 479 of file gnunet-service-reclaim.c.

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

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

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

◆ cleanup_as_handle()

static void cleanup_as_handle ( struct AttributeStoreHandle ash)
static

Cleanup attribute store handle.

Parameters
handlehandle to clean up

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

References AttributeStoreHandle::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().

515 {
516  if (NULL != ash->ns_qe)
518  if (NULL != ash->claim)
519  GNUNET_free (ash->claim);
520  if (NULL != ash->credential)
521  GNUNET_free (ash->credential);
522  GNUNET_free (ash);
523 }
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 532 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().

533 {
534  struct Iterator *ai;
535  struct TicketIteration *ti;
536  struct TicketRevocationOperation *rop;
537  struct TicketIssueOperation *iss;
538  struct ConsumeTicketOperation *ct;
539  struct AttributeStoreHandle *as;
540  struct AttributeDeleteHandle *adh;
541 
542  while (NULL != (iss = idp->issue_op_head))
543  {
545  GNUNET_free (iss);
546  }
547  while (NULL != (ct = idp->consume_op_head))
548  {
550  idp->consume_op_tail,
551  ct);
552  if (NULL != ct->ch)
554  GNUNET_free (ct);
555  }
556  while (NULL != (as = idp->store_op_head))
557  {
559  cleanup_as_handle (as);
560  }
561  while (NULL != (adh = idp->delete_op_head))
562  {
564  cleanup_adh (adh);
565  }
566 
567  while (NULL != (ai = idp->attr_iter_head))
568  {
570  GNUNET_free (ai);
571  }
572  while (NULL != (ai = idp->cred_iter_head))
573  {
575  ai);
576  GNUNET_free (ai);
577  }
578 
579  while (NULL != (rop = idp->revoke_op_head))
580  {
582  if (NULL != rop->rh)
584  GNUNET_free (rop);
585  }
586  while (NULL != (ti = idp->ticket_iter_head))
587  {
589  idp->ticket_iter_tail,
590  ti);
591  if (NULL != ti->iter)
593  GNUNET_free (ti);
594  }
595  GNUNET_free (idp);
596 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle for attribute deletion request.
struct TicketIteration * ticket_iter_tail
Tail of DLL of ticket iteration ops.
struct ConsumeTicketOperation * consume_op_head
Head of DLL of ticket consume ops.
Ticket issue operation handle.
void RECLAIM_TICKETS_iteration_stop(struct RECLAIM_TICKETS_Iterator *iter)
Stop a running ticket iteration.
struct RECLAIM_TICKETS_Iterator * iter
The ticket iterator.
struct TicketRevocationOperation * revoke_op_tail
Tail of DLL of ticket revocation ops.
struct Iterator * attr_iter_head
Head of the DLL of Attribute iteration operations in progress initiated by this client.
An attribute iteration operation.
struct 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 603 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().

604 {
605  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
606 
608  if (NULL != timeout_task)
610  if (NULL != nsh)
612 }
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 621 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().

622 {
623  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down...\n");
624  cleanup ();
625 }
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 637 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().

642 {
643  struct TicketResultMessage *irm;
644  struct GNUNET_MQ_Envelope *env;
645  size_t pres_len = 0;
646 
647  if (NULL != presentations)
648  {
649  pres_len =
651  }
652  env = GNUNET_MQ_msg_extra (irm,
653  pres_len,
655  if (NULL != ticket)
656  {
657  irm->ticket = *ticket;
658  }
659  // TODO add success member
660  irm->id = htonl (r_id);
661  irm->presentations_len = htons (pres_len);
662  if (NULL != presentations)
663  {
665  (char*) &irm[1]);
666  }
667  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
668  GNUNET_MQ_send (client->mq, env);
669 }
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 682 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().

687 {
688  struct TicketIssueOperation *tio = cls;
689 
690  if (GNUNET_OK != success)
691  {
692  send_ticket_result (tio->client, tio->r_id, NULL, NULL, GNUNET_SYSERR);
694  tio->client->issue_op_tail,
695  tio);
696  GNUNET_free (tio);
697  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error issuing ticket: %s\n", emsg);
698  return;
699  }
700  send_ticket_result (tio->client, tio->r_id,
701  ticket, presentations, GNUNET_SYSERR);
703  tio->client->issue_op_tail,
704  tio);
705  GNUNET_free (tio);
706 }
#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 717 of file gnunet-service-reclaim.c.

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

718 {
719  uint16_t size;
720 
721  size = ntohs (im->header.size);
722  if (size <= sizeof(struct IssueTicketMessage))
723  {
724  GNUNET_break (0);
725  return GNUNET_SYSERR;
726  }
727  return GNUNET_OK;
728 }
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 738 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.

739 {
740  struct TicketIssueOperation *tio;
741  struct IdpClient *idp = cls;
742  struct GNUNET_RECLAIM_AttributeList *attrs;
744  size_t attrs_len;
745 
746  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
747  tio = GNUNET_new (struct TicketIssueOperation);
748  attrs_len = ntohs (im->attr_len);
749  attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1],
750  attrs_len);
751  for (le = attrs->list_head; NULL != le; le = le->next)
753  "List entry: %s\n", le->attribute->name);
754 
755  tio->r_id = ntohl (im->id);
756  tio->client = idp;
759  attrs,
760  &im->rp,
762  tio);
765 }
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 779 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().

780 {
781  struct TicketRevocationOperation *rop = cls;
782  struct GNUNET_MQ_Envelope *env;
783  struct RevokeTicketResultMessage *trm;
784 
786  "Sending REVOKE_TICKET_RESULT message\n");
787  rop->rh = NULL;
789  trm->id = htonl (rop->r_id);
790  trm->success = htonl (success);
791  GNUNET_MQ_send (rop->client->mq, env);
793  rop->client->revoke_op_tail,
794  rop);
795  GNUNET_free (rop);
796 }
#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 807 of file gnunet-service-reclaim.c.

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

808 {
809  uint16_t size;
810 
811  size = ntohs (im->header.size);
812  if (size != sizeof(struct RevokeTicketMessage))
813  {
814  GNUNET_break (0);
815  return GNUNET_SYSERR;
816  }
817  return GNUNET_OK;
818 }
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 828 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.

829 {
830  struct TicketRevocationOperation *rop;
831  struct IdpClient *idp = cls;
832 
833  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
834  rop = GNUNET_new (struct TicketRevocationOperation);
835  rop->r_id = ntohl (rm->id);
836  rop->client = idp;
838  rop->rh
840  rop);
842 }
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 855 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().

861 {
862  struct ConsumeTicketOperation *cop = cls;
863  struct ConsumeTicketResultMessage *crm;
864  struct GNUNET_MQ_Envelope *env;
865  char *data_tmp;
866  size_t attrs_len = 0;
867  size_t pres_len = 0;
868 
869  if (GNUNET_OK != success)
870  {
871  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg);
872  }
874  pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations);
876  "Sending CONSUME_TICKET_RESULT message\n");
877  env = GNUNET_MQ_msg_extra (crm,
878  attrs_len + pres_len,
880  crm->id = htonl (cop->r_id);
881  crm->attrs_len = htons (attrs_len);
882  crm->presentations_len = htons (pres_len);
883  crm->identity = *identity;
884  crm->result = htonl (success);
885  data_tmp = (char *) &crm[1];
886  GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp);
887  data_tmp += attrs_len;
888  GNUNET_RECLAIM_presentation_list_serialize (presentations, data_tmp);
889  GNUNET_MQ_send (cop->client->mq, env);
891  cop->client->consume_op_tail,
892  cop);
893  GNUNET_free (cop);
894 }
#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 904 of file gnunet-service-reclaim.c.

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

905 {
906  uint16_t size;
907 
908  size = ntohs (cm->header.size);
909  if (size != sizeof(struct ConsumeTicketMessage))
910  {
911  GNUNET_break (0);
912  return GNUNET_SYSERR;
913  }
914  return GNUNET_OK;
915 }
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 925 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.

926 {
927  struct ConsumeTicketOperation *cop;
928  struct IdpClient *idp = cls;
929 
930  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
931  cop = GNUNET_new (struct ConsumeTicketOperation);
932  cop->r_id = ntohl (cm->id);
933  cop->client = idp;
934  cop->ch
936  cop);
939 }
#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 955 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().

956 {
957  struct AttributeStoreHandle *ash = cls;
958  struct GNUNET_MQ_Envelope *env;
959  struct SuccessResultMessage *acr_msg;
960 
961  ash->ns_qe = NULL;
963  ash->client->store_op_tail,
964  ash);
965 
966  if (GNUNET_SYSERR == success)
967  {
969  "Failed to store attribute %s\n",
970  emsg);
971  cleanup_as_handle (ash);
973  return;
974  }
975 
976  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
978  acr_msg->id = htonl (ash->r_id);
979  acr_msg->op_result = htonl (GNUNET_OK);
980  GNUNET_MQ_send (ash->client->mq, env);
981  cleanup_as_handle (ash);
982 }
#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 991 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().

992 {
993  struct AttributeStoreHandle *ash = cls;
994  struct GNUNET_GNSRECORD_Data rd[1];
995  char *buf;
996  char *label;
997  size_t buf_size;
998 
999  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing attribute\n");
1001  buf = GNUNET_malloc (buf_size);
1002  // Give the ash a new id if unset
1003  if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->claim->id))
1006  label
1008  sizeof (ash->claim->id));
1009  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label);
1010 
1011  rd[0].data_size = buf_size;
1012  rd[0].data = buf;
1013  rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE;
1015  rd[0].expiration_time = ash->exp.rel_value_us;
1017  &ash->identity,
1018  label,
1019  1,
1020  rd,
1021  &attr_store_cont,
1022  ash);
1023  GNUNET_free (buf);
1024  GNUNET_free (label);
1025 }
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 1035 of file gnunet-service-reclaim.c.

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

1037 {
1038  uint16_t size;
1039 
1040  size = ntohs (sam->header.size);
1041  if (size <= sizeof(struct AttributeStoreMessage))
1042  {
1043  GNUNET_break (0);
1044  return GNUNET_SYSERR;
1045  }
1046  return GNUNET_OK;
1047 }
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 1057 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.

1059 {
1060  struct AttributeStoreHandle *ash;
1061  struct IdpClient *idp = cls;
1062  size_t data_len;
1063 
1064  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
1065 
1066  data_len = ntohs (sam->attr_len);
1067 
1068  ash = GNUNET_new (struct AttributeStoreHandle);
1069  GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1],
1070  data_len,
1071  &ash->claim);
1072 
1073  ash->r_id = ntohl (sam->id);
1074  ash->identity = sam->identity;
1075  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1077 
1079  ash->client = idp;
1082 }
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 1093 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().

1094 {
1095  struct AttributeStoreHandle *ash = cls;
1096  struct GNUNET_MQ_Envelope *env;
1097  struct SuccessResultMessage *acr_msg;
1098 
1099  ash->ns_qe = NULL;
1101  ash->client->store_op_tail,
1102  ash);
1103 
1104  if (GNUNET_SYSERR == success)
1105  {
1107  "Failed to store credential: %s\n",
1108  emsg);
1109  cleanup_as_handle (ash);
1111  return;
1112  }
1113 
1114  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending SUCCESS_RESPONSE message\n");
1116  acr_msg->id = htonl (ash->r_id);
1117  acr_msg->op_result = htonl (GNUNET_OK);
1118  GNUNET_MQ_send (ash->client->mq, env);
1119  cleanup_as_handle (ash);
1120 }
#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 1129 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().

1130 {
1131  struct AttributeStoreHandle *ash = cls;
1133  "Failed to check for existing credential.\n");
1134  cleanup_as_handle (ash);
1136  return;
1137 }
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 1150 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().

1155 {
1156  struct AttributeStoreHandle *ash = cls;
1157  struct GNUNET_GNSRECORD_Data rd_new[1];
1158  char *buf;
1159  size_t buf_size;
1160 
1162  buf = GNUNET_malloc (buf_size);
1165  "Storing new credential under `%s'.\n",
1166  label);
1167  rd_new[0].data_size = buf_size;
1168  rd_new[0].data = buf;
1169  rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL;
1170  rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1171  rd_new[0].expiration_time = ash->exp.rel_value_us;
1173  &ash->identity,
1174  label,
1175  1,
1176  rd_new,
1177  &cred_store_cont,
1178  ash);
1179  GNUNET_free (buf);
1180  return;
1181 }
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 1190 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().

1191 {
1192  struct AttributeStoreHandle *ash = cls;
1193  char *label;
1194 
1195  // Give the ash a new id if unset
1199  sizeof (ash->credential->id));
1201  "Looking up existing data under label `%s'\n", label);
1203  &ash->identity,
1204  label,
1205  &cred_error,
1206  ash,
1207  &cred_add_cb,
1208  ash);
1209  GNUNET_free (label);
1210 }
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 1220 of file gnunet-service-reclaim.c.

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

1222 {
1223  uint16_t size;
1224 
1225  size = ntohs (sam->header.size);
1226  if (size <= sizeof(struct AttributeStoreMessage))
1227  {
1228  GNUNET_break (0);
1229  return GNUNET_SYSERR;
1230  }
1231  return GNUNET_OK;
1232 }
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 1242 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.

1244 {
1245  struct AttributeStoreHandle *ash;
1246  struct IdpClient *idp = cls;
1247  size_t data_len;
1248 
1249  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n");
1250 
1251  data_len = ntohs (sam->attr_len);
1252 
1253  ash = GNUNET_new (struct AttributeStoreHandle);
1254  ash->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &sam[1],
1255  data_len);
1256 
1257  ash->r_id = ntohl (sam->id);
1258  ash->identity = sam->identity;
1259  ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
1261 
1263  ash->client = idp;
1266 }
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 1276 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(), cred_delete_cont(), ticket_iter_err(), and update_tickets().

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

◆ ticket_iter()

static void ticket_iter ( void *  cls,
const struct GNUNET_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 1304 of file gnunet-service-reclaim.c.

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

Referenced by start_ticket_update().

1309 {
1310  struct AttributeDeleteHandle *adh = cls;
1311  struct TicketRecordsEntry *le;
1312  int has_changed = GNUNET_NO;
1313  for (int i = 0; i < rd_count; i++)
1314  {
1315  if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type)
1316  continue;
1317  if (adh->claim != NULL)
1319  &adh->claim->id))
1320  continue;
1321  if (adh->credential != NULL)
1322  if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data,
1323  &adh->credential->id))
1324  continue;
1326  "Attribute to delete found (%s)\n",
1327  adh->label);
1328  has_changed = GNUNET_YES;
1329  break;
1330  }
1331  if (GNUNET_YES == has_changed)
1332  {
1333  le = GNUNET_new (struct TicketRecordsEntry);
1334  le->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
1335  le->data = GNUNET_malloc (le->data_size);
1336  le->rd_count = rd_count;
1337  le->label = GNUNET_strdup (label);
1338  GNUNET_GNSRECORD_records_serialize (rd_count, rd, le->data_size, le->data);
1341  le);
1342  }
1344 }
Handle for attribute deletion request.
GNUNET_NETWORK_STRUCT_END ssize_t GNUNET_GNSRECORD_records_get_size(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Calculate how many bytes we will need to serialize the given records.
struct TicketRecordsEntry * tickets_to_update_tail
Tickets to update.
struct GNUNET_RECLAIM_Identifier id
ID.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
ssize_t GNUNET_GNSRECORD_records_serialize(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest)
Serialize the given records to the given destination buffer.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void GNUNET_NAMESTORE_zone_iterator_next(struct GNUNET_NAMESTORE_ZoneIterator *it, uint64_t limit)
Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_start for the next record...
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF
Record type for reclaim records.
struct GNUNET_RECLAIM_Credential * credential
The credential to delete.
unsigned int rd_count
Record count.
struct GNUNET_RECLAIM_Identifier id
ID.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
char * label
Attribute label.
#define GNUNET_RECLAIM_id_is_equal(a, b)
#define GNUNET_log(kind,...)
uint32_t data
The data value.
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
#define GNUNET_malloc(size)
Wrapper around malloc.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_tickets()

static void update_tickets ( void *  cls)
static

Recursion prototype for function.

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

Parameters
clsour deletion handle

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

Parameters
clsour attribute deletion handle

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

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

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

1381 {
1382  struct AttributeDeleteHandle *adh = cls;
1383  struct TicketRecordsEntry *le;
1384 
1385  if (NULL == adh->tickets_to_update_head)
1386  {
1388  "Finished updating tickets, success\n");
1390  cleanup_adh (adh);
1391  return;
1392  }
1394  "Updating %s\n",
1396  le = adh->tickets_to_update_head;
1399  le);
1400  struct GNUNET_GNSRECORD_Data rd[le->rd_count];
1401  struct GNUNET_GNSRECORD_Data rd_new[le->rd_count - 1];
1403  le->data,
1404  le->rd_count,
1405  rd))
1406  {
1408  "Unable to deserialize record data!\n");
1410  cleanup_adh (adh);
1411  return;
1412  }
1413  int j = 0;
1414  for (int i = 0; i < le->rd_count; i++)
1415  {
1416  if (adh->claim != NULL)
1419  &adh->claim->id)))
1420  continue;
1421  if (adh->credential != NULL)
1422  if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1423  && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data,
1424  &adh->credential->id)))
1425  continue;
1426  rd_new[j] = rd[i];
1427  j++;
1428  }
1430  &adh->identity,
1431  le->label,
1432  j,
1433  rd_new,
1434  &ticket_updated,
1435  adh);
1436  GNUNET_free (le->label);
1437  GNUNET_free (le->data);
1438  GNUNET_free (le);
1439 }
#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.
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.
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.
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.
struct GNUNET_RECLAIM_Credential * credential
The credential to delete.
unsigned int rd_count
Record count.
struct GNUNET_RECLAIM_Identifier id
ID.
struct TicketRecordsEntry * tickets_to_update_head
Tickets to update.
static void ticket_updated(void *cls, int32_t success, const char *emsg)
Callback called when a ticket was updated.
uint32_t record_type
Type of the GNS/DNS record.
#define GNUNET_RECLAIM_id_is_equal(a, b)
#define GNUNET_log(kind,...)
static struct GNUNET_NAMESTORE_Handle * nsh
Namestore handle.
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
uint32_t data
The data value.
struct GNUNET_RECLAIM_Attribute * claim
The attribute to delete.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_updated()

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

Callback called when a ticket was updated.

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

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

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

Referenced by update_tickets().

1364 {
1365  struct AttributeDeleteHandle *adh = cls;
1366 
1367  adh->ns_qe = NULL;
1369 }
Handle for attribute deletion request.
static void update_tickets(void *cls)
Recursion prototype for function.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1296
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_iter_fin()

static void ticket_iter_fin ( void *  cls)
static

Done collecting affected tickets, start updating.

Parameters
clsour attribute deletion handle

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

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

Referenced by start_ticket_update().

1449 {
1450  struct AttributeDeleteHandle *adh = cls;
1451  adh->ns_it = NULL;
1453 }
Handle for attribute deletion request.
static void update_tickets(void *cls)
Recursion prototype for function.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1296
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_iter_err()

static void ticket_iter_err ( void *  cls)
static

Error collecting affected tickets.

Abort.

Parameters
clsour attribute deletion handle

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

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

Referenced by start_ticket_update().

1463 {
1464  struct AttributeDeleteHandle *adh = cls;
1465 
1466  adh->ns_it = NULL;
1468  "Namestore error on delete %s\n",
1469  adh->label);
1471  cleanup_adh (adh);
1472 }
Handle for attribute deletion request.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
static void send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
Send a deletion success response.
char * label
Attribute label.
#define GNUNET_log(kind,...)
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_ticket_update()

static void start_ticket_update ( void *  cls)
static

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

Parameters
clsattribute deletion handle

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

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

Referenced by attr_delete_cont(), and cred_delete_cont().

1483 {
1484  struct AttributeDeleteHandle *adh = cls;
1485 
1487  &adh->identity,
1488  &ticket_iter_err,
1489  adh,
1490  &ticket_iter,
1491  adh,
1492  &ticket_iter_fin,
1493  adh);
1494 }
Handle for attribute deletion request.
static void ticket_iter_err(void *cls)
Error collecting affected tickets.
struct GNUNET_IDENTITY_PrivateKey identity
Identity.
static void ticket_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.
struct GNUNET_NAMESTORE_ZoneIterator * ns_it
Iterator.
static void ticket_iter_fin(void *cls)
Done collecting affected tickets, start updating.
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 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 1505 of file gnunet-service-reclaim.c.

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

Referenced by handle_attribute_delete_message().

1506 {
1507  struct AttributeDeleteHandle *adh = cls;
1508 
1509  adh->ns_qe = NULL;
1510  if (GNUNET_SYSERR == success)
1511  {
1513  "Error deleting attribute %s\n",
1514  adh->label);
1516  cleanup_adh (adh);
1517  return;
1518  }
1519  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1521 }
Handle for attribute deletion request.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
static void send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
Send a deletion success response.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1296
static void start_ticket_update(void *cls)
Start processing tickets which may still contain reference to deleted attribute.
char * label
Attribute label.
#define GNUNET_log(kind,...)
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_attribute_delete_message()

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

Check attribute delete message format.

unused message to check

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

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

1533 {
1534  uint16_t size;
1535 
1536  size = ntohs (dam->header.size);
1537  if (size <= sizeof(struct AttributeDeleteMessage))
1538  {
1539  GNUNET_break (0);
1540  return GNUNET_SYSERR;
1541  }
1542  return GNUNET_OK;
1543 }
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 1553 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.

1555 {
1556  struct AttributeDeleteHandle *adh;
1557  struct IdpClient *idp = cls;
1558  size_t data_len;
1559 
1560  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n");
1561 
1562  data_len = ntohs (dam->attr_len);
1563 
1564  adh = GNUNET_new (struct AttributeDeleteHandle);
1565  GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1],
1566  data_len,
1567  &adh->claim);
1568  adh->credential = NULL;
1569 
1570  adh->r_id = ntohl (dam->id);
1571  adh->identity = dam->identity;
1572  adh->label
1574  sizeof(adh->claim->id));
1576  adh->client = idp;
1579  &adh->identity,
1580  adh->label,
1581  0,
1582  NULL,
1584  adh);
1585 }
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 1596 of file gnunet-service-reclaim.c.

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

Referenced by handle_credential_delete_message().

1597 {
1598  struct AttributeDeleteHandle *adh = cls;
1599 
1600  adh->ns_qe = NULL;
1601  if (GNUNET_SYSERR == success)
1602  {
1604  "Error deleting credential `%s'\n",
1605  adh->label);
1607  cleanup_adh (adh);
1608  return;
1609  }
1610  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating tickets...\n");
1612 }
Handle for attribute deletion request.
struct GNUNET_NAMESTORE_QueueEntry * ns_qe
QueueEntry.
static void send_delete_response(struct AttributeDeleteHandle *adh, int32_t success)
Send a deletion success response.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1296
static void start_ticket_update(void *cls)
Start processing tickets which may still contain reference to deleted attribute.
char * label
Attribute label.
#define GNUNET_log(kind,...)
static void cleanup_adh(struct AttributeDeleteHandle *adh)
Cleanup attribute delete handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_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 1622 of file gnunet-service-reclaim.c.

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

1624 {
1625  uint16_t size;
1626 
1627  size = ntohs (dam->header.size);
1628  if (size <= sizeof(struct AttributeDeleteMessage))
1629  {
1630  GNUNET_break (0);
1631  return GNUNET_SYSERR;
1632  }
1633  return GNUNET_OK;
1634 }
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 1644 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.

1646 {
1647  struct AttributeDeleteHandle *adh;
1648  struct IdpClient *idp = cls;
1649  size_t data_len;
1650 
1651  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n");
1652 
1653  data_len = ntohs (dam->attr_len);
1654 
1655  adh = GNUNET_new (struct AttributeDeleteHandle);
1656  adh->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &dam[1],
1657  data_len);
1658  adh->claim = NULL;
1659 
1660  adh->r_id = ntohl (dam->id);
1661  adh->identity = dam->identity;
1662  adh->label
1664  sizeof(adh->credential->id));
1666  adh->client = idp;
1669  &adh->identity,
1670  adh->label,
1671  0,
1672  NULL,
1674  adh);
1675 }
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 1689 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().

1690 {
1691  struct Iterator *ai = cls;
1692  struct GNUNET_MQ_Envelope *env;
1693  struct AttributeResultMessage *arm;
1694 
1695  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
1697  arm->id = htonl (ai->request_id);
1698  arm->attr_len = htons (0);
1699  GNUNET_MQ_send (ai->client->mq, env);
1701  ai->client->attr_iter_tail,
1702  ai);
1703  GNUNET_free (ai);
1704 }
#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 1713 of file gnunet-service-reclaim.c.

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

Referenced by handle_iteration_start().

1714 {
1715  struct Iterator *ai = cls;
1716 
1717  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attributes\n");
1718  attr_iter_finished (ai);
1719 }
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 1732 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().

1737 {
1738  struct Iterator *ai = cls;
1739  struct GNUNET_MQ_Envelope *env;
1740  char *data_tmp;
1741 
1742  if ((rd_count != 1) ||
1744  {
1746  return;
1747  }
1748  struct AttributeResultMessage *arm;
1749  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
1750  label);
1752  "Sending ATTRIBUTE_RESULT message\n");
1753  env = GNUNET_MQ_msg_extra (arm,
1754  rd->data_size,
1756  arm->id = htonl (ai->request_id);
1757  arm->attr_len = htons (rd->data_size);
1759  data_tmp = (char *) &arm[1];
1760  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1761  GNUNET_MQ_send (ai->client->mq, env);
1762 }
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 1772 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.

1774 {
1775  struct IdpClient *idp = cls;
1776  struct Iterator *ai;
1777 
1779  "Received ATTRIBUTE_ITERATION_START message\n");
1780  ai = GNUNET_new (struct Iterator);
1781  ai->request_id = ntohl (ais_msg->id);
1782  ai->client = idp;
1783  ai->identity = ais_msg->identity;
1784 
1787  &ai->identity,
1788  &attr_iter_error,
1789  ai,
1790  &attr_iter_cb,
1791  ai,
1793  ai);
1795 }
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 1805 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.

1807 {
1808  struct IdpClient *idp = cls;
1809  struct Iterator *ai;
1810  uint32_t rid;
1811 
1813  "Received `%s' message\n",
1814  "ATTRIBUTE_ITERATION_STOP");
1815  rid = ntohl (ais_msg->id);
1816  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1817  if (ai->request_id == rid)
1818  break;
1819  if (NULL == ai)
1820  {
1821  GNUNET_break (0);
1823  return;
1824  }
1826  GNUNET_free (ai);
1828 }
#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 1838 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.

1840 {
1841  struct IdpClient *idp = cls;
1842  struct Iterator *ai;
1843  uint32_t rid;
1844 
1846  "Received ATTRIBUTE_ITERATION_NEXT message\n");
1847  rid = ntohl (ais_msg->id);
1848  for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next)
1849  if (ai->request_id == rid)
1850  break;
1851  if (NULL == ai)
1852  {
1853  GNUNET_break (0);
1855  return;
1856  }
1859 }
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 1873 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().

1874 {
1875  struct Iterator *ai = cls;
1876  struct GNUNET_MQ_Envelope *env;
1877  struct CredentialResultMessage *arm;
1878 
1879  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n");
1881  arm->id = htonl (ai->request_id);
1882  arm->credential_len = htons (0);
1883  GNUNET_MQ_send (ai->client->mq, env);
1885  ai->client->cred_iter_tail,
1886  ai);
1887  GNUNET_free (ai);
1888 }
#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 1897 of file gnunet-service-reclaim.c.

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

Referenced by handle_credential_iteration_start().

1898 {
1899  struct Iterator *ai = cls;
1900 
1901  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over credentials\n");
1902  cred_iter_finished (ai);
1903 }
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 1916 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().

1921 {
1922  struct Iterator *ai = cls;
1923  struct GNUNET_MQ_Envelope *env;
1924  struct CredentialResultMessage *arm;
1925  char *data_tmp;
1926 
1927  if ((rd_count != 1) ||
1929  {
1931  return;
1932  }
1933  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found credential under: %s\n",
1934  label);
1936  "Sending CREDENTIAL_RESULT message\n");
1937  env = GNUNET_MQ_msg_extra (arm,
1938  rd->data_size,
1940  arm->id = htonl (ai->request_id);
1941  arm->credential_len = htons (rd->data_size);
1943  data_tmp = (char *) &arm[1];
1944  GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
1945 
1946  GNUNET_MQ_send (ai->client->mq, env);
1947 }
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 1957 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.

1960 {
1961  struct IdpClient *idp = cls;
1962  struct Iterator *ai;
1963 
1965  "Received CREDENTIAL_ITERATION_START message\n");
1966  ai = GNUNET_new (struct Iterator);
1967  ai->request_id = ntohl (ais_msg->id);
1968  ai->client = idp;
1969  ai->identity = ais_msg->identity;
1970 
1972  ai);
1974  &ai->identity,
1975  &cred_iter_error,
1976  ai,
1977  &cred_iter_cb,
1978  ai,
1980  ai);
1982 }
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 1992 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.

1995 {
1996  struct IdpClient *idp = cls;
1997  struct Iterator *ai;
1998  uint32_t rid;
1999 
2001  "Received `%s' message\n",
2002  "CREDENTIAL_ITERATION_STOP");
2003  rid = ntohl (ais_msg->id);
2004  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2005  if (ai->request_id == rid)
2006  break;
2007  if (NULL == ai)
2008  {
2009  GNUNET_break (0);
2011  return;
2012  }
2014  ai);
2015  GNUNET_free (ai);
2017 }
#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 2027 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.

2030 {
2031  struct IdpClient *idp = cls;
2032  struct Iterator *ai;
2033  uint32_t rid;
2034 
2036  "Received CREDENTIAL_ITERATION_NEXT message\n");
2037  rid = ntohl (ais_msg->id);
2038  for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next)
2039  if (ai->request_id == rid)
2040  break;
2041  if (NULL == ai)
2042  {
2043  GNUNET_break (0);
2045  return;
2046  }
2049 }
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 2063 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().

2064 {
2065  struct TicketIteration *ti = cls;
2066  struct GNUNET_MQ_Envelope *env;
2067  struct TicketResultMessage *trm;
2068 
2070  if (NULL == ticket)
2071  {
2072  /* send empty response to indicate end of list */
2074  ti->client->ticket_iter_tail,
2075  ti);
2076  }
2077  else
2078  {
2079  trm->ticket = *ticket;
2080  }
2081  trm->id = htonl (ti->r_id);
2082  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
2083  GNUNET_MQ_send (ti->client->mq, env);
2084  if (NULL == ticket)
2085  GNUNET_free (ti);
2086 }
#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 2096 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.

2099 {
2100  struct IdpClient *client = cls;
2101  struct TicketIteration *ti;
2102 
2104  "Received TICKET_ITERATION_START message\n");
2105  ti = GNUNET_new (struct TicketIteration);
2106  ti->r_id = ntohl (tis_msg->id);
2107  ti->client = client;
2108 
2110  client->ticket_iter_tail,
2111  ti);
2112  ti->iter
2115 }
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 2125 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.

2127 {
2128  struct IdpClient *client = cls;
2129  struct TicketIteration *ti;
2130  uint32_t rid;
2131 
2133  "Received `%s' message\n",
2134  "TICKET_ITERATION_STOP");
2135  rid = ntohl (tis_msg->id);
2136  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2137  if (ti->r_id == rid)
2138  break;
2139  if (NULL == ti)
2140  {
2141  GNUNET_break (0);
2143  return;
2144  }
2147  client->ticket_iter_tail,
2148  ti);
2149  GNUNET_free (ti);
2151 }
#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 2161 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.

2163 {
2164  struct IdpClient *client = cls;
2165  struct TicketIteration *ti;
2166  uint32_t rid;
2167 
2169  "Received TICKET_ITERATION_NEXT message\n");
2170  rid = ntohl (tis_msg->id);
2171  for (ti = client->ticket_iter_head; NULL != ti; ti = ti->next)
2172  if (ti->r_id == rid)
2173  break;
2174  if (NULL == ti)
2175  {
2176  GNUNET_break (0);
2178  return;
2179  }
2182 }
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 2193 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().

2196 {
2197  cfg = c;
2198 
2200  {
2202  "Unable to initialize TICKETS subsystem.\n");
2204  return;
2205  }
2206  // Connect to identity and namestore services
2208  if (NULL == nsh)
2209  {
2211  "error connecting to namestore");
2212  }
2213 
2215 }
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 2226 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().

2229 {
2230  struct IdpClient *idp = app_ctx;
2231 
2232  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client);
2235  idp);
2236  cleanup_client (idp);
2237 }
#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 2249 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().

2252 {
2253  struct IdpClient *idp;
2254 
2255  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", client);
2256  idp = GNUNET_new (struct IdpClient);
2257  idp->client = client;
2258  idp->mq = mq;
2261  idp);
2262  return idp;
2263 }
#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()   
)

Define "main" method using service macro.

Referenced by client_connect_cb().

Here is the caller graph for this function:

Variable Documentation

◆ nsh

struct GNUNET_NAMESTORE_Handle* nsh
static

Namestore handle.

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

◆ timeout_task

struct GNUNET_SCHEDULER_Task* timeout_task
static

Timeout task.

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

◆ cfg

const struct GNUNET_CONFIGURATION_Handle* cfg
static

Our configuration.

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

◆ client_list_head

struct IdpClient* client_list_head = NULL
static

Client list.

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

◆ client_list_tail

struct IdpClient* client_list_tail = NULL
static

Client list.

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