GNUnet  0.11.x
Functions
json_reclaim.c File Reference
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_json_lib.h"
#include "gnunet_reclaim_attribute_lib.h"
#include "gnunet_reclaim_service.h"
Include dependency graph for json_reclaim.c:

Go to the source code of this file.

Functions

static int parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a claim. More...
 
static void clean_attr (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing RSA public key. More...
 
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr)
 JSON Specification for Reclaim claims. More...
 
static int parse_ticket (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a ticket. More...
 
static void clean_ticket (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing RSA public key. More...
 
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket)
 JSON Specification for Reclaim tickets. More...
 
static int parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to an attestation claim. More...
 
static void clean_attest (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing RSA public key. More...
 
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_claim_attest (struct GNUNET_RECLAIM_ATTESTATION_Claim **attr)
 JSON Specification for Reclaim attestation claims. More...
 
static int parse_attest_ref (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to an attestation claim. More...
 
static void clean_attest_ref (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing RSA public key. More...
 
struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_claim_attest_ref (struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **attr)
 JSON Specification for Reclaim attestation references. More...
 

Function Documentation

◆ parse_attr()

static int parse_attr ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a claim.

Parameters
clsclosure, NULL
rootthe json object representing data
specwhere to write the data
Returns
GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error

Definition at line 44 of file json_reclaim.c.

References data, data_size, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_RECLAIM_ATTRIBUTE_claim_new(), GNUNET_RECLAIM_ATTRIBUTE_string_to_value(), GNUNET_RECLAIM_ATTRIBUTE_typename_to_number(), GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, GNUNET_RECLAIM_ATTRIBUTE_Claim::id, GNUNET_JSON_Specification::ptr, type, and type_str.

Referenced by GNUNET_RECLAIM_JSON_spec_claim().

45 {
46  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
47  const char *name_str = NULL;
48  const char *val_str = NULL;
49  const char *type_str = NULL;
50  const char *id_str = NULL;
51  const char *flag_str = NULL;
52  char *data;
53  int unpack_state;
54  uint32_t type;
55  size_t data_size;
56 
57  GNUNET_assert (NULL != root);
58 
59  if (! json_is_object (root))
60  {
62  "Error json is not array nor object!\n");
63  return GNUNET_SYSERR;
64  }
65  // interpret single attribute
66  unpack_state = json_unpack (root,
67  "{s:s, s?s, s:s, s:s, s?s!}",
68  "name",
69  &name_str,
70  "id",
71  &id_str,
72  "type",
73  &type_str,
74  "value",
75  &val_str,
76  "flag",
77  &flag_str);
78  if ((0 != unpack_state) || (NULL == name_str) || (NULL == val_str) ||
79  (NULL == type_str))
80  {
82  "Error json object has a wrong format!\n");
83  return GNUNET_SYSERR;
84  }
86  if (GNUNET_SYSERR ==
88  val_str,
89  (void **) &data,
90  &data_size)))
91  {
92  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute value invalid!\n");
93  return GNUNET_SYSERR;
94  }
95  attr = GNUNET_RECLAIM_ATTRIBUTE_claim_new (name_str, type, data, data_size);
96  if ((NULL == id_str) || (0 == strlen (id_str)))
97  attr->id = 0;
98  else
100  strlen (id_str),
101  &attr->id,
102  sizeof(uint64_t));
103 
104  *(struct GNUNET_RECLAIM_ATTRIBUTE_Claim **) spec->ptr = attr;
105  return GNUNET_OK;
106 }
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.
uint32_t GNUNET_RECLAIM_ATTRIBUTE_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:83
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 'claim' of an attribute to the binary representation.
#define GNUNET_SYSERR
Definition: gnunet_common.h:84
static char * type_str
Attribute type.
void * ptr
Pointer, details specific to the parser.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * GNUNET_RECLAIM_ATTRIBUTE_claim_new(const char *attr_name, uint32_t type, const void *data, size_t data_size)
Create a new attribute claim.
#define GNUNET_log(kind,...)
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
uint32_t data
The data value.
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:952
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_attr()

