Mercurial > hg > nginx-quic
annotate src/stream/ngx_stream.h @ 9023:3c33d39a51d3 quic
README: updated building from sources, added directives reference.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 08 Feb 2023 12:47:35 +0400 |
parents | d514f88053e5 |
children |
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 | |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
7595
diff
changeset
|
19 #if (NGX_STREAM_QUIC) |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
7595
diff
changeset
|
20 #include <ngx_stream_quic_module.h> |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
7595
diff
changeset
|
21 #endif |
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
7595
diff
changeset
|
22 |
6115 | 23 |
24 typedef struct ngx_stream_session_s ngx_stream_session_t; | |
25 | |
26 | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
27 #include <ngx_stream_variables.h> |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
28 #include <ngx_stream_script.h> |
6115 | 29 #include <ngx_stream_upstream.h> |
30 #include <ngx_stream_upstream_round_robin.h> | |
31 | |
32 | |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
33 #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
|
34 #define NGX_STREAM_BAD_REQUEST 400 |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
35 #define NGX_STREAM_FORBIDDEN 403 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
36 #define NGX_STREAM_INTERNAL_SERVER_ERROR 500 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
37 #define NGX_STREAM_BAD_GATEWAY 502 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
38 #define NGX_STREAM_SERVICE_UNAVAILABLE 503 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
39 |
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
40 |
6115 | 41 typedef struct { |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
42 void **main_conf; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
43 void **srv_conf; |
6115 | 44 } ngx_stream_conf_ctx_t; |
45 | |
46 | |
47 typedef struct { | |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
6975
diff
changeset
|
48 struct sockaddr *sockaddr; |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
49 socklen_t socklen; |
7478
4f9b72a229c1
Multiple addresses in "listen".
Roman Arutyunyan <arut@nginx.com>
parents:
6975
diff
changeset
|
50 ngx_str_t addr_text; |
6115 | 51 |
52 /* server ctx */ | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
53 ngx_stream_conf_ctx_t *ctx; |
6115 | 54 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
55 unsigned bind:1; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
56 unsigned wildcard:1; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
57 unsigned ssl:1; |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
7595
diff
changeset
|
58 unsigned quic:1; |
6719
cebf5fed00bf
Modules compatibility: removed unneeded IPV6_V6ONLY checks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6711
diff
changeset
|
59 #if (NGX_HAVE_INET6) |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
60 unsigned ipv6only:1; |
6115 | 61 #endif |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
62 unsigned reuseport:1; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
63 unsigned so_keepalive:2; |
6680
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
64 unsigned proxy_protocol:1; |
6115 | 65 #if (NGX_HAVE_KEEPALIVE_TUNABLE) |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
66 int tcp_keepidle; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
67 int tcp_keepintvl; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
68 int tcp_keepcnt; |
6115 | 69 #endif |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
70 int backlog; |
6975
d7ce41bdf050
Stream: configurable socket buffer sizes.
Vladimir Homutov <vl@nginx.com>
parents:
6899
diff
changeset
|
71 int rcvbuf; |
d7ce41bdf050
Stream: configurable socket buffer sizes.
Vladimir Homutov <vl@nginx.com>
parents:
6899
diff
changeset
|
72 int sndbuf; |
8467
2ab7b55ae4a0
Stream: the "fastopen" parameter of the "listen" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7595
diff
changeset
|
73 #if (NGX_HAVE_TCP_FASTOPEN) |
2ab7b55ae4a0
Stream: the "fastopen" parameter of the "listen" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7595
diff
changeset
|
74 int fastopen; |
2ab7b55ae4a0
Stream: the "fastopen" parameter of the "listen" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
7595
diff
changeset
|
75 #endif |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
76 int type; |
6115 | 77 } ngx_stream_listen_t; |
78 | |
79 | |
80 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
81 ngx_stream_conf_ctx_t *ctx; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
82 ngx_str_t addr_text; |
6680
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
83 unsigned ssl:1; |
8000
893b3313f53c
QUIC: added "quic" listen parameter in Stream.
Roman Arutyunyan <arut@nginx.com>
parents:
7595
diff
changeset
|
84 unsigned quic:1; |
6680
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
85 unsigned proxy_protocol:1; |
6115 | 86 } ngx_stream_addr_conf_t; |
87 | |
88 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
89 in_addr_t addr; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
90 ngx_stream_addr_conf_t conf; |
6115 | 91 } ngx_stream_in_addr_t; |
92 | |
93 | |
94 #if (NGX_HAVE_INET6) | |
95 | |
96 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
97 struct in6_addr addr6; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
98 ngx_stream_addr_conf_t conf; |
6115 | 99 } ngx_stream_in6_addr_t; |
100 | |
101 #endif | |
102 | |
103 | |
104 typedef struct { | |
105 /* 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
|
106 void *addrs; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
107 ngx_uint_t naddrs; |
6115 | 108 } ngx_stream_port_t; |
109 | |
110 | |
111 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
112 int family; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
113 int type; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
114 in_port_t port; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
115 ngx_array_t addrs; /* array of ngx_stream_conf_addr_t */ |
6115 | 116 } ngx_stream_conf_port_t; |
117 | |
118 | |
119 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
120 ngx_stream_listen_t opt; |
6115 | 121 } ngx_stream_conf_addr_t; |
122 | |
123 | |
6693 | 124 typedef enum { |
125 NGX_STREAM_POST_ACCEPT_PHASE = 0, | |
126 NGX_STREAM_PREACCESS_PHASE, | |
127 NGX_STREAM_ACCESS_PHASE, | |
128 NGX_STREAM_SSL_PHASE, | |
6694 | 129 NGX_STREAM_PREREAD_PHASE, |
6693 | 130 NGX_STREAM_CONTENT_PHASE, |
131 NGX_STREAM_LOG_PHASE | |
132 } ngx_stream_phases; | |
133 | |
134 | |
135 typedef struct ngx_stream_phase_handler_s ngx_stream_phase_handler_t; | |
136 | |
137 typedef ngx_int_t (*ngx_stream_phase_handler_pt)(ngx_stream_session_t *s, | |
138 ngx_stream_phase_handler_t *ph); | |
139 typedef ngx_int_t (*ngx_stream_handler_pt)(ngx_stream_session_t *s); | |
140 typedef void (*ngx_stream_content_handler_pt)(ngx_stream_session_t *s); | |
141 | |
142 | |
143 struct ngx_stream_phase_handler_s { | |
144 ngx_stream_phase_handler_pt checker; | |
145 ngx_stream_handler_pt handler; | |
146 ngx_uint_t next; | |
147 }; | |
148 | |
149 | |
150 typedef struct { | |
151 ngx_stream_phase_handler_t *handlers; | |
152 } ngx_stream_phase_engine_t; | |
153 | |
154 | |
155 typedef struct { | |
156 ngx_array_t handlers; | |
157 } ngx_stream_phase_t; | |
6175 | 158 |
159 | |
6115 | 160 typedef struct { |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
161 ngx_array_t servers; /* ngx_stream_core_srv_conf_t */ |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
162 ngx_array_t listen; /* ngx_stream_listen_t */ |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
163 |
6693 | 164 ngx_stream_phase_engine_t phase_engine; |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
165 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
166 ngx_hash_t variables_hash; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
167 |
6899
d2b2ff157da5
Variables: generic prefix variables.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6736
diff
changeset
|
168 ngx_array_t variables; /* ngx_stream_variable_t */ |
d2b2ff157da5
Variables: generic prefix variables.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6736
diff
changeset
|
169 ngx_array_t prefix_variables; /* ngx_stream_variable_t */ |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
170 ngx_uint_t ncaptures; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
171 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
172 ngx_uint_t variables_hash_max_size; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
173 ngx_uint_t variables_hash_bucket_size; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
174 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
175 ngx_hash_keys_arrays_t *variables_keys; |
6693 | 176 |
177 ngx_stream_phase_t phases[NGX_STREAM_LOG_PHASE + 1]; | |
6115 | 178 } ngx_stream_core_main_conf_t; |
179 | |
180 | |
181 typedef struct { | |
6693 | 182 ngx_stream_content_handler_pt handler; |
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_stream_conf_ctx_t *ctx; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
185 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
186 u_char *file_name; |
6656
a2f57dfa65a9
Fixed wrong type of the "line" field.
Roman Arutyunyan <arut@nginx.com>
parents:
6618
diff
changeset
|
187 ngx_uint_t line; |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
188 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
189 ngx_flag_t tcp_nodelay; |
6694 | 190 size_t preread_buffer_size; |
191 ngx_msec_t preread_timeout; | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
192 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
193 ngx_log_t *error_log; |
6618 | 194 |
195 ngx_msec_t resolver_timeout; | |
196 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
|
197 |
6680
7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6679
diff
changeset
|
198 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
|
199 |
6657
3d5202c71f94
Ensure "listen" exists in a mail or stream server (ticket #1049).
Roman Arutyunyan <arut@nginx.com>
parents:
6656
diff
changeset
|
200 ngx_uint_t listen; /* unsigned listen:1; */ |
6115 | 201 } ngx_stream_core_srv_conf_t; |
202 | |
203 | |
204 struct ngx_stream_session_s { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
205 uint32_t signature; /* "STRM" */ |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
206 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
207 ngx_connection_t *connection; |
6115 | 208 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
209 off_t received; |
6669
164a0824ce20
Stream: the $session_time variable.
Vladimir Homutov <vl@nginx.com>
parents:
6657
diff
changeset
|
210 time_t start_sec; |
164a0824ce20
Stream: the $session_time variable.
Vladimir Homutov <vl@nginx.com>
parents:
6657
diff
changeset
|
211 ngx_msec_t start_msec; |
6115 | 212 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
213 ngx_log_handler_pt log_handler; |
6115 | 214 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
215 void **ctx; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
216 void **main_conf; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
217 void **srv_conf; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
218 |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
219 ngx_stream_upstream_t *upstream; |
6675
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6674
diff
changeset
|
220 ngx_array_t *upstream_states; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6674
diff
changeset
|
221 /* of ngx_stream_upstream_state_t */ |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
222 ngx_stream_variable_value_t *variables; |
6115 | 223 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
224 #if (NGX_PCRE) |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
225 ngx_uint_t ncaptures; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
226 int *captures; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
227 u_char *captures_data; |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
228 #endif |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
229 |
6693 | 230 ngx_int_t phase_handler; |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
231 ngx_uint_t status; |
6679
40e8ce405859
Stream: postpone session initialization under accept mutex.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
6678
diff
changeset
|
232 |
6710
3ab8736958cb
Modules compatibility: health check fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6694
diff
changeset
|
233 unsigned ssl:1; |
3ab8736958cb
Modules compatibility: health check fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6694
diff
changeset
|
234 |
6711
90a03b1dc4db
Modules compatibility: status fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6710
diff
changeset
|
235 unsigned stat_processing:1; |
90a03b1dc4db
Modules compatibility: status fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6710
diff
changeset
|
236 |
6710
3ab8736958cb
Modules compatibility: health check fields.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6694
diff
changeset
|
237 unsigned health_check:1; |
7595
9606d93aa586
Limit conn: $limit_conn_status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
7478
diff
changeset
|
238 |
9606d93aa586
Limit conn: $limit_conn_status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
7478
diff
changeset
|
239 unsigned limit_conn_status:2; |
6115 | 240 }; |
241 | |
242 | |
243 typedef struct { | |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
244 ngx_int_t (*preconfiguration)(ngx_conf_t *cf); |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
245 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
|
246 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
247 void *(*create_main_conf)(ngx_conf_t *cf); |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
248 char *(*init_main_conf)(ngx_conf_t *cf, void *conf); |
6115 | 249 |
6607
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
250 void *(*create_srv_conf)(ngx_conf_t *cf); |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
251 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, |
c70b7f4537e1
Stream: variables and script.
Vladimir Homutov <vl@nginx.com>
parents:
6606
diff
changeset
|
252 void *conf); |
6115 | 253 } ngx_stream_module_t; |
254 | |
255 | |
256 #define NGX_STREAM_MODULE 0x4d525453 /* "STRM" */ | |
257 | |
258 #define NGX_STREAM_MAIN_CONF 0x02000000 | |
259 #define NGX_STREAM_SRV_CONF 0x04000000 | |
260 #define NGX_STREAM_UPS_CONF 0x08000000 | |
261 | |
262 | |
263 #define NGX_STREAM_MAIN_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, main_conf) | |
264 #define NGX_STREAM_SRV_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, srv_conf) | |
265 | |
266 | |
267 #define ngx_stream_get_module_ctx(s, module) (s)->ctx[module.ctx_index] | |
268 #define ngx_stream_set_ctx(s, c, module) s->ctx[module.ctx_index] = c; | |
269 #define ngx_stream_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL; | |
270 | |
271 | |
272 #define ngx_stream_get_module_main_conf(s, module) \ | |
273 (s)->main_conf[module.ctx_index] | |
274 #define ngx_stream_get_module_srv_conf(s, module) \ | |
275 (s)->srv_conf[module.ctx_index] | |
276 | |
277 #define ngx_stream_conf_get_module_main_conf(cf, module) \ | |
278 ((ngx_stream_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] | |
279 #define ngx_stream_conf_get_module_srv_conf(cf, module) \ | |
280 ((ngx_stream_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index] | |
281 | |
282 #define ngx_stream_cycle_get_module_main_conf(cycle, module) \ | |
283 (cycle->conf_ctx[ngx_stream_module.index] ? \ | |
284 ((ngx_stream_conf_ctx_t *) cycle->conf_ctx[ngx_stream_module.index]) \ | |
285 ->main_conf[module.ctx_index]: \ | |
286 NULL) | |
287 | |
288 | |
6692 | 289 #define NGX_STREAM_WRITE_BUFFERED 0x10 |
290 | |
291 | |
6693 | 292 void ngx_stream_core_run_phases(ngx_stream_session_t *s); |
293 ngx_int_t ngx_stream_core_generic_phase(ngx_stream_session_t *s, | |
294 ngx_stream_phase_handler_t *ph); | |
6694 | 295 ngx_int_t ngx_stream_core_preread_phase(ngx_stream_session_t *s, |
296 ngx_stream_phase_handler_t *ph); | |
6693 | 297 ngx_int_t ngx_stream_core_content_phase(ngx_stream_session_t *s, |
298 ngx_stream_phase_handler_t *ph); | |
299 | |
300 | |
6115 | 301 void ngx_stream_init_connection(ngx_connection_t *c); |
6693 | 302 void ngx_stream_session_handler(ngx_event_t *rev); |
6674
38143d1abdec
Stream: the $status variable.
Roman Arutyunyan <arut@nginx.com>
parents:
6669
diff
changeset
|
303 void ngx_stream_finalize_session(ngx_stream_session_t *s, ngx_uint_t rc); |
6115 | 304 |
305 | |
306 extern ngx_module_t ngx_stream_module; | |
307 extern ngx_uint_t ngx_stream_max_module; | |
308 extern ngx_module_t ngx_stream_core_module; | |
309 | |
310 | |
6692 | 311 typedef ngx_int_t (*ngx_stream_filter_pt)(ngx_stream_session_t *s, |
312 ngx_chain_t *chain, ngx_uint_t from_upstream); | |
313 | |
314 | |
315 extern ngx_stream_filter_pt ngx_stream_top_filter; | |
316 | |
317 | |
6115 | 318 #endif /* _NGX_STREAM_H_INCLUDED_ */ |