Mercurial > hg > nginx-quic
annotate src/stream/ngx_stream.h @ 6205:dcae651b2a0c
OCSP stapling: fixed ssl_stapling_file (ticket #769).
Broken by 6893a1007a7c (1.9.2) during introduction of strict OCSP response
validity checks. As stapling file is expected to be returned unconditionally,
fix is to set its validity to the maximum supported time.
Reported by Faidon Liambotis.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 07 Jul 2015 16:38:49 +0300 |
parents | 0dcef374b8bb |
children | 7565e056fad6 |
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 | |
23 #include <ngx_stream_upstream.h> | |
24 #include <ngx_stream_upstream_round_robin.h> | |
25 | |
26 | |
27 typedef struct { | |
28 void **main_conf; | |
29 void **srv_conf; | |
30 } ngx_stream_conf_ctx_t; | |
31 | |
32 | |
33 typedef struct { | |
6170
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
34 union { |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
35 struct sockaddr sockaddr; |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
36 struct sockaddr_in sockaddr_in; |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
37 #if (NGX_HAVE_INET6) |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
38 struct sockaddr_in6 sockaddr_in6; |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
39 #endif |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
40 #if (NGX_HAVE_UNIX_DOMAIN) |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
41 struct sockaddr_un sockaddr_un; |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
42 #endif |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
43 u_char sockaddr_data[NGX_SOCKADDRLEN]; |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
44 } u; |
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
45 |
6115 | 46 socklen_t socklen; |
47 | |
48 /* server ctx */ | |
49 ngx_stream_conf_ctx_t *ctx; | |
50 | |
51 unsigned bind:1; | |
52 unsigned wildcard:1; | |
53 #if (NGX_STREAM_SSL) | |
54 unsigned ssl:1; | |
55 #endif | |
56 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) | |
57 unsigned ipv6only:1; | |
58 #endif | |
6153
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6129
diff
changeset
|
59 #if (NGX_HAVE_REUSEPORT) |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6129
diff
changeset
|
60 unsigned reuseport:1; |
4f6efabcb09b
The "reuseport" option of the "listen" directive.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6129
diff
changeset
|
61 #endif |
6115 | 62 unsigned so_keepalive:2; |
63 #if (NGX_HAVE_KEEPALIVE_TUNABLE) | |
64 int tcp_keepidle; | |
65 int tcp_keepintvl; | |
66 int tcp_keepcnt; | |
67 #endif | |
6172 | 68 int backlog; |
6115 | 69 } ngx_stream_listen_t; |
70 | |
71 | |
72 typedef struct { | |
73 ngx_stream_conf_ctx_t *ctx; | |
74 ngx_str_t addr_text; | |
75 #if (NGX_STREAM_SSL) | |
76 ngx_uint_t ssl; /* unsigned ssl:1; */ | |
77 #endif | |
78 } ngx_stream_addr_conf_t; | |
79 | |
80 typedef struct { | |
81 in_addr_t addr; | |
82 ngx_stream_addr_conf_t conf; | |
83 } ngx_stream_in_addr_t; | |
84 | |
85 | |
86 #if (NGX_HAVE_INET6) | |
87 | |
88 typedef struct { | |
89 struct in6_addr addr6; | |
90 ngx_stream_addr_conf_t conf; | |
91 } ngx_stream_in6_addr_t; | |
92 | |
93 #endif | |
94 | |
95 | |
96 typedef struct { | |
97 /* ngx_stream_in_addr_t or ngx_stream_in6_addr_t */ | |
98 void *addrs; | |
99 ngx_uint_t naddrs; | |
100 } ngx_stream_port_t; | |
101 | |
102 | |
103 typedef struct { | |
104 int family; | |
105 in_port_t port; | |
106 ngx_array_t addrs; /* array of ngx_stream_conf_addr_t */ | |
107 } ngx_stream_conf_port_t; | |
108 | |
109 | |
110 typedef struct { | |
6170
c13091e6292c
Stream: embed ngx_stream_listen_t into ngx_stream_conf_addr_t.
Ruslan Ermilov <ru@nginx.com>
parents:
6169
diff
changeset
|
111 ngx_stream_listen_t opt; |
6115 | 112 } ngx_stream_conf_addr_t; |
113 | |
114 | |
6175 | 115 typedef ngx_int_t (*ngx_stream_access_pt)(ngx_stream_session_t *s); |
116 | |
117 | |
6115 | 118 typedef struct { |
119 ngx_array_t servers; /* ngx_stream_core_srv_conf_t */ | |
120 ngx_array_t listen; /* ngx_stream_listen_t */ | |
6197
0dcef374b8bb
Stream: connection limiting module.
Vladimir Homutov <vl@nginx.com>
parents:
6175
diff
changeset
|
121 ngx_stream_access_pt limit_conn_handler; |
6175 | 122 ngx_stream_access_pt access_handler; |
6115 | 123 } ngx_stream_core_main_conf_t; |
124 | |
125 | |
126 typedef void (*ngx_stream_handler_pt)(ngx_stream_session_t *s); | |
127 | |
128 | |
129 typedef struct { | |
130 ngx_stream_handler_pt handler; | |
131 ngx_stream_conf_ctx_t *ctx; | |
132 u_char *file_name; | |
133 ngx_int_t line; | |
134 ngx_log_t *error_log; | |
135 } ngx_stream_core_srv_conf_t; | |
136 | |
137 | |
138 struct ngx_stream_session_s { | |
139 uint32_t signature; /* "STRM" */ | |
140 | |
141 ngx_connection_t *connection; | |
142 | |
143 off_t received; | |
144 | |
145 ngx_log_handler_pt log_handler; | |
146 | |
147 void **ctx; | |
148 void **main_conf; | |
149 void **srv_conf; | |
150 | |
151 ngx_stream_upstream_t *upstream; | |
152 }; | |
153 | |
154 | |
155 typedef struct { | |
6174
68c106e6fa0a
Stream: added postconfiguration method to stream modules.
Vladimir Homutov <vl@nginx.com>
parents:
6172
diff
changeset
|
156 ngx_int_t (*postconfiguration)(ngx_conf_t *cf); |
68c106e6fa0a
Stream: added postconfiguration method to stream modules.
Vladimir Homutov <vl@nginx.com>
parents:
6172
diff
changeset
|
157 |
6115 | 158 void *(*create_main_conf)(ngx_conf_t *cf); |
159 char *(*init_main_conf)(ngx_conf_t *cf, void *conf); | |
160 | |
161 void *(*create_srv_conf)(ngx_conf_t *cf); | |
162 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, | |
163 void *conf); | |
164 } ngx_stream_module_t; | |
165 | |
166 | |
167 #define NGX_STREAM_MODULE 0x4d525453 /* "STRM" */ | |
168 | |
169 #define NGX_STREAM_MAIN_CONF 0x02000000 | |
170 #define NGX_STREAM_SRV_CONF 0x04000000 | |
171 #define NGX_STREAM_UPS_CONF 0x08000000 | |
172 | |
173 | |
174 #define NGX_STREAM_MAIN_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, main_conf) | |
175 #define NGX_STREAM_SRV_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, srv_conf) | |
176 | |
177 | |
178 #define ngx_stream_get_module_ctx(s, module) (s)->ctx[module.ctx_index] | |
179 #define ngx_stream_set_ctx(s, c, module) s->ctx[module.ctx_index] = c; | |
180 #define ngx_stream_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL; | |
181 | |
182 | |
183 #define ngx_stream_get_module_main_conf(s, module) \ | |
184 (s)->main_conf[module.ctx_index] | |
185 #define ngx_stream_get_module_srv_conf(s, module) \ | |
186 (s)->srv_conf[module.ctx_index] | |
187 | |
188 #define ngx_stream_conf_get_module_main_conf(cf, module) \ | |
189 ((ngx_stream_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] | |
190 #define ngx_stream_conf_get_module_srv_conf(cf, module) \ | |
191 ((ngx_stream_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index] | |
192 | |
193 #define ngx_stream_cycle_get_module_main_conf(cycle, module) \ | |
194 (cycle->conf_ctx[ngx_stream_module.index] ? \ | |
195 ((ngx_stream_conf_ctx_t *) cycle->conf_ctx[ngx_stream_module.index]) \ | |
196 ->main_conf[module.ctx_index]: \ | |
197 NULL) | |
198 | |
199 | |
200 void ngx_stream_init_connection(ngx_connection_t *c); | |
201 void ngx_stream_close_connection(ngx_connection_t *c); | |
202 | |
203 | |
204 extern ngx_module_t ngx_stream_module; | |
205 extern ngx_uint_t ngx_stream_max_module; | |
206 extern ngx_module_t ngx_stream_core_module; | |
207 | |
208 | |
209 #endif /* _NGX_STREAM_H_INCLUDED_ */ |