]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
lib/json: CONF_PARSER definition for json_format
authorMatthew Newton <matthew-git@newtoncomputing.co.uk>
Mon, 17 Feb 2020 00:03:29 +0000 (00:03 +0000)
committerMatthew Newton <matthew-git@newtoncomputing.co.uk>
Fri, 21 Feb 2020 19:10:06 +0000 (19:10 +0000)
src/lib/json/base.h
src/lib/json/json.c

index 0888ae3b70fa88c31b1c946c4c0a12c25b7c50a1..33a78791e8d36854acc12d39b863c8558723fa2a 100644 (file)
@@ -226,6 +226,8 @@ struct fr_json_format_s {
 
 typedef struct fr_json_format_s fr_json_format_t;
 
+extern CONF_PARSER const fr_json_format_config[];
+
 
 /* jpath .c */
 typedef struct fr_jpath_node fr_jpath_node_t;
index 5b9c2a2331ea52fe4210ce0869673eab182da510..87e82523bf2de550002ba6d0de7d4979a733c881 100644 (file)
@@ -43,6 +43,28 @@ static fr_json_format_t const default_json_format = {
        .value = { .value_as_array = true },
 };
 
+CONF_PARSER const json_format_attr_config[] = {
+       { FR_CONF_OFFSET("prefix", FR_TYPE_STRING, fr_json_format_attr_t, prefix) },
+       CONF_PARSER_TERMINATOR
+};
+
+CONF_PARSER const json_format_value_config[] = {
+       { FR_CONF_OFFSET("single_value_as_array", FR_TYPE_BOOL, fr_json_format_value_t, value_as_array), .dflt = "no" },
+       { FR_CONF_OFFSET("enum_as_integer", FR_TYPE_BOOL, fr_json_format_value_t, enum_as_int), .dflt = "no" },
+       { FR_CONF_OFFSET("always_string", FR_TYPE_BOOL, fr_json_format_value_t, always_string), .dflt = "no" },
+       CONF_PARSER_TERMINATOR
+};
+
+CONF_PARSER const fr_json_format_config[] = {
+       { FR_CONF_OFFSET("output_mode", FR_TYPE_STRING, fr_json_format_t, output_mode_str), .dflt = "object" },
+       { FR_CONF_OFFSET("attribute", FR_TYPE_SUBSECTION, fr_json_format_t, attr),
+               .subcs = (void const *) json_format_attr_config },
+       { FR_CONF_OFFSET("value", FR_TYPE_SUBSECTION, fr_json_format_t, value),
+               .subcs = (void const *) json_format_value_config },
+
+       CONF_PARSER_TERMINATOR
+};
+
 
 /** Convert json object to fr_value_box_t
  *