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

Identity Provider utility. More...

#include "platform.h"
#include <inttypes.h>
#include "gnunet_util_lib.h"
#include "gnunet_identity_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_reclaim_service.h"
#include "gnunet_signatures.h"
Include dependency graph for gnunet-reclaim.c:

Go to the source code of this file.

Functions

static void do_cleanup (void *cls)
 
static void ticket_issue_cb (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_RECLAIM_PresentationList *presentations)
 
static void store_cont (void *cls, int32_t success, const char *emsg)
 
static void process_attrs (void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Presentation *presentation)
 
static void ticket_iter_err (void *cls)
 
static void ticket_iter_fin (void *cls)
 
static void ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
 
static void iter_error (void *cls)
 
static void timeout_task (void *cls)
 
static void process_rvk (void *cls, int success, const char *msg)
 
static void process_delete (void *cls, int success, const char *msg)
 
static void iter_finished (void *cls)
 
static void iter_cb (void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)
 
static void cred_iter_finished (void *cls)
 
static void cred_iter_cb (void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Credential *cred)
 
static void start_process ()
 
static void ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
 
int main (int argc, char *const argv[])
 

Variables

static int ret
 return value More...
 
static int list
 List attribute flag. More...
 
static int list_credentials
 List credentials flag. More...
 
static char * credential_id
 Credential ID string. More...
 
static struct GNUNET_RECLAIM_Identifier credential
 Credential ID. More...
 
static char * credential_name
 Credential name. More...
 
static char * credential_type
 Credential type. More...
 
static int credential_exists
 Credential exists. More...
 
static char * rp
 Relying party. More...
 
static char * attr_name
 The attribute. More...
 
static char * attr_value
 Attribute value. More...
 
static char * issue_attrs
 Attributes to issue. More...
 
static char * consume_ticket
 Ticket to consume. More...
 
static char * type_str
 Attribute type. More...
 
static char * revoke_ticket
 Ticket to revoke. More...
 
static int list_tickets
 Ticket listing. More...
 
static char * ego_name
 Ego name. More...
 
static struct GNUNET_IDENTITY_Handleidentity_handle
 Identity handle. More...
 
static struct GNUNET_RECLAIM_Handlereclaim_handle
 reclaim handle More...
 
static struct GNUNET_RECLAIM_Operationreclaim_op
 reclaim operation More...
 
static struct GNUNET_RECLAIM_AttributeIteratorattr_iterator
 Attribute iterator. More...
 
static struct GNUNET_RECLAIM_CredentialIteratorcred_iterator
 Credential iterator. More...
 
static struct GNUNET_RECLAIM_TicketIteratorticket_iterator
 Ticket iterator. More...
 
static const struct GNUNET_IDENTITY_PrivateKeypkey
 ego private key More...
 
static struct GNUNET_IDENTITY_PublicKey rp_key
 rp public key More...
 
static struct GNUNET_RECLAIM_Ticket ticket
 Ticket to consume. More...
 
static struct GNUNET_RECLAIM_AttributeListattr_list
 Attribute list. More...
 
static struct GNUNET_TIME_Relative exp_interval
 Attribute expiration interval. More...
 
static struct GNUNET_SCHEDULER_Tasktimeout
 Timeout task. More...
 
static struct GNUNET_SCHEDULER_Taskcleanup_task
 Cleanup task. More...
 
struct GNUNET_RECLAIM_Attributeclaim
 Claim to store. More...
 
static char * attr_delete
 Claim to delete. More...
 
static struct GNUNET_RECLAIM_Attributeattr_to_delete
 Claim object to delete. More...
 
static int init = GNUNET_YES
 

Detailed Description

Identity Provider utility.

Author
Martin Schanzenbach

Definition in file gnunet-reclaim.c.

Function Documentation

◆ do_cleanup()

static void do_cleanup ( void *  cls)
static

Definition at line 203 of file gnunet-reclaim.c.

References credential_type, GNUNET_free, GNUNET_IDENTITY_disconnect(), GNUNET_RECLAIM_cancel(), GNUNET_RECLAIM_disconnect(), GNUNET_RECLAIM_get_attributes_stop(), GNUNET_RECLAIM_get_credentials_stop(), GNUNET_RECLAIM_ticket_iteration_stop(), and GNUNET_SCHEDULER_cancel().

Referenced by cred_iter_finished(), iter_error(), iter_finished(), process_attrs(), process_delete(), process_rvk(), start_process(), store_cont(), ticket_issue_cb(), ticket_iter_err(), ticket_iter_fin(), and timeout_task().

204 {
205  cleanup_task = NULL;
206  if (NULL != timeout)
208  if (NULL != reclaim_op)
210  if (NULL != attr_iterator)
212  if (NULL != cred_iterator)
214  if (NULL != ticket_iterator)
216  if (NULL != reclaim_handle)
218  if (NULL != identity_handle)
220  if (NULL != attr_list)
222  if (NULL != attr_to_delete)
224  if (NULL == credential_type)
226 }
static char * credential_type
Credential type.
void GNUNET_RECLAIM_get_credentials_stop(struct GNUNET_RECLAIM_CredentialIterator *ait)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1509
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
void GNUNET_RECLAIM_disconnect(struct GNUNET_RECLAIM_Handle *h)
Disconnect from identity provider service.
Definition: reclaim_api.c:1104
void GNUNET_RECLAIM_cancel(struct GNUNET_RECLAIM_Operation *op)
Cancel an identity provider operation.
Definition: reclaim_api.c:1089
void GNUNET_RECLAIM_ticket_iteration_stop(struct GNUNET_RECLAIM_TicketIterator *it)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1701
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket iterator.
static struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute list.
static struct GNUNET_SCHEDULER_Task * timeout
Timeout task.
static struct GNUNET_IDENTITY_Handle * identity_handle
Identity handle.
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:921
static struct GNUNET_RECLAIM_Attribute * attr_to_delete
Claim object to delete.
static struct GNUNET_RECLAIM_CredentialIterator * cred_iterator
Credential iterator.
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
void GNUNET_RECLAIM_get_attributes_stop(struct GNUNET_RECLAIM_AttributeIterator *it)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1398
#define GNUNET_free(ptr)
Wrapper around free.
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:

