Mercurial > hg > nginx
comparison src/core/ngx_conf_file.h @ 96:a23d010f356d
nginx-0.0.1-2003-05-27-16:18:54 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 27 May 2003 12:18:54 +0000 |
parents | 637625a2acdb |
children | c9b243802a17 |
comparison
equal
deleted
inserted
replaced
95:b48066122884 | 96:a23d010f356d |
---|---|
38 #define NGX_CONF_ERROR (void *) -1 | 38 #define NGX_CONF_ERROR (void *) -1 |
39 | 39 |
40 #define NGX_CONF_BLOCK_DONE 1 | 40 #define NGX_CONF_BLOCK_DONE 1 |
41 #define NGX_CONF_FILE_DONE 2 | 41 #define NGX_CONF_FILE_DONE 2 |
42 | 42 |
43 #define NGX_MODULE 0, 0 | |
43 | 44 |
44 #define NGX_CORE_MODULE_TYPE 0x45524F43 /* "CORE" */ | 45 #define NGX_CORE_MODULE 0x45524F43 /* "CORE" */ |
45 #define NGX_CONF_MODULE_TYPE 0x464E4F43 /* "CONF" */ | 46 #define NGX_CONF_MODULE 0x464E4F43 /* "CONF" */ |
47 | |
48 | |
49 #define MAX_CONF_ERRSTR 256 | |
50 extern char ngx_conf_errstr[MAX_CONF_ERRSTR]; | |
46 | 51 |
47 | 52 |
48 typedef struct ngx_conf_s ngx_conf_t; | 53 typedef struct ngx_conf_s ngx_conf_t; |
49 | 54 |
50 | 55 |
51 typedef struct ngx_command_s ngx_command_t; | 56 typedef struct ngx_command_s ngx_command_t; |
52 struct ngx_command_s { | 57 struct ngx_command_s { |
53 ngx_str_t name; | 58 ngx_str_t name; |
54 int type; | 59 int type; |
55 char *(*set)(ngx_conf_t *cf, ngx_command_t *cmd, char *conf); | 60 char *(*set)(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
56 int conf; | 61 int conf; |
57 int offset; | 62 int offset; |
58 void *bounds; | 63 void *bounds; |
59 }; | 64 }; |
60 | 65 |
66 #define ngx_null_command {ngx_null_string, 0, NULL, 0, 0, NULL} | |
61 | 67 |
62 typedef struct { | 68 typedef struct { |
69 int ctx_index; | |
70 int index; | |
63 void *ctx; | 71 void *ctx; |
64 int index; | |
65 ngx_command_t *commands; | 72 ngx_command_t *commands; |
66 int type; | 73 int type; |
67 int (*init_module)(ngx_pool_t *p); | 74 int (*init_module)(ngx_pool_t *p); |
68 } ngx_module_t; | 75 } ngx_module_t; |
69 | 76 |
127 #define ngx_conf_merge_size_value(conf, prev, default) \ | 134 #define ngx_conf_merge_size_value(conf, prev, default) \ |
128 if (conf == (size_t) NGX_CONF_UNSET) { \ | 135 if (conf == (size_t) NGX_CONF_UNSET) { \ |
129 conf = (prev == (size_t) NGX_CONF_UNSET) ? default : prev; \ | 136 conf = (prev == (size_t) NGX_CONF_UNSET) ? default : prev; \ |
130 } | 137 } |
131 | 138 |
139 #define ngx_conf_merge_str_value(conf, prev, default) \ | |
140 if (conf.len == 0) { \ | |
141 if (prev.len) { \ | |
142 conf.len = prev.len; \ | |
143 conf.data = prev.data; \ | |
144 } else { \ | |
145 conf.len = sizeof(default) - 1; \ | |
146 conf.data = default; \ | |
147 } \ | |
148 } | |
149 | |
132 | 150 |
133 #define addressof(addr) ((int) &addr) | 151 #define addressof(addr) ((int) &addr) |
134 | 152 |
135 | 153 |
136 char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename); | 154 char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename); |
137 | 155 |
138 | 156 |
139 char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf); | 157 char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
140 char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf); | 158 char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
141 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf); | 159 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
142 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf); | 160 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
143 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf); | 161 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
144 char *ngx_conf_set_time_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf); | 162 char *ngx_conf_set_time_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
145 | 163 |
146 | 164 |
147 extern ngx_module_t *ngx_modules[]; | 165 extern ngx_module_t *ngx_modules[]; |
148 extern void ****ngx_conf_ctx; | 166 extern void ****ngx_conf_ctx; |
149 | 167 |