Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ngx_conf_file.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) Igor Sysoev
4  * Copyright (C) Nginx, Inc.
5  */
6 
7 
8 #ifndef _NGX_HTTP_CONF_FILE_H_INCLUDED_
9 #define _NGX_HTTP_CONF_FILE_H_INCLUDED_
10 
11 
12 #include <ngx_config.h>
13 #include <ngx_core.h>
14 
15 
16 /*
17  * AAAA number of arguments
18  * FF command flags
19  * TT command type, i.e. HTTP "location" or "server" command
20  */
21 
22 #define NGX_CONF_NOARGS 0x00000001
23 #define NGX_CONF_TAKE1 0x00000002
24 #define NGX_CONF_TAKE2 0x00000004
25 #define NGX_CONF_TAKE3 0x00000008
26 #define NGX_CONF_TAKE4 0x00000010
27 #define NGX_CONF_TAKE5 0x00000020
28 #define NGX_CONF_TAKE6 0x00000040
29 #define NGX_CONF_TAKE7 0x00000080
30 
31 #define NGX_CONF_MAX_ARGS 8
32 
33 #define NGX_CONF_TAKE12 (NGX_CONF_TAKE1|NGX_CONF_TAKE2)
34 #define NGX_CONF_TAKE13 (NGX_CONF_TAKE1|NGX_CONF_TAKE3)
35 
36 #define NGX_CONF_TAKE23 (NGX_CONF_TAKE2|NGX_CONF_TAKE3)
37 
38 #define NGX_CONF_TAKE123 (NGX_CONF_TAKE1|NGX_CONF_TAKE2|NGX_CONF_TAKE3)
39 #define NGX_CONF_TAKE1234 (NGX_CONF_TAKE1|NGX_CONF_TAKE2|NGX_CONF_TAKE3 \
40  |NGX_CONF_TAKE4)
41 
42 #define NGX_CONF_ARGS_NUMBER 0x000000ff
43 #define NGX_CONF_BLOCK 0x00000100
44 #define NGX_CONF_FLAG 0x00000200
45 #define NGX_CONF_ANY 0x00000400
46 #define NGX_CONF_1MORE 0x00000800
47 #define NGX_CONF_2MORE 0x00001000
48 #define NGX_CONF_MULTI 0x00000000 /* compatibility */
49 
50 #define NGX_DIRECT_CONF 0x00010000
51 
52 #define NGX_MAIN_CONF 0x01000000
53 #define NGX_ANY_CONF 0x0F000000
54 
55 
56 
57 #define NGX_CONF_UNSET -1
58 #define NGX_CONF_UNSET_UINT (ngx_uint_t) -1
59 #define NGX_CONF_UNSET_PTR (void *) -1
60 #define NGX_CONF_UNSET_SIZE (size_t) -1
61 #define NGX_CONF_UNSET_MSEC (ngx_msec_t) -1
62 
63 
64 #define NGX_CONF_OK NULL
65 #define NGX_CONF_ERROR (void *) -1
66 
67 #define NGX_CONF_BLOCK_START 1
68 #define NGX_CONF_BLOCK_DONE 2
69 #define NGX_CONF_FILE_DONE 3
70 
71 #define NGX_CORE_MODULE 0x45524F43 /* "CORE" */
72 #define NGX_CONF_MODULE 0x464E4F43 /* "CONF" */
73 
74 
75 #define NGX_MAX_CONF_ERRSTR 1024
76 
77 
78 struct ngx_command_s {
81  char *(*set)(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
84  void *post;
85 };
86 
87 #define ngx_null_command { ngx_null_string, 0, NULL, 0, 0, NULL }
88 
89 
93 
94  void (*flush)(ngx_open_file_t *file, ngx_log_t *log);
95  void *data;
96 };
97 
98 
99 #define NGX_MODULE_V1 0, 0, 0, 0, 0, 0, 1
100 #define NGX_MODULE_V1_PADDING 0, 0, 0, 0, 0, 0, 0, 0
101 
102 struct ngx_module_s {
105 
110 
112 
113  void *ctx;
116 
118 
120 
123  void (*exit_thread)(ngx_cycle_t *cycle);
124  void (*exit_process)(ngx_cycle_t *cycle);
125 
126  void (*exit_master)(ngx_cycle_t *cycle);
127 
128  uintptr_t spare_hook0;
129  uintptr_t spare_hook1;
130  uintptr_t spare_hook2;
131  uintptr_t spare_hook3;
132  uintptr_t spare_hook4;
133  uintptr_t spare_hook5;
134  uintptr_t spare_hook6;
135  uintptr_t spare_hook7;
136 };
137 
138 
139 typedef struct {
141  void *(*create_conf)(ngx_cycle_t *cycle);
142  char *(*init_conf)(ngx_cycle_t *cycle, void *conf);
144 
145 
146 typedef struct {
151 
152 
153 typedef char *(*ngx_conf_handler_pt)(ngx_conf_t *cf,
154  ngx_command_t *dummy, void *conf);
155 
156 
157 struct ngx_conf_s {
158  char *name;
160 
166 
167  void *ctx;
170 
173 };
174 
175 
176 typedef char *(*ngx_conf_post_handler_pt) (ngx_conf_t *cf,
177  void *data, void *conf);
178 
179 typedef struct {
182 
183 
184 typedef struct {
186  char *old_name;
187  char *new_name;
189 
190 
191 typedef struct {
196 
197 
198 typedef struct {
202 
203 
204 #define NGX_CONF_BITMASK_SET 1
205 
206 typedef struct {
210 
211 
212 
213 char * ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data);
214 char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data);
215 
216 
217 #define ngx_get_conf(conf_ctx, module) conf_ctx[module.index]
218 
219 
220 
221 #define ngx_conf_init_value(conf, default) \
222  if (conf == NGX_CONF_UNSET) { \
223  conf = default; \
224  }
225 
226 #define ngx_conf_init_ptr_value(conf, default) \
227  if (conf == NGX_CONF_UNSET_PTR) { \
228  conf = default; \
229  }
230 
231 #define ngx_conf_init_uint_value(conf, default) \
232  if (conf == NGX_CONF_UNSET_UINT) { \
233  conf = default; \
234  }
235 
236 #define ngx_conf_init_size_value(conf, default) \
237  if (conf == NGX_CONF_UNSET_SIZE) { \
238  conf = default; \
239  }
240 
241 #define ngx_conf_init_msec_value(conf, default) \
242  if (conf == NGX_CONF_UNSET_MSEC) { \
243  conf = default; \
244  }
245 
246 #define ngx_conf_merge_value(conf, prev, default) \
247  if (conf == NGX_CONF_UNSET) { \
248  conf = (prev == NGX_CONF_UNSET) ? default : prev; \
249  }
250 
251 #define ngx_conf_merge_ptr_value(conf, prev, default) \
252  if (conf == NGX_CONF_UNSET_PTR) { \
253  conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev; \
254  }
255 
256 #define ngx_conf_merge_uint_value(conf, prev, default) \
257  if (conf == NGX_CONF_UNSET_UINT) { \
258  conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev; \
259  }
260 
261 #define ngx_conf_merge_msec_value(conf, prev, default) \
262  if (conf == NGX_CONF_UNSET_MSEC) { \
263  conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev; \
264  }
265 
266 #define ngx_conf_merge_sec_value(conf, prev, default) \
267  if (conf == NGX_CONF_UNSET) { \
268  conf = (prev == NGX_CONF_UNSET) ? default : prev; \
269  }
270 
271 #define ngx_conf_merge_size_value(conf, prev, default) \
272  if (conf == NGX_CONF_UNSET_SIZE) { \
273  conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev; \
274  }
275 
276 #define ngx_conf_merge_off_value(conf, prev, default) \
277  if (conf == NGX_CONF_UNSET) { \
278  conf = (prev == NGX_CONF_UNSET) ? default : prev; \
279  }
280 
281 #define ngx_conf_merge_str_value(conf, prev, default) \
282  if (conf.data == NULL) { \
283  if (prev.data) { \
284  conf.len = prev.len; \
285  conf.data = prev.data; \
286  } else { \
287  conf.len = sizeof(default) - 1; \
288  conf.data = (u_char *) default; \
289  } \
290  }
291 
292 #define ngx_conf_merge_bufs_value(conf, prev, default_num, default_size) \
293  if (conf.num == 0) { \
294  if (prev.num) { \
295  conf.num = prev.num; \
296  conf.size = prev.size; \
297  } else { \
298  conf.num = default_num; \
299  conf.size = default_size; \
300  } \
301  }
302 
303 #define ngx_conf_merge_bitmask_value(conf, prev, default) \
304  if (conf == 0) { \
305  conf = (prev == 0) ? default : prev; \
306  }
307 
308 
309 char *ngx_conf_param(ngx_conf_t *cf);
310 char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename);
311 char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
312 
313 
315  ngx_uint_t conf_prefix);
318  ngx_err_t err, const char *fmt, ...);
319 
320 
321 char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
322 char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
324  void *conf);
325 char *ngx_conf_set_keyval_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
326 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
327 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
328 char *ngx_conf_set_off_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
329 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
330 char *ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
331 char *ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
332 char *ngx_conf_set_enum_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
333 char *ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
334 
335 
337 extern ngx_module_t *ngx_modules[];
338 
339 
340 #endif /* _NGX_HTTP_CONF_FILE_H_INCLUDED_ */