◆ ticket_issue_cb()

static void ticket_issue_cb ( void *  cls,
const struct GNUNET_RECLAIM_Ticket ticket,
const struct GNUNET_RECLAIM_PresentationList presentations 
)
static

Definition at line 230 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_free, GNUNET_SCHEDULER_add_now(), and GNUNET_STRINGS_data_to_string_alloc().

Referenced by iter_finished().

233 {
234  char *ticket_str;
235 
236  reclaim_op = NULL;
237  if (NULL != ticket)
238  {
239  ticket_str =
241  sizeof(
242  struct GNUNET_RECLAIM_Ticket));
243  printf ("%s\n", ticket_str);
244  GNUNET_free (ticket_str);
245  }
247 }
The authorization ticket.
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
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 struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
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_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ store_cont()

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

Definition at line 251 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_SCHEDULER_add_now(), and GNUNET_SYSERR.

Referenced by cred_iter_finished(), and iter_finished().

252 {
253  reclaim_op = NULL;
254  if (GNUNET_SYSERR == success)
255  {
256  fprintf (stderr, "%s\n", emsg);
257  }
259 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
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 struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_attrs()

static void process_attrs ( void *  cls,
const struct GNUNET_IDENTITY_PublicKey identity,
const struct GNUNET_RECLAIM_Attribute attr,
const struct GNUNET_RECLAIM_Presentation presentation 
)
static

Definition at line 263 of file gnunet-reclaim.c.

References GNUNET_RECLAIM_AttributeListEntry::attribute, GNUNET_RECLAIM_Attribute::data, GNUNET_RECLAIM_Attribute::data_size, do_cleanup(), GNUNET_RECLAIM_Attribute::flag, GNUNET_free, GNUNET_RECLAIM_attribute_number_to_typename(), GNUNET_RECLAIM_attribute_value_to_string(), GNUNET_RECLAIM_presentation_get_attributes(), GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_Attribute::id, id, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_Attribute::name, GNUNET_RECLAIM_AttributeListEntry::next, ret, and GNUNET_RECLAIM_Attribute::type.

Referenced by iter_finished().

267 {
268  char *value_str;
269  char *id;
270  const char *attr_type;
271 
272  if (NULL == identity)
273  {
274  reclaim_op = NULL;
276  return;
277  }
278  if (NULL == attr)
279  {
280  ret = 1;
281  return;
282  }
284  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
285  value_str = NULL;
286  if (NULL == presentation)
287  {
289  attr->data,
290  attr->data_size);
291  }
292  else
293  {
297 
298  for (ale = al->list_head; NULL != ale; ale = ale->next)
299  {
300  if (0 != strncmp (attr->data, ale->attribute->name, attr->data_size))
301  continue;
302  value_str
304  ale->attribute->data,
305  ale->attribute->data_size);
306  break;
307  }
308  }
309  fprintf (stdout,
310  "Name: %s; Value: %s (%s); Flag %u; ID: %s %s\n",
311  attr->name,
312  (NULL != value_str) ? value_str : "???",
313  attr_type,
314  attr->flag,
315  id,
316  (NULL == presentation) ? "" : "(ATTESTED)");
317  GNUNET_free (value_str);
318  GNUNET_free (id);
319 }
static void do_cleanup(void *cls)
const char * name
The name of the attribute.
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
A list of GNUNET_RECLAIM_Attribute structures.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_presentation_get_attributes(const struct GNUNET_RECLAIM_Presentation *cred)
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1296
struct GNUNET_RECLAIM_Identifier id
ID.
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
const char * GNUNET_RECLAIM_attribute_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
const void * data
Binary value stored as attribute value.
char * GNUNET_RECLAIM_attribute_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attribute to a string.
uint32_t type
Type of Claim.
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
static int ret
return value
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_iter_err()

static void ticket_iter_err ( void *  cls)
static

Definition at line 323 of file gnunet-reclaim.c.

References do_cleanup(), and GNUNET_SCHEDULER_add_now().

Referenced by start_process().

