GNUnet  0.11.x
Data Structures | Macros | Functions
reclaim_api.c File Reference

api to interact with the reclaim service More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_constants.h"
#include "gnunet_mq_lib.h"
#include "gnunet_protocols.h"
#include "gnunet_reclaim_lib.h"
#include "gnunet_reclaim_service.h"
#include "reclaim.h"
Include dependency graph for reclaim_api.c:

Go to the source code of this file.

Data Structures

struct  GNUNET_RECLAIM_Operation
 Handle for an operation with the service. More...
 
struct  GNUNET_RECLAIM_TicketIterator
 Handle for a ticket iterator operation. More...
 
struct  GNUNET_RECLAIM_AttributeIterator
 Handle for a attribute iterator operation. More...
 
struct  GNUNET_RECLAIM_AttestationIterator
 Handle for a attestation iterator operation. More...
 
struct  GNUNET_RECLAIM_Handle
 Handle to the service. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "reclaim-api", __VA_ARGS__)
 

Functions

static void reconnect (struct GNUNET_RECLAIM_Handle *h)
 Try again to connect to the service. More...
 
static void reconnect_task (void *cls)
 Reconnect. More...
 
static void force_reconnect (struct GNUNET_RECLAIM_Handle *handle)
 Disconnect from service and then reconnect. More...
 
static void free_it (struct GNUNET_RECLAIM_AttributeIterator *it)
 Free it. More...
 
static void free_ait (struct GNUNET_RECLAIM_AttestationIterator *ait)
 Free it. More...
 
static void free_op (struct GNUNET_RECLAIM_Operation *op)
 Free op. More...
 
static void mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
 Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More...
 
static void handle_success_response (void *cls, const struct SuccessResultMessage *msg)
 Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE. More...
 
static int check_consume_ticket_result (void *cls, const struct ConsumeTicketResultMessage *msg)
 Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT. More...
 
static void handle_consume_ticket_result (void *cls, const struct ConsumeTicketResultMessage *msg)
 Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT. More...
 
static int check_attribute_result (void *cls, const struct AttributeResultMessage *msg)
 Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT. More...
 
static void handle_attribute_result (void *cls, const struct AttributeResultMessage *msg)
 Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT. More...
 
static int check_attestation_result (void *cls, const struct AttestationResultMessage *msg)
 Handle an incoming message of type #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT. More...
 
static void handle_attestation_result (void *cls, const struct AttestationResultMessage *msg)
 Handle an incoming message of type #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT. More...
 
static void handle_ticket_result (void *cls, const struct TicketResultMessage *msg)
 Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT. More...
 
static void handle_revoke_ticket_result (void *cls, const struct RevokeTicketResultMessage *msg)
 Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT. More...
 
struct GNUNET_RECLAIM_HandleGNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Connect to the reclaim service. More...
 
void GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op)
 Cancel an operation. More...
 
void GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h)
 Disconnect from service. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_attribute_store (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
 Store an attribute. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_attribute_delete (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
 Delete an attribute. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_attestation_store (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const struct GNUNET_RECLAIM_Attestation *attr, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
 Store an attestation. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_attestation_delete (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const struct GNUNET_RECLAIM_Attestation *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
 Delete an attestation. More...
 
struct GNUNET_RECLAIM_AttributeIteratorGNUNET_RECLAIM_get_attributes_start (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
 List all attributes for a local identity. More...
 
void GNUNET_RECLAIM_get_attributes_next (struct GNUNET_RECLAIM_AttributeIterator *it)
 Calls the record processor specified in GNUNET_RECLAIM_get_attributes_start for the next record. More...
 
void GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it)
 Stops iteration and releases the handle for further calls. More...
 
struct GNUNET_RECLAIM_AttestationIteratorGNUNET_RECLAIM_get_attestations_start (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_AttestationResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
 List all attestations for a local identity. More...
 
void GNUNET_RECLAIM_get_attestations_next (struct GNUNET_RECLAIM_AttestationIterator *ait)
 Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start for the next record. More...
 
void GNUNET_RECLAIM_get_attestations_stop (struct GNUNET_RECLAIM_AttestationIterator *ait)
 Stops iteration and releases the handle for further calls. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_ticket_issue (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, const struct GNUNET_RECLAIM_AttributeList *attrs, GNUNET_RECLAIM_TicketCallback cb, void *cb_cls)
 Issues a ticket to another relying party. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_ticket_consume (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls)
 Consumes an issued ticket. More...
 
struct GNUNET_RECLAIM_TicketIteratorGNUNET_RECLAIM_ticket_iteration_start (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
 Lists all tickets that have been issued to remote identites (relying parties) More...
 
void GNUNET_RECLAIM_ticket_iteration_next (struct GNUNET_RECLAIM_TicketIterator *it)
 Calls the ticket processor specified in GNUNET_RECLAIM_ticket_iteration_start for the next record. More...
 
void GNUNET_RECLAIM_ticket_iteration_stop (struct GNUNET_RECLAIM_TicketIterator *it)
 Stops iteration and releases the handle for further calls. More...
 
struct GNUNET_RECLAIM_OperationGNUNET_RECLAIM_ticket_revoke (struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
 Revoked an issued ticket. More...
 

Detailed Description

api to interact with the reclaim service

Author
Martin Schanzenbach

Definition in file reclaim_api.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "reclaim-api", __VA_ARGS__)

Function Documentation

◆ reconnect()

static void reconnect ( struct GNUNET_RECLAIM_Handle h)
static

Try again to connect to the service.

Parameters
hhandle to the reclaim service.

Definition at line 977 of file reclaim_api.c.

References GNUNET_RECLAIM_Handle::cfg, GNUNET_RECLAIM_Operation::env, GNUNET_assert, GNUNET_CLIENT_connect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT, GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_send_copy(), LOG, GNUNET_RECLAIM_Handle::mq, mq_error_handler(), GNUNET_RECLAIM_Operation::next, op, and GNUNET_RECLAIM_Handle::op_head.

Referenced by GNUNET_RECLAIM_connect(), and reconnect_task().

978 {
980  { GNUNET_MQ_hd_fixed_size (success_response,
982  struct SuccessResultMessage,
983  h),
984  GNUNET_MQ_hd_var_size (attribute_result,
986  struct AttributeResultMessage,
987  h),
988  GNUNET_MQ_hd_var_size (attestation_result,
991  h),
992  GNUNET_MQ_hd_fixed_size (ticket_result,
994  struct TicketResultMessage,
995  h),
996  GNUNET_MQ_hd_var_size (consume_ticket_result,
999  h),
1000  GNUNET_MQ_hd_fixed_size (revoke_ticket_result,
1003  h),
1004  GNUNET_MQ_handler_end () };
1005  struct GNUNET_RECLAIM_Operation *op;
1006 
1007  GNUNET_assert (NULL == h->mq);
1008  LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to reclaim service.\n");
1009 
1010  h->mq =
1011  GNUNET_CLIENT_connect (h->cfg, "reclaim", handlers, &mq_error_handler, h);
1012  if (NULL == h->mq)
1013  return;
1014  for (op = h->op_head; NULL != op; op = op->next)
1015  GNUNET_MQ_send_copy (h->mq, op->env);
1016 }
#define LOG(kind,...)
Definition: reclaim_api.c:35
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT
Ticket result message.
Definition: reclaim.h:453
Attribute list is returned from the idp.
Definition: reclaim.h:500
#define GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1063
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
Handle for an operation with the service.
Definition: reclaim_api.c:41
struct GNUNET_MQ_Handle * mq
Connection to service (if available).
Definition: reclaim_api.c:387
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
struct GNUNET_MQ_Envelope * env
Envelope with the message for this queue entry.
Definition: reclaim_api.c:97
#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT
struct GNUNET_RECLAIM_Operation * next
We keep operations in a DLL.
Definition: reclaim_api.c:51
Message handler for a specific message type.
Attribute store/delete response message.
Definition: reclaim.h:103
struct GNUNET_RECLAIM_Operation * op_head
Head of active operations.
Definition: reclaim_api.c:332
#define GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Definition: reclaim_api.c:317
Ticket revoke message.
Definition: reclaim.h:431
void GNUNET_MQ_send_copy(struct GNUNET_MQ_Handle *mq, const struct GNUNET_MQ_Envelope *ev)
Send a copy of a message with the given message queue.
Definition: mq.c:439
Attribute is returned from the idp.
Definition: reclaim.h:124
#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
Attestation is returned from the idp.
Definition: reclaim.h:164
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
Definition: reclaim_api.c:503
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reconnect_task()

static void reconnect_task ( void *  cls)
static

Reconnect.

Parameters
clsthe handle

Definition at line 416 of file reclaim_api.c.

References GNUNET_RECLAIM_Operation::cls, handle, reconnect(), and GNUNET_RECLAIM_Handle::reconnect_task.

Referenced by force_reconnect().

417 {
418  struct GNUNET_RECLAIM_Handle *handle = cls;
419 
420  handle->reconnect_task = NULL;
421  reconnect (handle);
422 }
Handle to the service.
Definition: reclaim_api.c:312
struct GNUNET_SCHEDULER_Task * reconnect_task
Task doing exponential back-off trying to reconnect.
Definition: reclaim_api.c:377
static void reconnect(struct GNUNET_RECLAIM_Handle *h)
Try again to connect to the service.
Definition: reclaim_api.c:977
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ force_reconnect()

static void force_reconnect ( struct GNUNET_RECLAIM_Handle handle)
static

Disconnect from service and then reconnect.

Parameters
handleour service

Definition at line 431 of file reclaim_api.c.

References GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, GNUNET_RECLAIM_Handle::mq, GNUNET_RECLAIM_Handle::reconnect_backoff, GNUNET_RECLAIM_Handle::reconnect_task, and reconnect_task().

Referenced by handle_attestation_result(), handle_attribute_result(), and mq_error_handler().

432 {
433  GNUNET_MQ_destroy (handle->mq);
434  handle->mq = NULL;
435  handle->reconnect_backoff =
437  handle->reconnect_task =
440  handle);
441 }
struct GNUNET_SCHEDULER_Task * reconnect_task
Task doing exponential back-off trying to reconnect.
Definition: reclaim_api.c:377
struct GNUNET_MQ_Handle * mq
Connection to service (if available).
Definition: reclaim_api.c:387
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1269
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
struct GNUNET_TIME_Relative reconnect_backoff
Time for next connect retry.
Definition: reclaim_api.c:382
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:833
static void reconnect_task(void *cls)
Reconnect.
Definition: reclaim_api.c:416
Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_it()

static void free_it ( struct GNUNET_RECLAIM_AttributeIterator it)
static

Free it.

Parameters
itentry to free

Definition at line 450 of file reclaim_api.c.

References GNUNET_RECLAIM_AttributeIterator::env, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_discard(), GNUNET_RECLAIM_Operation::h, GNUNET_RECLAIM_AttributeIterator::h, GNUNET_RECLAIM_Handle::it_head, and GNUNET_RECLAIM_Handle::it_tail.

Referenced by GNUNET_RECLAIM_get_attributes_stop(), and handle_attribute_result().

451 {
452  struct GNUNET_RECLAIM_Handle *h = it->h;
453 
455  if (NULL != it->env)
456  GNUNET_MQ_discard (it->env);
457  GNUNET_free (it);
458 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle to the service.
Definition: reclaim_api.c:312
struct GNUNET_RECLAIM_AttributeIterator * it_tail
Tail of active iterations.
Definition: reclaim_api.c:347
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
Definition: mq.c:323
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:228
struct GNUNET_RECLAIM_AttributeIterator * it_head
Head of active iterations.
Definition: reclaim_api.c:342
struct GNUNET_RECLAIM_Handle * h
Main handle to access the service.
Definition: reclaim_api.c:192
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_ait()

static void free_ait ( struct GNUNET_RECLAIM_AttestationIterator ait)
static

Free it.

Parameters
aitentry to free

Definition at line 467 of file reclaim_api.c.

References GNUNET_RECLAIM_Handle::ait_head, GNUNET_RECLAIM_Handle::ait_tail, GNUNET_RECLAIM_AttestationIterator::env, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_discard(), GNUNET_RECLAIM_Operation::h, and GNUNET_RECLAIM_AttestationIterator::h.

Referenced by GNUNET_RECLAIM_get_attestations_stop(), and handle_attestation_result().

468 {
469  struct GNUNET_RECLAIM_Handle *h = ait->h;
470 
472  if (NULL != ait->env)
473  GNUNET_MQ_discard (ait->env);
474  GNUNET_free (ait);
475 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle to the service.
Definition: reclaim_api.c:312
struct GNUNET_MQ_Envelope * env
Envelope of the message to send to the service, if not yet sent.
Definition: reclaim_api.c:295
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
struct GNUNET_RECLAIM_Handle * h
Main handle to access the service.
Definition: reclaim_api.c:259
struct GNUNET_RECLAIM_AttestationIterator * ait_head
Head of active iterations.
Definition: reclaim_api.c:352
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
Definition: mq.c:323
struct GNUNET_RECLAIM_AttestationIterator * ait_tail
Tail of active iterations.
Definition: reclaim_api.c:357
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_op()

static void free_op ( struct GNUNET_RECLAIM_Operation op)
static

Free op.

Parameters
opthe operation to free

Definition at line 484 of file reclaim_api.c.

References GNUNET_RECLAIM_Operation::env, GNUNET_free, and GNUNET_MQ_discard().

Referenced by GNUNET_RECLAIM_cancel(), handle_attestation_result(), handle_attribute_result(), handle_consume_ticket_result(), handle_revoke_ticket_result(), handle_success_response(), and handle_ticket_result().

485 {
486  if (NULL == op)
487  return;
488  if (NULL != op->env)
489  GNUNET_MQ_discard (op->env);
490  GNUNET_free (op);
491 }
struct GNUNET_MQ_Envelope * env
Envelope with the message for this queue entry.
Definition: reclaim_api.c:97
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
Definition: mq.c:323
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mq_error_handler()

static void mq_error_handler ( void *  cls,
enum GNUNET_MQ_Error  error 
)
static

Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.

Not every message queue implementation supports an error handler.

Parameters
clsclosure with the struct GNUNET_GNS_Handle *
errorerror code

Definition at line 503 of file reclaim_api.c.

References GNUNET_RECLAIM_Operation::cls, force_reconnect(), and handle.

Referenced by reconnect().

504 {
505  struct GNUNET_RECLAIM_Handle *handle = cls;
506 
507  force_reconnect (handle);
508 }
Handle to the service.
Definition: reclaim_api.c:312
static void force_reconnect(struct GNUNET_RECLAIM_Handle *handle)
Disconnect from service and then reconnect.
Definition: reclaim_api.c:431
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_success_response()

static void handle_success_response ( void *  cls,
const struct SuccessResultMessage msg 
)
static

Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE.

Parameters
cls
msgthe message we received

Definition at line 519 of file reclaim_api.c.

References _, GNUNET_RECLAIM_Operation::as_cb, GNUNET_RECLAIM_Operation::cls, free_op(), GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_SYSERR, GNUNET_RECLAIM_Operation::h, SuccessResultMessage::id, LOG, GNUNET_RECLAIM_Operation::next, op, GNUNET_RECLAIM_Handle::op_head, SuccessResultMessage::op_result, GNUNET_RECLAIM_Handle::op_tail, GNUNET_RECLAIM_Operation::r_id, and res.

520 {
521  struct GNUNET_RECLAIM_Handle *h = cls;
523  uint32_t r_id = ntohl (msg->id);
524  int res;
525  const char *emsg;
526 
527  for (op = h->op_head; NULL != op; op = op->next)
528  if (op->r_id == r_id)
529  break;
530  if (NULL == op)
531  return;
532 
533  res = ntohl (msg->op_result);
535  "Received SUCCESS_RESPONSE with result %d\n",
536  res);
537 
538  /* TODO: add actual error message to response... */
539  if (GNUNET_SYSERR == res)
540  emsg = _ ("failed to store record\n");
541  else
542  emsg = NULL;
543  if (NULL != op->as_cb)
544  op->as_cb (op->cls, res, emsg);
546  free_op (op);
547 }
#define LOG(kind,...)
Definition: reclaim_api.c:35
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle to the service.
Definition: reclaim_api.c:312
void * cls
Closure for cont or cb.
Definition: reclaim_api.c:107
GNUNET_RECLAIM_ContinuationWithStatus as_cb
Continuation to invoke after attribute store call.
Definition: reclaim_api.c:67
int32_t op_result
GNUNET_SYSERR on failure, GNUNET_OK on success
Definition: reclaim.h:118
Handle for an operation with the service.
Definition: reclaim_api.c:41
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
#define _(String)
GNU gettext support macro.
Definition: platform.h:184
struct GNUNET_RECLAIM_Operation * op_tail
Tail of active operations.
Definition: reclaim_api.c:337
struct GNUNET_RECLAIM_Operation * next
We keep operations in a DLL.
Definition: reclaim_api.c:51
static int res
struct GNUNET_RECLAIM_Operation * op_head
Head of active operations.
Definition: reclaim_api.c:332
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static void free_op(struct GNUNET_RECLAIM_Operation *op)
Free op.
Definition: reclaim_api.c:484
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:113
uint32_t r_id
request id
Definition: reclaim_api.c:102
Here is the call graph for this function:

◆ check_consume_ticket_result()

static int check_consume_ticket_result ( void *  cls,
const struct ConsumeTicketResultMessage msg 
)
static

Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT.

Parameters
cls
msgthe message we received
Returns
GNUNET_OK on success, GNUNET_SYSERR on error

Definition at line 559 of file reclaim_api.c.

References ConsumeTicketResultMessage::attestations_len, ConsumeTicketResultMessage::attrs_len, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, ConsumeTicketResultMessage::header, and GNUNET_MessageHeader::size.

561 {
562  size_t msg_len;
563  size_t attrs_len;
564  size_t attests_len;
565 
566  msg_len = ntohs (msg->header.size);
567  attrs_len = ntohs (msg->attrs_len);
568  attests_len = ntohs (msg->attestations_len);
569  if (msg_len !=
570  sizeof(struct ConsumeTicketResultMessage) + attrs_len + attests_len)
571  {
572  GNUNET_break (0);
573  return GNUNET_SYSERR;
574  }
575  return GNUNET_OK;
576 }
Attribute list is returned from the idp.
Definition: reclaim.h:500
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...
uint16_t attestations_len
Length of attestation data.
Definition: reclaim.h:525
uint16_t attrs_len
Length of serialized attribute data.
Definition: reclaim.h:520
struct GNUNET_MessageHeader header
Message header.
Definition: reclaim.h:505

◆ handle_consume_ticket_result()

static void handle_consume_ticket_result ( void *  cls,
const struct ConsumeTicketResultMessage msg 
)
static

Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT.

Parameters
cls
msgthe message we received

Definition at line 587 of file reclaim_api.c.

References GNUNET_RECLAIM_Operation::atr_cb, GNUNET_RECLAIM_Attribute::attestation, GNUNET_RECLAIM_AttestationListEntry::attestation, ConsumeTicketResultMessage::attestations_len, GNUNET_RECLAIM_AttributeListEntry::attribute, ConsumeTicketResultMessage::attrs_len, GNUNET_RECLAIM_Operation::cls, free_op(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NO, GNUNET_RECLAIM_attestation_list_deserialize(), GNUNET_RECLAIM_attestation_list_destroy(), GNUNET_RECLAIM_attribute_list_deserialize(), GNUNET_RECLAIM_attribute_list_destroy(), GNUNET_RECLAIM_id_is_equal, GNUNET_RECLAIM_id_is_zero, GNUNET_YES, GNUNET_RECLAIM_Operation::h, GNUNET_RECLAIM_Attestation::id, ConsumeTicketResultMessage::id, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_AttestationList::list_head, GNUNET_RECLAIM_Operation::next, GNUNET_RECLAIM_AttributeListEntry::next, GNUNET_RECLAIM_AttestationListEntry::next, op, GNUNET_RECLAIM_Handle::op_head, GNUNET_RECLAIM_Handle::op_tail, and GNUNET_RECLAIM_Operation::r_id.

589 {
590  struct GNUNET_RECLAIM_Handle *h = cls;
592  size_t attrs_len;
593  size_t attests_len;
594  uint32_t r_id = ntohl (msg->id);
595  char *read_ptr;
596 
597  attrs_len = ntohs (msg->attrs_len);
598  attests_len = ntohs (msg->attestations_len);
599  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n");
600 
601 
602  for (op = h->op_head; NULL != op; op = op->next)
603  if (op->r_id == r_id)
604  break;
605  if (NULL == op)
606  return;
607 
608  {
609  struct GNUNET_RECLAIM_AttributeList *attrs;
611  struct GNUNET_RECLAIM_AttestationList *attests;
613  attrs =
614  GNUNET_RECLAIM_attribute_list_deserialize ((char *) &msg[1], attrs_len);
615  read_ptr = ((char *) &msg[1]) + attrs_len;
616  attests =
617  GNUNET_RECLAIM_attestation_list_deserialize (read_ptr, attests_len);
618  if (NULL != op->atr_cb)
619  {
620  if (NULL == attrs)
621  {
622  op->atr_cb (op->cls, &msg->identity, NULL, NULL);
623  }
624  else
625  {
626  for (le = attrs->list_head; NULL != le; le = le->next)
627  {
628  if (GNUNET_NO ==
630  {
631  for (ale = attests->list_head; NULL != ale; ale = ale->next)
632  {
633  if (GNUNET_YES ==
635  &ale->attestation->id))
636  {
637  op->atr_cb (op->cls, &msg->identity,
638  le->attribute, ale->attestation);
639  break;
640  }
641 
642  }
643  }
644  else // No attestations
645  {
646  op->atr_cb (op->cls, &msg->identity,
647  le->attribute, NULL);
648  }
649  }
650  if (NULL != attrs)
652  if (NULL != attests)
654  attrs = NULL;
655  attests = NULL;
656  }
657  op->atr_cb (op->cls, NULL, NULL, NULL);
658  }
660  free_op (op);
661  GNUNET_free (attrs);
662  return;
663  }
664  GNUNET_assert (0);
665 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle to the service.
Definition: reclaim_api.c:312
void * cls
Closure for cont or cb.
Definition: reclaim_api.c:107
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
void GNUNET_RECLAIM_attestation_list_destroy(struct GNUNET_RECLAIM_AttestationList *attestations)
Destroy claim list.
GNUNET_RECLAIM_AttributeTicketResult atr_cb
Attribute result callback.
Definition: reclaim_api.c:77
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:510
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attribute_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
struct GNUNET_RECLAIM_Attestation * attestation
The attestation.
A list of GNUNET_RECLAIM_Attribute structures.
A list of GNUNET_RECLAIM_Attestation structures.
Handle for an operation with the service.
Definition: reclaim_api.c:41
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_Identifier attestation
Referenced ID of Attestation (may be 0 if self-attested)
struct GNUNET_RECLAIM_Operation * op_tail
Tail of active operations.
Definition: reclaim_api.c:337
uint16_t attestations_len
Length of attestation data.
Definition: reclaim.h:525
struct GNUNET_RECLAIM_Operation * next
We keep operations in a DLL.
Definition: reclaim_api.c:51
struct GNUNET_RECLAIM_Identifier id
ID.
struct GNUNET_RECLAIM_AttestationListEntry * list_head
List head.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
struct GNUNET_RECLAIM_Operation * op_head
Head of active operations.
Definition: reclaim_api.c:332
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The public key of the identity.
Definition: reclaim.h:535
#define GNUNET_RECLAIM_id_is_equal(a, b)
uint16_t attrs_len
Length of serialized attribute data.
Definition: reclaim.h:520
#define GNUNET_log(kind,...)
struct GNUNET_RECLAIM_AttestationList * GNUNET_RECLAIM_attestation_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
struct GNUNET_RECLAIM_AttestationListEntry * next
DLL.
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static void free_op(struct GNUNET_RECLAIM_Operation *op)
Free op.
Definition: reclaim_api.c:484
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_RECLAIM_id_is_zero(a)
uint32_t r_id
request id
Definition: reclaim_api.c:102
Here is the call graph for this function:

◆ check_attribute_result()

static int check_attribute_result ( void *  cls,
const struct AttributeResultMessage msg 
)
static

Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT.

Parameters
cls
msgthe message we received
Returns
GNUNET_OK on success, GNUNET_SYSERR on error

Definition at line 677 of file reclaim_api.c.

References AttributeResultMessage::attr_len, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, AttributeResultMessage::header, and GNUNET_MessageHeader::size.

678 {
679  size_t msg_len;
680  size_t attr_len;
681 
682  msg_len = ntohs (msg->header.size);
683  attr_len = ntohs (msg->attr_len);
684  if (msg_len != sizeof(struct AttributeResultMessage) + attr_len)
685  {
686  GNUNET_break (0);
687  return GNUNET_SYSERR;
688  }
689  return GNUNET_OK;
690 }
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...
Attribute is returned from the idp.
Definition: reclaim.h:124
uint16_t attr_len
Length of serialized attribute data.
Definition: reclaim.h:139
struct GNUNET_MessageHeader header
Message header.
Definition: reclaim.h:129

◆ handle_attribute_result()

static void handle_attribute_result ( void *  cls,
const struct AttributeResultMessage msg 
)
static

Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT.

Parameters
cls
msgthe message we received

Definition at line 701 of file reclaim_api.c.

References GNUNET_RECLAIM_Operation::ar_cb, AttributeResultMessage::attr_len, GNUNET_RECLAIM_Operation::cls, GNUNET_RECLAIM_AttributeIterator::finish_cb, GNUNET_RECLAIM_AttributeIterator::finish_cb_cls, force_reconnect(), free_it(), free_op(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_RECLAIM_attribute_deserialize(), GNUNET_RECLAIM_Operation::h, AttributeResultMessage::id, AttributeResultMessage::identity, GNUNET_RECLAIM_Handle::it_head, LOG, GNUNET_RECLAIM_Operation::next, GNUNET_RECLAIM_AttributeIterator::next, op, GNUNET_RECLAIM_Handle::op_head, GNUNET_RECLAIM_Handle::op_tail, GNUNET_RECLAIM_AttributeIterator::proc, GNUNET_RECLAIM_AttributeIterator::proc_cls, GNUNET_RECLAIM_Operation::r_id, and GNUNET_RECLAIM_AttributeIterator::r_id.

702 {
703  static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
704  struct GNUNET_RECLAIM_Handle *h = cls;
707  size_t attr_len;
708  uint32_t r_id = ntohl (msg->id);
709 
710  attr_len = ntohs (msg->attr_len);
711  LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attribute result.\n");
712 
713 
714  for (it = h->it_head; NULL != it; it = it->next)
715  if (it->r_id == r_id)
716  break;
717  for (op = h->op_head; NULL != op; op = op->next)
718  if (op->r_id == r_id)
719  break;
720  if ((NULL == it) && (NULL == op))
721  return;
722 
723  if ((0 ==
724  (memcmp (&msg->identity, &identity_dummy, sizeof(identity_dummy)))))
725  {
726  if ((NULL == it) && (NULL == op))
727  {
728  GNUNET_break (0);
729  force_reconnect (h);
730  return;
731  }
732  if (NULL != it)
733  {
734  if (NULL != it->finish_cb)
735  it->finish_cb (it->finish_cb_cls);
736  free_it (it);
737  }
738  if (NULL != op)
739  {
740  if (NULL != op->ar_cb)
741  op->ar_cb (op->cls, NULL, NULL);
743  free_op (op);
744  }
745  return;
746  }
747 
748  {
749  struct GNUNET_RECLAIM_Attribute *attr;
750  attr = GNUNET_RECLAIM_attribute_deserialize ((char *) &msg[1], attr_len);
751  if (NULL != it)
752  {
753  if (NULL != it->proc)
754  it->proc (it->proc_cls, &msg->identity, attr);
755  }
756  else if (NULL != op)
757  {
758  if (NULL != op->ar_cb)
759  op->ar_cb (op->cls, &msg->identity, attr);
760  }
761  GNUNET_free (attr);
762  return;
763  }
764  GNUNET_assert (0);
765 }
#define LOG(kind,...)
Definition: reclaim_api.c:35
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle to the service.
Definition: reclaim_api.c:312
void * cls
Closure for cont or cb.
Definition: reclaim_api.c:107
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:134
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:202
Private ECC key encoded for transmission.
Handle for an operation with the service.
Definition: reclaim_api.c:41
GNUNET_RECLAIM_AttributeResult proc
The continuation to call with the results.
Definition: reclaim_api.c:207
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
void * proc_cls
Closure for proc.
Definition: reclaim_api.c:212
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static void force_reconnect(struct GNUNET_RECLAIM_Handle *handle)
Disconnect from service and then reconnect.
Definition: reclaim_api.c:431
struct GNUNET_RECLAIM_Operation * op_tail
Tail of active operations.
Definition: reclaim_api.c:337
Handle for a attribute iterator operation.
Definition: reclaim_api.c:177
struct GNUNET_RECLAIM_AttributeIterator * next
Kept in a DLL.
Definition: reclaim_api.c:182
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:238
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_deserialize(const char *data, size_t data_size)
Deserialize an attribute.
struct GNUNET_RECLAIM_Operation * next
We keep operations in a DLL.
Definition: reclaim_api.c:51
struct GNUNET_RECLAIM_Operation * op_head
Head of active operations.
Definition: reclaim_api.c:332
GNUNET_RECLAIM_AttributeResult ar_cb
Attribute result callback.
Definition: reclaim_api.c:72
struct GNUNET_RECLAIM_AttributeIterator * it_head
Head of active iterations.
Definition: reclaim_api.c:342
uint16_t attr_len
Length of serialized attribute data.
Definition: reclaim.h:139
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The public key of the identity.
Definition: reclaim.h:154
static void free_it(struct GNUNET_RECLAIM_AttributeIterator *it)
Free it.
Definition: reclaim_api.c:450
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static void free_op(struct GNUNET_RECLAIM_Operation *op)
Free op.
Definition: reclaim_api.c:484
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:197
#define GNUNET_free(ptr)
Wrapper around free.
uint32_t r_id
request id
Definition: reclaim_api.c:102
Here is the call graph for this function:

◆ check_attestation_result()

static int check_attestation_result ( void *  cls,
const struct AttestationResultMessage msg 
)
static

Handle an incoming message of type #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT.

Parameters
cls
msgthe message we received
Returns
GNUNET_OK on success, GNUNET_SYSERR on error

Definition at line 777 of file reclaim_api.c.

References AttestationResultMessage::attestation_len, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, AttestationResultMessage::header, and GNUNET_MessageHeader::size.

778 {
779  size_t msg_len;
780  size_t attest_len;
781 
782  msg_len = ntohs (msg->header.size);
783  attest_len = ntohs (msg->attestation_len);
784  if (msg_len != sizeof(struct AttestationResultMessage) + attest_len)
785  {
786  GNUNET_break (0);
787  return GNUNET_SYSERR;
788  }
789  return GNUNET_OK;
790 }
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...
uint16_t attestation_len
Length of serialized attribute data.
Definition: reclaim.h:179
struct GNUNET_MessageHeader header
Message header.
Definition: reclaim.h:169
Attestation is returned from the idp.
Definition: reclaim.h:164

◆ handle_attestation_result()

static void handle_attestation_result ( void *  cls,
const struct AttestationResultMessage msg 
)
static

Handle an incoming message of type #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT.

Parameters
cls
msgthe message we received

Definition at line 801 of file reclaim_api.c.

References GNUNET_RECLAIM_Handle::ait_head, GNUNET_RECLAIM_Operation::at_cb, AttestationResultMessage::attestation_len, GNUNET_RECLAIM_Operation::cls, GNUNET_RECLAIM_AttestationIterator::finish_cb, GNUNET_RECLAIM_AttestationIterator::finish_cb_cls, force_reconnect(), free_ait(), free_op(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_RECLAIM_attestation_deserialize(), GNUNET_RECLAIM_Operation::h, AttestationResultMessage::id, AttestationResultMessage::identity, LOG, GNUNET_RECLAIM_Operation::next, GNUNET_RECLAIM_AttestationIterator::next, op, GNUNET_RECLAIM_Handle::op_head, GNUNET_RECLAIM_Handle::op_tail, GNUNET_RECLAIM_AttestationIterator::proc, GNUNET_RECLAIM_AttestationIterator::proc_cls, GNUNET_RECLAIM_Operation::r_id, and GNUNET_RECLAIM_AttestationIterator::r_id.

803 {
804  static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
805  struct GNUNET_RECLAIM_Handle *h = cls;
808  size_t att_len;
809  uint32_t r_id = ntohl (msg->id);
810 
811  att_len = ntohs (msg->attestation_len);
812  LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attestation result.\n");
813 
814 
815  for (it = h->ait_head; NULL != it; it = it->next)
816  if (it->r_id == r_id)
817  break;
818  for (op = h->op_head; NULL != op; op = op->next)
819  if (op->r_id == r_id)
820  break;
821  if ((NULL == it) && (NULL == op))
822  return;
823 
824  if ((0 ==
825  (memcmp (&msg->identity, &identity_dummy, sizeof(identity_dummy)))))
826  {
827  if ((NULL == it) && (NULL == op))
828  {
829  GNUNET_break (0);
830  force_reconnect (h);
831  return;
832  }
833  if (NULL != it)
834  {
835  if (NULL != it->finish_cb)
836  it->finish_cb (it->finish_cb_cls);
837  free_ait (it);
838  }
839  if (NULL != op)
840  {
841  if (NULL != op->at_cb)
842  op->at_cb (op->cls, NULL, NULL);
844  free_op (op);
845  }
846  return;
847  }
848 
849  {
850  struct GNUNET_RECLAIM_Attestation *att;
851  att = GNUNET_RECLAIM_attestation_deserialize ((char *) &msg[1], att_len);
852 
853  if (NULL != it)
854  {
855  if (NULL != it->proc)
856  it->proc (it->proc_cls, &msg->identity, att);
857  }
858  else if (NULL != op)
859  {
860  if (NULL != op->at_cb)
861  op->at_cb (op->cls, &msg->identity, att);
862  }
863  GNUNET_free (att);
864  return;
865  }
866  GNUNET_assert (0);
867 }
#define LOG(kind,...)
Definition: reclaim_api.c:35
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle to the service.
Definition: reclaim_api.c:312
void * cls
Closure for cont or cb.
Definition: reclaim_api.c:107
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:264
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Private ECC key encoded for transmission.
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:305
Handle for an operation with the service.
Definition: reclaim_api.c:41
GNUNET_RECLAIM_AttestationResult at_cb
Attestation result callback.
Definition: reclaim_api.c:82
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:174
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:269
static void force_reconnect(struct GNUNET_RECLAIM_Handle *handle)
Disconnect from service and then reconnect.
Definition: reclaim_api.c:431
struct GNUNET_RECLAIM_AttestationIterator * ait_head
Head of active iterations.
Definition: reclaim_api.c:352
struct GNUNET_RECLAIM_Operation * op_tail
Tail of active operations.
Definition: reclaim_api.c:337
struct GNUNET_RECLAIM_Operation * next
We keep operations in a DLL.
Definition: reclaim_api.c:51
struct GNUNET_RECLAIM_Attestation * GNUNET_RECLAIM_attestation_deserialize(const char *data, size_t data_size)
Deserialize an attestation.
uint16_t attestation_len
Length of serialized attribute data.
Definition: reclaim.h:179
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The public key of the identity.
Definition: reclaim.h:189
static void free_ait(struct GNUNET_RECLAIM_AttestationIterator *ait)
Free it.
Definition: reclaim_api.c:467
struct GNUNET_RECLAIM_Operation * op_head
Head of active operations.
Definition: reclaim_api.c:332
struct GNUNET_RECLAIM_AttestationIterator * next
Kept in a DLL.
Definition: reclaim_api.c:249
Handle for a attestation iterator operation.
Definition: reclaim_api.c:244
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static void free_op(struct GNUNET_RECLAIM_Operation *op)
Free op.
Definition: reclaim_api.c:484
GNUNET_RECLAIM_AttestationResult proc
The continuation to call with the results.
Definition: reclaim_api.c:274
void * proc_cls
Closure for proc.
Definition: reclaim_api.c:279
#define GNUNET_free(ptr)
Wrapper around free.
uint32_t r_id
request id
Definition: reclaim_api.c:102
Here is the call graph for this function:

◆ handle_ticket_result()

static void handle_ticket_result ( void *  cls,
const struct TicketResultMessage msg 
)
static

Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT.

Parameters
cls
msgthe message we received

Definition at line 878 of file reclaim_api.c.

References GNUNET_RECLAIM_Operation::cls, GNUNET_RECLAIM_TicketIterator::cls, GNUNET_RECLAIM_TicketIterator::finish_cb, GNUNET_RECLAIM_TicketIterator::finish_cb_cls, free_op(), GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_free, handle, TicketResultMessage::id, GNUNET_RECLAIM_Operation::next, GNUNET_RECLAIM_TicketIterator::next, op, GNUNET_RECLAIM_Handle::op_head, GNUNET_RECLAIM_Handle::op_tail, GNUNET_RECLAIM_Operation::r_id, GNUNET_RECLAIM_TicketIterator::r_id, TicketResultMessage::ticket, GNUNET_RECLAIM_Handle::ticket_it_head, GNUNET_RECLAIM_Handle::ticket_it_tail, GNUNET_RECLAIM_Operation::tr_cb, and GNUNET_RECLAIM_TicketIterator::tr_cb.

879 {
880  struct GNUNET_RECLAIM_Handle *handle = cls;
883  uint32_t r_id = ntohl (msg->id);
884  static const struct GNUNET_RECLAIM_Ticket ticket;
885 
886  for (op = handle->op_head; NULL != op; op = op->next)
887  if (op->r_id == r_id)
888  break;
889  for (it = handle->ticket_it_head; NULL != it; it = it->next)
890  if (it->r_id == r_id)
891  break;
892  if ((NULL == op) && (NULL == it))
893  return;
894  if (NULL != op)
895  {
896  GNUNET_CONTAINER_DLL_remove (handle->op_head, handle->op_tail, op);
897  if (0 ==
898  memcmp (&msg->ticket, &ticket, sizeof(struct GNUNET_RECLAIM_Ticket)))
899  {
900  if (NULL != op->tr_cb)
901  op->tr_cb (op->cls, NULL);
902  }
903  else
904  {
905  if (NULL != op->tr_cb)
906  op->tr_cb (op->cls, &msg->ticket);
907  }
908  free_op (op);
909  return;
910  }
911  else if (NULL != it)
912  {
913  if (0 ==
914  memcmp (&msg->ticket, &ticket, sizeof(struct GNUNET_RECLAIM_Ticket)))
915  {
917  handle->ticket_it_tail,
918  it);
919  it->finish_cb (it->finish_cb_cls);
920  GNUNET_free (it);
921  }
922  else
923  {
924  if (NULL != it->tr_cb)
925  it->tr_cb (it->cls, &msg->ticket);
926  }
927  return;
928  }
929  GNUNET_break (0);
930 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_RECLAIM_TicketIterator * ticket_it_tail
Tail of active iterations.
Definition: reclaim_api.c:367
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:463
Handle to the service.
Definition: reclaim_api.c:312
The authorization ticket.
struct GNUNET_RECLAIM_Ticket ticket
The new ticket.
Definition: reclaim.h:468
void * cls
Closure for cont or cb.
Definition: reclaim_api.c:107
void * finish_cb_cls
Closure for finish_cb.
Definition: reclaim_api.c:139
Handle for an operation with the service.
Definition: reclaim_api.c:41
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
struct GNUNET_RECLAIM_Operation * op_tail
Tail of active operations.
Definition: reclaim_api.c:337
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
uint32_t r_id
The operation id this zone iteration operation has.
Definition: reclaim_api.c:170
struct GNUNET_RECLAIM_Operation * next
We keep operations in a DLL.
Definition: reclaim_api.c:51
void * cls
Closure for tr_cb.
Definition: reclaim_api.c:149
GNUNET_RECLAIM_TicketCallback tr_cb
Ticket result callback.
Definition: reclaim_api.c:92
struct GNUNET_RECLAIM_Operation * op_head
Head of active operations.
Definition: reclaim_api.c:332
struct GNUNET_RECLAIM_TicketIterator * next
Kept in a DLL.
Definition: reclaim_api.c:119
GNUNET_RECLAIM_TicketCallback tr_cb
The continuation to call with the results.
Definition: reclaim_api.c:144
Handle for a ticket iterator operation.
Definition: reclaim_api.c:114
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static void free_op(struct GNUNET_RECLAIM_Operation *op)
Free op.
Definition: reclaim_api.c:484
GNUNET_SCHEDULER_TaskCallback finish_cb
Function to call on completion.
Definition: reclaim_api.c:134
struct GNUNET_RECLAIM_TicketIterator * ticket_it_head
Head of active iterations.
Definition: reclaim_api.c:362
#define GNUNET_free(ptr)
Wrapper around free.
uint32_t r_id
request id
Definition: reclaim_api.c:102
Here is the call graph for this function:

◆ handle_revoke_ticket_result()

static void handle_revoke_ticket_result ( void *  cls,
const struct RevokeTicketResultMessage msg 
)
static

Handle an incoming message of type GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT.

Parameters
cls
msgthe message we received

Definition at line 941 of file reclaim_api.c.

References GNUNET_RECLAIM_Operation::cls, free_op(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_RECLAIM_Operation::h, RevokeTicketResultMessage::id, LOG, GNUNET_RECLAIM_Operation::next, op, GNUNET_RECLAIM_Handle::op_head, GNUNET_RECLAIM_Handle::op_tail, GNUNET_RECLAIM_Operation::r_id, GNUNET_RECLAIM_Operation::rvk_cb, and RevokeTicketResultMessage::success.

943 {
944  struct GNUNET_RECLAIM_Handle *h = cls;
946  uint32_t r_id = ntohl (msg->id);
947  int32_t success;
948 
949  LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing revocation result.\n");
950 
951 
952  for (op = h->op_head; NULL != op; op = op->next)
953  if (op->r_id == r_id)
954  break;
955  if (NULL == op)
956  return;
957  success = ntohl (msg->success);
958  {
959  if (NULL != op->rvk_cb)
960  {
961  op->rvk_cb (op->cls, success, NULL);
962  }
964  free_op (op);
965  return;
966  }
967  GNUNET_assert (0);
968 }
#define LOG(kind,...)
Definition: reclaim_api.c:35
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
Handle to the service.
Definition: reclaim_api.c:312
void * cls
Closure for cont or cb.
Definition: reclaim_api.c:107
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Handle for an operation with the service.
Definition: reclaim_api.c:41
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
GNUNET_RECLAIM_ContinuationWithStatus rvk_cb
Revocation result callback.
Definition: reclaim_api.c:87
struct GNUNET_RECLAIM_Operation * op_tail
Tail of active operations.
Definition: reclaim_api.c:337
struct GNUNET_RECLAIM_Operation * next
We keep operations in a DLL.
Definition: reclaim_api.c:51
struct GNUNET_RECLAIM_Operation * op_head
Head of active operations.
Definition: reclaim_api.c:332
uint32_t id
Unique identifier for this request (for key collisions).
Definition: reclaim.h:441
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static void free_op(struct GNUNET_RECLAIM_Operation *op)
Free op.
Definition: reclaim_api.c:484
uint32_t success
Revocation result.
Definition: reclaim.h:446
uint32_t r_id
request id
Definition: reclaim_api.c:102
Here is the call graph for this function: