#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_json_lib.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_gnsrecord_json_lib.h"
Go to the source code of this file.
Data Structures | |
struct | GnsRecordInfo |
Macros | |
#define | GNUNET_JSON_GNSRECORD_VALUE "value" |
#define | GNUNET_JSON_GNSRECORD_RECORD_DATA "data" |
#define | GNUNET_JSON_GNSRECORD_TYPE "record_type" |
#define | GNUNET_JSON_GNSRECORD_RELATIVE_EXPIRATION_TIME "relative_expiration" |
#define | GNUNET_JSON_GNSRECORD_ABSOLUTE_EXPIRATION_TIME "absolute_expiration" |
#define | GNUNET_JSON_GNSRECORD_FLAG_MAINTENANCE "is_maintenance" |
#define | GNUNET_JSON_GNSRECORD_FLAG_PRIVATE "is_private" |
#define | GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL "is_supplemental" |
#define | GNUNET_JSON_GNSRECORD_FLAG_RELATIVE "is_relative_expiration" |
#define | GNUNET_JSON_GNSRECORD_FLAG_SHADOW "is_shadow" |
#define | GNUNET_JSON_GNSRECORD_RECORD_NAME "record_name" |
Functions | |
static void | cleanup_recordinfo (struct GnsRecordInfo *gnsrecord_info) |
static int | parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd) |
Parse given JSON object to gns record. More... | |
static int | parse_record_data (struct GnsRecordInfo *gnsrecord_info, json_t *data) |
Parse given JSON object to gns record. More... | |
static int | parse_gnsrecordobject (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) |
static void | clean_gnsrecordobject (void *cls, struct GNUNET_JSON_Specification *spec) |
Cleanup data left from parsing the record. More... | |
struct GNUNET_JSON_Specification | GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd, unsigned int *rd_count, char **name) |
JSON Specification for GNS Records. More... | |
json_t * | GNUNET_GNSRECORD_JSON_from_gnsrecord (const char *rname, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count) |
Convert GNS record to JSON. More... | |
#define GNUNET_JSON_GNSRECORD_VALUE "value" |
Definition at line 32 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_RECORD_DATA "data" |
Definition at line 33 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_TYPE "record_type" |
Definition at line 34 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_RELATIVE_EXPIRATION_TIME "relative_expiration" |
Definition at line 35 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_ABSOLUTE_EXPIRATION_TIME "absolute_expiration" |
Definition at line 36 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_FLAG_MAINTENANCE "is_maintenance" |
Definition at line 37 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_FLAG_PRIVATE "is_private" |
Definition at line 38 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL "is_supplemental" |
Definition at line 39 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_FLAG_RELATIVE "is_relative_expiration" |
Definition at line 40 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_FLAG_SHADOW "is_shadow" |
Definition at line 41 of file json_gnsrecord.c.
#define GNUNET_JSON_GNSRECORD_RECORD_NAME "record_name" |
Definition at line 42 of file json_gnsrecord.c.
|
static |
Definition at line 55 of file json_gnsrecord.c.
References data, GNUNET_free, GnsRecordInfo::name, GnsRecordInfo::rd, and GnsRecordInfo::rd_count.
Referenced by parse_gnsrecordobject().
|
static |
Parse given JSON object to gns record.
cls | closure, NULL |
root | the json object representing data |
spec | where to write the data |
Definition at line 85 of file json_gnsrecord.c.
References GNUNET_TIME_Absolute::abs_value_us, data, GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_ERROR_TYPE_ERROR, GNUNET_GNSRECORD_RF_MAINTENANCE, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW, GNUNET_GNSRECORD_RF_SUPPLEMENTAL, GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_typename_to_number(), GNUNET_JSON_GNSRECORD_ABSOLUTE_EXPIRATION_TIME, GNUNET_JSON_GNSRECORD_FLAG_MAINTENANCE, GNUNET_JSON_GNSRECORD_FLAG_PRIVATE, GNUNET_JSON_GNSRECORD_FLAG_RELATIVE, GNUNET_JSON_GNSRECORD_FLAG_SHADOW, GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, GNUNET_JSON_GNSRECORD_RELATIVE_EXPIRATION_TIME, GNUNET_JSON_GNSRECORD_TYPE, GNUNET_JSON_GNSRECORD_VALUE, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, rd, GNUNET_GNSRECORD_Data::record_type, GNUNET_TIME_Relative::rel_value_us, and value.
Referenced by parse_record_data().
|
static |
Parse given JSON object to gns record.
cls | closure, NULL |
root | the json object representing data |
spec | where to write the data |
Definition at line 196 of file json_gnsrecord.c.
References data, GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_malloc, GNUNET_OK, GNUNET_SYSERR, parse_record(), GnsRecordInfo::rd, GnsRecordInfo::rd_count, and value.
Referenced by parse_gnsrecordobject().
|
static |
Definition at line 222 of file json_gnsrecord.c.
References cleanup_recordinfo(), data, GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_JSON_GNSRECORD_RECORD_DATA, GNUNET_JSON_GNSRECORD_RECORD_NAME, GNUNET_log, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, name, GnsRecordInfo::name, parse_record_data(), and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_GNSRECORD_JSON_spec_gnsrecord().
|
static |
Cleanup data left from parsing the record.
cls | closure, NULL | |
[out] | spec | where to free the data |
Definition at line 269 of file json_gnsrecord.c.
References GNUNET_free, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_GNSRECORD_JSON_spec_gnsrecord().