324 {
325  ticket_iterator = NULL;
326  fprintf (stderr, "Failed to iterate over tickets\n");
328 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket 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_fin()

static void ticket_iter_fin ( void *  cls)
static

Definition at line 332 of file gnunet-reclaim.c.

References do_cleanup(), and GNUNET_SCHEDULER_add_now().

Referenced by start_process().

333 {
334  ticket_iterator = NULL;
336 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket 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()

static void ticket_iter ( void *  cls,
const struct GNUNET_RECLAIM_Ticket ticket 
)
static

Definition at line 340 of file gnunet-reclaim.c.

References GNUNET_RECLAIM_Ticket::audience, GNUNET_free, GNUNET_RECLAIM_ticket_iteration_next(), GNUNET_STRINGS_data_to_string_alloc(), and GNUNET_RECLAIM_Ticket::rnd.

Referenced by start_process().

341 {
342  char *aud;
343  char *ref;
344  char *tkt;
345 
346  aud =
348  sizeof(struct
350  ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
351  tkt =
353  sizeof(struct GNUNET_RECLAIM_Ticket));
354  fprintf (stdout, "Ticket: %s | ID: %s | Audience: %s\n", tkt, ref, aud);
355  GNUNET_free (aud);
356  GNUNET_free (ref);
357  GNUNET_free (tkt);
359 }
The authorization ticket.
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...
Definition: reclaim_api.c:1681
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket iterator.
An identity key as per LSD0001.
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_IDENTITY_PublicKey audience
The ticket audience (= relying party)
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_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iter_error()

static void iter_error ( void *  cls)
static

Definition at line 363 of file gnunet-reclaim.c.

References do_cleanup(), and GNUNET_SCHEDULER_add_now().

Referenced by cred_iter_finished(), and start_process().

364 {
365  attr_iterator = NULL;
366  cred_iterator = NULL;
367  fprintf (stderr, "Failed\n");
368 
370 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute 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
static struct GNUNET_RECLAIM_CredentialIterator * cred_iterator
Credential iterator.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeout_task()

static void timeout_task ( void *  cls)
static

Definition at line 374 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_SCHEDULER_add_now(), and ret.

Referenced by iter_finished().

375 {
376  timeout = NULL;
377  ret = 1;
378  fprintf (stderr, "Timeout\n");
379  if (NULL == cleanup_task)
381 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
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 struct GNUNET_SCHEDULER_Task * timeout
Timeout task.
static int ret
return value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_rvk()

static void process_rvk ( void *  cls,
int  success,
const char *  msg 
)
static

Definition at line 385 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), and ret.

Referenced by iter_finished().

386 {
387  reclaim_op = NULL;
388  if (GNUNET_OK != success)
389  {
390  fprintf (stderr, "Revocation failed.\n");
391  ret = 1;
392  }
394 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
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 struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
static int ret
return value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_delete()

static void process_delete ( void *  cls,
int  success,
const char *  msg 
)
static

Definition at line 398 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), and ret.

Referenced by iter_finished().

399 {
400  reclaim_op = NULL;
401  if (GNUNET_OK != success)
402  {
403  fprintf (stderr, "Deletion failed.\n");
404  ret = 1;
405  }
407 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
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 struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
static int ret
return value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iter_finished()

static void iter_finished ( void *  cls)
static

Definition at line 411 of file gnunet-reclaim.c.

References attr_delete, attr_name, attr_value, consume_ticket, credential, GNUNET_RECLAIM_Attribute::credential, credential_id, data, GNUNET_RECLAIM_Attribute::data, GNUNET_RECLAIM_Attribute::data_size, data_size, do_cleanup(), exp_interval, GNUNET_assert, GNUNET_free, GNUNET_RECLAIM_attribute_delete(), GNUNET_RECLAIM_attribute_new(), GNUNET_RECLAIM_attribute_store(), GNUNET_RECLAIM_attribute_string_to_value(), GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING, GNUNET_RECLAIM_attribute_typename_to_number(), GNUNET_RECLAIM_ticket_consume(), GNUNET_RECLAIM_ticket_issue(), GNUNET_RECLAIM_ticket_revoke(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_SECONDS, issue_attrs, list, process_attrs(), process_delete(), process_rvk(), revoke_ticket, rp_key, store_cont(), ticket, ticket_issue_cb(), timeout_task(), type, GNUNET_RECLAIM_Attribute::type, and type_str.

Referenced by cred_iter_finished().

412 {
413  char *data;
414  size_t data_size;
415  int type;
416 
417  attr_iterator = NULL;
418  if (list)
419  {
421  return;
422  }
423 
424  if (issue_attrs)
425  {
427  pkey,
428  &rp_key,
429  attr_list,
431  NULL);
432  return;
433  }
434  if (consume_ticket)
435  {
437  pkey,
438  &ticket,
439  &process_attrs,
440  NULL);
443  &timeout_task,
444  NULL);
445  return;
446  }
447  if (revoke_ticket)
448  {
450  pkey,
451  &ticket,
452  &process_rvk,
453  NULL);
454  return;
455  }
456  if (attr_delete)
457  {
458  if (NULL == attr_to_delete)
459  {
460  fprintf (stdout, "No such attribute ``%s''\n", attr_delete);
462  return;
463  }
465  pkey,
468  NULL);
469  return;
470  }
471  if (attr_name)
472  {
473  if (NULL == type_str)
475  else
477 
480  attr_value,
481  (void **) &data,
482  &data_size));
483  if (NULL != claim)
484  {
485  claim->type = type;
486  claim->data = data;
488  }
489  else
490  {
491  claim =
492  GNUNET_RECLAIM_attribute_new (attr_name, NULL, type, data, data_size);
493  }
494  if (NULL != credential_id)
495  {
497  }
499  pkey,
500  claim,
501  &exp_interval,
502  &store_cont,
503  NULL);
504  GNUNET_free (data);
505  GNUNET_free (claim);
506  return;
507  }
509 }
static char * consume_ticket
Ticket to consume.
static const struct GNUNET_IDENTITY_PrivateKey * pkey
ego private key
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_new(const char *attr_name, const struct GNUNET_RECLAIM_Identifier *credential, uint32_t type, const void *data, size_t data_size)
Create a new attribute claim.
static void do_cleanup(void *cls)
static void store_cont(void *cls, int32_t success, const char *emsg)
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static char * attr_delete
Claim to delete.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_TIME_UNIT_SECONDS
One second.
static char * credential_id
Credential ID string.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_consume(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls)
Consumes an issued ticket.
Definition: reclaim_api.c:1591
static struct GNUNET_TIME_Relative exp_interval
Attribute expiration interval.
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
static void ticket_issue_cb(void *cls, const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_RECLAIM_PresentationList *presentations)
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute list.
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
static char * attr_value
Attribute value.
static char * attr_name
The attribute.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1296
static struct GNUNET_SCHEDULER_Task * timeout
Timeout task.
uint32_t GNUNET_RECLAIM_attribute_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:442
size_t data_size
Number of bytes in data.
static char * issue_attrs
Attributes to issue.
static void process_attrs(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Presentation *presentation)
static struct GNUNET_RECLAIM_Attribute * attr_to_delete
Claim object to delete.
int GNUNET_RECLAIM_attribute_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a &#39;claim&#39; of an attribute to the binary representation.
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
static char * type_str
Attribute type.
static void process_delete(void *cls, int success, const char *msg)
static struct GNUNET_IDENTITY_PublicKey rp_key
rp public key
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_delete(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Delete an attribute.
Definition: reclaim_api.c:1182
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_revoke(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
Revoked an issued ticket.
Definition: reclaim_api.c:1732
static void process_rvk(void *cls, int success, const char *msg)
const void * data
Binary value stored as attribute value.
uint32_t type
Type of Claim.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Store an attribute.
Definition: reclaim_api.c:1135
static int list
List attribute flag.
static char * revoke_ticket
Ticket to revoke.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_issue(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *iss, const struct GNUNET_IDENTITY_PublicKey *rp, const struct GNUNET_RECLAIM_AttributeList *attrs, GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls)
Issues a ticket to a relying party.
Definition: reclaim_api.c:1542
uint32_t data
The data value.
static void timeout_task(void *cls)
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iter_cb()

static void iter_cb ( void *  cls,
const struct GNUNET_IDENTITY_PublicKey identity,
const struct GNUNET_RECLAIM_Attribute attr 
)
static

Definition at line 513 of file gnunet-reclaim.c.

References attr_delete, attr_name, GNUNET_RECLAIM_AttributeListEntry::attribute, GNUNET_RECLAIM_Attribute::credential, GNUNET_RECLAIM_Attribute::data, GNUNET_RECLAIM_Attribute::data_size, GNUNET_RECLAIM_Attribute::flag, GNUNET_CONTAINER_DLL_insert, GNUNET_free, GNUNET_new, GNUNET_RECLAIM_attribute_new(), GNUNET_RECLAIM_attribute_number_to_typename(), GNUNET_RECLAIM_attribute_value_to_string(), GNUNET_RECLAIM_get_attributes_next(), GNUNET_RECLAIM_id_is_zero, GNUNET_strdup, GNUNET_STRINGS_data_to_string_alloc(), GNUNET_YES, GNUNET_RECLAIM_Attribute::id, id, issue_attrs, list, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_AttributeList::list_tail, GNUNET_RECLAIM_Attribute::name, and GNUNET_RECLAIM_Attribute::type.

Referenced by cred_iter_finished().

516 {
518  char *attrs_tmp;
519  char *attr_str;
520  char *label;
521  char *id;
522  const char *attr_type;
523 
524  if ((NULL != attr_name) && (NULL != claim))
525  {
526  if (0 == strcasecmp (attr_name, attr->name))
527  {
529  &attr->credential,
530  attr->type,
531  attr->data,
532  attr->data_size);
533  }
534  }
535  else if (issue_attrs)
536  {
537  attrs_tmp = GNUNET_strdup (issue_attrs);
538  attr_str = strtok (attrs_tmp, ",");
539  while (NULL != attr_str)
540  {
541  if (0 != strcasecmp (attr_str, attr->name))
542  {
543  attr_str = strtok (NULL, ",");
544  continue;
545  }
548  &attr->credential,
549  attr->type,
550  attr->data,
551  attr->data_size);
552  le->attribute->flag = attr->flag;
553  le->attribute->id = attr->id;
556  le);
557  break;
558  }
559  GNUNET_free (attrs_tmp);
560  }
561  else if (attr_delete && (NULL == attr_to_delete))
562  {
563  label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
564  if (0 == strcasecmp (attr_delete, label))
565  {
567  &attr->credential,
568  attr->type,
569  attr->data,
570  attr->data_size);
571  attr_to_delete->id = attr->id;
572  }
573  GNUNET_free (label);
574  }
575  else if (list)
576  {
578  attr->data,
579  attr->data_size);
581  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
583  {
584  fprintf (stdout,
585  "%s: ``%s'' (%s); ID: %s\n",
586  attr->name,
587  attr_str,
588  attr_type,
589  id);
590  }
591  else
592  {
593  char *cred_id =
595  sizeof(attr->credential));
596  fprintf (stdout,
597  "%s: ``%s'' in credential presentation `%s' (%s); ID: %s\n",
598  attr->name,
599  attr_str,
600  cred_id,
601  attr_type,
602  id);
603  GNUNET_free (cred_id);
604 
605  }
606  GNUNET_free (id);
607  }
609 }
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_new(const char *attr_name, const struct GNUNET_RECLAIM_Identifier *credential, uint32_t type, const void *data, size_t data_size)
Create a new attribute claim.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
const char * name
The name of the attribute.
static char * attr_delete
Claim to delete.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
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...
Definition: reclaim_api.c:1377
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
static struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute list.
static char * attr_name
The attribute.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
struct GNUNET_RECLAIM_Identifier id
ID.
size_t data_size
Number of bytes in data.
static char * issue_attrs
Attributes to issue.
static struct GNUNET_RECLAIM_Attribute * attr_to_delete
Claim object to delete.
const char * GNUNET_RECLAIM_attribute_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
const void * data
Binary value stored as attribute value.
char * GNUNET_RECLAIM_attribute_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attribute to a string.
uint32_t type
Type of Claim.
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
static int list
List attribute flag.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_RECLAIM_id_is_zero(a)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cred_iter_finished()

static void cred_iter_finished ( void *  cls)
static

Definition at line 613 of file gnunet-reclaim.c.

References attr_value, credential, credential_name, credential_type, do_cleanup(), exp_interval, GNUNET_RECLAIM_credential_new(), GNUNET_RECLAIM_credential_store(), GNUNET_RECLAIM_credential_typename_to_number(), GNUNET_RECLAIM_get_attributes_start(), GNUNET_SCHEDULER_add_now(), iter_cb(), iter_error(), iter_finished(), list_credentials, and store_cont().

Referenced by start_process().

614 {
615  cred_iterator = NULL;
616 
617  // Add new credential
618  if ((NULL != credential_name) &&
619  (NULL != attr_value))
620  {
621  enum GNUNET_RECLAIM_CredentialType ctype =
625  ctype,
626  attr_value,
627  strlen (attr_value));
629  pkey,
630  credential,
631  &exp_interval,
632  store_cont,
633  NULL);
634  return;
635 
636  }
637  if (list_credentials)
638  {
640  return;
641  }
643  pkey,
644  &iter_error,
645  NULL,
646  &iter_cb,
647  NULL,
648  &iter_finished,
649  NULL);
650 
651 }
static char * credential_type
Credential type.
static const struct GNUNET_IDENTITY_PrivateKey * pkey
ego private key
uint32_t GNUNET_RECLAIM_credential_typename_to_number(const char *typename)
Convert an credential type name to the corresponding number.
static void do_cleanup(void *cls)
static void iter_finished(void *cls)
static void store_cont(void *cls, int32_t success, const char *emsg)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static int list_credentials
List credentials flag.
static struct GNUNET_TIME_Relative exp_interval
Attribute expiration interval.
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
static char * attr_value
Attribute value.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1296
struct GNUNET_RECLAIM_AttributeIterator * GNUNET_RECLAIM_get_attributes_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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.
Definition: reclaim_api.c:1331
static char * credential_name
Credential name.
static void iter_error(void *cls)
static struct GNUNET_RECLAIM_CredentialIterator * cred_iterator
Credential iterator.
static void iter_cb(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_credential_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const struct GNUNET_RECLAIM_Credential *credential, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Store a credential.
Definition: reclaim_api.c:1227
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
GNUNET_RECLAIM_CredentialType
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_new(const char *name, uint32_t type, const void *data, size_t data_size)
Create a new credential.
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_PublicKey identity,
const struct GNUNET_RECLAIM_Credential cred 
)
static

