Igor Sysoev | d90282d | 2004-09-28 08:34:51 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
Igor Sysoev | ff8da91 | 2004-09-29 16:00:49 +0000 | [diff] [blame] | 3 | * Copyright (C) Igor Sysoev |
Maxim Konovalov | f8d59e3 | 2012-01-18 15:07:43 +0000 | [diff] [blame] | 4 | * Copyright (C) Nginx, Inc. |
Igor Sysoev | d90282d | 2004-09-28 08:34:51 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | |
Igor Sysoev | e0268b9 | 2002-09-11 15:18:33 +0000 | [diff] [blame] | 8 | #ifndef _NGX_HTTP_CONFIG_H_INCLUDED_ |
| 9 | #define _NGX_HTTP_CONFIG_H_INCLUDED_ |
| 10 | |
| 11 | |
Igor Sysoev | 7b190b4 | 2005-06-07 15:56:31 +0000 | [diff] [blame] | 12 | #include <ngx_config.h> |
| 13 | #include <ngx_core.h> |
Igor Sysoev | e0268b9 | 2002-09-11 15:18:33 +0000 | [diff] [blame] | 14 | #include <ngx_http.h> |
| 15 | |
Igor Sysoev | e0268b9 | 2002-09-11 15:18:33 +0000 | [diff] [blame] | 16 | |
Igor Sysoev | 207ed5a | 2002-12-26 16:26:23 +0000 | [diff] [blame] | 17 | typedef struct { |
Igor Sysoev | 43f279d | 2005-12-18 16:02:44 +0000 | [diff] [blame] | 18 | void **main_conf; |
| 19 | void **srv_conf; |
| 20 | void **loc_conf; |
Igor Sysoev | 207ed5a | 2002-12-26 16:26:23 +0000 | [diff] [blame] | 21 | } ngx_http_conf_ctx_t; |
| 22 | |
| 23 | |
Igor Sysoev | dc479b4 | 2003-03-20 16:09:44 +0000 | [diff] [blame] | 24 | typedef struct { |
Igor Sysoev | 899b44e | 2005-05-12 14:58:06 +0000 | [diff] [blame] | 25 | ngx_int_t (*preconfiguration)(ngx_conf_t *cf); |
| 26 | ngx_int_t (*postconfiguration)(ngx_conf_t *cf); |
Igor Sysoev | dc479b4 | 2003-03-20 16:09:44 +0000 | [diff] [blame] | 27 | |
Igor Sysoev | 2f65722 | 2004-06-16 15:32:11 +0000 | [diff] [blame] | 28 | void *(*create_main_conf)(ngx_conf_t *cf); |
| 29 | char *(*init_main_conf)(ngx_conf_t *cf, void *conf); |
Igor Sysoev | dc479b4 | 2003-03-20 16:09:44 +0000 | [diff] [blame] | 30 | |
Igor Sysoev | 2f65722 | 2004-06-16 15:32:11 +0000 | [diff] [blame] | 31 | void *(*create_srv_conf)(ngx_conf_t *cf); |
| 32 | char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf); |
Igor Sysoev | 7832933 | 2003-11-10 17:17:31 +0000 | [diff] [blame] | 33 | |
Igor Sysoev | 2f65722 | 2004-06-16 15:32:11 +0000 | [diff] [blame] | 34 | void *(*create_loc_conf)(ngx_conf_t *cf); |
| 35 | char *(*merge_loc_conf)(ngx_conf_t *cf, void *prev, void *conf); |
Igor Sysoev | dc479b4 | 2003-03-20 16:09:44 +0000 | [diff] [blame] | 36 | } ngx_http_module_t; |
| 37 | |
| 38 | |
Igor Sysoev | 6253ca1 | 2003-05-27 12:18:54 +0000 | [diff] [blame] | 39 | #define NGX_HTTP_MODULE 0x50545448 /* "HTTP" */ |
Igor Sysoev | dc479b4 | 2003-03-20 16:09:44 +0000 | [diff] [blame] | 40 | |
Igor Sysoev | 43f1319 | 2004-04-12 16:38:09 +0000 | [diff] [blame] | 41 | #define NGX_HTTP_MAIN_CONF 0x02000000 |
| 42 | #define NGX_HTTP_SRV_CONF 0x04000000 |
| 43 | #define NGX_HTTP_LOC_CONF 0x08000000 |
Igor Sysoev | 805d9db | 2005-02-03 19:33:37 +0000 | [diff] [blame] | 44 | #define NGX_HTTP_UPS_CONF 0x10000000 |
| 45 | #define NGX_HTTP_SIF_CONF 0x20000000 |
Igor Sysoev | 94e32ce | 2006-04-07 14:08:04 +0000 | [diff] [blame] | 46 | #define NGX_HTTP_LIF_CONF 0x40000000 |
| 47 | #define NGX_HTTP_LMT_CONF 0x80000000 |
Igor Sysoev | 4e9393a | 2003-01-09 05:36:00 +0000 | [diff] [blame] | 48 | |
Igor Sysoev | dc479b4 | 2003-03-20 16:09:44 +0000 | [diff] [blame] | 49 | |
Igor Sysoev | bb4ec5c | 2003-05-16 15:27:48 +0000 | [diff] [blame] | 50 | #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 Sysoev | 207ed5a | 2002-12-26 16:26:23 +0000 | [diff] [blame] | 53 | |
| 54 | |
Igor Sysoev | 8184d1b | 2005-03-04 14:06:57 +0000 | [diff] [blame] | 55 | #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 Sysoev | dc479b4 | 2003-03-20 16:09:44 +0000 | [diff] [blame] | 59 | |
Igor Sysoev | 1c3567e | 2004-07-15 16:35:51 +0000 | [diff] [blame] | 60 | |
Igor Sysoev | 74a5ddb | 2004-07-18 19:11:20 +0000 | [diff] [blame] | 61 | #define ngx_http_conf_get_module_main_conf(cf, module) \ |
Igor Sysoev | c157172 | 2005-03-19 12:38:37 +0000 | [diff] [blame] | 62 | ((ngx_http_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] |
Igor Sysoev | 74a5ddb | 2004-07-18 19:11:20 +0000 | [diff] [blame] | 63 | #define ngx_http_conf_get_module_srv_conf(cf, module) \ |
Igor Sysoev | c157172 | 2005-03-19 12:38:37 +0000 | [diff] [blame] | 64 | ((ngx_http_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index] |
Igor Sysoev | 74a5ddb | 2004-07-18 19:11:20 +0000 | [diff] [blame] | 65 | #define ngx_http_conf_get_module_loc_conf(cf, module) \ |
Igor Sysoev | c157172 | 2005-03-19 12:38:37 +0000 | [diff] [blame] | 66 | ((ngx_http_conf_ctx_t *) cf->ctx)->loc_conf[module.ctx_index] |
Igor Sysoev | 74a5ddb | 2004-07-18 19:11:20 +0000 | [diff] [blame] | 67 | |
Igor Sysoev | 1c3567e | 2004-07-15 16:35:51 +0000 | [diff] [blame] | 68 | #define ngx_http_cycle_get_module_main_conf(cycle, module) \ |
Igor Sysoev | ca878c8 | 2009-04-15 20:26:33 +0000 | [diff] [blame] | 69 | (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 Sysoev | dc479b4 | 2003-03-20 16:09:44 +0000 | [diff] [blame] | 73 | |
Igor Sysoev | 207ed5a | 2002-12-26 16:26:23 +0000 | [diff] [blame] | 74 | |
Igor Sysoev | 7300977 | 2003-02-06 17:21:13 +0000 | [diff] [blame] | 75 | #endif /* _NGX_HTTP_CONFIG_H_INCLUDED_ */ |