Mercurial > hg > nginx
annotate src/stream/ngx_stream.h @ 6719:cebf5fed00bf
Modules compatibility: removed unneeded IPV6_V6ONLY checks.
The IPV6_V6ONLY macro is now checked only while parsing appropriate flag
and when using the macro.
The ipv6only field in listen structures is always initialized to 1,
even if not supported on a given platform. This is expected to prevent
a module compiled without IPV6_V6ONLY from accidentally creating dual
sockets if loaded into main binary with proper IPV6_V6ONLY support.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 03 Oct 2016 15:58:25 +0300 |
parents | 90a03b1dc4db |
children | 9170240f1241 |
rev | line source |
---|---|
6115 | 1 |
2 /* | |
3 * Copyright (C) Roman Arutyunyan | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #ifndef _NGX_STREAM_H_INCLUDED_ | |
9 #define _NGX_STREAM_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 | |
15 #if (NGX_STREAM_SSL) | |
16 #include <ngx_stream_ssl_module.h> | |
17 #endif | |
18 | |
19 | |
20 typedef struct ngx_stream_session_s ngx_stream_session_t; | |
21 | |
22 | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
23 #include <ngx_stream_variables.h> |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
24 #include <ngx_stream_script.h> |
6115 | 25 #include <ngx_stream_upstream.h> |
26 #include <ngx_stream_upstream_round_robin.h> | |
27 | |
28 | |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
29 #define NGX_STREAM_OK 200 |
6680
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
30 #define NGX_STREAM_BAD_REQUEST 400 |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
31 #define NGX_STREAM_FORBIDDEN 403 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
32 #define NGX_STREAM_INTERNAL_SERVER_ERROR 500 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
33 #define NGX_STREAM_BAD_GATEWAY 502 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
34 #define NGX_STREAM_SERVICE_UNAVAILABLE 503 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
35 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
36 |
6115 | 37 typedef struct { |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
38 void **main_conf; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
39 void **srv_conf; |
6115 | 40 } ngx_stream_conf_ctx_t; |
41 | |
42 | |
43 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
44 ngx_sockaddr_t sockaddr; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
45 socklen_t socklen; |
6115 | 46 |
47 /* server ctx */ | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
48 ngx_stream_conf_ctx_t *ctx; |
6115 | 49 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
50 unsigned bind:1; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
51 unsigned wildcard:1; |
6115 | 52 #if (NGX_STREAM_SSL) |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
53 unsigned ssl:1; |
6115 | 54 #endif |
6719
cebf5fed00bf
Modules compatibility: removed unneeded IPV6_V6ONLY checks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6711
diff
changeset
|
55 #if (NGX_HAVE_INET6) |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
56 unsigned ipv6only:1; |
6115 | 57 #endif |
6153
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6129
diff
changeset
|
58 #if (NGX_HAVE_REUSEPORT) |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
59 unsigned reuseport:1; |
6153
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6129
diff
changeset
|
60 #endif |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
61 unsigned so_keepalive:2; |
6680
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
62 unsigned proxy_protocol:1; |
6115 | 63 #if (NGX_HAVE_KEEPALIVE_TUNABLE) |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
64 int tcp_keepidle; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
65 int tcp_keepintvl; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
66 int tcp_keepcnt; |
6115 | 67 #endif |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
68 int backlog; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
69 int type; |
6115 | 70 } ngx_stream_listen_t; |
71 | |
72 | |
73 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
74 ngx_stream_conf_ctx_t *ctx; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
75 ngx_str_t addr_text; |
6115 | 76 #if (NGX_STREAM_SSL) |
6680
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
77 unsigned ssl:1; |
6115 | 78 #endif |
6680
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
79 unsigned proxy_protocol:1; |
6115 | 80 } ngx_stream_addr_conf_t; |
81 | |
82 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
83 in_addr_t addr; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
84 ngx_stream_addr_conf_t conf; |
6115 | 85 } ngx_stream_in_addr_t; |
86 | |
87 | |
88 #if (NGX_HAVE_INET6) | |
89 | |
90 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
91 struct in6_addr addr6; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
92 ngx_stream_addr_conf_t conf; |
6115 | 93 } ngx_stream_in6_addr_t; |
94 | |
95 #endif | |
96 | |
97 | |
98 typedef struct { | |
99 /* ngx_stream_in_addr_t or ngx_stream_in6_addr_t */ | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
100 void *addrs; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
101 ngx_uint_t naddrs; |
6115 | 102 } ngx_stream_port_t; |
103 | |
104 | |
105 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
106 int family; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
107 int type; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
108 in_port_t port; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
109 ngx_array_t addrs; /* array of ngx_stream_conf_addr_t */ |
6115 | 110 } ngx_stream_conf_port_t; |
111 | |
112 | |
113 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
114 ngx_stream_listen_t opt; |
6115 | 115 } ngx_stream_conf_addr_t; |
116 | |
117 | |
6693 | 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 | |
6694 | 125 NGX_STREAM_PREREAD_PHASE, |
6693 | 126 NGX_STREAM_CONTENT_PHASE, |
127 NGX_STREAM_LOG_PHASE | |
128 } ngx_stream_phases; | |
129 | |
130 | |
131 typedef struct ngx_stream_phase_handler_s ngx_stream_phase_handler_t; | |
132 | |
133 typedef ngx_int_t (*ngx_stream_phase_handler_pt)(ngx_stream_session_t *s, | |
134 ngx_stream_phase_handler_t *ph); | |
135 typedef ngx_int_t (*ngx_stream_handler_pt)(ngx_stream_session_t *s); | |
136 typedef void (*ngx_stream_content_handler_pt)(ngx_stream_session_t *s); | |
137 | |
138 | |
139 struct ngx_stream_phase_handler_s { | |
140 ngx_stream_phase_handler_pt checker; | |
141 ngx_stream_handler_pt handler; | |
142 ngx_uint_t next; | |
143 }; | |
144 | |
145 | |
146 typedef struct { | |
147 ngx_stream_phase_handler_t *handlers; | |
148 } ngx_stream_phase_engine_t; | |
149 | |
150 | |
151 typedef struct { | |
152 ngx_array_t handlers; | |
153 } ngx_stream_phase_t; | |
6175 | 154 |
155 | |
6115 | 156 typedef struct { |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
157 ngx_array_t servers; /* ngx_stream_core_srv_conf_t */ |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
158 ngx_array_t listen; /* ngx_stream_listen_t */ |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
159 |
6693 | 160 ngx_stream_phase_engine_t phase_engine; |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
161 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
162 ngx_hash_t variables_hash; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
163 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
164 ngx_array_t variables; /* ngx_stream_variable_t */ |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
165 ngx_uint_t ncaptures; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
166 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
167 ngx_uint_t variables_hash_max_size; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
168 ngx_uint_t variables_hash_bucket_size; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
169 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
170 ngx_hash_keys_arrays_t *variables_keys; |
6693 | 171 |
172 ngx_stream_phase_t phases[NGX_STREAM_LOG_PHASE + 1]; | |
6115 | 173 } ngx_stream_core_main_conf_t; |
174 | |
175 | |
176 typedef struct { | |
6693 | 177 ngx_stream_content_handler_pt handler; |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
178 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
179 ngx_stream_conf_ctx_t *ctx; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
180 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
181 u_char *file_name; |
6656
a2f57dfa65a9
Fixed wrong type of the "line" field.
Roman Arutyunyan <arut@nginx.com>
parents:
6618
diff
changeset
|
182 ngx_uint_t line; |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
183 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
184 ngx_flag_t tcp_nodelay; |
6694 | 185 size_t preread_buffer_size; |
186 ngx_msec_t preread_timeout; | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
187 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
188 ngx_log_t *error_log; |
6618 | 189 |
190 ngx_msec_t resolver_timeout; | |
191 ngx_resolver_t *resolver; | |
6657
3d5202c71f94
Ensure "listen" exists in a mail or stream server (ticket #1049).
Roman Arutyunyan <arut@nginx.com>
parents:
6656
diff
changeset
|
192 |
6680
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
193 ngx_msec_t proxy_protocol_timeout; |
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
194 |
6657
3d5202c71f94
Ensure "listen" exists in a mail or stream server (ticket #1049).
Roman Arutyunyan <arut@nginx.com>
parents:
6656
diff
changeset
|
195 ngx_uint_t listen; /* unsigned listen:1; */ |
6115 | 196 } ngx_stream_core_srv_conf_t; |
197 | |
198 | |
199 struct ngx_stream_session_s { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
200 uint32_t signature; /* "STRM" */ |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
201 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
202 ngx_connection_t *connection; |
6115 | 203 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
204 off_t received; |
6669
164a0824ce20
Stream: the $session_time variable.
Vladimir Homutov <vl@nginx.com>
parents:
6657
diff
changeset
|
205 time_t start_sec; |
164a0824ce20
Stream: the $session_time variable.
Vladimir Homutov <vl@nginx.com>
parents:
6657
diff
changeset
|
206 ngx_msec_t start_msec; |
6115 | 207 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
208 ngx_log_handler_pt log_handler; |
6115 | 209 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
210 void **ctx; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
211 void **main_conf; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
212 void **srv_conf; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
213 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
214 ngx_stream_upstream_t *upstream; |
6675
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6674
diff
changeset
|
215 ngx_array_t *upstream_states; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6674
diff
changeset
|
216 /* of ngx_stream_upstream_state_t */ |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
217 ngx_stream_variable_value_t *variables; |
6115 | 218 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
219 #if (NGX_PCRE) |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
220 ngx_uint_t ncaptures; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
221 int *captures; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
222 u_char *captures_data; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
223 #endif |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
224 |
6693 | 225 ngx_int_t phase_handler; |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
226 ngx_uint_t status; |
6679
40e8ce405859
Stream: postpone session initialization under accept mutex.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6678
diff
changeset
|
227 |
40e8ce405859
Stream: postpone session initialization under accept mutex.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6678
diff
changeset
|
228 #if (NGX_STREAM_SSL) |
6710
3ab8736958cb
Modules compatibility: health check fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6694
diff
changeset
|
229 unsigned ssl:1; |
6679
40e8ce405859
Stream: postpone session initialization under accept mutex.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6678
diff
changeset
|
230 #endif |
6710
3ab8736958cb
Modules compatibility: health check fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6694
diff
changeset
|
231 |
6711
90a03b1dc4db
Modules compatibility: status fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6710
diff
changeset
|
232 unsigned stat_processing:1; |
90a03b1dc4db
Modules compatibility: status fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6710
diff
changeset
|
233 |
6710
3ab8736958cb
Modules compatibility: health check fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6694
diff
changeset
|
234 unsigned health_check:1; |
6115 | 235 }; |
236 | |
237 | |
238 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
239 ngx_int_t (*preconfiguration)(ngx_conf_t *cf); |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
240 ngx_int_t (*postconfiguration)(ngx_conf_t *cf); |
6174
68c106e6fa0a
Stream: added postconfiguration method to stream modules.
Vladimir Homutov <vl@nginx.com>
parents:
6172
diff
changeset
|
241 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
242 void *(*create_main_conf)(ngx_conf_t *cf); |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
243 char *(*init_main_conf)(ngx_conf_t *cf, void *conf); |
6115 | 244 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
245 void *(*create_srv_conf)(ngx_conf_t *cf); |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
246 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
247 void *conf); |
6115 | 248 } ngx_stream_module_t; |
249 | |
250 | |
251 #define NGX_STREAM_MODULE 0x4d525453 /* "STRM" */ | |
252 | |
253 #define NGX_STREAM_MAIN_CONF 0x02000000 | |
254 #define NGX_STREAM_SRV_CONF 0x04000000 | |
255 #define NGX_STREAM_UPS_CONF 0x08000000 | |
256 | |
257 | |
258 #define NGX_STREAM_MAIN_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, main_conf) | |
259 #define NGX_STREAM_SRV_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, srv_conf) | |
260 | |
261 | |
262 #define ngx_stream_get_module_ctx(s, module) (s)->ctx[module.ctx_index] | |
263 #define ngx_stream_set_ctx(s, c, module) s->ctx[module.ctx_index] = c; | |
264 #define ngx_stream_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL; | |
265 | |
266 | |
267 #define ngx_stream_get_module_main_conf(s, module) \ | |
268 (s)->main_conf[module.ctx_index] | |
269 #define ngx_stream_get_module_srv_conf(s, module) \ | |
270 (s)->srv_conf[module.ctx_index] | |
271 | |
272 #define ngx_stream_conf_get_module_main_conf(cf, module) \ | |
273 ((ngx_stream_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] | |
274 #define ngx_stream_conf_get_module_srv_conf(cf, module) \ | |
275 ((ngx_stream_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index] | |
276 | |
277 #define ngx_stream_cycle_get_module_main_conf(cycle, module) \ | |
278 (cycle->conf_ctx[ngx_stream_module.index] ? \ | |
279 ((ngx_stream_conf_ctx_t *) cycle->conf_ctx[ngx_stream_module.index]) \ | |
280 ->main_conf[module.ctx_index]: \ | |
281 NULL) | |
282 | |
283 | |
6692 | 284 #define NGX_STREAM_WRITE_BUFFERED 0x10 |
285 | |
286 | |
6693 | 287 void ngx_stream_core_run_phases(ngx_stream_session_t *s); |
288 ngx_int_t ngx_stream_core_generic_phase(ngx_stream_session_t *s, | |
289 ngx_stream_phase_handler_t *ph); | |
6694 | 290 ngx_int_t ngx_stream_core_preread_phase(ngx_stream_session_t *s, |
291 ngx_stream_phase_handler_t *ph); | |
6693 | 292 ngx_int_t ngx_stream_core_content_phase(ngx_stream_session_t *s, |
293 ngx_stream_phase_handler_t *ph); | |
294 | |
295 | |
6115 | 296 void ngx_stream_init_connection(ngx_connection_t *c); |
6693 | 297 void ngx_stream_session_handler(ngx_event_t *rev); |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
298 void ngx_stream_finalize_session(ngx_stream_session_t *s, ngx_uint_t rc); |
6115 | 299 |
300 | |
301 extern ngx_module_t ngx_stream_module; | |
302 extern ngx_uint_t ngx_stream_max_module; | |
303 extern ngx_module_t ngx_stream_core_module; | |
304 | |
305 | |
6692 | 306 typedef ngx_int_t (*ngx_stream_filter_pt)(ngx_stream_session_t *s, |
307 ngx_chain_t *chain, ngx_uint_t from_upstream); | |
308 | |
309 | |
310 extern ngx_stream_filter_pt ngx_stream_top_filter; | |
311 | |
312 | |
6115 | 313 #endif /* _NGX_STREAM_H_INCLUDED_ */ |