Definition at line 655 of file gnunet-reclaim.c.

References GNUNET_RECLAIM_AttributeListEntry::attribute, credential, credential_exists, GNUNET_RECLAIM_Attribute::data, GNUNET_RECLAIM_Credential::data, GNUNET_RECLAIM_Attribute::data_size, GNUNET_RECLAIM_Credential::data_size, GNUNET_free, GNUNET_RECLAIM_attribute_list_destroy(), GNUNET_RECLAIM_attribute_value_to_string(), GNUNET_RECLAIM_credential_get_attributes(), GNUNET_RECLAIM_credential_number_to_typename(), GNUNET_RECLAIM_credential_value_to_string(), GNUNET_RECLAIM_get_credentials_next(), GNUNET_RECLAIM_id_is_equal, GNUNET_STRINGS_data_to_string_alloc(), GNUNET_YES, GNUNET_RECLAIM_Credential::id, id, list_credentials, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_Attribute::name, GNUNET_RECLAIM_Credential::name, GNUNET_RECLAIM_AttributeListEntry::next, GNUNET_RECLAIM_Attribute::type, and GNUNET_RECLAIM_Credential::type.

Referenced by start_process().

658 {
659  char *cred_str;
660  char *attr_str;
661  char *id;
662  const char *cred_type;
664 
666  &cred->id))
668  if (list_credentials)
669  {
671  cred->data,
672  cred->data_size);
674  id = GNUNET_STRINGS_data_to_string_alloc (&cred->id, sizeof(cred->id));
675  fprintf (stdout,
676  "%s: ``%s'' (%s); ID: %s\n",
677  cred->name,
678  cred_str,
679  cred_type,
680  id);
681  struct GNUNET_RECLAIM_AttributeList *attrs =
683  if (NULL != attrs)
684  {
685  fprintf (stdout,
686  "\t Attributes:\n");
687  for (ale = attrs->list_head; NULL != ale; ale = ale->next)
688  {
690  ale->attribute->type,
691  ale->attribute->data,
692  ale->attribute->data_size);
693  fprintf (stdout,
694  "\t %s: %s\n", ale->attribute->name, attr_str);
695  GNUNET_free (attr_str);
696  }
698  }
699  GNUNET_free (id);
700  }
702 }
void GNUNET_RECLAIM_get_credentials_next(struct GNUNET_RECLAIM_CredentialIterator *ait)
Calls the record processor specified in GNUNET_RECLAIM_get_credentials_start for the next record...
Definition: reclaim_api.c:1487
struct GNUNET_RECLAIM_Identifier id
ID.
uint32_t type
Type/Format of Claim.
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
static int credential_exists
Credential exists.
const char * name
The name of the attribute.
size_t data_size
Number of bytes in data.
static int list_credentials
List credentials flag.
A list of GNUNET_RECLAIM_Attribute structures.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
const void * data
Binary value stored as credential value.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
const char * GNUNET_RECLAIM_credential_number_to_typename(uint32_t type)
Convert an credential type number to the corresponding credential type string.
size_t data_size
Number of bytes in data.
static struct GNUNET_RECLAIM_CredentialIterator * cred_iterator
Credential iterator.
const char * name
The name of the credential.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
#define GNUNET_RECLAIM_id_is_equal(a, b)
const void * data
Binary value stored as attribute value.
char * GNUNET_RECLAIM_attribute_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attribute to a string.
uint32_t type
Type of Claim.
char * GNUNET_RECLAIM_credential_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an credential to a string.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:937
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_credential_get_attributes(const struct GNUNET_RECLAIM_Credential *cred)
Convert an credential type name to the corresponding number.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_process()

