![]() |
GNUnet
0.11.x
|
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_json_lib.h"
#include "gnunet_gnsrecord_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_EXPIRATION_TIME "expiration_time" |
#define | GNUNET_JSON_GNSRECORD_FLAG_PRIVATE "private" |
#define | GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL "supplemental" |
#define | GNUNET_JSON_GNSRECORD_FLAG_RELATIVE "relative_expiration" |
#define | GNUNET_JSON_GNSRECORD_FLAG_SHADOW "shadow" |
#define | GNUNET_JSON_GNSRECORD_RECORD_NAME "record_name" |
#define | GNUNET_JSON_GNSRECORD_NEVER "never" |
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 31 of file json_gnsrecord.c.
Referenced by parse_record().
#define GNUNET_JSON_GNSRECORD_RECORD_DATA "data" |
Definition at line 32 of file json_gnsrecord.c.
Referenced by parse_gnsrecordobject().
#define GNUNET_JSON_GNSRECORD_TYPE "record_type" |
Definition at line 33 of file json_gnsrecord.c.
Referenced by parse_record().
#define GNUNET_JSON_GNSRECORD_EXPIRATION_TIME "expiration_time" |
Definition at line 34 of file json_gnsrecord.c.
Referenced by parse_record().
#define GNUNET_JSON_GNSRECORD_FLAG_PRIVATE "private" |
Definition at line 35 of file json_gnsrecord.c.
Referenced by parse_record().
#define GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL "supplemental" |
Definition at line 36 of file json_gnsrecord.c.
Referenced by parse_record().
#define GNUNET_JSON_GNSRECORD_FLAG_RELATIVE "relative_expiration" |
Definition at line 37 of file json_gnsrecord.c.
Referenced by parse_record().
#define GNUNET_JSON_GNSRECORD_FLAG_SHADOW "shadow" |
Definition at line 38 of file json_gnsrecord.c.
Referenced by parse_record().
#define GNUNET_JSON_GNSRECORD_RECORD_NAME "record_name" |
Definition at line 39 of file json_gnsrecord.c.
Referenced by parse_gnsrecordobject().
#define GNUNET_JSON_GNSRECORD_NEVER "never" |
Definition at line 40 of file json_gnsrecord.c.
Referenced by parse_record().
|
static |
Definition at line 53 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 83 of file json_gnsrecord.c.
References GNUNET_TIME_Absolute::abs_value_us, 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_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW_RECORD, GNUNET_GNSRECORD_RF_SUPPLEMENTAL, GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_typename_to_number(), GNUNET_JSON_GNSRECORD_EXPIRATION_TIME, GNUNET_JSON_GNSRECORD_FLAG_PRIVATE, GNUNET_JSON_GNSRECORD_FLAG_RELATIVE, GNUNET_JSON_GNSRECORD_FLAG_SHADOW, GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, GNUNET_JSON_GNSRECORD_NEVER, GNUNET_JSON_GNSRECORD_TYPE, GNUNET_JSON_GNSRECORD_VALUE, GNUNET_log, GNUNET_OK, GNUNET_STRINGS_fancy_time_to_absolute(), GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_ABS, 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 176 of file json_gnsrecord.c.
References 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 200 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, 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 247 of file json_gnsrecord.c.
References GNUNET_free, and GNUNET_JSON_Specification::ptr.
Referenced by GNUNET_GNSRECORD_JSON_spec_gnsrecord().