comparison src/http/v3/ngx_http_v3_parse.h @ 8226:268f4389130d quic

Refactored HTTP/3 parser.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 18 Mar 2020 13:46:35 +0300
parents
children 5649079a41f4
comparison
equal deleted inserted replaced
8225:714a19dba6af 8226:268f4389130d
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;
25 ngx_uint_t mask;
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;
44 } ngx_http_v3_parse_header_block_prefix_t;
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;
68 } ngx_http_v3_parse_header_t;
69
70
71 typedef struct {
72 ngx_uint_t state;
73 ngx_http_v3_parse_header_t header;
74 } ngx_http_v3_parse_header_rep_t;
75
76
77 typedef struct {
78 ngx_uint_t state;
79 ngx_uint_t length;
80 ngx_http_v3_parse_varlen_int_t vlint;
81 ngx_http_v3_parse_header_block_prefix_t prefix;
82 ngx_http_v3_parse_header_rep_t header_rep;
83 } ngx_http_v3_parse_headers_t;
84
85
86 typedef struct {
87 ngx_uint_t state;
88 ngx_http_v3_parse_header_t header;
89 ngx_http_v3_parse_prefix_int_t pint;
90 } ngx_http_v3_parse_encoder_t;
91
92
93 typedef struct {
94 ngx_uint_t state;
95 ngx_http_v3_parse_prefix_int_t pint;
96 } ngx_http_v3_parse_decoder_t;
97
98
99 typedef struct {
100 ngx_uint_t state;
101 ngx_uint_t type;
102 ngx_uint_t length;
103 ngx_http_v3_parse_varlen_int_t vlint;
104 ngx_http_v3_parse_settings_t settings;
105 } ngx_http_v3_parse_control_t;
106
107
108 ngx_int_t ngx_http_v3_parse_varlen_int(ngx_connection_t *c,
109 ngx_http_v3_parse_varlen_int_t *st, u_char ch);
110 ngx_int_t ngx_http_v3_parse_prefix_int(ngx_connection_t *c,
111 ngx_http_v3_parse_prefix_int_t *st, ngx_uint_t prefix, u_char ch);
112
113 ngx_int_t ngx_http_v3_parse_headers(ngx_connection_t *c,
114 ngx_http_v3_parse_headers_t *st, u_char ch);
115 ngx_int_t ngx_http_v3_parse_header_block_prefix(ngx_connection_t *c,
116 ngx_http_v3_parse_header_block_prefix_t *st, u_char ch);
117 ngx_int_t ngx_http_v3_parse_header_rep(ngx_connection_t *c,
118 ngx_http_v3_parse_header_rep_t *st, ngx_uint_t base, u_char ch);
119 ngx_int_t ngx_http_v3_parse_literal(ngx_connection_t *c,
120 ngx_http_v3_parse_literal_t *st, u_char ch);
121 ngx_int_t ngx_http_v3_parse_header_ri(ngx_connection_t *c,
122 ngx_http_v3_parse_header_t *st, u_char ch);
123 ngx_int_t ngx_http_v3_parse_header_lri(ngx_connection_t *c,
124 ngx_http_v3_parse_header_t *st, u_char ch);
125 ngx_int_t ngx_http_v3_parse_header_l(ngx_connection_t *c,
126 ngx_http_v3_parse_header_t *st, u_char ch);
127 ngx_int_t ngx_http_v3_parse_header_pbi(ngx_connection_t *c,
128 ngx_http_v3_parse_header_t *st, u_char ch);
129 ngx_int_t ngx_http_v3_parse_header_lpbi(ngx_connection_t *c,
130 ngx_http_v3_parse_header_t *st, u_char ch);
131
132 ngx_int_t ngx_http_v3_parse_control(ngx_connection_t *c, void *data, u_char ch);
133 ngx_int_t ngx_http_v3_parse_settings(ngx_connection_t *c,
134 ngx_http_v3_parse_settings_t *st, u_char ch);
135
136 ngx_int_t ngx_http_v3_parse_encoder(ngx_connection_t *c, void *data, u_char ch);
137 ngx_int_t ngx_http_v3_parse_header_inr(ngx_connection_t *c,
138 ngx_http_v3_parse_header_t *st, u_char ch);
139 ngx_int_t ngx_http_v3_parse_header_iwnr(ngx_connection_t *c,
140 ngx_http_v3_parse_header_t *st, u_char ch);
141
142 ngx_int_t ngx_http_v3_parse_decoder(ngx_connection_t *c, void *data, u_char ch);
143
144
145 #endif /* _NGX_HTTP_V3_PARSE_H_INCLUDED_ */