Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.13.12 ]​[ nginx-1.12.2 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #ifndef _NGX_HTTP_CONFIG_H_INCLUDED_
0009 #define _NGX_HTTP_CONFIG_H_INCLUDED_
0010 
0011 
0012 #include <ngx_config.h>
0013 #include <ngx_core.h>
0014 #include <ngx_http.h>
0015 
0016 
0017 typedef struct {
0018     void        **main_conf;
0019     void        **srv_conf;
0020     void        **loc_conf;
0021 } ngx_http_conf_ctx_t;
0022 
0023 
0024 typedef struct {
0025     ngx_int_t   (*preconfiguration)(ngx_conf_t *cf);
0026     ngx_int_t   (*postconfiguration)(ngx_conf_t *cf);
0027 
0028     void       *(*create_main_conf)(ngx_conf_t *cf);
0029     char       *(*init_main_conf)(ngx_conf_t *cf, void *conf);
0030 
0031     void       *(*create_srv_conf)(ngx_conf_t *cf);
0032     char       *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf);
0033 
0034     void       *(*create_loc_conf)(ngx_conf_t *cf);
0035     char       *(*merge_loc_conf)(ngx_conf_t *cf, void *prev, void *conf);
0036 } ngx_http_module_t;
0037 
0038 
0039 #define NGX_HTTP_MODULE           0x50545448   /* "HTTP" */
0040 
0041 #define NGX_HTTP_MAIN_CONF        0x02000000
0042 #define NGX_HTTP_SRV_CONF         0x04000000
0043 #define NGX_HTTP_LOC_CONF         0x08000000
0044 #define NGX_HTTP_UPS_CONF         0x10000000
0045 #define NGX_HTTP_SIF_CONF         0x20000000
0046 #define NGX_HTTP_LIF_CONF         0x40000000
0047 #define NGX_HTTP_LMT_CONF         0x80000000
0048 
0049 
0050 #define NGX_HTTP_MAIN_CONF_OFFSET  offsetof(ngx_http_conf_ctx_t, main_conf)
0051 #define NGX_HTTP_SRV_CONF_OFFSET   offsetof(ngx_http_conf_ctx_t, srv_conf)
0052 #define NGX_HTTP_LOC_CONF_OFFSET   offsetof(ngx_http_conf_ctx_t, loc_conf)
0053 
0054 
0055 #define ngx_http_get_module_main_conf(r, module)                             \
0056     (r)->main_conf[module.ctx_index]
0057 #define ngx_http_get_module_srv_conf(r, module)  (r)->srv_conf[module.ctx_index]
0058 #define ngx_http_get_module_loc_conf(r, module)  (r)->loc_conf[module.ctx_index]
0059 
0060 
0061 #define ngx_http_conf_get_module_main_conf(cf, module)                        \
0062     ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
0063 #define ngx_http_conf_get_module_srv_conf(cf, module)                         \
0064     ((ngx_http_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index]
0065 #define ngx_http_conf_get_module_loc_conf(cf, module)                         \
0066     ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index]
0067 
0068 #define ngx_http_cycle_get_module_main_conf(cycle, module)                    \
0069     (cycle->conf_ctx[ngx_http_module.index] ?                                 \
0070         ((ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index])      \
0071             ->main_conf[module.ctx_index]:                                    \
0072         NULL)
0073 
0074 
0075 #endif /* _NGX_HTTP_CONFIG_H_INCLUDED_ */