Mercurial > hg > nginx-quic
annotate src/http/v3/ngx_http_v3_parse.h @ 8605:4ca8035c19a4 quic
Merged with the default branch.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 08 Sep 2021 15:53:00 +0300 |
parents | d6e191a583cc |
children |
rev | line source |
---|---|
7692 | 1 |
2 /* | |
3 * Copyright (C) Roman Arutyunyan | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #ifndef _NGX_HTTP_V3_PARSE_H_INCLUDED_ | |
9 #define _NGX_HTTP_V3_PARSE_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 #include <ngx_http.h> | |
15 | |
16 | |
17 typedef struct { | |
18 ngx_uint_t state; | |
19 uint64_t value; | |
20 } ngx_http_v3_parse_varlen_int_t; | |
21 | |
22 | |
23 typedef struct { | |
24 ngx_uint_t state; | |
7950
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
7761
diff
changeset
|
25 ngx_uint_t shift; |
7692 | 26 uint64_t value; |
27 } ngx_http_v3_parse_prefix_int_t; | |
28 | |
29 | |
30 typedef struct { | |
31 ngx_uint_t state; | |
32 uint64_t id; | |
33 ngx_http_v3_parse_varlen_int_t vlint; | |
34 } ngx_http_v3_parse_settings_t; | |
35 | |
36 | |
37 typedef struct { | |
38 ngx_uint_t state; | |
39 ngx_uint_t insert_count; | |
40 ngx_uint_t delta_base; | |
41 ngx_uint_t sign; | |
42 ngx_uint_t base; | |
43 ngx_http_v3_parse_prefix_int_t pint; | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8432
diff
changeset
|
44 } ngx_http_v3_parse_field_section_prefix_t; |
7692 | 45 |
46 | |
47 typedef struct { | |
48 ngx_uint_t state; | |
49 ngx_uint_t length; | |
50 ngx_uint_t huffman; | |
51 ngx_str_t value; | |
52 u_char *last; | |
53 u_char huffstate; | |
54 } ngx_http_v3_parse_literal_t; | |
55 | |
56 | |
57 typedef struct { | |
58 ngx_uint_t state; | |
59 ngx_uint_t index; | |
60 ngx_uint_t base; | |
61 ngx_uint_t dynamic; | |
62 | |
63 ngx_str_t name; | |
64 ngx_str_t value; | |
65 | |
66 ngx_http_v3_parse_prefix_int_t pint; | |
67 ngx_http_v3_parse_literal_t literal; | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8432
diff
changeset
|
68 } ngx_http_v3_parse_field_t; |
7692 | 69 |
70 | |
71 typedef struct { | |
72 ngx_uint_t state; | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8432
diff
changeset
|
73 ngx_http_v3_parse_field_t field; |
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8432
diff
changeset
|
74 } ngx_http_v3_parse_field_rep_t; |
7692 | 75 |
76 | |
77 typedef struct { | |
78 ngx_uint_t state; | |
8087
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
7955
diff
changeset
|
79 ngx_uint_t type; |
7692 | 80 ngx_uint_t length; |
81 ngx_http_v3_parse_varlen_int_t vlint; | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8432
diff
changeset
|
82 ngx_http_v3_parse_field_section_prefix_t prefix; |
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8432
diff
changeset
|
83 ngx_http_v3_parse_field_rep_t field_rep; |
7692 | 84 } ngx_http_v3_parse_headers_t; |
85 | |
86 | |
87 typedef struct { | |
88 ngx_uint_t state; | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8432
diff
changeset
|
89 ngx_http_v3_parse_field_t field; |
7692 | 90 ngx_http_v3_parse_prefix_int_t pint; |
91 } ngx_http_v3_parse_encoder_t; | |
92 | |
93 | |
94 typedef struct { | |
95 ngx_uint_t state; | |
96 ngx_http_v3_parse_prefix_int_t pint; | |
97 } ngx_http_v3_parse_decoder_t; | |
98 | |
99 | |
100 typedef struct { | |
101 ngx_uint_t state; | |
102 ngx_uint_t type; | |
103 ngx_uint_t length; | |
104 ngx_http_v3_parse_varlen_int_t vlint; | |
105 ngx_http_v3_parse_settings_t settings; | |
106 } ngx_http_v3_parse_control_t; | |
107 | |
108 | |
7761
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7692
diff
changeset
|
109 typedef struct { |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7692
diff
changeset
|
110 ngx_uint_t state; |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
111 ngx_http_v3_parse_varlen_int_t vlint; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
112 union { |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
113 ngx_http_v3_parse_encoder_t encoder; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
114 ngx_http_v3_parse_decoder_t decoder; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
115 ngx_http_v3_parse_control_t control; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
116 } u; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
117 } ngx_http_v3_parse_uni_t; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
118 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
119 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
120 typedef struct { |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
121 ngx_uint_t state; |
8087
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
7955
diff
changeset
|
122 ngx_uint_t type; |
7761
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7692
diff
changeset
|
123 ngx_uint_t length; |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7692
diff
changeset
|
124 ngx_http_v3_parse_varlen_int_t vlint; |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7692
diff
changeset
|
125 } ngx_http_v3_parse_data_t; |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7692
diff
changeset
|
126 |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7692
diff
changeset
|
127 |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
128 /* |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
129 * Parse functions return codes: |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
130 * NGX_DONE - parsing done |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
131 * NGX_OK - sub-element done |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
132 * NGX_AGAIN - more data expected |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
133 * NGX_BUSY - waiting for external event |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
134 * NGX_ERROR - internal error |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
135 * NGX_HTTP_V3_ERROR_XXX - HTTP/3 or QPACK error |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
136 */ |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
137 |
7692 | 138 ngx_int_t ngx_http_v3_parse_headers(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
139 ngx_http_v3_parse_headers_t *st, ngx_buf_t *b); |
7761
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7692
diff
changeset
|
140 ngx_int_t ngx_http_v3_parse_data(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
141 ngx_http_v3_parse_data_t *st, ngx_buf_t *b); |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
142 ngx_int_t ngx_http_v3_parse_uni(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
143 ngx_http_v3_parse_uni_t *st, ngx_buf_t *b); |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8087
diff
changeset
|
144 |
7692 | 145 |
146 #endif /* _NGX_HTTP_V3_PARSE_H_INCLUDED_ */ |