xref: /unit/src/nxt_conf.h (revision 106)
129Svbart@nginx.com 
229Svbart@nginx.com /*
329Svbart@nginx.com  * Copyright (C) Igor Sysoev
429Svbart@nginx.com  * Copyright (C) Valentin V. Bartenev
529Svbart@nginx.com  * Copyright (C) NGINX, Inc.
629Svbart@nginx.com  */
729Svbart@nginx.com 
829Svbart@nginx.com #ifndef _NXT_CONF_INCLUDED_
929Svbart@nginx.com #define _NXT_CONF_INCLUDED_
1029Svbart@nginx.com 
1129Svbart@nginx.com 
12*106Svbart@nginx.com typedef struct nxt_conf_value_s  nxt_conf_value_t;
13*106Svbart@nginx.com typedef struct nxt_conf_op_s     nxt_conf_op_t;
1429Svbart@nginx.com 
1529Svbart@nginx.com 
1697Svbart@nginx.com typedef enum {
17*106Svbart@nginx.com     NXT_CONF_MAP_INT8,
18*106Svbart@nginx.com     NXT_CONF_MAP_INT32,
19*106Svbart@nginx.com     NXT_CONF_MAP_INT64,
20*106Svbart@nginx.com     NXT_CONF_MAP_INT,
21*106Svbart@nginx.com     NXT_CONF_MAP_SIZE,
22*106Svbart@nginx.com     NXT_CONF_MAP_OFF,
23*106Svbart@nginx.com     NXT_CONF_MAP_DOUBLE,
24*106Svbart@nginx.com     NXT_CONF_MAP_STR,
25*106Svbart@nginx.com     NXT_CONF_MAP_PTR,
26*106Svbart@nginx.com } nxt_conf_map_type_t;
2797Svbart@nginx.com 
2897Svbart@nginx.com 
2945Svbart@nginx.com typedef struct {
30*106Svbart@nginx.com     nxt_str_t            name;
31*106Svbart@nginx.com     nxt_conf_map_type_t  type;
32*106Svbart@nginx.com     size_t               offset;
33*106Svbart@nginx.com } nxt_conf_map_t;
3497Svbart@nginx.com 
3597Svbart@nginx.com 
3697Svbart@nginx.com typedef struct {
37*106Svbart@nginx.com     uint32_t             level;
38*106Svbart@nginx.com     uint8_t              more_space;  /* 1 bit. */
3945Svbart@nginx.com } nxt_conf_json_pretty_t;
4045Svbart@nginx.com 
4145Svbart@nginx.com 
42*106Svbart@nginx.com nxt_conf_value_t *nxt_conf_get_path(nxt_conf_value_t *value, nxt_str_t *path);
43*106Svbart@nginx.com nxt_conf_value_t *nxt_conf_get_object_member(nxt_conf_value_t *value,
44*106Svbart@nginx.com     nxt_str_t *name, uint32_t *index);
45*106Svbart@nginx.com nxt_conf_value_t *nxt_conf_next_object_member(nxt_conf_value_t *value,
46*106Svbart@nginx.com     nxt_str_t *name, uint32_t *next);
4751Svbart@nginx.com 
48*106Svbart@nginx.com nxt_int_t nxt_conf_map_object(nxt_conf_value_t *value, nxt_conf_map_t *map,
49*106Svbart@nginx.com     void *data);
5097Svbart@nginx.com 
51*106Svbart@nginx.com nxt_int_t nxt_conf_op_compile(nxt_mp_t *mp, nxt_conf_op_t **ops,
52*106Svbart@nginx.com     nxt_conf_value_t *root, nxt_str_t *path, nxt_conf_value_t *value);
53*106Svbart@nginx.com nxt_conf_value_t *nxt_conf_clone(nxt_mp_t *mp, nxt_conf_op_t *op,
54*106Svbart@nginx.com     nxt_conf_value_t *value);
5551Svbart@nginx.com 
56*106Svbart@nginx.com nxt_conf_value_t *nxt_conf_json_parse(nxt_mp_t *mp, u_char *start, u_char *end);
5751Svbart@nginx.com 
58*106Svbart@nginx.com #define nxt_conf_json_parse_str(mp, str)                                      \
5991Svbart@nginx.com     nxt_conf_json_parse(mp, (str)->start, (str)->start + (str)->length)
6091Svbart@nginx.com 
61*106Svbart@nginx.com size_t nxt_conf_json_length(nxt_conf_value_t *value,
6292Svbart@nginx.com     nxt_conf_json_pretty_t *pretty);
63*106Svbart@nginx.com u_char *nxt_conf_json_print(u_char *p, nxt_conf_value_t *value,
6445Svbart@nginx.com     nxt_conf_json_pretty_t *pretty);
6529Svbart@nginx.com 
6629Svbart@nginx.com 
6729Svbart@nginx.com #endif /* _NXT_CONF_INCLUDED_ */
68