static void start_process ( )
static

Definition at line 706 of file gnunet-reclaim.c.

References consume_ticket, cred_iter_cb(), cred_iter_finished(), credential, credential_exists, credential_id, credential_type, do_cleanup(), ego_name, GNUNET_IDENTITY_public_key_from_string(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_RECLAIM_get_credentials_start(), GNUNET_RECLAIM_ID_ZERO, GNUNET_RECLAIM_ticket_iteration_start(), GNUNET_SCHEDULER_add_now(), GNUNET_strdup, GNUNET_STRINGS_string_to_data(), iter_error(), list_tickets, revoke_ticket, rp, rp_key, ticket, ticket_iter(), ticket_iter_err(), and ticket_iter_fin().

Referenced by ego_cb().

707 {
708  if (NULL == pkey)
709  {
710  fprintf (stderr, "Ego %s not found\n", ego_name);
712  return;
713  }
714  if (NULL == credential_type)
715  credential_type = GNUNET_strdup ("JWT");
717  if (NULL != credential_id)
719  strlen (credential_id),
720  &credential, sizeof(credential));
722  if (list_tickets)
723  {
725  pkey,
727  NULL,
728  &ticket_iter,
729  NULL,
731  NULL);
732  return;
733  }
734 
735  if ((NULL != rp) &&
736  (GNUNET_OK !=
738  {
739  fprintf (stderr, "%s is not a public key!\n", rp);
741  return;
742  }
743  if (NULL != consume_ticket)
745  strlen (consume_ticket),
746  &ticket,
747  sizeof(struct GNUNET_RECLAIM_Ticket));
748  if (NULL != revoke_ticket)
750  strlen (revoke_ticket),
751  &ticket,
752  sizeof(struct GNUNET_RECLAIM_Ticket));
753 
755  claim = NULL;
757  pkey,
758  &iter_error,
759  NULL,
760  &cred_iter_cb,
761  NULL,
763  NULL);
764 
765 }
static char * credential_type
Credential type.
static char * consume_ticket
Ticket to consume.
static const struct GNUNET_IDENTITY_PrivateKey * pkey
ego private key
static void cred_iter_cb(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Credential *cred)
The authorization ticket.
static void do_cleanup(void *cls)
static void ticket_iter_fin(void *cls)
static int list_tickets
Ticket listing.
static int credential_exists
Credential exists.
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
struct GNUNET_RECLAIM_CredentialIterator * GNUNET_RECLAIM_get_credentials_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_CredentialResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
List all credentials for a local identity.
Definition: reclaim_api.c:1440
static char * credential_id
Credential ID string.
A list of GNUNET_RECLAIM_Attribute structures.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
static void cred_iter_finished(void *cls)
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket iterator.
static char * ego_name
Ego name.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute list.
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 const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_public_key_from_string(const char *str, struct GNUNET_IDENTITY_PublicKey *key)
Parses a (Base32) string representation of the public key.
static void iter_error(void *cls)
static struct GNUNET_RECLAIM_CredentialIterator * cred_iterator
Credential iterator.
static void ticket_iter(void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
static void ticket_iter_err(void *cls)
static struct GNUNET_IDENTITY_PublicKey rp_key
rp public key
static char * rp
Relying party.
static char * revoke_ticket
Ticket to revoke.
int GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
Definition: strings.c:972
struct GNUNET_RECLAIM_TicketIterator * GNUNET_RECLAIM_ticket_iteration_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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)
Definition: reclaim_api.c:1637
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ego_cb()

static void ego_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego,
void **  ctx,
const char *  name 
)
static

Definition at line 771 of file gnunet-reclaim.c.

References ego_name, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_NO, GNUNET_YES, init, and start_process().

Referenced by run().

