Mercurial > hg > nginx
comparison src/stream/ngx_stream.h @ 6693:3908156a51fa
Stream: phases.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 15 Sep 2016 14:55:54 +0300 |
parents | 56fc55e32f23 |
children | ea9dfe2f62e7 |
comparison
equal
deleted
inserted
replaced
6692:56fc55e32f23 | 6693:3908156a51fa |
---|---|
113 typedef struct { | 113 typedef struct { |
114 ngx_stream_listen_t opt; | 114 ngx_stream_listen_t opt; |
115 } ngx_stream_conf_addr_t; | 115 } ngx_stream_conf_addr_t; |
116 | 116 |
117 | 117 |
118 typedef ngx_int_t (*ngx_stream_access_pt)(ngx_stream_session_t *s); | 118 typedef enum { |
119 NGX_STREAM_POST_ACCEPT_PHASE = 0, | |
120 NGX_STREAM_PREACCESS_PHASE, | |
121 NGX_STREAM_ACCESS_PHASE, | |
122 #if (NGX_STREAM_SSL) | |
123 NGX_STREAM_SSL_PHASE, | |
124 #endif | |
125 NGX_STREAM_CONTENT_PHASE, | |
126 NGX_STREAM_LOG_PHASE | |
127 } ngx_stream_phases; | |
128 | |
129 | |
130 typedef struct ngx_stream_phase_handler_s ngx_stream_phase_handler_t; | |
131 | |
132 typedef ngx_int_t (*ngx_stream_phase_handler_pt)(ngx_stream_session_t *s, | |
133 ngx_stream_phase_handler_t *ph); | |
134 typedef ngx_int_t (*ngx_stream_handler_pt)(ngx_stream_session_t *s); | |
135 typedef void (*ngx_stream_content_handler_pt)(ngx_stream_session_t *s); | |
136 | |
137 | |
138 struct ngx_stream_phase_handler_s { | |
139 ngx_stream_phase_handler_pt checker; | |
140 ngx_stream_handler_pt handler; | |
141 ngx_uint_t next; | |
142 }; | |
143 | |
144 | |
145 typedef struct { | |
146 ngx_stream_phase_handler_t *handlers; | |
147 } ngx_stream_phase_engine_t; | |
148 | |
149 | |
150 typedef struct { | |
151 ngx_array_t handlers; | |
152 } ngx_stream_phase_t; | |
119 | 153 |
120 | 154 |
121 typedef struct { | 155 typedef struct { |
122 ngx_array_t servers; /* ngx_stream_core_srv_conf_t */ | 156 ngx_array_t servers; /* ngx_stream_core_srv_conf_t */ |
123 ngx_array_t listen; /* ngx_stream_listen_t */ | 157 ngx_array_t listen; /* ngx_stream_listen_t */ |
124 | 158 |
125 ngx_stream_access_pt realip_handler; | 159 ngx_stream_phase_engine_t phase_engine; |
126 ngx_stream_access_pt limit_conn_handler; | |
127 ngx_stream_access_pt access_handler; | |
128 ngx_stream_access_pt access_log_handler; | |
129 | 160 |
130 ngx_hash_t variables_hash; | 161 ngx_hash_t variables_hash; |
131 | 162 |
132 ngx_array_t variables; /* ngx_stream_variable_t */ | 163 ngx_array_t variables; /* ngx_stream_variable_t */ |
133 ngx_uint_t ncaptures; | 164 ngx_uint_t ncaptures; |
134 | 165 |
135 ngx_uint_t variables_hash_max_size; | 166 ngx_uint_t variables_hash_max_size; |
136 ngx_uint_t variables_hash_bucket_size; | 167 ngx_uint_t variables_hash_bucket_size; |
137 | 168 |
138 ngx_hash_keys_arrays_t *variables_keys; | 169 ngx_hash_keys_arrays_t *variables_keys; |
170 | |
171 ngx_stream_phase_t phases[NGX_STREAM_LOG_PHASE + 1]; | |
139 } ngx_stream_core_main_conf_t; | 172 } ngx_stream_core_main_conf_t; |
140 | 173 |
141 | 174 |
142 typedef void (*ngx_stream_handler_pt)(ngx_stream_session_t *s); | 175 typedef struct { |
143 | 176 ngx_stream_content_handler_pt handler; |
144 | |
145 typedef struct { | |
146 ngx_stream_handler_pt handler; | |
147 | 177 |
148 ngx_stream_conf_ctx_t *ctx; | 178 ngx_stream_conf_ctx_t *ctx; |
149 | 179 |
150 u_char *file_name; | 180 u_char *file_name; |
151 ngx_uint_t line; | 181 ngx_uint_t line; |
187 ngx_uint_t ncaptures; | 217 ngx_uint_t ncaptures; |
188 int *captures; | 218 int *captures; |
189 u_char *captures_data; | 219 u_char *captures_data; |
190 #endif | 220 #endif |
191 | 221 |
222 ngx_int_t phase_handler; | |
192 ngx_uint_t status; | 223 ngx_uint_t status; |
193 | 224 |
194 #if (NGX_STREAM_SSL) | 225 #if (NGX_STREAM_SSL) |
195 ngx_uint_t ssl; /* unsigned ssl:1; */ | 226 ngx_uint_t ssl; /* unsigned ssl:1; */ |
196 #endif | 227 #endif |
244 | 275 |
245 | 276 |
246 #define NGX_STREAM_WRITE_BUFFERED 0x10 | 277 #define NGX_STREAM_WRITE_BUFFERED 0x10 |
247 | 278 |
248 | 279 |
280 void ngx_stream_core_run_phases(ngx_stream_session_t *s); | |
281 ngx_int_t ngx_stream_core_generic_phase(ngx_stream_session_t *s, | |
282 ngx_stream_phase_handler_t *ph); | |
283 ngx_int_t ngx_stream_core_content_phase(ngx_stream_session_t *s, | |
284 ngx_stream_phase_handler_t *ph); | |
285 | |
286 | |
249 void ngx_stream_init_connection(ngx_connection_t *c); | 287 void ngx_stream_init_connection(ngx_connection_t *c); |
288 void ngx_stream_session_handler(ngx_event_t *rev); | |
250 void ngx_stream_finalize_session(ngx_stream_session_t *s, ngx_uint_t rc); | 289 void ngx_stream_finalize_session(ngx_stream_session_t *s, ngx_uint_t rc); |
251 | 290 |
252 | 291 |
253 extern ngx_module_t ngx_stream_module; | 292 extern ngx_module_t ngx_stream_module; |
254 extern ngx_uint_t ngx_stream_max_module; | 293 extern ngx_uint_t ngx_stream_max_module; |