aboutsummaryrefslogtreecommitdiff
path: root/src/json
diff options
context:
space:
mode:
authorPhil <phil.buschmann@tum.de>2018-08-12 23:11:10 +0200
committerPhil <phil.buschmann@tum.de>2018-08-12 23:11:10 +0200
commit4df7069dcd17ac39c786ee6f21455c96e6a6dbf4 (patch)
tree80fe63630f82dd79f73f24cbb954c0703cd873f3 /src/json
parent89485145a0f33984a70bffdf0f766667b4a3e75e (diff)
downloadgnunet-4df7069dcd17ac39c786ee6f21455c96e6a6dbf4.tar.gz
gnunet-4df7069dcd17ac39c786ee6f21455c96e6a6dbf4.zip
Changed Namestore API, changed error handling, changed gns record json
Diffstat (limited to 'src/json')
-rw-r--r--src/json/json_generator.c32
-rw-r--r--src/json/json_gnsrecord.c8
2 files changed, 30 insertions, 10 deletions
diff --git a/src/json/json_generator.c b/src/json/json_generator.c
index d8c82bc86..0ffe5c643 100644
--- a/src/json/json_generator.c
+++ b/src/json/json_generator.c
@@ -182,12 +182,32 @@ GNUNET_JSON_from_gns_record (const char* rname,
182 record_type_str = GNUNET_GNSRECORD_number_to_typename(rd->record_type); 182 record_type_str = GNUNET_GNSRECORD_number_to_typename(rd->record_type);
183 183
184 // ? for possible NULL values 184 // ? for possible NULL values
185 ret = json_pack("{s:s?,s:s?,s:s?,s:i,s:s?}", 185 if (NULL != rname)
186 "value", value_str, 186 {
187 "type", record_type_str, 187 ret = json_pack ("{s:s?,s:s?,s:s?,s:i,s:s?}",
188 "expiration_time", expiration_time_str, 188 "value",
189 "flag", flags, 189 value_str,
190 "label", rname); 190 "record_type",
191 record_type_str,
192 "expiration_time",
193 expiration_time_str,
194 "flag",
195 flags,
196 "label",
197 rname);
198 }
199 else
200 {
201 ret = json_pack ("{s:s?,s:s?,s:s?,s:i}",
202 "value",
203 value_str,
204 "record_type",
205 record_type_str,
206 "expiration_time",
207 expiration_time_str,
208 "flag",
209 flags);
210 }
191 GNUNET_free_non_null(value_str); 211 GNUNET_free_non_null(value_str);
192 return ret; 212 return ret;
193} 213}
diff --git a/src/json/json_gnsrecord.c b/src/json/json_gnsrecord.c
index 7bdf97f06..fe51119b1 100644
--- a/src/json/json_gnsrecord.c
+++ b/src/json/json_gnsrecord.c
@@ -26,10 +26,10 @@
26#include "gnunet_json_lib.h" 26#include "gnunet_json_lib.h"
27 27
28#define GNUNET_JSON_GNSRECORD_VALUE "value" 28#define GNUNET_JSON_GNSRECORD_VALUE "value"
29#define GNUNET_JSON_GNSRECORD_TYPE "type" 29#define GNUNET_JSON_GNSRECORD_TYPE "record_type"
30#define GNUNET_JSON_GNSRECORD_EXPIRATION_TIME "expiration_time" 30#define GNUNET_JSON_GNSRECORD_EXPIRATION_TIME "expiration_time"
31#define GNUNET_JSON_GNSRECORD_FLAG "flag" 31#define GNUNET_JSON_GNSRECORD_FLAG "flag"
32#define GNUNET_JSON_GNSRECORD_LABEL "label" 32#define GNUNET_JSON_GNSRECORD_RECORD_NAME "record_name"
33#define GNUNET_JSON_GNSRECORD_NEVER "never" 33#define GNUNET_JSON_GNSRECORD_NEVER "never"
34 34
35 35
@@ -52,7 +52,7 @@ parse_gnsrecordobject (void *cls,
52 const char *value; 52 const char *value;
53 const char *expiration_time; 53 const char *expiration_time;
54 const char *record_type; 54 const char *record_type;
55 const char *label; 55 const char *name;
56 int flag; 56 int flag;
57 void *rdata = NULL; 57 void *rdata = NULL;
58 size_t rdata_size; 58 size_t rdata_size;
@@ -71,7 +71,7 @@ parse_gnsrecordobject (void *cls,
71 GNUNET_JSON_GNSRECORD_TYPE, &record_type, 71 GNUNET_JSON_GNSRECORD_TYPE, &record_type,
72 GNUNET_JSON_GNSRECORD_EXPIRATION_TIME, &expiration_time, 72 GNUNET_JSON_GNSRECORD_EXPIRATION_TIME, &expiration_time,
73 GNUNET_JSON_GNSRECORD_FLAG, &flag, 73 GNUNET_JSON_GNSRECORD_FLAG, &flag,
74 GNUNET_JSON_GNSRECORD_LABEL, &label); 74 GNUNET_JSON_GNSRECORD_RECORD_NAME, &name);
75 if (0 != unpack_state) 75 if (0 != unpack_state)
76 { 76 {
77 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 77 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,