1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #ifndef OBJCONF_H
30 #define OBJCONF_H
31
32 #include "conf.h"
33
34
35 #include "serverconfig.h"
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 #define CFG_LEVEL_PREPEND(list, level) \
42 cx_linked_list_prepend((
void**)list,
NULL, -
1, offsetof(ConfigParserLevel, next), level)
43
44 typedef struct _conf_object {
45 ConfigLine *begin;
46 ConfigLine *end;
47
48 cxmutstr name;
49 cxmutstr ppath;
50
51 ConfigDirectiveList *directives[
7];
52 } ConfigObject;
53
54
55
56
57 typedef struct ConfigParserLevel ConfigParserLevel;
58 struct ConfigParserLevel {
59 ConfigTag *iftag;
60 ConfigTag *tag;
61 int levelnum;
62 ConfigParserLevel *next;
63 };
64
65 typedef struct _obj_conf {
66 ConfigParser parser;
67 char *file;
68
69
70 CxList *objects;
71
72
73 ConfigObject *obj;
74
75 ConfigParserLevel *levels;
76
77 } ObjectConfig;
78
79
80 typedef struct ObjectConfig2 {
81 CxMempool *mp;
82 ConfigNode *root;
83 } ObjectConfig2;
84
85 ObjectConfig2* objectconf_load(
const char *file);
86
87 void objectconf_free(ObjectConfig2 *objconf);
88
89 int objectconf_validate_directive(ConfigParser2 *parser, ConfigNode *node);
90
91 int objectconf_validate_objbegin(ConfigParser2 *parser, ConfigNode *node);
92
93 int objectconf_validate_objend(ConfigParser2 *parser, ConfigNode *node);
94
95
96
97 ObjectConfig *load_object_config(
char *file);
98
99 void free_object_config(ObjectConfig *conf);
100
101 int objconf_parse(
void *p, ConfigLine *begin, ConfigLine *end, cxmutstr line);
102
103 int objconf_on_begin_tag(ObjectConfig *conf, ConfigTag *tag);
104
105 int objconf_on_end_tag(ObjectConfig *conf, cxmutstr tagname);
106
107 int objconf_on_directive(ObjectConfig *conf, ConfigDirective *dir);
108
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif
115
116