helper functions for generating JSON from GNUnet data structures More...
Go to the source code of this file.
Functions | |
json_t * | GNUNET_JSON_from_data (const void *data, size_t size) |
Convert binary data to a JSON string with the base32crockford encoding. More... | |
json_t * | GNUNET_JSON_from_data64 (const void *data, size_t size) |
Convert binary data to a JSON string with base64 encoding. More... | |
json_t * | GNUNET_JSON_from_timestamp (struct GNUNET_TIME_Timestamp stamp) |
Convert timestamp to a json string. More... | |
json_t * | GNUNET_JSON_from_timestamp_nbo (struct GNUNET_TIME_TimestampNBO stamp) |
Convert timestamp to a json string. More... | |
json_t * | GNUNET_JSON_from_time_rel (struct GNUNET_TIME_Relative stamp) |
Convert relative timestamp to a json string. More... | |
json_t * | GNUNET_JSON_from_rsa_public_key (const struct GNUNET_CRYPTO_RsaPublicKey *pk) |
Convert RSA public key to JSON. More... | |
json_t * | GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig) |
Convert RSA signature to JSON. More... | |
helper functions for generating JSON from GNUnet data structures
Definition in file json_generator.c.
json_t * GNUNET_JSON_from_data | ( | const void * | data, |
size_t | size | ||
) |
Convert binary data to a JSON string with the base32crockford encoding.
data | binary data |
size | size of data in bytes |
Definition at line 31 of file json_generator.c.
References data, GNUNET_break, GNUNET_free, GNUNET_MAX_MALLOC_CHECKED, GNUNET_STRINGS_data_to_string_alloc(), and size.
Referenced by GNUNET_JSON_from_rsa_public_key(), GNUNET_JSON_from_rsa_signature(), and GNUNET_JSON_pack_data_varsize().
json_t * GNUNET_JSON_from_data64 | ( | const void * | data, |
size_t | size | ||
) |
Convert binary data to a JSON string with base64 encoding.
data | binary data |
size | size of data in bytes |
Definition at line 52 of file json_generator.c.
References data, GNUNET_break, GNUNET_free, GNUNET_MAX_MALLOC_CHECKED, GNUNET_STRINGS_base64_encode(), and size.
Referenced by GNUNET_JSON_pack_data64_varsize().
json_t * GNUNET_JSON_from_timestamp | ( | struct GNUNET_TIME_Timestamp | stamp | ) |
Convert timestamp to a json string.
stamp | the time stamp |
Definition at line 81 of file json_generator.c.
References GNUNET_TIME_Timestamp::abs_time, GNUNET_TIME_Absolute::abs_value_us, GNUNET_assert, GNUNET_break, GNUNET_TIME_absolute_is_never(), and GNUNET_TIME_UNIT_SECONDS.
Referenced by GNUNET_JSON_from_timestamp_nbo(), and GNUNET_JSON_pack_timestamp().
json_t * GNUNET_JSON_from_timestamp_nbo | ( | struct GNUNET_TIME_TimestampNBO | stamp | ) |
Convert timestamp to a json string.
stamp | the time stamp |
Definition at line 125 of file json_generator.c.
References GNUNET_JSON_from_timestamp(), and GNUNET_TIME_timestamp_ntoh().
json_t * GNUNET_JSON_from_time_rel | ( | struct GNUNET_TIME_Relative | stamp | ) |
Convert relative timestamp to a json string.
stamp | the time stamp |
Definition at line 132 of file json_generator.c.
References GNUNET_break, GNUNET_TIME_relative_is_forever(), and GNUNET_TIME_Relative::rel_value_us.
Referenced by GNUNET_JSON_pack_time_rel().
json_t * GNUNET_JSON_from_rsa_public_key | ( | const struct GNUNET_CRYPTO_RsaPublicKey * | pk | ) |
Convert RSA public key to JSON.
pk | public key to convert |
Definition at line 176 of file json_generator.c.
References GNUNET_CRYPTO_rsa_public_key_encode(), GNUNET_free, GNUNET_JSON_from_data(), pk, and ret.
Referenced by GNUNET_JSON_pack_rsa_public_key().
json_t * GNUNET_JSON_from_rsa_signature | ( | const struct GNUNET_CRYPTO_RsaSignature * | sig | ) |
Convert RSA signature to JSON.
sig | signature to convert |
Definition at line 192 of file json_generator.c.
References GNUNET_CRYPTO_rsa_signature_encode(), GNUNET_free, GNUNET_JSON_from_data(), and ret.
Referenced by GNUNET_JSON_pack_rsa_signature().