summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf.h
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2017-06-26 21:41:58 +0300
committerValentin Bartenev <vbart@nginx.com>2017-06-26 21:41:58 +0300
commitf86c80309885230df2960ef8e1db337f04b11926 (patch)
tree9a66939a017d8e11e5119b0df3d5f27812a10ff9 /src/nxt_conf.h
parent01517e37c1d2b09712a666b7b4870fc932e526a9 (diff)
downloadunit-f86c80309885230df2960ef8e1db337f04b11926.tar.gz
unit-f86c80309885230df2960ef8e1db337f04b11926.tar.bz2
Interface for mapping JSON configuration objects to C structures.
Diffstat (limited to 'src/nxt_conf.h')
-rw-r--r--src/nxt_conf.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/nxt_conf.h b/src/nxt_conf.h
index 91002741..4fe88404 100644
--- a/src/nxt_conf.h
+++ b/src/nxt_conf.h
@@ -13,9 +13,29 @@ typedef struct nxt_conf_json_value_s nxt_conf_json_value_t;
typedef struct nxt_conf_json_op_s nxt_conf_json_op_t;
+typedef enum {
+ NXT_CONF_JSON_MAP_INT8,
+ NXT_CONF_JSON_MAP_INT32,
+ NXT_CONF_JSON_MAP_INT64,
+ NXT_CONF_JSON_MAP_INT,
+ NXT_CONF_JSON_MAP_SIZE,
+ NXT_CONF_JSON_MAP_OFF,
+ NXT_CONF_JSON_MAP_DOUBLE,
+ NXT_CONF_JSON_MAP_STR,
+ NXT_CONF_JSON_MAP_PTR,
+} nxt_conf_json_map_type_t;
+
+
+typedef struct {
+ nxt_str_t name;
+ nxt_conf_json_map_type_t type;
+ size_t offset;
+} nxt_conf_json_object_map_t;
+
+
typedef struct {
- uint32_t level;
- uint8_t more_space; /* 1 bit. */
+ uint32_t level;
+ uint8_t more_space; /* 1 bit. */
} nxt_conf_json_pretty_t;
@@ -24,6 +44,9 @@ nxt_conf_json_value_t *nxt_conf_json_get_value(nxt_conf_json_value_t *value,
nxt_conf_json_value_t *nxt_conf_json_object_get_member(
nxt_conf_json_value_t *value, nxt_str_t *name, uint32_t *index);
+nxt_int_t nxt_conf_json_object_map(nxt_conf_json_value_t *value,
+ nxt_conf_json_object_map_t *map, void *data);
+
nxt_int_t nxt_conf_json_op_compile(nxt_mp_t *mp, nxt_conf_json_op_t **ops,
nxt_conf_json_value_t *root, nxt_str_t *path,
nxt_conf_json_value_t *value);