775 {
776  if (NULL == name)
777  {
778  if (GNUNET_YES == init)
779  {
780  init = GNUNET_NO;
781  start_process ();
782  }
783  return;
784  }
785  if (0 != strcmp (name, ego_name))
786  return;
788 }
static const struct GNUNET_IDENTITY_PrivateKey * pkey
ego private key
static int init
static void start_process()
static char * ego_name
Ego name.
const char * name
const struct GNUNET_IDENTITY_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:639
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle c 
)
static

Definition at line 792 of file gnunet-reclaim.c.

References _, attr_name, attr_value, ego_cb(), ego_name, GNUNET_IDENTITY_connect(), GNUNET_RECLAIM_connect(), issue_attrs, ret, and rp.

Referenced by main().

796 {
797  ret = 0;
798  if (NULL == ego_name)
799  {
800  ret = 1;
801  fprintf (stderr, _ ("Ego is required\n"));
802  return;
803  }
804 
805  if ((NULL == attr_value) && (NULL != attr_name))
806  {
807  ret = 1;
808  fprintf (stderr, _ ("Attribute value missing!\n"));
809  return;
810  }
811 
812  if ((NULL == rp) && (NULL != issue_attrs))
813  {
814  ret = 1;
815  fprintf (stderr, _ ("Requesting party key is required!\n"));
816  return;
817  }
818 
820  // Get Ego
822 }
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
Definition: identity_api.c:610
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
#define _(String)
GNU gettext support macro.
Definition: platform.h:184
static char * ego_name
Ego name.
static char * attr_value
Attribute value.
static char * attr_name
The attribute.
static struct GNUNET_IDENTITY_Handle * identity_handle
Identity handle.
static char * issue_attrs
Attributes to issue.
static void ego_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
static char * rp
Relying party.
static int ret
return value
struct GNUNET_RECLAIM_Handle * GNUNET_RECLAIM_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the re:claimID service.
Definition: reclaim_api.c:1064
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const  argv[] 
)

Definition at line 826 of file gnunet-reclaim.c.

References _, attr_delete, attr_name, attr_value, consume_ticket, credential_id, credential_name, credential_type, ego_name, exp_interval, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_relative_time(), GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_TIME_UNIT_HOURS, issue_attrs, list, list_credentials, list_tickets, ret, revoke_ticket, rp, run(), and type_str.

827 {
831  "add",
832  "NAME",
833  gettext_noop ("Add an attribute NAME"),
834  &attr_name),
836  "delete",
837  "ID",
838  gettext_noop ("Delete the attribute with ID"),
839  &attr_delete),
841  "value",
842  "VALUE",
843  gettext_noop ("The attribute VALUE"),
844  &attr_value),
846  "ego",
847  "EGO",
848  gettext_noop ("The EGO to use"),
849  &ego_name),
851  "rp",
852  "RP",
853  gettext_noop (
854  "Specify the relying party for issue"),
855  &rp),
857  "dump",
858  gettext_noop ("List attributes for EGO"),
859  &list),
861  "credentials",
862  gettext_noop ("List credentials for EGO"),
865  "credential-id",
866  "CREDENTIAL_ID",
867  gettext_noop (
868  "Credential to use for attribute"),
869  &credential_id),
871  "credential-name",
872  "NAME",
873  gettext_noop ("Credential name"),
874  &credential_name),
876  "issue",
877  "A1,A2,...",
878  gettext_noop (
879  "Issue a ticket for a set of attributes separated by comma"),
880  &issue_attrs),
882  "consume",
883  "TICKET",
884  gettext_noop ("Consume a ticket"),
885  &consume_ticket),
887  "revoke",
888  "TICKET",
889  gettext_noop ("Revoke a ticket"),
890  &revoke_ticket),
892  "type",
893  "TYPE",
894  gettext_noop ("Type of attribute"),
895  &type_str),
897  "credential-type",
898  "TYPE",
899  gettext_noop ("Type of credential"),
900  &credential_type),
902  "tickets",
903  gettext_noop ("List tickets of ego"),
904  &list_tickets),
906  "expiration",
907  "INTERVAL",
908  gettext_noop (
909  "Expiration interval of the attribute"),
910  &exp_interval),
911 
913  };
914  if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
915  argv,
916  "gnunet-reclaim",
917  _ ("re:claimID command line tool"),
918  options,
919  &run,
920  NULL))
921  return 1;
922  else
923  return ret;
924 }
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time)...
static char * credential_type
Credential type.
static char * consume_ticket
Ticket to consume.
#define GNUNET_TIME_UNIT_HOURS
One hour.
static int list_tickets
Ticket listing.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
static char * attr_delete
Claim to delete.
static char * credential_id
Credential ID string.
static int list_credentials
List credentials flag.
Definition of a command line option.
static struct GNUNET_TIME_Relative exp_interval
Attribute expiration interval.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
#define _(String)
GNU gettext support macro.
Definition: platform.h:184
static char * ego_name
Ego name.
static char * attr_value
Attribute value.
static char * attr_name
The attribute.
static char * issue_attrs
Attributes to issue.
static char * credential_name
Credential name.
static char * type_str
Attribute type.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
static char * rp
Relying party.
int GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
Definition: program.c:372
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
static int list
List attribute flag.
static char * revoke_ticket
Ticket to revoke.
static int ret
return value
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:

Variable Documentation

◆ ret

int ret
static

return value

Definition at line 38 of file gnunet-reclaim.c.

Referenced by main(), process_attrs(), process_delete(), process_rvk(), run(), and timeout_task().

◆ list

int list
static

List attribute flag.

Definition at line 43 of file gnunet-reclaim.c.

Referenced by iter_cb(), iter_finished(), and main().

◆ list_credentials

