aboutsummaryrefslogtreecommitdiff
path: root/src/json/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/json/json.c')
-rw-r--r--src/json/json.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/src/json/json.c b/src/json/json.c
index d55189804..51d5c0c72 100644
--- a/src/json/json.c
+++ b/src/json/json.c
@@ -28,19 +28,6 @@
28#include "gnunet_json_lib.h" 28#include "gnunet_json_lib.h"
29 29
30 30
31/**
32 * Navigate and parse data in a JSON tree. Tries to parse the @a root
33 * to find all of the values given in the @a spec. If one of the
34 * entries in @a spec cannot be found or parsed, the name of the JSON
35 * field is returned in @a error_json_name, and the offset of the
36 * entry in @a spec is returned in @a error_line.
37 *
38 * @param root the JSON node to start the navigation at.
39 * @param spec parse specification array
40 * @param[out] error_json_name which JSON field was problematic
41 * @param[out] which index into @a spec did we encounter an error
42 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
43 */
44enum GNUNET_GenericReturnValue 31enum GNUNET_GenericReturnValue
45GNUNET_JSON_parse (const json_t *root, 32GNUNET_JSON_parse (const json_t *root,
46 struct GNUNET_JSON_Specification *spec, 33 struct GNUNET_JSON_Specification *spec,
@@ -85,12 +72,6 @@ GNUNET_JSON_parse (const json_t *root,
85} 72}
86 73
87 74
88/**
89 * Set the "optional" flag for a parser specification entry.
90 *
91 * @param spec specification to modify
92 * @return spec copy of @a spec with optional bit set
93 */
94struct GNUNET_JSON_Specification 75struct GNUNET_JSON_Specification
95GNUNET_JSON_spec_mark_optional (struct GNUNET_JSON_Specification spec) 76GNUNET_JSON_spec_mark_optional (struct GNUNET_JSON_Specification spec)
96{ 77{
@@ -101,18 +82,13 @@ GNUNET_JSON_spec_mark_optional (struct GNUNET_JSON_Specification spec)
101} 82}
102 83
103 84
104/**
105 * Frees all elements allocated during a #GNUNET_JSON_parse()
106 * operation.
107 *
108 * @param spec specification of the parse operation
109 */
110void 85void
111GNUNET_JSON_parse_free (struct GNUNET_JSON_Specification *spec) 86GNUNET_JSON_parse_free (struct GNUNET_JSON_Specification *spec)
112{ 87{
113 for (unsigned int i = 0; NULL != spec[i].parser; i++) 88 for (unsigned int i = 0; NULL != spec[i].parser; i++)
114 if (NULL != spec[i].cleaner) 89 if (NULL != spec[i].cleaner)
115 spec[i].cleaner (spec[i].cls, &spec[i]); 90 spec[i].cleaner (spec[i].cls,
91 &spec[i]);
116} 92}
117 93
118 94
@@ -151,15 +127,6 @@ set_json (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
151} 127}
152 128
153 129
154/**
155 * Allow user to specify a JSON input value.
156 *
157 * @param shortName short name of the option
158 * @param name long name of the option
159 * @param argumentHelp help text for the option argument
160 * @param description long help text for the option
161 * @param[out] val set to the JSON specified at the command line
162 */
163struct GNUNET_GETOPT_CommandLineOption 130struct GNUNET_GETOPT_CommandLineOption
164GNUNET_JSON_getopt (char shortName, 131GNUNET_JSON_getopt (char shortName,
165 const char *name, 132 const char *name,