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