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"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. | |
functions to generate specifciations for JSON parsing
Definition in file json_helper.c.
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_end | ( | void | ) |
End of a parser specification.
Definition at line 34 of file json_helper.c.
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().
|
static |
Convert string value to numeric cipher value.
| cipher_s | input string |
Definition at line 51 of file json_helper.c.
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().
|
static |
Parse given JSON object to fixed size data.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 76 of file json_helper.c.
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().
| 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).
| name | name of the JSON field | |
| [out] | obj | pointer where to write the data, must have size bytes |
| size | number of bytes expected in obj |
Definition at line 116 of file json_helper.c.
References name, parse_fixed_data(), GNUNET_JSON_Specification::parser, ret, and size.
|
static |
Parse given JSON object to fixed size data.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 140 of file json_helper.c.
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().
| 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).
| name | name of the JSON field | |
| [out] | obj | pointer where to write the data, must have size bytes |
| size | number of bytes expected in obj |
Definition at line 177 of file json_helper.c.
References name, parse_fixed64_data(), GNUNET_JSON_Specification::parser, ret, and size.
|
static |
Parse given JSON object to variable size data.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 201 of file json_helper.c.
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().
|
static |
Cleanup data left from parsing variable size data.
| cls | closure, NULL | |
| [out] | spec | where to free the data |
Definition at line 237 of file json_helper.c.
References GNUNET_JSON_Specification::cls, GNUNET_free, GNUNET_JSON_Specification::ptr, and GNUNET_JSON_Specification::size_ptr.
Referenced by 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).
| name | name of the JSON field | |
| [out] | obj | pointer where to write the data, will be allocated |
| [out] | size | where to store the number of bytes allocated for obj |
Definition at line 251 of file json_helper.c.
References clean_variable_data(), name, parse_variable_data(), GNUNET_JSON_Specification::parser, ret, and size.
Referenced by parse_blinded_message().
|
static |
Parse given JSON object to string.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 278 of file json_helper.c.
References GNUNET_JSON_Specification::cls, GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_JSON_Specification::ptr, and str.
Referenced by GNUNET_JSON_spec_string().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_string | ( | const char * | name, |
| const char ** | strptr | ||
| ) |
The expected field stores a string.
| name | name of the JSON field |
| strptr | where to store a pointer to the field |
Definition at line 297 of file json_helper.c.
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().
|
static |
Parse given JSON object to string, and make a copy.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 320 of file json_helper.c.
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().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_string_copy | ( | const char * | name, |
| char ** | strptr | ||
| ) |
The expected field stores a string.
| name | name of the JSON field |
| strptr | where to store a pointer to the field |
Definition at line 339 of file json_helper.c.
References name, parse_string_copy(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a JSON object.
(Yes, trivial.)
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 362 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_json().
|
static |
Cleanup data left from parsing JSON object.
| cls | closure, NULL | |
| [out] | spec | where to free the data |
Definition at line 383 of file json_helper.c.
References GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_array_copy(), GNUNET_JSON_spec_json(), and GNUNET_JSON_spec_object_copy().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_json | ( | const char * | name, |
| json_t ** | jsonp | ||
| ) |
JSON object or array.
Reference counter is incremented.
| name | name of the JSON field | |
| [out] | jsonp | where to store the JSON found under name |
Definition at line 397 of file json_helper.c.
References clean_json(), name, parse_json(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a JSON object.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 421 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by 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.
| name | name of the JSON field | |
| [out] | jsonp | where to store the JSON found under name |
Definition at line 438 of file json_helper.c.
References name, parse_object_const(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a JSON object and increment the reference counter.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 461 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by 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.
| name | name of the JSON field | |
| [out] | jsonp | where to store the JSON found under name |
Definition at line 478 of file json_helper.c.
References clean_json(), name, parse_object_copy(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON to a JSON array.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 502 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by 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.
| name | name of the JSON field | |
| [out] | jsonp | where to store the JSON found under name |
Definition at line 519 of file json_helper.c.
References name, parse_array_const(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON to a JSON array and increment the reference counter.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 542 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by 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.
| name | name of the JSON field | |
| [out] | jsonp | where to store the JSON found under name |
Definition at line 559 of file json_helper.c.
References clean_json(), name, parse_array_copy(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a bool.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 583 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_bool().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_bool | ( | const char * | name, |
| bool * | b | ||
| ) |
boolean.
| name | name of the JSON field | |
| [out] | b | where to store the boolean found under name |
Definition at line 605 of file json_helper.c.
References name, parse_bool(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a double.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 628 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_double().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_double | ( | const char * | name, |
| double * | f | ||
| ) |
double.
| name | name of the JSON field | |
| [out] | f | where to store the double found under name |
Definition at line 645 of file json_helper.c.
References name, parse_double(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a uint8_t.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 668 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_uint8().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint8 | ( | const char * | name, |
| uint8_t * | u8 | ||
| ) |
8-bit integer.
| name | name of the JSON field | |
| [out] | u8 | where to store the integer found under name |
Definition at line 692 of file json_helper.c.
References name, parse_u8(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a uint16_t.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 715 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_uint16().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint16 | ( | const char * | name, |
| uint16_t * | u16 | ||
| ) |
16-bit integer.
| name | name of the JSON field | |
| [out] | u16 | where to store the integer found under name |
Definition at line 739 of file json_helper.c.
References name, parse_u16(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a uint32_t.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 762 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_uint32().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint32 | ( | const char * | name, |
| uint32_t * | u32 | ||
| ) |
32-bit integer.
| name | name of the JSON field | |
| [out] | u32 | where to store the integer found under name |
Definition at line 786 of file json_helper.c.
References name, parse_u32(), GNUNET_JSON_Specification::parser, and ret.
Referenced by parse_blinded_sig().
|
static |
Parse given JSON object to an unsigned int.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 809 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_uint().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint | ( | const char * | name, |
| unsigned int * | ui | ||
| ) |
Unsigned integer.
| name | name of the JSON field | |
| [out] | ui | where to store the integer found under name |
Definition at line 833 of file json_helper.c.
References name, parse_ui(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to an unsigned long long.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 856 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_ull().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_ull | ( | const char * | name, |
| unsigned long long * | ull | ||
| ) |
Unsigned long long.
| name | name of the JSON field | |
| [out] | ull | where to store the unsigned long long found under name |
Definition at line 880 of file json_helper.c.
References name, parse_ull(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a uint64_t.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 903 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_uint64().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_uint64 | ( | const char * | name, |
| uint64_t * | u64 | ||
| ) |
64-bit integer.
| name | name of the JSON field | |
| [out] | u64 | where to store the integer found under name |
Definition at line 922 of file json_helper.c.
References name, parse_u64(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a int16_t.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 945 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_int16().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_int16 | ( | const char * | name, |
| int16_t * | i16 | ||
| ) |
16-bit signed integer.
| name | name of the JSON field | |
| [out] | i16 | where to store the integer found under name |
Definition at line 970 of file json_helper.c.
References name, parse_i16(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a int64_t.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 993 of file json_helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_JSON_spec_int64().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_int64 | ( | const char * | name, |
| int64_t * | i64 | ||
| ) |
64-bit signed integer.
| name | name of the JSON field | |
| [out] | i64 | where to store the integer found under name |
Definition at line 1012 of file json_helper.c.
References name, parse_i64(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a timestamp.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1037 of file json_helper.c.
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().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_timestamp | ( | const char * | name, |
| struct GNUNET_TIME_Timestamp * | t | ||
| ) |
Timestamp.
| name | name of the JSON field | |
| [out] | t | at where to store the absolute time found under name |
Definition at line 1088 of file json_helper.c.
References name, parse_timestamp(), GNUNET_JSON_Specification::parser, ret, and t.
|
static |
Parse given JSON object to absolute time.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1111 of file json_helper.c.
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().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_timestamp_nbo | ( | const char * | name, |
| struct GNUNET_TIME_TimestampNBO * | tn | ||
| ) |
Timestamp in network byte order.
| name | name of the JSON field | |
| [out] | tn | where to store the absolute time found under name |
Definition at line 1133 of file json_helper.c.
References name, parse_timestamp_nbo(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to relative time.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1156 of file json_helper.c.
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().
| struct GNUNET_JSON_Specification GNUNET_JSON_spec_relative_time | ( | const char * | name, |
| struct GNUNET_TIME_Relative * | rt | ||
| ) |
Relative time.
| name | name of the JSON field | |
| [out] | rt | where to store the relative time found under name |
Definition at line 1203 of file json_helper.c.
References name, parse_rel_time(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to RSA public key.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1226 of file json_helper.c.
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().
|
static |
Cleanup data left from parsing RSA public key.
| cls | closure, NULL | |
| [out] | spec | where to free the data |
Definition at line 1273 of file json_helper.c.
References GNUNET_CRYPTO_rsa_public_key_free(), pk, and GNUNET_JSON_Specification::ptr.
Referenced by 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.
| name | name of the JSON field |
| pk | where to store the RSA key found under name |
Definition at line 1287 of file json_helper.c.
References clean_rsa_public_key(), name, parse_rsa_public_key(), GNUNET_JSON_Specification::parser, pk, and ret.
|
static |
Parse given JSON object to RSA signature.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1311 of file json_helper.c.
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().
|
static |
Cleanup data left from parsing RSA signature.
| cls | closure, NULL | |
| [out] | spec | where to free the data |
Definition at line 1358 of file json_helper.c.
References GNUNET_CRYPTO_rsa_signature_free(), and GNUNET_JSON_Specification::ptr.
Referenced by 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.
| name | name of the JSON field |
| sig | where to store the RSA signature found under name |
Definition at line 1372 of file json_helper.c.
References clean_rsa_signature(), name, parse_rsa_signature(), GNUNET_JSON_Specification::parser, and ret.
Referenced by parse_blinded_sig(), and parse_unblinded_sig().
|
static |
Parse given JSON object to an int as a boolean.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1399 of file json_helper.c.
References GNUNET_break_op, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, and GNUNET_JSON_Specification::ptr.
Referenced by 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).
| name | name of the JSON field | |
| [out] | boolean | where to store the boolean found under name |
Definition at line 1416 of file json_helper.c.
References name, parse_boolean(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a blinded message.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1439 of file json_helper.c.
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().
|
static |
Cleanup data left from parsing blinded message.
| cls | closure, NULL | |
| [out] | spec | where to free the data |
Definition at line 1538 of file json_helper.c.
References GNUNET_CRYPTO_blinded_message_decref(), and GNUNET_JSON_Specification::ptr.
Referenced by 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.
| name | name of the JSON field |
| sig | where to store the blinded message found under name |
Definition at line 1553 of file json_helper.c.
References clean_blinded_message(), msg, name, parse_blinded_message(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to a blinded signature.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1580 of file json_helper.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().
|
static |
Cleanup data left from parsing blinded sig.
| cls | closure, NULL | |
| [out] | spec | where to free the data |
Definition at line 1672 of file json_helper.c.
References GNUNET_CRYPTO_blinded_sig_decref(), and GNUNET_JSON_Specification::ptr.
Referenced by 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.
| name | name of the JSON field |
| sig | where to store the blinded signature found under name |
Definition at line 1688 of file json_helper.c.
References clean_blinded_sig(), GNUNET_JSON_Specification::field, parse_blinded_sig(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to unblinded signature.
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1713 of file json_helper.c.
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().
|
static |
Cleanup data left from parsing unblinded signature.
| cls | closure, NULL | |
| [out] | spec | where to free the data |
Definition at line 1806 of file json_helper.c.
References GNUNET_CRYPTO_unblinded_sig_decref(), and GNUNET_JSON_Specification::ptr.
Referenced by 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.
| name | name of the JSON field |
| sig | where to store the unblinded signature found under name |
Definition at line 1821 of file json_helper.c.
References clean_unblinded_sig(), GNUNET_JSON_Specification::field, parse_unblinded_sig(), GNUNET_JSON_Specification::parser, and ret.
|
static |
Parse given JSON object to enum GNUNET_TIME_RounderInterval
| cls | closure, NULL | |
| root | the json object representing data | |
| [out] | spec | where to write the data |
Definition at line 1846 of file json_helper.c.
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().
| 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.
| name | name of the time rounder interval type in the JSON | |
| [out] | ri | where to store the time rounder interval |
Definition at line 1878 of file json_helper.c.
References GNUNET_TIME_RI_NONE, name, parse_tri(), GNUNET_JSON_Specification::parser, ret, and ri.