comparison src/http/v3/ngx_http_v3.h @ 8773:b43e50f47b2e quic

HTTP/3: separate header files for existing source files.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 05 May 2021 15:09:23 +0300
parents 345370fdd32d
children 1fec68e322d0
comparison
equal deleted inserted replaced
8772:345370fdd32d 8773:b43e50f47b2e
10 10
11 11
12 #include <ngx_config.h> 12 #include <ngx_config.h>
13 #include <ngx_core.h> 13 #include <ngx_core.h>
14 #include <ngx_http.h> 14 #include <ngx_http.h>
15
15 #include <ngx_http_v3_parse.h> 16 #include <ngx_http_v3_parse.h>
17 #include <ngx_http_v3_encode.h>
18 #include <ngx_http_v3_streams.h>
19 #include <ngx_http_v3_tables.h>
16 20
17 21
18 #define NGX_HTTP_V3_ALPN_ADVERTISE "\x02h3" 22 #define NGX_HTTP_V3_ALPN_ADVERTISE "\x02h3"
19 #define NGX_HTTP_V3_ALPN_DRAFT_FMT "\x05h3-%02uD" 23 #define NGX_HTTP_V3_ALPN_DRAFT_FMT "\x05h3-%02uD"
20 24
110 ngx_http_v3_parse_headers_t headers; 114 ngx_http_v3_parse_headers_t headers;
111 ngx_http_v3_parse_data_t body; 115 ngx_http_v3_parse_data_t body;
112 }; 116 };
113 117
114 118
115 typedef struct {
116 ngx_str_t name;
117 ngx_str_t value;
118 } ngx_http_v3_header_t;
119
120
121 typedef struct {
122 ngx_http_v3_header_t **elts;
123 ngx_uint_t nelts;
124 ngx_uint_t base;
125 size_t size;
126 size_t capacity;
127 } ngx_http_v3_dynamic_table_t;
128
129
130 struct ngx_http_v3_session_s { 119 struct ngx_http_v3_session_s {
131 ngx_http_v3_dynamic_table_t table; 120 ngx_http_v3_dynamic_table_t table;
132 121
133 ngx_event_t keepalive; 122 ngx_event_t keepalive;
134 ngx_uint_t nrequests; 123 ngx_uint_t nrequests;
146 ngx_connection_t *known_streams[NGX_HTTP_V3_MAX_KNOWN_STREAM]; 135 ngx_connection_t *known_streams[NGX_HTTP_V3_MAX_KNOWN_STREAM];
147 }; 136 };
148 137
149 138
150 void ngx_http_v3_init(ngx_connection_t *c); 139 void ngx_http_v3_init(ngx_connection_t *c);
140 ngx_int_t ngx_http_v3_init_session(ngx_connection_t *c);
141
151 ngx_int_t ngx_http_v3_read_request_body(ngx_http_request_t *r); 142 ngx_int_t ngx_http_v3_read_request_body(ngx_http_request_t *r);
152 ngx_int_t ngx_http_v3_read_unbuffered_request_body(ngx_http_request_t *r); 143 ngx_int_t ngx_http_v3_read_unbuffered_request_body(ngx_http_request_t *r);
153
154 uintptr_t ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value);
155 uintptr_t ngx_http_v3_encode_prefix_int(u_char *p, uint64_t value,
156 ngx_uint_t prefix);
157
158 uintptr_t ngx_http_v3_encode_header_block_prefix(u_char *p,
159 ngx_uint_t insert_count, ngx_uint_t sign, ngx_uint_t delta_base);
160 uintptr_t ngx_http_v3_encode_header_ri(u_char *p, ngx_uint_t dynamic,
161 ngx_uint_t index);
162 uintptr_t ngx_http_v3_encode_header_lri(u_char *p, ngx_uint_t dynamic,
163 ngx_uint_t index, u_char *data, size_t len);
164 uintptr_t ngx_http_v3_encode_header_l(u_char *p, ngx_str_t *name,
165 ngx_str_t *value);
166 uintptr_t ngx_http_v3_encode_header_pbi(u_char *p, ngx_uint_t index);
167 uintptr_t ngx_http_v3_encode_header_lpbi(u_char *p, ngx_uint_t index,
168 u_char *data, size_t len);
169
170 ngx_int_t ngx_http_v3_init_session(ngx_connection_t *c);
171 void ngx_http_v3_init_uni_stream(ngx_connection_t *c);
172 ngx_int_t ngx_http_v3_register_uni_stream(ngx_connection_t *c, uint64_t type);
173 ngx_connection_t *ngx_http_v3_create_push_stream(ngx_connection_t *c,
174 uint64_t push_id);
175 ngx_int_t ngx_http_v3_send_goaway(ngx_connection_t *c, uint64_t id);
176 ngx_int_t ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
177 ngx_uint_t index, ngx_str_t *value);
178 ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name,
179 ngx_str_t *value);
180 ngx_int_t ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity);
181 ngx_int_t ngx_http_v3_duplicate(ngx_connection_t *c, ngx_uint_t index);
182 ngx_int_t ngx_http_v3_ack_header(ngx_connection_t *c, ngx_uint_t stream_id);
183 ngx_int_t ngx_http_v3_cancel_stream(ngx_connection_t *c, ngx_uint_t stream_id);
184 ngx_int_t ngx_http_v3_inc_insert_count(ngx_connection_t *c, ngx_uint_t inc);
185 ngx_int_t ngx_http_v3_lookup_static(ngx_connection_t *c, ngx_uint_t index,
186 ngx_str_t *name, ngx_str_t *value);
187 ngx_int_t ngx_http_v3_lookup(ngx_connection_t *c, ngx_uint_t index,
188 ngx_str_t *name, ngx_str_t *value);
189 ngx_int_t ngx_http_v3_decode_insert_count(ngx_connection_t *c,
190 ngx_uint_t *insert_count);
191 ngx_int_t ngx_http_v3_check_insert_count(ngx_connection_t *c,
192 ngx_uint_t insert_count);
193 ngx_int_t ngx_http_v3_set_param(ngx_connection_t *c, uint64_t id,
194 uint64_t value);
195 ngx_int_t ngx_http_v3_set_max_push_id(ngx_connection_t *c,
196 uint64_t max_push_id);
197 ngx_int_t ngx_http_v3_cancel_push(ngx_connection_t *c, uint64_t push_id);
198
199 ngx_int_t ngx_http_v3_send_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
200 ngx_uint_t index, ngx_str_t *value);
201 ngx_int_t ngx_http_v3_send_insert(ngx_connection_t *c, ngx_str_t *name,
202 ngx_str_t *value);
203 ngx_int_t ngx_http_v3_send_set_capacity(ngx_connection_t *c,
204 ngx_uint_t capacity);
205 ngx_int_t ngx_http_v3_send_duplicate(ngx_connection_t *c, ngx_uint_t index);
206 ngx_int_t ngx_http_v3_send_ack_header(ngx_connection_t *c,
207 ngx_uint_t stream_id);
208 ngx_int_t ngx_http_v3_send_cancel_stream(ngx_connection_t *c,
209 ngx_uint_t stream_id);
210 ngx_int_t ngx_http_v3_send_inc_insert_count(ngx_connection_t *c,
211 ngx_uint_t inc);
212 144
213 145
214 extern ngx_module_t ngx_http_v3_module; 146 extern ngx_module_t ngx_http_v3_module;
215 147
216 148