int list_credentials
static

List credentials flag.

Definition at line 48 of file gnunet-reclaim.c.

Referenced by cred_iter_cb(), cred_iter_finished(), and main().

◆ credential_id

char* credential_id
static

Credential ID string.

Definition at line 53 of file gnunet-reclaim.c.

Referenced by iter_finished(), main(), and start_process().

◆ credential

struct GNUNET_RECLAIM_Identifier credential
static

◆ credential_name

char* credential_name
static

Credential name.

Definition at line 63 of file gnunet-reclaim.c.

Referenced by cred_iter_finished(), and main().

◆ credential_type

char* credential_type
static

Credential type.

Definition at line 68 of file gnunet-reclaim.c.

Referenced by cred_iter_finished(), do_cleanup(), main(), and start_process().

◆ credential_exists

int credential_exists
static

Credential exists.

Definition at line 73 of file gnunet-reclaim.c.

Referenced by cred_iter_cb(), and start_process().

◆ rp

char* rp
static

◆ attr_name

char* attr_name
static

The attribute.

Definition at line 83 of file gnunet-reclaim.c.

Referenced by iter_cb(), iter_finished(), main(), and run().

◆ attr_value

char* attr_value
static

Attribute value.

Definition at line 88 of file gnunet-reclaim.c.

Referenced by cred_iter_finished(), iter_finished(), main(), and run().

◆ issue_attrs

char* issue_attrs
static

Attributes to issue.

Definition at line 93 of file gnunet-reclaim.c.

Referenced by iter_cb(), iter_finished(), main(), and run().

◆ consume_ticket

char* consume_ticket
static

Ticket to consume.

Definition at line 98 of file gnunet-reclaim.c.

Referenced by iter_finished(), main(), and start_process().

◆ type_str

char* type_str
static

Attribute type.

Definition at line 103 of file gnunet-reclaim.c.

Referenced by iter_finished(), main(), parse_attr(), parse_credential(), and parse_jwt().

◆ revoke_ticket

char* revoke_ticket
static

Ticket to revoke.

Definition at line 108 of file gnunet-reclaim.c.

Referenced by iter_finished(), main(), and start_process().

◆ list_tickets

int list_tickets
static

Ticket listing.

Definition at line 113 of file gnunet-reclaim.c.

Referenced by main(), and start_process().

◆ ego_name

char* ego_name
static

Ego name.

Definition at line 118 of file gnunet-reclaim.c.

Referenced by ego_cb(), main(), run(), and start_process().

◆ identity_handle

struct GNUNET_IDENTITY_Handle* identity_handle
static

Identity handle.

Definition at line 123 of file gnunet-reclaim.c.

◆ reclaim_handle

struct GNUNET_RECLAIM_Handle* reclaim_handle
static

reclaim handle

Definition at line 128 of file gnunet-reclaim.c.

◆ reclaim_op

struct GNUNET_RECLAIM_Operation* reclaim_op
static

reclaim operation

Definition at line 133 of file gnunet-reclaim.c.

◆ attr_iterator

struct GNUNET_RECLAIM_AttributeIterator* attr_iterator
static

Attribute iterator.

Definition at line 138 of file gnunet-reclaim.c.

◆ cred_iterator

struct GNUNET_RECLAIM_CredentialIterator* cred_iterator
static

Credential iterator.

Definition at line 143 of file gnunet-reclaim.c.

◆ ticket_iterator

struct GNUNET_RECLAIM_TicketIterator* ticket_iterator
static

Ticket iterator.

Definition at line 149 of file gnunet-reclaim.c.

◆ pkey

const struct GNUNET_IDENTITY_PrivateKey* pkey
static

ego private key

Definition at line 155 of file gnunet-reclaim.c.

◆ rp_key

struct GNUNET_IDENTITY_PublicKey rp_key
static

rp public key

Definition at line 160 of file gnunet-reclaim.c.

Referenced by iter_finished(), and start_process().

◆ ticket

struct GNUNET_RECLAIM_Ticket ticket
static

◆ attr_list

struct GNUNET_RECLAIM_AttributeList* attr_list
static

Attribute list.

Definition at line 170 of file gnunet-reclaim.c.

◆ exp_interval

struct GNUNET_TIME_Relative exp_interval
static

Attribute expiration interval.

Definition at line 175 of file gnunet-reclaim.c.

Referenced by cred_iter_finished(), iter_finished(), and main().

◆ timeout

struct GNUNET_SCHEDULER_Task* timeout
static

Timeout task.

Definition at line 180 of file gnunet-reclaim.c.

◆ cleanup_task

struct GNUNET_SCHEDULER_Task* cleanup_task
static

Cleanup task.

Definition at line 185 of file gnunet-reclaim.c.

Referenced by GST_neighbour_get_connection_cancel().

◆ claim

struct GNUNET_RECLAIM_Attribute* claim

Claim to store.

Definition at line 190 of file gnunet-reclaim.c.

Referenced by rvk_move_attr_cb().

◆ attr_delete

char* attr_delete
static

Claim to delete.

Definition at line 195 of file gnunet-reclaim.c.

Referenced by iter_cb(), iter_finished(), and main().

◆ attr_to_delete

struct GNUNET_RECLAIM_Attribute* attr_to_delete
static

Claim object to delete.

Definition at line 200 of file gnunet-reclaim.c.

◆ init

int init = GNUNET_YES
static

Definition at line 768 of file gnunet-reclaim.c.

Referenced by ego_cb().