GNUnet 0.25.2-12-g8d1cef5f6
 
Loading...
Searching...
No Matches
json_helper.c File Reference

functions to generate specifciations for JSON parsing More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_json_lib.h"
#include "gnunet_common.h"
Include dependency graph for json_helper.c:

Go to the source code of this file.

Functions

struct GNUNET_JSON_Specification GNUNET_JSON_spec_end ()
 End of a parser specification.
 
static enum GNUNET_CRYPTO_BlindSignatureAlgorithm string_to_cipher (const char *cipher_s)
 Convert string value to numeric cipher value.
 
static enum GNUNET_GenericReturnValue parse_fixed_data (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to fixed size data.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_fixed (const char *name, void *obj, size_t size)
 Variable size object (in network byte order, encoded using Crockford Base32hex encoding).
 
static enum GNUNET_GenericReturnValue parse_fixed64_data (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to fixed size data.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_fixed64 (const char *name, void *obj, size_t size)
 Variable size object (in network byte order, encoded using base64 encoding).
 
static enum GNUNET_GenericReturnValue parse_variable_data (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to variable size data.
 
static void clean_variable_data (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing variable size data.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_varsize (const char *name, void **obj, size_t *size)
 Variable size object (in network byte order, encoded using Crockford Base32hex encoding).
 
static enum GNUNET_GenericReturnValue parse_string (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to string.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_string (const char *name, const char **strptr)
 The expected field stores a string.
 
static enum GNUNET_GenericReturnValue parse_string_copy (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to string, and make a copy.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_string_copy (const char *name, char **strptr)
 The expected field stores a string.
 
static enum GNUNET_GenericReturnValue parse_json (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a JSON object.
 
static void clean_json (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing JSON object.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_json (const char *name, json_t **jsonp)
 JSON object or array.
 
static enum GNUNET_GenericReturnValue parse_object_const (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a JSON object.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_object_const (const char *name, const json_t **jsonp)
 JSON object, reference counter not incremented.
 
static enum GNUNET_GenericReturnValue parse_object_copy (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a JSON object and increment the reference counter.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_object_copy (const char *name, json_t **jsonp)
 JSON object, reference counter incremented.
 
static enum GNUNET_GenericReturnValue parse_array_const (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON to a JSON array.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_array_const (const char *name, const json_t **jsonp)
 JSON array, reference counter not incremented.
 
static enum GNUNET_GenericReturnValue parse_array_copy (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON to a JSON array and increment the reference counter.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_array_copy (const char *name, json_t **jsonp)
 JSON array, reference counter incremented.
 
static enum GNUNET_GenericReturnValue parse_bool (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a bool.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_bool (const char *name, bool *b)
 boolean.
 
static enum GNUNET_GenericReturnValue parse_double (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a double.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_double (const char *name, double *f)
 double.
 
static enum GNUNET_GenericReturnValue parse_u8 (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a uint8_t.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint8 (const char *name, uint8_t *u8)
 8-bit integer.
 
static enum GNUNET_GenericReturnValue parse_u16 (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a uint16_t.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint16 (const char *name, uint16_t *u16)
 16-bit integer.
 
static enum GNUNET_GenericReturnValue parse_u32 (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a uint32_t.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint32 (const char *name, uint32_t *u32)
 32-bit integer.
 
static enum GNUNET_GenericReturnValue parse_ui (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to an unsigned int.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint (const char *name, unsigned int *ui)
 Unsigned integer.
 
static enum GNUNET_GenericReturnValue parse_ull (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to an unsigned long long.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_ull (const char *name, unsigned long long *ull)
 Unsigned long long.
 
static enum GNUNET_GenericReturnValue parse_u64 (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a uint64_t.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint64 (const char *name, uint64_t *u64)
 64-bit integer.
 
static enum GNUNET_GenericReturnValue parse_i16 (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a int16_t.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_int16 (const char *name, int16_t *i16)
 16-bit signed integer.
 
static enum GNUNET_GenericReturnValue parse_i64 (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a int64_t.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_int64 (const char *name, int64_t *i64)
 64-bit signed integer.
 
static enum GNUNET_GenericReturnValue parse_timestamp (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a timestamp.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_timestamp (const char *name, struct GNUNET_TIME_Timestamp *t)
 Timestamp.
 
static enum GNUNET_GenericReturnValue parse_timestamp_nbo (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to absolute time.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_timestamp_nbo (const char *name, struct GNUNET_TIME_TimestampNBO *at)
 Timestamp in network byte order.
 
static enum GNUNET_GenericReturnValue parse_rel_time (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to relative time.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_relative_time (const char *name, struct GNUNET_TIME_Relative *rt)
 Relative time.
 
static enum GNUNET_GenericReturnValue parse_rsa_public_key (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to RSA public key.
 
static void clean_rsa_public_key (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing RSA public key.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_public_key (const char *name, struct GNUNET_CRYPTO_RsaPublicKey **pk)
 Specification for parsing an RSA public key.
 
static enum GNUNET_GenericReturnValue parse_rsa_signature (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to RSA signature.
 
static void clean_rsa_signature (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing RSA signature.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_signature (const char *name, struct GNUNET_CRYPTO_RsaSignature **sig)
 Specification for parsing an RSA signature.
 
static enum GNUNET_GenericReturnValue parse_boolean (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to an int as a boolean.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_boolean (const char *name, int *boolean)
 Boolean (true mapped to GNUNET_YES, false mapped to GNUNET_NO).
 
static enum GNUNET_GenericReturnValue parse_blinded_message (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a blinded message.
 
static void clean_blinded_message (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing blinded message.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_blinded_message (const char *name, struct GNUNET_CRYPTO_BlindedMessage **msg)
 Specification for parsing a blinded message.
 
static enum GNUNET_GenericReturnValue parse_blinded_sig (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to a blinded signature.
 
static void clean_blinded_sig (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing blinded sig.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_blinded_signature (const char *field, struct GNUNET_CRYPTO_BlindedSignature **b_sig)
 Specification for parsing a blinded signature.
 
static enum GNUNET_GenericReturnValue parse_unblinded_sig (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to unblinded signature.
 
static void clean_unblinded_sig (void *cls, struct GNUNET_JSON_Specification *spec)
 Cleanup data left from parsing unblinded signature.
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_unblinded_signature (const char *field, struct GNUNET_CRYPTO_UnblindedSignature **ub_sig)
 Specification for parsing an unblinded signature.
 
static enum GNUNET_GenericReturnValue parse_tri (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
 Parse given JSON object to enum GNUNET_TIME_RounderInterval
 
struct GNUNET_JSON_Specification GNUNET_JSON_spec_time_rounder_interval (const char *name, enum GNUNET_TIME_RounderInterval *ri)
 Provide specification to parse a time rounder interval.
 

Detailed Description

functions to generate specifciations for JSON parsing

Author
Florian Dold
Benedikt Mueller
Christian Grothoff

Definition in file json_helper.c.

Function Documentation

◆ GNUNET_JSON_spec_end()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_end ( void  )

End of a parser specification.

Definition at line 34 of file json_helper.c.

35{
37 .parser = NULL,
38 };
39
40 return ret;
41}
static int ret
Final status code.
Definition gnunet-arm.c:93
Entry in parser specification for GNUNET_JSON_parse().
GNUNET_JSON_Parser parser
Function for how to parse this type of entry.

References GNUNET_JSON_Specification::parser, and ret.

Referenced by add_attribute_cont(), add_credential_cont(), bulk_tx_start(), consume_ticket_cont(), namestore_add_or_update(), parse_blinded_message(), parse_blinded_sig(), parse_unblinded_sig(), and revoke_ticket_cont().

Here is the caller graph for this function:

◆ string_to_cipher()

static enum GNUNET_CRYPTO_BlindSignatureAlgorithm string_to_cipher ( const char *  cipher_s)
static

Convert string value to numeric cipher value.

Parameters
cipher_sinput string
Returns
numeric cipher value

Definition at line 51 of file json_helper.c.

52{
53 if ((0 == strcasecmp (cipher_s,
54 "RSA")) ||
55 (0 == strcasecmp (cipher_s,
56 "RSA+age_restricted")))
58 if ((0 == strcasecmp (cipher_s,
59 "CS")) ||
60 (0 == strcasecmp (cipher_s,
61 "CS+age_restricted")))
64}
@ GNUNET_CRYPTO_BSA_INVALID
Invalid type of signature.
@ GNUNET_CRYPTO_BSA_CS
Clause Blind Schnorr signature.
@ GNUNET_CRYPTO_BSA_RSA
RSA blind signature.

References GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, and GNUNET_CRYPTO_BSA_RSA.

Referenced by parse_blinded_message(), parse_blinded_sig(), and parse_unblinded_sig().

Here is the caller graph for this function:

◆ parse_fixed_data()

static enum GNUNET_GenericReturnValue parse_fixed_data ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to fixed size data.

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

Definition at line 76 of file json_helper.c.

79{
80 const char *enc;
81 size_t len;
82
83 if (NULL == (enc = json_string_value (root)))
84 {
86 return GNUNET_SYSERR;
87 }
88 len = strlen (enc);
89 if (len >= SIZE_MAX / 5)
90 {
92 return GNUNET_SYSERR;
93 }
94 if (((len * 5) / 8) != spec->ptr_size)
95 {
98 "Field `%s' has wrong length\n",
99 spec->field);
100 return GNUNET_SYSERR;
101 }
102 if (GNUNET_OK !=
104 len,
105 spec->ptr,
106 spec->ptr_size))
107 {
108 GNUNET_break_op (0);
109 return GNUNET_SYSERR;
110 }
111 return GNUNET_OK;
112}
static OpusEncoder * enc
OPUS encoder.
#define GNUNET_log(kind,...)
@ GNUNET_OK
@ GNUNET_SYSERR
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
@ GNUNET_ERROR_TYPE_WARNING
enum GNUNET_GenericReturnValue 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:832
#define SIZE_MAX
Definition platform.h:209
void * ptr
Pointer, details specific to the parser.
const char * field
Name of the field to parse, use NULL to get the JSON of the main object instead of the JSON of an ind...
size_t ptr_size
Number of bytes available in ptr.

References enc, GNUNET_JSON_Specification::field, GNUNET_break_op, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, GNUNET_JSON_Specification::ptr, GNUNET_JSON_Specification::ptr_size, and SIZE_MAX.

Referenced by GNUNET_JSON_spec_fixed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_JSON_spec_fixed()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_fixed ( const char *  name,
void *  obj,
size_t  size 
)

Variable size object (in network byte order, encoded using Crockford Base32hex encoding).

Parameters
namename of the JSON field
[out]objpointer where to write the data, must have size bytes
sizenumber of bytes expected in obj

Definition at line 116 of file json_helper.c.

119{
122 .field = name,
123 .ptr = obj,
124 .ptr_size = size,
125 };
126
127 return ret;
128}
static char * name
Name (label) of the records to list.
static enum GNUNET_GenericReturnValue parse_fixed_data(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to fixed size data.
Definition json_helper.c:76
static unsigned int size
Size of the "table".
Definition peer.c:68

References name, parse_fixed_data(), GNUNET_JSON_Specification::parser, ret, and size.

Here is the call graph for this function:

◆ parse_fixed64_data()

static enum GNUNET_GenericReturnValue parse_fixed64_data ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to fixed size data.

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

Definition at line 140 of file json_helper.c.

143{
144 const char *enc;
145 unsigned int len;
146 void *output;
147 size_t olen;
148
149 if (NULL == (enc = json_string_value (root)))
150 {
151 GNUNET_break_op (0);
152 return GNUNET_SYSERR;
153 }
154 len = strlen (enc);
155 output = NULL;
157 len,
158 &output);
159 if (olen != spec->ptr_size)
160 {
161 GNUNET_break_op (0);
163 "Field `%s' has wrong length\n",
164 spec->field);
165 GNUNET_free (output);
166 return GNUNET_SYSERR;
167 }
168 memcpy (spec->ptr,
169 output,
170 olen);
171 GNUNET_free (output);
172 return GNUNET_OK;
173}
#define GNUNET_free(ptr)
Wrapper around free.
size_t GNUNET_STRINGS_base64_decode(const char *data, size_t len, void **output)
Decode from Base64.
Definition strings.c:1720

References enc, GNUNET_JSON_Specification::field, GNUNET_break_op, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_STRINGS_base64_decode(), GNUNET_SYSERR, GNUNET_JSON_Specification::ptr, and GNUNET_JSON_Specification::ptr_size.

Referenced by GNUNET_JSON_spec_fixed64().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_JSON_spec_fixed64()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_fixed64 ( const char *  name,
void *  obj,
size_t  size 
)

Variable size object (in network byte order, encoded using base64 encoding).

Parameters
namename of the JSON field
[out]objpointer where to write the data, must have size bytes
sizenumber of bytes expected in obj

Definition at line 177 of file json_helper.c.

180{
183 .field = name,
184 .ptr = obj,
185 .ptr_size = size,
186 };
187
188 return ret;
189}
static enum GNUNET_GenericReturnValue parse_fixed64_data(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to fixed size data.

References name, parse_fixed64_data(), GNUNET_JSON_Specification::parser, ret, and size.

Here is the call graph for this function:

◆ parse_variable_data()

static enum GNUNET_GenericReturnValue parse_variable_data ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to variable size data.

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

Definition at line 201 of file json_helper.c.

204{
205 const char *str;
206 size_t size;
207 void *data;
208
209 str = json_string_value (root);
210 if (NULL == str)
211 {
212 GNUNET_break_op (0);
213 return GNUNET_SYSERR;
214 }
215 if (GNUNET_OK !=
217 strlen (str),
218 &data,
219 &size))
220 {
221 GNUNET_break_op (0);
222 return GNUNET_SYSERR;
223 }
224 *(void **) spec->ptr = data;
225 *spec->size_ptr = size;
226 return GNUNET_OK;
227}
static char * data
The data to insert into the dht.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_string_to_data_alloc(const char *enc, size_t enclen, void **out, size_t *out_size)
Convert CrockfordBase32 encoding back to data.
Definition strings.c:898
size_t * size_ptr
Where should we store the final size of ptr.
const char * str
Definition time.c:1252

References data, GNUNET_break_op, GNUNET_OK, GNUNET_STRINGS_string_to_data_alloc(), GNUNET_SYSERR, GNUNET_JSON_Specification::ptr, size, GNUNET_JSON_Specification::size_ptr, and str.

Referenced by GNUNET_JSON_spec_varsize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_variable_data()

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

Cleanup data left from parsing variable size data.

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

Definition at line 237 of file json_helper.c.

239{
240 (void) cls;
241 if (0 != *spec->size_ptr)
242 {
243 GNUNET_free (*(void **) spec->ptr);
244 *(void **) spec->ptr = NULL;
245 *spec->size_ptr = 0;
246 }
247}

References GNUNET_JSON_Specification::cls, GNUNET_free, GNUNET_JSON_Specification::ptr, and GNUNET_JSON_Specification::size_ptr.

Referenced by GNUNET_JSON_spec_varsize().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_varsize()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_varsize ( const char *  name,
void **  obj,
size_t *  size 
)

Variable size object (in network byte order, encoded using Crockford Base32hex encoding).

Parameters
namename of the JSON field
[out]objpointer where to write the data, will be allocated
[out]sizewhere to store the number of bytes allocated for obj

Definition at line 251 of file json_helper.c.

254{
257 .cleaner = &clean_variable_data,
258 .field = name,
259 .ptr = obj,
260 .size_ptr = size
261 };
262
263 *obj = NULL;
264 *size = 0;
265 return ret;
266}
static void clean_variable_data(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing variable size data.
static enum GNUNET_GenericReturnValue parse_variable_data(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to variable size data.

References clean_variable_data(), name, parse_variable_data(), GNUNET_JSON_Specification::parser, ret, and size.

Referenced by parse_blinded_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_string()

static enum GNUNET_GenericReturnValue parse_string ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to string.

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

Definition at line 278 of file json_helper.c.

281{
282 const char *str;
283
284 (void) cls;
285 str = json_string_value (root);
286 if (NULL == str)
287 {
288 GNUNET_break_op (0);
289 return GNUNET_SYSERR;
290 }
291 *(const char **) spec->ptr = str;
292 return GNUNET_OK;
293}

References GNUNET_JSON_Specification::cls, GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_JSON_Specification::ptr, and str.

Referenced by GNUNET_JSON_spec_string().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_string()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_string ( const char *  name,
const char **  strptr 
)

The expected field stores a string.

Parameters
namename of the JSON field
strptrwhere to store a pointer to the field

Definition at line 297 of file json_helper.c.

299{
302 .field = name,
303 .ptr = strptr
304 };
305
306 *strptr = NULL;
307 return ret;
308}
static enum GNUNET_GenericReturnValue parse_string(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to string.

References name, parse_string(), GNUNET_JSON_Specification::parser, and ret.

Referenced by consume_ticket_cont(), parse_blinded_message(), parse_blinded_sig(), and parse_unblinded_sig().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_string_copy()

static enum GNUNET_GenericReturnValue parse_string_copy ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to string, and make a copy.

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

Definition at line 320 of file json_helper.c.

323{
324 const char *str;
325
326 (void) cls;
327 str = json_string_value (root);
328 if (NULL == str)
329 {
330 GNUNET_break_op (0);
331 return GNUNET_SYSERR;
332 }
333 *((char **) spec->ptr) = GNUNET_strdup (str);
334 return GNUNET_OK;
335}
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.

References GNUNET_JSON_Specification::cls, GNUNET_break_op, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, GNUNET_JSON_Specification::ptr, and str.

Referenced by GNUNET_JSON_spec_string_copy().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_string_copy()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_string_copy ( const char *  name,
char **  strptr 
)

The expected field stores a string.

Parameters
namename of the JSON field
strptrwhere to store a pointer to the field

Definition at line 339 of file json_helper.c.

341{
344 .field = name,
345 .ptr = strptr
346 };
347
348 *strptr = NULL;
349 return ret;
350}
static enum GNUNET_GenericReturnValue parse_string_copy(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to string, and make a copy.

References name, parse_string_copy(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_json()

static enum GNUNET_GenericReturnValue parse_json ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a JSON object.

(Yes, trivial.)

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

Definition at line 362 of file json_helper.c.

365{
366 if (! (json_is_object (root) || json_is_array (root)))
367 {
368 GNUNET_break_op (0);
369 return GNUNET_SYSERR;
370 }
371 *(json_t **) spec->ptr = json_incref (root);
372 return GNUNET_OK;
373}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_json().

Here is the caller graph for this function:

◆ clean_json()

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

Cleanup data left from parsing JSON object.

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

Definition at line 383 of file json_helper.c.

385{
386 json_t **ptr = (json_t **) spec->ptr;
387
388 if (NULL != *ptr)
389 {
390 json_decref (*ptr);
391 *ptr = NULL;
392 }
393}

References GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_array_copy(), GNUNET_JSON_spec_json(), and GNUNET_JSON_spec_object_copy().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_json()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_json ( const char *  name,
json_t **  jsonp 
)

JSON object or array.

Reference counter is incremented.

Parameters
namename of the JSON field
[out]jsonpwhere to store the JSON found under name

Definition at line 397 of file json_helper.c.

399{
401 .parser = &parse_json,
402 .cleaner = &clean_json,
403 .field = name,
404 .ptr = jsonp,
405 };
406
407 *jsonp = NULL;
408 return ret;
409}
static void clean_json(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing JSON object.
static enum GNUNET_GenericReturnValue parse_json(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a JSON object.

References clean_json(), name, parse_json(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_object_const()

static enum GNUNET_GenericReturnValue parse_object_const ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a JSON object.

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

Definition at line 421 of file json_helper.c.

424{
425 if (NULL == root)
426 return GNUNET_OK;
427 if (! json_is_object (root))
428 {
429 GNUNET_break_op (0);
430 return GNUNET_SYSERR;
431 }
432 *(const json_t **) spec->ptr = (const json_t *) root;
433 return GNUNET_OK;
434}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_object_const().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_object_const()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_object_const ( const char *  name,
const json_t **  jsonp 
)

JSON object, reference counter not incremented.

Parameters
namename of the JSON field
[out]jsonpwhere to store the JSON found under name

Definition at line 438 of file json_helper.c.

440{
443 .field = name,
444 .ptr = jsonp,
445 };
446
447 *jsonp = NULL;
448 return ret;
449}
static enum GNUNET_GenericReturnValue parse_object_const(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a JSON object.

References name, parse_object_const(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_object_copy()

static enum GNUNET_GenericReturnValue parse_object_copy ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a JSON object and increment the reference counter.

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

Definition at line 461 of file json_helper.c.

464{
465 if (NULL == root)
466 return GNUNET_OK;
467 if (! json_is_object (root))
468 {
469 GNUNET_break_op (0);
470 return GNUNET_SYSERR;
471 }
472 *((json_t **) spec->ptr) = json_incref (root);
473 return GNUNET_OK;
474}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_object_copy().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_object_copy()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_object_copy ( const char *  name,
json_t **  jsonp 
)

JSON object, reference counter incremented.

Parameters
namename of the JSON field
[out]jsonpwhere to store the JSON found under name

Definition at line 478 of file json_helper.c.

480{
483 .cls = &clean_json,
484 .field = name,
485 .ptr = jsonp,
486 };
487
488 *jsonp = NULL;
489 return ret;
490}
static enum GNUNET_GenericReturnValue parse_object_copy(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a JSON object and increment the reference counter.

References clean_json(), name, parse_object_copy(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_array_const()

static enum GNUNET_GenericReturnValue parse_array_const ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON to a JSON array.

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

Definition at line 502 of file json_helper.c.

505{
506 if (NULL == root)
507 return GNUNET_OK;
508 if (! json_is_array (root))
509 {
510 GNUNET_break_op (0);
511 return GNUNET_SYSERR;
512 }
513 *(const json_t **) spec->ptr = (const json_t *) root;
514 return GNUNET_OK;
515}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_array_const().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_array_const()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_array_const ( const char *  name,
const json_t **  jsonp 
)

JSON array, reference counter not incremented.

Parameters
namename of the JSON field
[out]jsonpwhere to store the JSON found under name

Definition at line 519 of file json_helper.c.

521{
524 .field = name,
525 .ptr = jsonp
526 };
527
528 *jsonp = NULL;
529 return ret;
530}
static enum GNUNET_GenericReturnValue parse_array_const(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON to a JSON array.

References name, parse_array_const(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_array_copy()

static enum GNUNET_GenericReturnValue parse_array_copy ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON to a JSON array and increment the reference counter.

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

Definition at line 542 of file json_helper.c.

545{
546 if (NULL == root)
547 return GNUNET_OK;
548 if (! json_is_array (root))
549 {
550 GNUNET_break_op (0);
551 return GNUNET_SYSERR;
552 }
553 *((json_t **) spec->ptr) = json_incref (root);
554 return GNUNET_OK;
555}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_array_copy().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_array_copy()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_array_copy ( const char *  name,
json_t **  jsonp 
)

JSON array, reference counter incremented.

Parameters
namename of the JSON field
[out]jsonpwhere to store the JSON found under name

Definition at line 559 of file json_helper.c.

561{
564 .cleaner = &clean_json,
565 .field = name,
566 .ptr = jsonp
567 };
568
569 *jsonp = NULL;
570 return ret;
571}
static enum GNUNET_GenericReturnValue parse_array_copy(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON to a JSON array and increment the reference counter.

References clean_json(), name, parse_array_copy(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_bool()

static enum GNUNET_GenericReturnValue parse_bool ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a bool.

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

Definition at line 583 of file json_helper.c.

586{
587 bool *b = spec->ptr;
588
589 if (json_true () == root)
590 {
591 *b = true;
592 return GNUNET_OK;
593 }
594 if (json_false () == root)
595 {
596 *b = false;
597 return GNUNET_OK;
598 }
599 GNUNET_break_op (0);
600 return GNUNET_SYSERR;
601}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_bool().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_bool()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_bool ( const char *  name,
bool *  b 
)

boolean.

Parameters
namename of the JSON field
[out]bwhere to store the boolean found under name

Definition at line 605 of file json_helper.c.

607{
609 .parser = &parse_bool,
610 .field = name,
611 .ptr = b,
612 .ptr_size = sizeof(bool),
613 };
614
615 return ret;
616}
static enum GNUNET_GenericReturnValue parse_bool(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a bool.

References name, parse_bool(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_double()

static enum GNUNET_GenericReturnValue parse_double ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a double.

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

Definition at line 628 of file json_helper.c.

631{
632 double *f = spec->ptr;
633
634 if (! json_is_real (root))
635 {
636 GNUNET_break_op (0);
637 return GNUNET_SYSERR;
638 }
639 *f = json_real_value (root);
640 return GNUNET_OK;
641}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_double().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_double()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_double ( const char *  name,
double *  f 
)

double.

Parameters
namename of the JSON field
[out]fwhere to store the double found under name

Definition at line 645 of file json_helper.c.

647{
650 .field = name,
651 .ptr = f,
652 .ptr_size = sizeof(double),
653 };
654
655 return ret;
656}
static enum GNUNET_GenericReturnValue parse_double(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a double.

References name, parse_double(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_u8()

static enum GNUNET_GenericReturnValue parse_u8 ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a uint8_t.

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

Definition at line 668 of file json_helper.c.

671{
672 json_int_t val;
673 uint8_t *up = spec->ptr;
674
675 if (! json_is_integer (root))
676 {
677 GNUNET_break_op (0);
678 return GNUNET_SYSERR;
679 }
680 val = json_integer_value (root);
681 if ((0 > val) || (val > UINT8_MAX))
682 {
683 GNUNET_break_op (0);
684 return GNUNET_SYSERR;
685 }
686 *up = (uint8_t) val;
687 return GNUNET_OK;
688}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_uint8().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_uint8()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint8 ( const char *  name,
uint8_t *  u8 
)

8-bit integer.

Parameters
namename of the JSON field
[out]u8where to store the integer found under name

Definition at line 692 of file json_helper.c.

694{
696 .parser = &parse_u8,
697 .field = name,
698 .ptr = u8,
699 .ptr_size = sizeof(uint8_t),
700 };
701
702 return ret;
703}
static enum GNUNET_GenericReturnValue parse_u8(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a uint8_t.

References name, parse_u8(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_u16()

static enum GNUNET_GenericReturnValue parse_u16 ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a uint16_t.

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

Definition at line 715 of file json_helper.c.

718{
719 json_int_t val;
720 uint16_t *up = spec->ptr;
721
722 if (! json_is_integer (root))
723 {
724 GNUNET_break_op (0);
725 return GNUNET_SYSERR;
726 }
727 val = json_integer_value (root);
728 if ((0 > val) || (val > UINT16_MAX))
729 {
730 GNUNET_break_op (0);
731 return GNUNET_SYSERR;
732 }
733 *up = (uint16_t) val;
734 return GNUNET_OK;
735}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_uint16().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_uint16()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint16 ( const char *  name,
uint16_t *  u16 
)

16-bit integer.

Parameters
namename of the JSON field
[out]u16where to store the integer found under name

Definition at line 739 of file json_helper.c.

741{
743 .parser = &parse_u16,
744 .field = name,
745 .ptr = u16,
746 .ptr_size = sizeof(uint16_t),
747 };
748
749 return ret;
750}
static enum GNUNET_GenericReturnValue parse_u16(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a uint16_t.

References name, parse_u16(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_u32()

static enum GNUNET_GenericReturnValue parse_u32 ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a uint32_t.

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

Definition at line 762 of file json_helper.c.

765{
766 json_int_t val;
767 uint32_t *up = spec->ptr;
768
769 if (! json_is_integer (root))
770 {
771 GNUNET_break_op (0);
772 return GNUNET_SYSERR;
773 }
774 val = json_integer_value (root);
775 if ((0 > val) || (val > UINT32_MAX))
776 {
777 GNUNET_break_op (0);
778 return GNUNET_SYSERR;
779 }
780 *up = (uint32_t) val;
781 return GNUNET_OK;
782}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_uint32().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_uint32()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint32 ( const char *  name,
uint32_t *  u32 
)

32-bit integer.

Parameters
namename of the JSON field
[out]u32where to store the integer found under name

Definition at line 786 of file json_helper.c.

788{
790 .parser = &parse_u32,
791 .field = name,
792 .ptr = u32,
793 .ptr_size = sizeof(uint32_t),
794 };
795
796 return ret;
797}
static enum GNUNET_GenericReturnValue parse_u32(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a uint32_t.

References name, parse_u32(), GNUNET_JSON_Specification::parser, and ret.

Referenced by parse_blinded_sig().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_ui()

static enum GNUNET_GenericReturnValue parse_ui ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to an unsigned int.

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

Definition at line 809 of file json_helper.c.

812{
813 json_int_t val;
814 unsigned int *up = spec->ptr;
815
816 if (! json_is_integer (root))
817 {
818 GNUNET_break_op (0);
819 return GNUNET_SYSERR;
820 }
821 val = json_integer_value (root);
822 if ((0 > val) || (val > UINT_MAX))
823 {
824 GNUNET_break_op (0);
825 return GNUNET_SYSERR;
826 }
827 *up = (unsigned int) val;
828 return GNUNET_OK;
829}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_uint().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_uint()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint ( const char *  name,
unsigned int *  ui 
)

Unsigned integer.

Parameters
namename of the JSON field
[out]uiwhere to store the integer found under name

Definition at line 833 of file json_helper.c.

835{
837 .parser = &parse_ui,
838 .field = name,
839 .ptr = ui,
840 .ptr_size = sizeof(unsigned int),
841 };
842
843 return ret;
844}
static enum GNUNET_GenericReturnValue parse_ui(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to an unsigned int.

References name, parse_ui(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_ull()

static enum GNUNET_GenericReturnValue parse_ull ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to an unsigned long long.

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

Definition at line 856 of file json_helper.c.

859{
860 json_int_t val;
861 unsigned long long *up = spec->ptr;
862
863 if (! json_is_integer (root))
864 {
865 GNUNET_break_op (0);
866 return GNUNET_SYSERR;
867 }
868 val = json_integer_value (root);
869 if ((0 > val) || (val > ULLONG_MAX))
870 {
871 GNUNET_break_op (0);
872 return GNUNET_SYSERR;
873 }
874 *up = (unsigned long long) val;
875 return GNUNET_OK;
876}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_ull().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_ull()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_ull ( const char *  name,
unsigned long long *  ull 
)

Unsigned long long.

Parameters
namename of the JSON field
[out]ullwhere to store the unsigned long long found under name

Definition at line 880 of file json_helper.c.

882{
884 .parser = &parse_ull,
885 .field = name,
886 .ptr = ull,
887 .ptr_size = sizeof(unsigned long long),
888 };
889
890 return ret;
891}
static enum GNUNET_GenericReturnValue parse_ull(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to an unsigned long long.

References name, parse_ull(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_u64()

static enum GNUNET_GenericReturnValue parse_u64 ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a uint64_t.

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

Definition at line 903 of file json_helper.c.

906{
907 json_int_t val;
908 uint64_t *up = spec->ptr;
909
910 if (! json_is_integer (root))
911 {
912 GNUNET_break_op (0);
913 return GNUNET_SYSERR;
914 }
915 val = json_integer_value (root);
916 *up = (uint64_t) val;
917 return GNUNET_OK;
918}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_uint64().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_uint64()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint64 ( const char *  name,
uint64_t *  u64 
)

64-bit integer.

Parameters
namename of the JSON field
[out]u64where to store the integer found under name

Definition at line 922 of file json_helper.c.

924{
926 .parser = &parse_u64,
927 .field = name,
928 .ptr = u64,
929 .ptr_size = sizeof(uint64_t),
930 };
931
932 return ret;
933}
static enum GNUNET_GenericReturnValue parse_u64(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a uint64_t.

References name, parse_u64(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_i16()

static enum GNUNET_GenericReturnValue parse_i16 ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a int16_t.

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

Definition at line 945 of file json_helper.c.

948{
949 json_int_t val;
950 int16_t *up = spec->ptr;
951
952 if (! json_is_integer (root))
953 {
954 GNUNET_break_op (0);
955 return GNUNET_SYSERR;
956 }
957 val = json_integer_value (root);
958 if ( (val < INT16_MIN) ||
959 (val > INT16_MAX) )
960 {
961 GNUNET_break_op (0);
962 return GNUNET_SYSERR;
963 }
964 *up = (int16_t) val;
965 return GNUNET_OK;
966}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_int16().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_int16()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_int16 ( const char *  name,
int16_t *  i16 
)

16-bit signed integer.

Parameters
namename of the JSON field
[out]i16where to store the integer found under name

Definition at line 970 of file json_helper.c.

972{
974 .parser = &parse_i16,
975 .field = name,
976 .ptr = i16,
977 .ptr_size = sizeof(int16_t),
978 };
979
980 return ret;
981}
static enum GNUNET_GenericReturnValue parse_i16(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a int16_t.

References name, parse_i16(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_i64()

static enum GNUNET_GenericReturnValue parse_i64 ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a int64_t.

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

Definition at line 993 of file json_helper.c.

996{
997 json_int_t val;
998 int64_t *up = spec->ptr;
999
1000 if (! json_is_integer (root))
1001 {
1002 GNUNET_break_op (0);
1003 return GNUNET_SYSERR;
1004 }
1005 val = json_integer_value (root);
1006 *up = (int64_t) val;
1007 return GNUNET_OK;
1008}

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_int64().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_int64()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_int64 ( const char *  name,
int64_t *  i64 
)

64-bit signed integer.

Parameters
namename of the JSON field
[out]i64where to store the integer found under name

Definition at line 1012 of file json_helper.c.

1014{
1016 .parser = &parse_i64,
1017 .field = name,
1018 .ptr = i64,
1019 .ptr_size = sizeof(int64_t),
1020 };
1021
1022 return ret;
1023}
static enum GNUNET_GenericReturnValue parse_i64(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a int64_t.

References name, parse_i64(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_timestamp()

static enum GNUNET_GenericReturnValue parse_timestamp ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a timestamp.

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

Definition at line 1037 of file json_helper.c.

1040{
1041 struct GNUNET_TIME_Timestamp *ts = spec->ptr;
1042 json_t *json_t_s;
1043 unsigned long long int tval;
1044
1045 if (! json_is_object (root))
1046 {
1047 GNUNET_break_op (0);
1048 return GNUNET_SYSERR;
1049 }
1050 json_t_s = json_object_get (root,
1051 "t_s");
1052 if (json_is_integer (json_t_s))
1053 {
1054 tval = json_integer_value (json_t_s);
1055 /* Time is in seconds in JSON, but in microseconds in GNUNET_TIME_Absolute */
1057 = tval * GNUNET_TIME_UNIT_SECONDS.rel_value_us;
1058 if (ts->abs_time.abs_value_us
1059 / GNUNET_TIME_UNIT_SECONDS.rel_value_us
1060 != tval)
1061 {
1062 /* Integer overflow */
1063 GNUNET_break_op (0);
1064 return GNUNET_SYSERR;
1065 }
1066 return GNUNET_OK;
1067 }
1068 if (json_is_string (json_t_s))
1069 {
1070 const char *val;
1071
1072 val = json_string_value (json_t_s);
1073 if ((0 == strcasecmp (val,
1074 "never")))
1075 {
1077 return GNUNET_OK;
1078 }
1079 GNUNET_break_op (0);
1080 return GNUNET_SYSERR;
1081 }
1082 GNUNET_break_op (0);
1083 return GNUNET_SYSERR;
1084}
#define GNUNET_TIME_UNIT_SECONDS
One second.
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
uint64_t abs_value_us
The actual value.
Time for timestamps used by GNUnet, in microseconds rounded to seconds.
struct GNUNET_TIME_Absolute abs_time
The actual value.

References GNUNET_TIME_Timestamp::abs_time, GNUNET_TIME_Absolute::abs_value_us, GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_SECONDS, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_timestamp(), and parse_timestamp_nbo().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_timestamp()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_timestamp ( const char *  name,
struct GNUNET_TIME_Timestamp t 
)

Timestamp.

Parameters
namename of the JSON field
[out]tat where to store the absolute time found under name

Definition at line 1088 of file json_helper.c.

1090{
1093 .field = name,
1094 .ptr = t,
1095 .ptr_size = sizeof(struct GNUNET_TIME_Timestamp)
1096 };
1097
1098 return ret;
1099}
static struct GNUNET_SCHEDULER_Task * t
Main task.
static enum GNUNET_GenericReturnValue parse_timestamp(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a timestamp.

References name, parse_timestamp(), GNUNET_JSON_Specification::parser, ret, and t.

Here is the call graph for this function:

◆ parse_timestamp_nbo()

static enum GNUNET_GenericReturnValue parse_timestamp_nbo ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to absolute time.

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

Definition at line 1111 of file json_helper.c.

1114{
1115 struct GNUNET_TIME_TimestampNBO *ts = spec->ptr;
1116 struct GNUNET_TIME_Timestamp a;
1117 struct GNUNET_JSON_Specification ispec;
1118
1119 ispec = *spec;
1120 ispec.parser = &parse_timestamp;
1121 ispec.ptr = &a;
1122 if (GNUNET_OK !=
1123 parse_timestamp (NULL,
1124 root,
1125 &ispec))
1126 return GNUNET_SYSERR;
1128 return GNUNET_OK;
1129}
struct GNUNET_TIME_TimestampNBO GNUNET_TIME_timestamp_hton(struct GNUNET_TIME_Timestamp t)
Convert timestamp to network byte order.
Definition time.c:91
Time for timestamps used by GNUnet, in seconds and in network byte order.

References GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_timestamp_hton(), parse_timestamp(), GNUNET_JSON_Specification::parser, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_timestamp_nbo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_JSON_spec_timestamp_nbo()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_timestamp_nbo ( const char *  name,
struct GNUNET_TIME_TimestampNBO tn 
)

Timestamp in network byte order.

Parameters
namename of the JSON field
[out]tnwhere to store the absolute time found under name

Definition at line 1133 of file json_helper.c.

1135{
1138 .field = name,
1139 .ptr = at,
1140 .ptr_size = sizeof(struct GNUNET_TIME_TimestampNBO)
1141 };
1142
1143 return ret;
1144}
static enum GNUNET_GenericReturnValue parse_timestamp_nbo(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to absolute time.

References name, parse_timestamp_nbo(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_rel_time()

static enum GNUNET_GenericReturnValue parse_rel_time ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to relative time.

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

Definition at line 1156 of file json_helper.c.

1159{
1160 struct GNUNET_TIME_Relative *rel = spec->ptr;
1161 json_t *json_d_us;
1162 unsigned long long int tval;
1163
1164 if (! json_is_object (root))
1165 {
1166 GNUNET_break_op (0);
1167 return GNUNET_SYSERR;
1168 }
1169 json_d_us = json_object_get (root,
1170 "d_us");
1171 if (json_is_integer (json_d_us))
1172 {
1173 tval = json_integer_value (json_d_us);
1174 if (tval >= (1LLU << 53))
1175 {
1176 /* value is larger than allowed */
1177 GNUNET_break_op (0);
1178 return GNUNET_SYSERR;
1179 }
1180 rel->rel_value_us = tval;
1181 return GNUNET_OK;
1182 }
1183 if (json_is_string (json_d_us))
1184 {
1185 const char *val;
1186
1187 val = json_string_value (json_d_us);
1188 if ((0 == strcasecmp (val,
1189 "forever")))
1190 {
1192 return GNUNET_OK;
1193 }
1194 GNUNET_break_op (0);
1195 return GNUNET_SYSERR;
1196 }
1197 GNUNET_break_op (0);
1198 return GNUNET_SYSERR;
1199}
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_JSON_Specification::ptr, and GNUNET_TIME_Relative::rel_value_us.

Referenced by GNUNET_JSON_spec_relative_time().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_relative_time()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_relative_time ( const char *  name,
struct GNUNET_TIME_Relative rt 
)

Relative time.

Parameters
namename of the JSON field
[out]rtwhere to store the relative time found under name

Definition at line 1203 of file json_helper.c.

1205{
1208 .field = name,
1209 .ptr = rt,
1210 .ptr_size = sizeof(struct GNUNET_TIME_Relative)
1211 };
1212
1213 return ret;
1214}
static enum GNUNET_GenericReturnValue parse_rel_time(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to relative time.

References name, parse_rel_time(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_rsa_public_key()

static enum GNUNET_GenericReturnValue parse_rsa_public_key ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to RSA public key.

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

Definition at line 1226 of file json_helper.c.

1229{
1230 struct GNUNET_CRYPTO_RsaPublicKey **pk = spec->ptr;
1231 const char *enc;
1232 char *buf;
1233 size_t len;
1234 size_t buf_len;
1235
1236 if (NULL == (enc = json_string_value (root)))
1237 {
1238 GNUNET_break_op (0);
1239 return GNUNET_SYSERR;
1240 }
1241 len = strlen (enc);
1242 buf_len = (len * 5) / 8;
1243 buf = GNUNET_malloc (buf_len);
1244 if (GNUNET_OK !=
1246 len,
1247 buf,
1248 buf_len))
1249 {
1250 GNUNET_break_op (0);
1251 GNUNET_free (buf);
1252 return GNUNET_SYSERR;
1253 }
1254 if (NULL == (*pk = GNUNET_CRYPTO_rsa_public_key_decode (buf,
1255 buf_len)))
1256 {
1257 GNUNET_break_op (0);
1258 GNUNET_free (buf);
1259 return GNUNET_SYSERR;
1260 }
1261 GNUNET_free (buf);
1262 return GNUNET_OK;
1263}
struct GNUNET_CRYPTO_BlindablePrivateKey pk
Private key from command line option, or NULL.
struct GNUNET_CRYPTO_RsaPublicKey * GNUNET_CRYPTO_rsa_public_key_decode(const char *buf, size_t len)
Decode the public key from the data-format back to the "normal", internal format.
Definition crypto_rsa.c:423
#define GNUNET_malloc(size)
Wrapper around malloc.
The public information of an RSA key pair.
Definition crypto_rsa.c:53

References enc, GNUNET_break_op, GNUNET_CRYPTO_rsa_public_key_decode(), GNUNET_free, GNUNET_malloc, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, pk, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_rsa_public_key().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_rsa_public_key()

static void clean_rsa_public_key ( 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 1273 of file json_helper.c.

1275{
1276 struct GNUNET_CRYPTO_RsaPublicKey **pk = spec->ptr;
1277
1278 if (NULL != *pk)
1279 {
1281 *pk = NULL;
1282 }
1283}
void GNUNET_CRYPTO_rsa_public_key_free(struct GNUNET_CRYPTO_RsaPublicKey *key)
Free memory occupied by the public key.
Definition crypto_rsa.c:268

References GNUNET_CRYPTO_rsa_public_key_free(), pk, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_rsa_public_key().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_JSON_spec_rsa_public_key()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_public_key ( const char *  name,
struct GNUNET_CRYPTO_RsaPublicKey **  pk 
)

Specification for parsing an RSA public key.

Parameters
namename of the JSON field
pkwhere to store the RSA key found under name

Definition at line 1287 of file json_helper.c.

1289{
1292 .cleaner = &clean_rsa_public_key,
1293 .field = name,
1294 .ptr = pk
1295 };
1296
1297 *pk = NULL;
1298 return ret;
1299}
static void clean_rsa_public_key(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA public key.
static enum GNUNET_GenericReturnValue parse_rsa_public_key(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to RSA public key.

References clean_rsa_public_key(), name, parse_rsa_public_key(), GNUNET_JSON_Specification::parser, pk, and ret.

Here is the call graph for this function:

◆ parse_rsa_signature()

static enum GNUNET_GenericReturnValue parse_rsa_signature ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to RSA signature.

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

Definition at line 1311 of file json_helper.c.

1314{
1315 struct GNUNET_CRYPTO_RsaSignature **sig = spec->ptr;
1316 size_t size;
1317 const char *str;
1318 int res;
1319 void *buf;
1320
1321 str = json_string_value (root);
1322 if (NULL == str)
1323 {
1324 GNUNET_break_op (0);
1325 return GNUNET_SYSERR;
1326 }
1327 size = (strlen (str) * 5) / 8;
1328 buf = GNUNET_malloc (size);
1330 strlen (str),
1331 buf,
1332 size);
1333 if (GNUNET_OK != res)
1334 {
1335 GNUNET_free (buf);
1336 GNUNET_break_op (0);
1337 return GNUNET_SYSERR;
1338 }
1339 if (NULL == (*sig = GNUNET_CRYPTO_rsa_signature_decode (buf,
1340 size)))
1341 {
1342 GNUNET_break_op (0);
1343 GNUNET_free (buf);
1344 return GNUNET_SYSERR;
1345 }
1346 GNUNET_free (buf);
1347 return GNUNET_OK;
1348}
static char * res
Currently read line or NULL on EOF.
struct GNUNET_CRYPTO_RsaSignature * GNUNET_CRYPTO_rsa_signature_decode(const void *buf, size_t buf_size)
Decode the signature from the data-format back to the "normal", internal format.

References GNUNET_break_op, GNUNET_CRYPTO_rsa_signature_decode(), GNUNET_free, GNUNET_malloc, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_SYSERR, GNUNET_JSON_Specification::ptr, res, size, and str.

Referenced by GNUNET_JSON_spec_rsa_signature().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_rsa_signature()

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

Cleanup data left from parsing RSA signature.

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

Definition at line 1358 of file json_helper.c.

1360{
1361 struct GNUNET_CRYPTO_RsaSignature **sig = spec->ptr;
1362
1363 if (NULL != *sig)
1364 {
1366 *sig = NULL;
1367 }
1368}
void GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig)
Free memory occupied by signature.

References GNUNET_CRYPTO_rsa_signature_free(), and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_rsa_signature().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_JSON_spec_rsa_signature()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_signature ( const char *  name,
struct GNUNET_CRYPTO_RsaSignature **  sig 
)

Specification for parsing an RSA signature.

Parameters
namename of the JSON field
sigwhere to store the RSA signature found under name

Definition at line 1372 of file json_helper.c.

1374{
1377 .cleaner = &clean_rsa_signature,
1378 .cls = NULL,
1379 .field = name,
1380 .ptr = sig,
1381 .ptr_size = 0,
1382 .size_ptr = NULL
1383 };
1384
1385 *sig = NULL;
1386 return ret;
1387}
static enum GNUNET_GenericReturnValue parse_rsa_signature(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to RSA signature.
static void clean_rsa_signature(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing RSA signature.

References clean_rsa_signature(), name, parse_rsa_signature(), GNUNET_JSON_Specification::parser, and ret.

Referenced by parse_blinded_sig(), and parse_unblinded_sig().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_boolean()

static enum GNUNET_GenericReturnValue parse_boolean ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to an int as a boolean.

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

Definition at line 1399 of file json_helper.c.

1402{
1403 int *bp = spec->ptr;
1404
1405 if (! json_is_boolean (root))
1406 {
1407 GNUNET_break_op (0);
1408 return GNUNET_SYSERR;
1409 }
1410 *bp = json_boolean_value (root) ? GNUNET_YES : GNUNET_NO;
1411 return GNUNET_OK;
1412}
@ GNUNET_YES
@ GNUNET_NO

References GNUNET_break_op, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_boolean().

Here is the caller graph for this function:

◆ GNUNET_JSON_spec_boolean()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_boolean ( const char *  name,
int *  boolean 
)

Boolean (true mapped to GNUNET_YES, false mapped to GNUNET_NO).

Parameters
namename of the JSON field
[out]booleanwhere to store the boolean found under name

Definition at line 1416 of file json_helper.c.

1418{
1421 .field = name,
1422 .ptr = boolean,
1423 .ptr_size = sizeof(int),
1424 };
1425
1426 return ret;
1427}
static enum GNUNET_GenericReturnValue parse_boolean(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to an int as a boolean.

References name, parse_boolean(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_blinded_message()

static enum GNUNET_GenericReturnValue parse_blinded_message ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a blinded message.

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

Definition at line 1439 of file json_helper.c.

1442{
1443 struct GNUNET_CRYPTO_BlindedMessage **target = spec->ptr;
1444 struct GNUNET_CRYPTO_BlindedMessage *blinded_message;
1445 const char *cipher;
1446 struct GNUNET_JSON_Specification dspec[] = {
1447 GNUNET_JSON_spec_string ("cipher",
1448 &cipher),
1450 };
1451 const char *emsg;
1452 unsigned int eline;
1453
1454 (void) cls;
1455 if (GNUNET_OK !=
1456 GNUNET_JSON_parse (root,
1457 dspec,
1458 &emsg,
1459 &eline))
1460 {
1461 GNUNET_break_op (0);
1462 return GNUNET_SYSERR;
1463 }
1464 blinded_message = GNUNET_new (struct GNUNET_CRYPTO_BlindedMessage);
1465 blinded_message->rc = 1;
1466 blinded_message->cipher = string_to_cipher (cipher);
1467 switch (blinded_message->cipher)
1468 {
1470 break;
1472 {
1473 struct GNUNET_JSON_Specification ispec[] = {
1475 /* TODO: Change this field name to something
1476 more generic / pass in as argument. */
1477 "rsa_blinded_planchet",
1478 &blinded_message->details.rsa_blinded_message.blinded_msg,
1479 &blinded_message->details.rsa_blinded_message.blinded_msg_size),
1481 };
1482
1483 if (GNUNET_OK !=
1484 GNUNET_JSON_parse (root,
1485 ispec,
1486 &emsg,
1487 &eline))
1488 {
1489 GNUNET_break_op (0);
1490 GNUNET_free (blinded_message);
1491 return GNUNET_SYSERR;
1492 }
1493 *target = blinded_message;
1494 return GNUNET_OK;
1495 }
1497 {
1498 struct GNUNET_JSON_Specification ispec[] = {
1500 "cs_nonce",
1501 &blinded_message->details.cs_blinded_message.nonce),
1503 "cs_blinded_c0",
1504 &blinded_message->details.cs_blinded_message.c[0]),
1506 "cs_blinded_c1",
1507 &blinded_message->details.cs_blinded_message.c[1]),
1509 };
1510
1511 if (GNUNET_OK !=
1512 GNUNET_JSON_parse (root,
1513 ispec,
1514 &emsg,
1515 &eline))
1516 {
1517 GNUNET_break_op (0);
1518 GNUNET_free (blinded_message);
1519 return GNUNET_SYSERR;
1520 }
1521 *target = blinded_message;
1522 return GNUNET_OK;
1523 }
1524 }
1525 GNUNET_break_op (0);
1526 GNUNET_free (blinded_message);
1527 return GNUNET_SYSERR;
1528}
#define GNUNET_JSON_spec_fixed_auto(name, obj)
Fixed size object (in network byte order, encoded using Crockford Base32hex encoding).
enum GNUNET_GenericReturnValue GNUNET_JSON_parse(const json_t *root, struct GNUNET_JSON_Specification *spec, const char **error_json_name, unsigned int *error_line)
Navigate and parse data in a JSON tree.
Definition json.c:32
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_JSON_Specification GNUNET_JSON_spec_varsize(const char *name, void **obj, size_t *size)
Variable size object (in network byte order, encoded using Crockford Base32hex encoding).
struct GNUNET_JSON_Specification GNUNET_JSON_spec_end()
End of a parser specification.
Definition json_helper.c:34
struct GNUNET_JSON_Specification GNUNET_JSON_spec_string(const char *name, const char **strptr)
The expected field stores a string.
static enum GNUNET_CRYPTO_BlindSignatureAlgorithm string_to_cipher(const char *cipher_s)
Convert string value to numeric cipher value.
Definition json_helper.c:51
Blinded message ready for blind signing.
unsigned int rc
Reference counter.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the sign blinded message.
struct GNUNET_CRYPTO_CsBlindedMessage cs_blinded_message
If we use GNUNET_CRYPTO_BSA_CS in cipher.
union GNUNET_CRYPTO_BlindedMessage::@22 details
Details, depending on cipher.
struct GNUNET_CRYPTO_RsaBlindedMessage rsa_blinded_message
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
struct GNUNET_CRYPTO_CsC c[2]
The Clause Schnorr c_0 and c_1 containing the blinded message.
struct GNUNET_CRYPTO_CsSessionNonce nonce
Nonce used in initial request.
size_t blinded_msg_size
Size of the blinded_msg to be signed.
void * blinded_msg
Blinded message to be signed Note: is malloc()'ed!
void * cls
Closure for parser and cleaner.

References GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg, GNUNET_CRYPTO_RsaBlindedMessage::blinded_msg_size, GNUNET_CRYPTO_CsBlindedMessage::c, GNUNET_CRYPTO_BlindedMessage::cipher, GNUNET_JSON_Specification::cls, GNUNET_CRYPTO_BlindedMessage::cs_blinded_message, GNUNET_CRYPTO_BlindedMessage::details, GNUNET_break_op, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_free, GNUNET_JSON_parse(), GNUNET_JSON_spec_end(), GNUNET_JSON_spec_fixed_auto, GNUNET_JSON_spec_string(), GNUNET_JSON_spec_varsize(), GNUNET_new, GNUNET_OK, GNUNET_SYSERR, GNUNET_CRYPTO_CsBlindedMessage::nonce, GNUNET_JSON_Specification::ptr, GNUNET_CRYPTO_BlindedMessage::rc, GNUNET_CRYPTO_BlindedMessage::rsa_blinded_message, and string_to_cipher().

Referenced by GNUNET_JSON_spec_blinded_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_blinded_message()

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

Cleanup data left from parsing blinded message.

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

Definition at line 1538 of file json_helper.c.

1540{
1541 struct GNUNET_CRYPTO_BlindedMessage **blinded_message = spec->ptr;
1542
1543 (void) cls;
1544 if (NULL != blinded_message)
1545 {
1546 GNUNET_CRYPTO_blinded_message_decref (*blinded_message);
1547 *blinded_message = NULL;
1548 }
1549}
void GNUNET_CRYPTO_blinded_message_decref(struct GNUNET_CRYPTO_BlindedMessage *bm)
Decrement reference counter of a bm, and free it if it reaches zero.

References GNUNET_CRYPTO_blinded_message_decref(), and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_blinded_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_JSON_spec_blinded_message()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_blinded_message ( const char *  name,
struct GNUNET_CRYPTO_BlindedMessage **  msg 
)

Specification for parsing a blinded message.

Parameters
namename of the JSON field
sigwhere to store the blinded message found under name

Definition at line 1553 of file json_helper.c.

1555{
1558 .cleaner = &clean_blinded_message,
1559 .cls = NULL,
1560 .field = name,
1561 .ptr = msg,
1562 .ptr_size = 0,
1563 .size_ptr = NULL
1564 };
1565
1566 *msg = NULL;
1567 return ret;
1568}
struct GNUNET_MessageHeader * msg
Definition 005.c:2
static enum GNUNET_GenericReturnValue parse_blinded_message(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a blinded message.
static void clean_blinded_message(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing blinded message.

References clean_blinded_message(), msg, name, parse_blinded_message(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_blinded_sig()

static enum GNUNET_GenericReturnValue parse_blinded_sig ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to a blinded signature.

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

Definition at line 1580 of file json_helper.c.

1583{
1584 struct GNUNET_CRYPTO_BlindedSignature **target = spec->ptr;
1585 struct GNUNET_CRYPTO_BlindedSignature *blinded_sig;
1586 const char *cipher;
1587 struct GNUNET_JSON_Specification dspec[] = {
1588 GNUNET_JSON_spec_string ("cipher",
1589 &cipher),
1591 };
1592 const char *emsg;
1593 unsigned int eline;
1594
1595 (void) cls;
1596 if (GNUNET_OK !=
1597 GNUNET_JSON_parse (root,
1598 dspec,
1599 &emsg,
1600 &eline))
1601 {
1602 GNUNET_break_op (0);
1603 return GNUNET_SYSERR;
1604 }
1605 blinded_sig = GNUNET_new (struct GNUNET_CRYPTO_BlindedSignature);
1606 blinded_sig->cipher = string_to_cipher (cipher);
1607 blinded_sig->rc = 1;
1608 switch (blinded_sig->cipher)
1609 {
1611 break;
1613 {
1614 struct GNUNET_JSON_Specification ispec[] = {
1616 "blinded_rsa_signature",
1617 &blinded_sig->details.blinded_rsa_signature),
1619 };
1620
1621 if (GNUNET_OK !=
1622 GNUNET_JSON_parse (root,
1623 ispec,
1624 &emsg,
1625 &eline))
1626 {
1627 GNUNET_break_op (0);
1628 GNUNET_free (blinded_sig);
1629 return GNUNET_SYSERR;
1630 }
1631 *target = blinded_sig;
1632 return GNUNET_OK;
1633 }
1635 {
1636 struct GNUNET_JSON_Specification ispec[] = {
1638 &blinded_sig->details.blinded_cs_answer.b),
1640 &blinded_sig->details.blinded_cs_answer.
1641 s_scalar),
1643 };
1644
1645 if (GNUNET_OK !=
1646 GNUNET_JSON_parse (root,
1647 ispec,
1648 &emsg,
1649 &eline))
1650 {
1651 GNUNET_break_op (0);
1652 GNUNET_free (blinded_sig);
1653 return GNUNET_SYSERR;
1654 }
1655 *target = blinded_sig;
1656 return GNUNET_OK;
1657 }
1658 }
1659 GNUNET_break_op (0);
1660 GNUNET_free (blinded_sig);
1661 return GNUNET_SYSERR;
1662}
struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint32(const char *name, uint32_t *u32)
32-bit integer.
struct GNUNET_JSON_Specification GNUNET_JSON_spec_rsa_signature(const char *name, struct GNUNET_CRYPTO_RsaSignature **sig)
Specification for parsing an RSA signature.
Type for blinded signatures.
unsigned int rc
Reference counter.
struct GNUNET_CRYPTO_CsBlindSignature blinded_cs_answer
If we use GNUNET_CRYPTO_BSA_CS in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the signature.
struct GNUNET_CRYPTO_RsaSignature * blinded_rsa_signature
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
union GNUNET_CRYPTO_BlindedSignature::@19 details
Details, depending on cipher.
unsigned int b
To make ROS problem harder, the signer chooses an unpredictable b and only calculates signature of c_...

References GNUNET_CRYPTO_CsBlindSignature::b, GNUNET_CRYPTO_BlindedSignature::blinded_cs_answer, GNUNET_CRYPTO_BlindedSignature::blinded_rsa_signature, GNUNET_CRYPTO_BlindedSignature::cipher, GNUNET_JSON_Specification::cls, GNUNET_CRYPTO_BlindedSignature::details, GNUNET_break_op, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_free, GNUNET_JSON_parse(), GNUNET_JSON_spec_end(), GNUNET_JSON_spec_fixed_auto, GNUNET_JSON_spec_rsa_signature(), GNUNET_JSON_spec_string(), GNUNET_JSON_spec_uint32(), GNUNET_new, GNUNET_OK, GNUNET_SYSERR, GNUNET_JSON_Specification::ptr, GNUNET_CRYPTO_BlindedSignature::rc, and string_to_cipher().

Referenced by GNUNET_JSON_spec_blinded_signature().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_blinded_sig()

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

Cleanup data left from parsing blinded sig.

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

Definition at line 1672 of file json_helper.c.

1674{
1675 struct GNUNET_CRYPTO_BlindedSignature **b_sig = spec->ptr;
1676
1677 (void) cls;
1678
1679 if (NULL != *b_sig)
1680 {
1682 *b_sig = NULL;
1683 }
1684}
void GNUNET_CRYPTO_blinded_sig_decref(struct GNUNET_CRYPTO_BlindedSignature *blind_sig)
Decrement reference counter of a blind_sig, and free it if it reaches zero.

References GNUNET_CRYPTO_blinded_sig_decref(), and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_blinded_signature().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_JSON_spec_blinded_signature()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_blinded_signature ( const char *  field,
struct GNUNET_CRYPTO_BlindedSignature **  b_sig 
)

Specification for parsing a blinded signature.

Parameters
namename of the JSON field
sigwhere to store the blinded signature found under name

Definition at line 1688 of file json_helper.c.

1691{
1694 .cleaner = &clean_blinded_sig,
1695 .field = field,
1696 .ptr = b_sig
1697 };
1698
1699 *b_sig = NULL;
1700 return ret;
1701}
static enum GNUNET_GenericReturnValue parse_blinded_sig(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to a blinded signature.
static void clean_blinded_sig(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing blinded sig.

References clean_blinded_sig(), GNUNET_JSON_Specification::field, parse_blinded_sig(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_unblinded_sig()

static enum GNUNET_GenericReturnValue parse_unblinded_sig ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to unblinded signature.

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

Definition at line 1713 of file json_helper.c.

1716{
1717 struct GNUNET_CRYPTO_UnblindedSignature **target = spec->ptr;
1718 struct GNUNET_CRYPTO_UnblindedSignature *unblinded_sig;
1719 const char *cipher;
1720 struct GNUNET_JSON_Specification dspec[] = {
1721 GNUNET_JSON_spec_string ("cipher",
1722 &cipher),
1724 };
1725 const char *emsg;
1726 unsigned int eline;
1727
1728 (void) cls;
1729 if (GNUNET_OK !=
1730 GNUNET_JSON_parse (root,
1731 dspec,
1732 &emsg,
1733 &eline))
1734 {
1735 GNUNET_break_op (0);
1736 return GNUNET_SYSERR;
1737 }
1738 unblinded_sig = GNUNET_new (struct GNUNET_CRYPTO_UnblindedSignature);
1739 unblinded_sig->cipher = string_to_cipher (cipher);
1740 unblinded_sig->rc = 1;
1741 switch (unblinded_sig->cipher)
1742 {
1744 break;
1746 {
1747 struct GNUNET_JSON_Specification ispec[] = {
1749 "rsa_signature",
1750 &unblinded_sig->details.rsa_signature),
1752 };
1753
1754 if (GNUNET_OK !=
1755 GNUNET_JSON_parse (root,
1756 ispec,
1757 &emsg,
1758 &eline))
1759 {
1760 GNUNET_break_op (0);
1761 GNUNET_free (unblinded_sig);
1762 return GNUNET_SYSERR;
1763 }
1764 *target = unblinded_sig;
1765 return GNUNET_OK;
1766 }
1768 {
1769 struct GNUNET_JSON_Specification ispec[] = {
1770 GNUNET_JSON_spec_fixed_auto ("cs_signature_r",
1771 &unblinded_sig->details.cs_signature.
1772 r_point),
1773 GNUNET_JSON_spec_fixed_auto ("cs_signature_s",
1774 &unblinded_sig->details.cs_signature.
1775 s_scalar),
1777 };
1778
1779 if (GNUNET_OK !=
1780 GNUNET_JSON_parse (root,
1781 ispec,
1782 &emsg,
1783 &eline))
1784 {
1785 GNUNET_break_op (0);
1786 GNUNET_free (unblinded_sig);
1787 return GNUNET_SYSERR;
1788 }
1789 *target = unblinded_sig;
1790 return GNUNET_OK;
1791 }
1792 }
1793 GNUNET_break_op (0);
1794 GNUNET_free (unblinded_sig);
1795 return GNUNET_SYSERR;
1796}
Type of (unblinded) signatures.
union GNUNET_CRYPTO_UnblindedSignature::@18 details
Details, depending on cipher.
struct GNUNET_CRYPTO_RsaSignature * rsa_signature
If we use GNUNET_CRYPTO_BSA_RSA in cipher.
unsigned int rc
Reference counter.
struct GNUNET_CRYPTO_CsSignature cs_signature
If we use GNUNET_CRYPTO_BSA_CS in cipher.
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher
Type of the signature.

References GNUNET_CRYPTO_UnblindedSignature::cipher, GNUNET_JSON_Specification::cls, GNUNET_CRYPTO_UnblindedSignature::cs_signature, GNUNET_CRYPTO_UnblindedSignature::details, GNUNET_break_op, GNUNET_CRYPTO_BSA_CS, GNUNET_CRYPTO_BSA_INVALID, GNUNET_CRYPTO_BSA_RSA, GNUNET_free, GNUNET_JSON_parse(), GNUNET_JSON_spec_end(), GNUNET_JSON_spec_fixed_auto, GNUNET_JSON_spec_rsa_signature(), GNUNET_JSON_spec_string(), GNUNET_new, GNUNET_OK, GNUNET_SYSERR, GNUNET_JSON_Specification::ptr, GNUNET_CRYPTO_UnblindedSignature::rc, GNUNET_CRYPTO_UnblindedSignature::rsa_signature, and string_to_cipher().

Referenced by GNUNET_JSON_spec_unblinded_signature().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clean_unblinded_sig()

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

Cleanup data left from parsing unblinded signature.

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

Definition at line 1806 of file json_helper.c.

1808{
1809 struct GNUNET_CRYPTO_UnblindedSignature **ub_sig = spec->ptr;
1810
1811 (void) cls;
1812 if (NULL != *ub_sig)
1813 {
1815 *ub_sig = NULL;
1816 }
1817}
void GNUNET_CRYPTO_unblinded_sig_decref(struct GNUNET_CRYPTO_UnblindedSignature *ub_sig)
Decrement reference counter of a ub_sig, and free it if it reaches zero.

References GNUNET_CRYPTO_unblinded_sig_decref(), and GNUNET_JSON_Specification::ptr.

Referenced by GNUNET_JSON_spec_unblinded_signature().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_JSON_spec_unblinded_signature()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_unblinded_signature ( const char *  field,
struct GNUNET_CRYPTO_UnblindedSignature **  ub_sig 
)

Specification for parsing an unblinded signature.

Parameters
namename of the JSON field
sigwhere to store the unblinded signature found under name

Definition at line 1821 of file json_helper.c.

1824{
1827 .cleaner = &clean_unblinded_sig,
1828 .field = field,
1829 .ptr = ub_sig
1830 };
1831
1832 *ub_sig = NULL;
1833 return ret;
1834}
static void clean_unblinded_sig(void *cls, struct GNUNET_JSON_Specification *spec)
Cleanup data left from parsing unblinded signature.
static enum GNUNET_GenericReturnValue parse_unblinded_sig(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to unblinded signature.

References clean_unblinded_sig(), GNUNET_JSON_Specification::field, parse_unblinded_sig(), GNUNET_JSON_Specification::parser, and ret.

Here is the call graph for this function:

◆ parse_tri()

static enum GNUNET_GenericReturnValue parse_tri ( void *  cls,
json_t *  root,
struct GNUNET_JSON_Specification spec 
)
static

Parse given JSON object to enum GNUNET_TIME_RounderInterval

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

Definition at line 1846 of file json_helper.c.

1849{
1851 = (enum GNUNET_TIME_RounderInterval *) spec->ptr;
1852
1853 (void) cls;
1854 if (json_is_string (root))
1855 {
1856 const char *str;
1857
1858 str = json_string_value (root);
1859 if (NULL == str)
1860 {
1861 GNUNET_break_op (0);
1862 return GNUNET_SYSERR;
1863 }
1864 if (GNUNET_OK !=
1866 res))
1867 {
1868 GNUNET_break_op (0);
1869 return GNUNET_SYSERR;
1870 }
1871 return GNUNET_OK;
1872 }
1873 return GNUNET_SYSERR;
1874}
enum GNUNET_GenericReturnValue GNUNET_TIME_string_to_round_interval(const char *ri_str, enum GNUNET_TIME_RounderInterval *ri)
Convert rounding interval given as a string to the enum value.
Definition time.c:1268
GNUNET_TIME_RounderInterval
Quantities by which we support round up absolute time values.

References GNUNET_JSON_Specification::cls, GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_string_to_round_interval(), GNUNET_JSON_Specification::ptr, res, and str.

Referenced by GNUNET_JSON_spec_time_rounder_interval().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_JSON_spec_time_rounder_interval()

struct GNUNET_JSON_Specification GNUNET_JSON_spec_time_rounder_interval ( const char *  name,
enum GNUNET_TIME_RounderInterval ri 
)

Provide specification to parse a time rounder interval.

The value must be provided as a descriptive string.

Parameters
namename of the time rounder interval type in the JSON
[out]riwhere to store the time rounder interval
Returns
spec for parsing trigger event type

Definition at line 1878 of file json_helper.c.

1881{
1883 .parser = &parse_tri,
1884 .field = name,
1885 .ptr = ri
1886 };
1887
1889 return ret;
1890
1891}
@ GNUNET_TIME_RI_NONE
No rounding up.
static enum GNUNET_GenericReturnValue parse_tri(void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
Parse given JSON object to enum GNUNET_TIME_RounderInterval
enum GNUNET_TIME_RounderInterval ri
Definition time.c:1251

References GNUNET_TIME_RI_NONE, name, parse_tri(), GNUNET_JSON_Specification::parser, ret, and ri.

Here is the call graph for this function: