blob: 2208c601b96853983eaff2d308371d18de6d92b7 [file] [log] [blame]
Igor Sysoevd90282d2004-09-28 08:34:51 +00001
2/*
Igor Sysoevff8da912004-09-29 16:00:49 +00003 * Copyright (C) Igor Sysoev
Maxim Konovalovf8d59e32012-01-18 15:07:43 +00004 * Copyright (C) Nginx, Inc.
Igor Sysoevd90282d2004-09-28 08:34:51 +00005 */
6
7
Igor Sysoeve0268b92002-09-11 15:18:33 +00008#ifndef _NGX_HTTP_CONFIG_H_INCLUDED_
9#define _NGX_HTTP_CONFIG_H_INCLUDED_
10
11
Igor Sysoev7b190b42005-06-07 15:56:31 +000012#include <ngx_config.h>
13#include <ngx_core.h>
Igor Sysoeve0268b92002-09-11 15:18:33 +000014#include <ngx_http.h>
15
Igor Sysoeve0268b92002-09-11 15:18:33 +000016
Igor Sysoev207ed5a2002-12-26 16:26:23 +000017typedef struct {
Igor Sysoev43f279d2005-12-18 16:02:44 +000018 void **main_conf;
19 void **srv_conf;
20 void **loc_conf;
Igor Sysoev207ed5a2002-12-26 16:26:23 +000021} ngx_http_conf_ctx_t;
22
23
Igor Sysoevdc479b42003-03-20 16:09:44 +000024typedef struct {
Igor Sysoev899b44e2005-05-12 14:58:06 +000025 ngx_int_t (*preconfiguration)(ngx_conf_t *cf);
26 ngx_int_t (*postconfiguration)(ngx_conf_t *cf);
Igor Sysoevdc479b42003-03-20 16:09:44 +000027
Igor Sysoev2f657222004-06-16 15:32:11 +000028 void *(*create_main_conf)(ngx_conf_t *cf);
29 char *(*init_main_conf)(ngx_conf_t *cf, void *conf);
Igor Sysoevdc479b42003-03-20 16:09:44 +000030
Igor Sysoev2f657222004-06-16 15:32:11 +000031 void *(*create_srv_conf)(ngx_conf_t *cf);
32 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf);
Igor Sysoev78329332003-11-10 17:17:31 +000033
Igor Sysoev2f657222004-06-16 15:32:11 +000034 void *(*create_loc_conf)(ngx_conf_t *cf);
35 char *(*merge_loc_conf)(ngx_conf_t *cf, void *prev, void *conf);
Igor Sysoevdc479b42003-03-20 16:09:44 +000036} ngx_http_module_t;
37
38
Igor Sysoev6253ca12003-05-27 12:18:54 +000039#define NGX_HTTP_MODULE 0x50545448 /* "HTTP" */
Igor Sysoevdc479b42003-03-20 16:09:44 +000040
Igor Sysoev43f13192004-04-12 16:38:09 +000041#define NGX_HTTP_MAIN_CONF 0x02000000
42#define NGX_HTTP_SRV_CONF 0x04000000
43#define NGX_HTTP_LOC_CONF 0x08000000
Igor Sysoev805d9db2005-02-03 19:33:37 +000044#define NGX_HTTP_UPS_CONF 0x10000000
45#define NGX_HTTP_SIF_CONF 0x20000000
Igor Sysoev94e32ce2006-04-07 14:08:04 +000046#define NGX_HTTP_LIF_CONF 0x40000000
47#define NGX_HTTP_LMT_CONF 0x80000000
Igor Sysoev4e9393a2003-01-09 05:36:00 +000048
Igor Sysoevdc479b42003-03-20 16:09:44 +000049
Igor Sysoevbb4ec5c2003-05-16 15:27:48 +000050#define NGX_HTTP_MAIN_CONF_OFFSET offsetof(ngx_http_conf_ctx_t, main_conf)
51#define NGX_HTTP_SRV_CONF_OFFSET offsetof(ngx_http_conf_ctx_t, srv_conf)
52#define NGX_HTTP_LOC_CONF_OFFSET offsetof(ngx_http_conf_ctx_t, loc_conf)
Igor Sysoev207ed5a2002-12-26 16:26:23 +000053
54
Igor Sysoev8184d1b2005-03-04 14:06:57 +000055#define ngx_http_get_module_main_conf(r, module) \
56 (r)->main_conf[module.ctx_index]
57#define ngx_http_get_module_srv_conf(r, module) (r)->srv_conf[module.ctx_index]
58#define ngx_http_get_module_loc_conf(r, module) (r)->loc_conf[module.ctx_index]
Igor Sysoevdc479b42003-03-20 16:09:44 +000059
Igor Sysoev1c3567e2004-07-15 16:35:51 +000060
Igor Sysoev74a5ddb2004-07-18 19:11:20 +000061#define ngx_http_conf_get_module_main_conf(cf, module) \
Igor Sysoevc1571722005-03-19 12:38:37 +000062 ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index]
Igor Sysoev74a5ddb2004-07-18 19:11:20 +000063#define ngx_http_conf_get_module_srv_conf(cf, module) \
Igor Sysoevc1571722005-03-19 12:38:37 +000064 ((ngx_http_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index]
Igor Sysoev74a5ddb2004-07-18 19:11:20 +000065#define ngx_http_conf_get_module_loc_conf(cf, module) \
Igor Sysoevc1571722005-03-19 12:38:37 +000066 ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index]
Igor Sysoev74a5ddb2004-07-18 19:11:20 +000067
Igor Sysoev1c3567e2004-07-15 16:35:51 +000068#define ngx_http_cycle_get_module_main_conf(cycle, module) \
Igor Sysoevca878c82009-04-15 20:26:33 +000069 (cycle->conf_ctx[ngx_http_module.index] ? \
70 ((ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index]) \
71 ->main_conf[module.ctx_index]: \
72 NULL)
Igor Sysoevdc479b42003-03-20 16:09:44 +000073
Igor Sysoev207ed5a2002-12-26 16:26:23 +000074
Igor Sysoev73009772003-02-06 17:21:13 +000075#endif /* _NGX_HTTP_CONFIG_H_INCLUDED_ */