static void clean_attr ( void *  cls,
struct GNUNET_JSON_Specification spec 
)
static

Cleanup data left from parsing RSA public key.

Parameters
clsclosure, NULL
[out]specwhere to free the data

Definition at line 116 of file json_reclaim.c.

References GNUNET_free, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_RECLAIM_JSON_spec_claim().

117 {
118  struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr;
119 
120  attr = (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **) spec->ptr;
121  if (NULL != *attr)
122  {
123  GNUNET_free (*attr);
124  *attr = NULL;
125  }
126 }
void * ptr
Pointer, details specific to the parser.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_JSON_spec_claim()

struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_claim ( struct GNUNET_RECLAIM_ATTRIBUTE_Claim **  attr)

JSON Specification for Reclaim claims.

Parameters
ticketstruct of GNUNET_RECLAIM_ATTRIBUTE_Claim to fill
Returns
JSON Specification

Definition at line 136 of file json_reclaim.c.

References clean_attr(), parse_attr(), GNUNET_JSON_Specification::parser, and ret.

Referenced by add_attribute_cont().

137 {
138  struct GNUNET_JSON_Specification ret = { .parser = &parse_attr,
139  .cleaner = &clean_attr,
140  .cls = NULL,
141  .field = NULL,
142  .ptr = attr,
143  .ptr_size = 0,
144  .size_ptr = NULL };
145 
146  *attr = NULL;
147  return ret;
148 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
Entry in parser specification for GNUNET_JSON_parse().
static void clean_attr(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA public key.
Definition: json_reclaim.c:116
static int parse_attr(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a claim.
Definition: json_reclaim.c:44
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_ticket()

static int parse_ticket ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a ticket.

Parameters
clsclosure, NULL
rootthe json object representing data
specwhere to write the data
Returns
GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error

Definition at line 160 of file json_reclaim.c.

References GNUNET_RECLAIM_Ticket::audience, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, GNUNET_RECLAIM_Ticket::identity, GNUNET_JSON_Specification::ptr, GNUNET_RECLAIM_Ticket::rnd, and ticket.

Referenced by GNUNET_RECLAIM_JSON_spec_ticket().

161 {
163  const char *rnd_str;
164  const char *aud_str;
165  const char *id_str;
166  int unpack_state;
167 
168  GNUNET_assert (NULL != root);
169 
170  if (! json_is_object (root))
171  {
173  "Error json is not array nor object!\n");
174  return GNUNET_SYSERR;
175  }
176  // interpret single ticket
177  unpack_state = json_unpack (root,
178  "{s:s, s:s, s:s!}",
179  "rnd",
180  &rnd_str,
181  "audience",
182  &aud_str,
183  "issuer",
184  &id_str);
185  if (0 != unpack_state)
186  {
188  "Error json object has a wrong format!\n");
189  return GNUNET_SYSERR;
190  }
191  ticket = GNUNET_new (struct GNUNET_RECLAIM_Ticket);
193  strlen (rnd_str),
194  &ticket->rnd,
195  sizeof(uint64_t)))
196  {
197  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Rnd invalid\n");
198  GNUNET_free (ticket);
199  return GNUNET_SYSERR;
200  }
201  if (GNUNET_OK !=
203  strlen (id_str),
204  &ticket->identity,
205  sizeof(
207  {
208  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Identity invalid\n");
209  GNUNET_free (ticket);
210  return GNUNET_SYSERR;
211  }
212 
213  if (GNUNET_OK !=
215  strlen (aud_str),
216  &ticket->audience,
217  sizeof(struct
219  {
220  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Audience invalid\n");
221  GNUNET_free (ticket);
222  return GNUNET_SYSERR;
223  }
224 
225  *(struct GNUNET_RECLAIM_Ticket **) spec->ptr = ticket;
226  return GNUNET_OK;
227 }
The authorization ticket.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:83
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
struct GNUNET_CRYPTO_EcdsaPublicKey identity
The ticket issuer (= the user)
#define GNUNET_SYSERR
Definition: gnunet_common.h:84
uint64_t rnd
The ticket random (NBO)
void * ptr
Pointer, details specific to the parser.
struct GNUNET_CRYPTO_EcdsaPublicKey audience
The ticket audience (= relying party)
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
#define GNUNET_log(kind,...)
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:952
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_ticket()

static void clean_ticket ( void *  cls,
struct GNUNET_JSON_Specification spec 
)
static

Cleanup data left from parsing RSA public key.

Parameters
clsclosure, NULL
[out]specwhere to free the data

Definition at line 237 of file json_reclaim.c.

References GNUNET_free, GNUNET_JSON_Specification::ptr, and ticket.

Referenced by GNUNET_RECLAIM_JSON_spec_ticket().

238 {
239  struct GNUNET_RECLAIM_Ticket **ticket;
240 
241  ticket = (struct GNUNET_RECLAIM_Ticket **) spec->ptr;
242  if (NULL != *ticket)
243  {
244  GNUNET_free (*ticket);
245  *ticket = NULL;
246  }
247 }
The authorization ticket.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
void * ptr
Pointer, details specific to the parser.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_JSON_spec_ticket()

struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_ticket ( struct GNUNET_RECLAIM_Ticket **  ticket)

JSON Specification for Reclaim tickets.

Parameters
ticketstruct of GNUNET_RECLAIM_Ticket to fill
Returns
JSON Specification

Definition at line 257 of file json_reclaim.c.

References clean_ticket(), parse_ticket(), GNUNET_JSON_Specification::parser, ret, and ticket.

Referenced by consume_ticket_cont(), and revoke_ticket_cont().

258 {
259  struct GNUNET_JSON_Specification ret = { .parser = &parse_ticket,
260  .cleaner = &clean_ticket,
261  .cls = NULL,
262  .field = NULL,
263  .ptr = ticket,
264  .ptr_size = 0,
265  .size_ptr = NULL };
266 
267  *ticket = NULL;
268  return ret;
269 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
Entry in parser specification for GNUNET_JSON_parse().
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static int parse_ticket(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a ticket.
Definition: json_reclaim.c:160
static void clean_ticket(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA public key.
Definition: json_reclaim.c:237
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_attest()

static int parse_attest ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to an attestation claim.

Parameters
clsclosure, NULL
rootthe json object representing data
specwhere to write the data
Returns
GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error

Definition at line 280 of file json_reclaim.c.

References data, data_size, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_RECLAIM_ATTESTATION_claim_new(), GNUNET_RECLAIM_ATTESTATION_string_to_value(), GNUNET_RECLAIM_ATTESTATION_typename_to_number(), GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, GNUNET_RECLAIM_ATTESTATION_Claim::id, GNUNET_JSON_Specification::ptr, type, and type_str.

Referenced by GNUNET_RECLAIM_JSON_spec_claim_attest().

281 {
283  const char *name_str = NULL;
284  const char *val_str = NULL;
285  const char *type_str = NULL;
286  const char *id_str = NULL;
287  char *data;
288  int unpack_state;
289  uint32_t type;
290  size_t data_size;
291 
292  GNUNET_assert (NULL != root);
293 
294  if (! json_is_object (root))
295  {
297  "Error json is not array nor object!\n");
298  return GNUNET_SYSERR;
299  }
300  // interpret single attribute
301  unpack_state = json_unpack (root,
302  "{s:s, s?s, s:s, s:s!}",
303  "name",
304  &name_str,
305  "id",
306  &id_str,
307  "type",
308  &type_str,
309  "value",
310  &val_str);
311  if ((0 != unpack_state) || (NULL == name_str) || (NULL == val_str) ||
312  (NULL == type_str))
313  {
315  "Error json object has a wrong format!\n");
316  return GNUNET_SYSERR;
317  }
319  if (GNUNET_SYSERR ==
321  val_str,
322  (void **) &data,
323  &data_size)))
324  {
325  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attestation value invalid!\n");
326  return GNUNET_SYSERR;
327  }
328  attr = GNUNET_RECLAIM_ATTESTATION_claim_new (name_str, type, data, data_size);
329  if ((NULL == id_str) || (0 == strlen (id_str)))
330  attr->id = 0;
331  else
333  strlen (id_str),
334  &attr->id,
335  sizeof(uint64_t));
336 
337  *(struct GNUNET_RECLAIM_ATTESTATION_Claim **) spec->ptr = attr;
338  return GNUNET_OK;
339 }
struct GNUNET_RECLAIM_ATTESTATION_Claim * GNUNET_RECLAIM_ATTESTATION_claim_new(const char *attr_name, uint32_t type, const void *data, size_t data_size)
Create a new attestation.
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.
int GNUNET_RECLAIM_ATTESTATION_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a 'claim' of an attestation to the binary representation.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:83
#define GNUNET_SYSERR
Definition: gnunet_common.h:84
static char * type_str
Attribute type.
void * ptr
Pointer, details specific to the parser.
#define GNUNET_log(kind,...)
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
uint32_t data
The data value.
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:952
uint32_t GNUNET_RECLAIM_ATTESTATION_typename_to_number(const char *typename)
Convert an attestation type name to the corresponding number.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_attest()

static void clean_attest ( void *  cls,
struct GNUNET_JSON_Specification spec 
)
static

Cleanup data left from parsing RSA public key.

Parameters
clsclosure, NULL
[out]specwhere to free the data

Definition at line 348 of file json_reclaim.c.

References GNUNET_free, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_RECLAIM_JSON_spec_claim_attest().

349 {
350  struct GNUNET_RECLAIM_ATTESTATION_Claim **attr;
351 
352  attr = (struct GNUNET_RECLAIM_ATTESTATION_Claim **) spec->ptr;
353  if (NULL != *attr)
354  {
355  GNUNET_free (*attr);
356  *attr = NULL;
357  }
358 }
void * ptr
Pointer, details specific to the parser.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_JSON_spec_claim_attest()

struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_claim_attest ( struct GNUNET_RECLAIM_ATTESTATION_Claim **  attr)

JSON Specification for Reclaim attestation claims.

Parameters
ticketstruct of GNUNET_RECLAIM_ATTESTATION_Claim to fill
Returns
JSON Specification

Definition at line 366 of file json_reclaim.c.

References clean_attest(), parse_attest(), GNUNET_JSON_Specification::parser, and ret.

Referenced by add_attestation_cont().

368 {
369  struct GNUNET_JSON_Specification ret = { .parser = &parse_attest,
370  .cleaner = &clean_attest,
371  .cls = NULL,
372  .field = NULL,
373  .ptr = attr,
374  .ptr_size = 0,
375  .size_ptr = NULL };
376 
377  *attr = NULL;
378  return ret;
379 }
static void clean_attest(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA public key.
Definition: json_reclaim.c:348
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
Entry in parser specification for GNUNET_JSON_parse().
static int parse_attest(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to an attestation claim.
Definition: json_reclaim.c:280
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_attest_ref()

static int parse_attest_ref ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to an attestation claim.

Parameters
clsclosure, NULL
rootthe json object representing data
specwhere to write the data
Returns
GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error

Definition at line 390 of file json_reclaim.c.

References GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_RECLAIM_ATTESTATION_reference_new(), GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, GNUNET_RECLAIM_ATTESTATION_REFERENCE::id, GNUNET_RECLAIM_ATTESTATION_REFERENCE::id_attest, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_RECLAIM_JSON_spec_claim_attest_ref().

392 {
394  const char *name_str = NULL;
395  const char *ref_val_str = NULL;
396  const char *ref_id_str = NULL;
397  const char *id_str = NULL;
398  int unpack_state;
399 
400  GNUNET_assert (NULL != root);
401 
402  if (! json_is_object (root))
403  {
405  "Error json is not array nor object!\n");
406  return GNUNET_SYSERR;
407  }
408  // interpret single reference
409  unpack_state = json_unpack (root,
410  "{s:s, s?s, s:s, s:s!}",
411  "name",
412  &name_str,
413  "id",
414  &id_str,
415  "ref_id",
416  &ref_id_str,
417  "ref_value",
418  &ref_val_str);
419  if ((0 != unpack_state) || (NULL == name_str) || (NULL == ref_val_str) ||
420  (NULL == ref_id_str))
421  {
423  "Error json object has a wrong format!\n");
424  return GNUNET_SYSERR;
425  }
426 
427  attr = GNUNET_RECLAIM_ATTESTATION_reference_new (name_str, ref_val_str);
428 
429  attr->id = 0;
430 
431  if ((NULL == ref_id_str) || (0 == strlen (ref_id_str)))
432  attr->id_attest = 0;
433  else
434  GNUNET_STRINGS_string_to_data (ref_id_str,
435  strlen (ref_id_str),
436  &attr->id_attest,
437  sizeof(uint64_t));
438 
439  *(struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **) spec->ptr = attr;
440  return GNUNET_OK;
441 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:83
uint64_t id_attest
Referenced ID of Attestation.
struct GNUNET_RECLAIM_ATTESTATION_REFERENCE * GNUNET_RECLAIM_ATTESTATION_reference_new(const char *attr_name, const char *ref_value)
Create a new attestation reference.
#define GNUNET_SYSERR
Definition: gnunet_common.h:84
void * ptr
Pointer, details specific to the parser.
#define GNUNET_log(kind,...)
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:952
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_attest_ref()

static void clean_attest_ref ( void *  cls,
struct GNUNET_JSON_Specification spec 
)
static

Cleanup data left from parsing RSA public key.

Parameters
clsclosure, NULL
[out]specwhere to free the data

Definition at line 450 of file json_reclaim.c.

References GNUNET_free, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_RECLAIM_JSON_spec_claim_attest_ref().

451 {
453 
454  attr = (struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **) spec->ptr;
455  if (NULL != *attr)
456  {
457  GNUNET_free (*attr);
458  *attr = NULL;
459  }
460 }
void * ptr
Pointer, details specific to the parser.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_JSON_spec_claim_attest_ref()

struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_claim_attest_ref ( struct GNUNET_RECLAIM_ATTESTATION_REFERENCE **  attr)

JSON Specification for Reclaim attestation references.

Parameters
ticketstruct of GNUNET_RECLAIM_ATTESTATION_REFERENCE to fill
Returns
JSON Specification

Definition at line 469 of file json_reclaim.c.

References clean_attest_ref(), parse_attest_ref(), GNUNET_JSON_Specification::parser, and ret.

Referenced by add_attestation_ref_cont(), and delete_attestation_ref_cont().

472 {
473  struct GNUNET_JSON_Specification ret = { .parser = &parse_attest_ref,
474  .cleaner = &clean_attest_ref,
475  .cls = NULL,
476  .field = NULL,
477  .ptr = attr,
478  .ptr_size = 0,
479  .size_ptr = NULL };
480 
481  *attr = NULL;
482  return ret;
483 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
Entry in parser specification for GNUNET_JSON_parse().
static void clean_attest_ref(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA public key.
Definition: json_reclaim.c:450
static int parse_attest_ref(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to an attestation claim.
Definition: json_reclaim.c:390
Here is the call graph for this function:
Here is the caller graph for this function: