Mercurial > hg > nginx-quic
annotate src/http/v3/ngx_http_v3.h @ 7692:268f4389130d quic
Refactored HTTP/3 parser.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Wed, 18 Mar 2020 13:46:35 +0300 |
parents | 38c0898b6df7 |
children | e9891e8ee975 |
rev | line source |
---|---|
7681 | 1 |
2 /* | |
3 * Copyright (C) Roman Arutyunyan | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #ifndef _NGX_HTTP_V3_H_INCLUDED_ | |
9 #define _NGX_HTTP_V3_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 #include <ngx_http.h> | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
15 #include <ngx_http_v3_parse.h> |
7681 | 16 |
17 | |
18 #define NGX_HTTP_V3_STREAM 0x48335354 /* "H3ST" */ | |
19 | |
20 | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
21 #define NGX_HTTP_V3_VARLEN_INT_LEN 4 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
22 #define NGX_HTTP_V3_PREFIX_INT_LEN 11 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
23 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
24 #define NGX_HTTP_V3_STREAM_CONTROL 0x00 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
25 #define NGX_HTTP_V3_STREAM_PUSH 0x01 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
26 #define NGX_HTTP_V3_STREAM_ENCODER 0x02 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
27 #define NGX_HTTP_V3_STREAM_DECODER 0x03 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
28 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
29 #define NGX_HTTP_V3_FRAME_DATA 0x00 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
30 #define NGX_HTTP_V3_FRAME_HEADERS 0x01 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
31 #define NGX_HTTP_V3_FRAME_CANCEL_PUSH 0x03 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
32 #define NGX_HTTP_V3_FRAME_SETTINGS 0x04 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
33 #define NGX_HTTP_V3_FRAME_PUSH_PROMISE 0x05 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
34 #define NGX_HTTP_V3_FRAME_GOAWAY 0x07 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
35 #define NGX_HTTP_V3_FRAME_MAX_PUSH_ID 0x0d |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
36 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
37 #define NGX_HTTP_V3_PARAM_MAX_TABLE_CAPACITY 0x01 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
38 #define NGX_HTTP_V3_PARAM_MAX_HEADER_LIST_SIZE 0x06 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
39 #define NGX_HTTP_V3_PARAM_BLOCKED_STREAMS 0x07 |
7681 | 40 |
41 | |
42 typedef struct { | |
43 ngx_http_connection_t hc; | |
44 | |
45 ngx_array_t *dynamic; | |
46 | |
47 ngx_connection_t *client_encoder; | |
48 ngx_connection_t *client_decoder; | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
49 ngx_connection_t *client_control; |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
50 |
7681 | 51 ngx_connection_t *server_encoder; |
52 ngx_connection_t *server_decoder; | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
53 ngx_connection_t *server_control; |
7681 | 54 } ngx_http_v3_connection_t; |
55 | |
56 | |
57 typedef struct { | |
58 ngx_str_t name; | |
59 ngx_str_t value; | |
60 } ngx_http_v3_header_t; | |
61 | |
62 | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
63 ngx_int_t ngx_http_v3_parse_header(ngx_http_request_t *r, ngx_buf_t *b); |
7681 | 64 ngx_chain_t *ngx_http_v3_create_header(ngx_http_request_t *r); |
65 | |
66 uintptr_t ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value); | |
67 uintptr_t ngx_http_v3_encode_prefix_int(u_char *p, uint64_t value, | |
68 ngx_uint_t prefix); | |
69 | |
70 void ngx_http_v3_handle_client_uni_stream(ngx_connection_t *c); | |
71 | |
72 ngx_int_t ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, | |
73 ngx_uint_t index, ngx_str_t *value); | |
74 ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name, | |
75 ngx_str_t *value); | |
76 ngx_int_t ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity); | |
77 ngx_int_t ngx_http_v3_duplicate(ngx_connection_t *c, ngx_uint_t index); | |
78 ngx_int_t ngx_http_v3_ack_header(ngx_connection_t *c, ngx_uint_t stream_id); | |
79 ngx_int_t ngx_http_v3_cancel_stream(ngx_connection_t *c, ngx_uint_t stream_id); | |
80 ngx_int_t ngx_http_v3_inc_insert_count(ngx_connection_t *c, ngx_uint_t inc); | |
81 ngx_http_v3_header_t *ngx_http_v3_lookup_table(ngx_connection_t *c, | |
82 ngx_uint_t dynamic, ngx_uint_t index); | |
83 ngx_int_t ngx_http_v3_check_insert_count(ngx_connection_t *c, | |
84 ngx_uint_t insert_count); | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
85 ngx_int_t ngx_http_v3_set_param(ngx_connection_t *c, uint64_t id, |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
86 uint64_t value); |
7681 | 87 |
88 ngx_int_t ngx_http_v3_client_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, | |
89 ngx_uint_t index, ngx_str_t *value); | |
90 ngx_int_t ngx_http_v3_client_insert(ngx_connection_t *c, ngx_str_t *name, | |
91 ngx_str_t *value); | |
92 ngx_int_t ngx_http_v3_client_set_capacity(ngx_connection_t *c, | |
93 ngx_uint_t capacity); | |
94 ngx_int_t ngx_http_v3_client_duplicate(ngx_connection_t *c, ngx_uint_t index); | |
95 ngx_int_t ngx_http_v3_client_ack_header(ngx_connection_t *c, | |
96 ngx_uint_t stream_id); | |
97 ngx_int_t ngx_http_v3_client_cancel_stream(ngx_connection_t *c, | |
98 ngx_uint_t stream_id); | |
99 ngx_int_t ngx_http_v3_client_inc_insert_count(ngx_connection_t *c, | |
100 ngx_uint_t inc); | |
101 | |
102 | |
103 extern ngx_module_t ngx_http_v3_module; | |
104 | |
105 | |
106 #endif /* _NGX_HTTP_V3_H_INCLUDED_ */ |