0
|
1
|
|
2 /*
|
|
3 * Copyright (C) Igor Sysoev
|
|
4 */
|
|
5
|
|
6
|
|
7 #ifndef _NGX_HTTP_CONFIG_H_INCLUDED_
|
|
8 #define _NGX_HTTP_CONFIG_H_INCLUDED_
|
|
9
|
|
10
|
70
|
11 #include <ngx_config.h>
|
|
12 #include <ngx_core.h>
|
0
|
13 #include <ngx_http.h>
|
|
14
|
|
15
|
|
16 typedef struct {
|
140
|
17 void **main_conf;
|
|
18 void **srv_conf;
|
|
19 void **loc_conf;
|
0
|
20 } ngx_http_conf_ctx_t;
|
|
21
|
|
22
|
|
23 typedef struct {
|
58
|
24 ngx_int_t (*preconfiguration)(ngx_conf_t *cf);
|
|
25 ngx_int_t (*postconfiguration)(ngx_conf_t *cf);
|
0
|
26
|
|
27 void *(*create_main_conf)(ngx_conf_t *cf);
|
|
28 char *(*init_main_conf)(ngx_conf_t *cf, void *conf);
|
|
29
|
|
30 void *(*create_srv_conf)(ngx_conf_t *cf);
|
|
31 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf);
|
|
32
|
|
33 void *(*create_loc_conf)(ngx_conf_t *cf);
|
|
34 char *(*merge_loc_conf)(ngx_conf_t *cf, void *prev, void *conf);
|
|
35 } ngx_http_module_t;
|
|
36
|
|
37
|
|
38 #define NGX_HTTP_MODULE 0x50545448 /* "HTTP" */
|
|
39
|
|
40 #define NGX_HTTP_MAIN_CONF 0x02000000
|
|
41 #define NGX_HTTP_SRV_CONF 0x04000000
|
|
42 #define NGX_HTTP_LOC_CONF 0x08000000
|
34
|
43 #define NGX_HTTP_UPS_CONF 0x10000000
|
|
44 #define NGX_HTTP_SIF_CONF 0x20000000
|
180
|
45 #define NGX_HTTP_LIF_CONF 0x40000000
|
|
46 #define NGX_HTTP_LMT_CONF 0x80000000
|
0
|
47
|
|
48
|
|
49 #define NGX_HTTP_MAIN_CONF_OFFSET offsetof(ngx_http_conf_ctx_t, main_conf)
|
|
50 #define NGX_HTTP_SRV_CONF_OFFSET offsetof(ngx_http_conf_ctx_t, srv_conf)
|
|
51 #define NGX_HTTP_LOC_CONF_OFFSET offsetof(ngx_http_conf_ctx_t, loc_conf)
|
|
52
|
|
53
|
48
|
54 #define ngx_http_get_module_main_conf(r, module) \
|
|
55 (r)->main_conf[module.ctx_index]
|
|
56 #define ngx_http_get_module_srv_conf(r, module) (r)->srv_conf[module.ctx_index]
|
|
57 #define ngx_http_get_module_loc_conf(r, module) (r)->loc_conf[module.ctx_index]
|
0
|
58
|
|
59 /*
|
|
60 * ngx_http_conf_get_module_srv_conf() and ngx_http_conf_get_module_loc_conf()
|
|
61 * must not be used at the merge phase because cf->ctx points to http{}'s ctx
|
|
62 */
|
|
63
|
|
64 #define ngx_http_conf_get_module_main_conf(cf, module) \
|
50
|
65 ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
|
0
|
66 #define ngx_http_conf_get_module_srv_conf(cf, module) \
|
50
|
67 ((ngx_http_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index]
|
0
|
68 #define ngx_http_conf_get_module_loc_conf(cf, module) \
|
50
|
69 ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index]
|
0
|
70
|
|
71 #define ngx_http_cycle_get_module_main_conf(cycle, module) \
|
50
|
72 ((ngx_http_conf_ctx_t *) \
|
|
73 cycle->conf_ctx[ngx_http_module.index])->main_conf[module.ctx_index]
|
0
|
74
|
|
75
|
|
76 #endif /* _NGX_HTTP_CONFIG_H_INCLUDED_ */
|