Mercurial > hg > nginx-quic
annotate src/http/v3/ngx_http_v3.h @ 7743:50db7ce374b7 quic
Advertise our max_idle_timeout in transport parameters.
So we can easily tune how soon client would decide to close a connection.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 24 Mar 2020 22:12:52 +0300 |
parents | c9c3a73df6e8 |
children | dadbc66e9fca |
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 | |
7735
c9c3a73df6e8
Support for HTTP/3 ALPN.
Roman Arutyunyan <arut@nginx.com>
parents:
7713
diff
changeset
|
20 #define NGX_HTTP_V3_ALPN(s) NGX_HTTP_V3_ALPN_DRAFT(s) |
c9c3a73df6e8
Support for HTTP/3 ALPN.
Roman Arutyunyan <arut@nginx.com>
parents:
7713
diff
changeset
|
21 #define NGX_HTTP_V3_ALPN_DRAFT(s) "\x05h3-" #s |
c9c3a73df6e8
Support for HTTP/3 ALPN.
Roman Arutyunyan <arut@nginx.com>
parents:
7713
diff
changeset
|
22 #define NGX_HTTP_V3_ALPN_ADVERTISE NGX_HTTP_V3_ALPN(NGX_QUIC_DRAFT_VERSION) |
7681 | 23 |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
24 #define NGX_HTTP_V3_VARLEN_INT_LEN 4 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
25 #define NGX_HTTP_V3_PREFIX_INT_LEN 11 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
26 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
27 #define NGX_HTTP_V3_STREAM_CONTROL 0x00 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
28 #define NGX_HTTP_V3_STREAM_PUSH 0x01 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
29 #define NGX_HTTP_V3_STREAM_ENCODER 0x02 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
30 #define NGX_HTTP_V3_STREAM_DECODER 0x03 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
31 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
32 #define NGX_HTTP_V3_FRAME_DATA 0x00 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
33 #define NGX_HTTP_V3_FRAME_HEADERS 0x01 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
34 #define NGX_HTTP_V3_FRAME_CANCEL_PUSH 0x03 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
35 #define NGX_HTTP_V3_FRAME_SETTINGS 0x04 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
36 #define NGX_HTTP_V3_FRAME_PUSH_PROMISE 0x05 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
37 #define NGX_HTTP_V3_FRAME_GOAWAY 0x07 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
38 #define NGX_HTTP_V3_FRAME_MAX_PUSH_ID 0x0d |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
39 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
40 #define NGX_HTTP_V3_PARAM_MAX_TABLE_CAPACITY 0x01 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
41 #define NGX_HTTP_V3_PARAM_MAX_HEADER_LIST_SIZE 0x06 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
42 #define NGX_HTTP_V3_PARAM_BLOCKED_STREAMS 0x07 |
7681 | 43 |
44 | |
45 typedef struct { | |
7713
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
46 ngx_quic_tp_t quic; |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
47 } ngx_http_v3_srv_conf_t; |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
48 |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
49 |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
50 typedef struct { |
7681 | 51 ngx_http_connection_t hc; |
52 | |
53 ngx_array_t *dynamic; | |
54 | |
55 ngx_connection_t *client_encoder; | |
56 ngx_connection_t *client_decoder; | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
57 ngx_connection_t *client_control; |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
58 |
7681 | 59 ngx_connection_t *server_encoder; |
60 ngx_connection_t *server_decoder; | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
61 ngx_connection_t *server_control; |
7681 | 62 } ngx_http_v3_connection_t; |
63 | |
64 | |
65 typedef struct { | |
66 ngx_str_t name; | |
67 ngx_str_t value; | |
68 } ngx_http_v3_header_t; | |
69 | |
70 | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
71 ngx_int_t ngx_http_v3_parse_header(ngx_http_request_t *r, ngx_buf_t *b); |
7681 | 72 ngx_chain_t *ngx_http_v3_create_header(ngx_http_request_t *r); |
73 | |
74 uintptr_t ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value); | |
75 uintptr_t ngx_http_v3_encode_prefix_int(u_char *p, uint64_t value, | |
76 ngx_uint_t prefix); | |
77 | |
78 void ngx_http_v3_handle_client_uni_stream(ngx_connection_t *c); | |
79 | |
80 ngx_int_t ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, | |
81 ngx_uint_t index, ngx_str_t *value); | |
82 ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name, | |
83 ngx_str_t *value); | |
84 ngx_int_t ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity); | |
85 ngx_int_t ngx_http_v3_duplicate(ngx_connection_t *c, ngx_uint_t index); | |
86 ngx_int_t ngx_http_v3_ack_header(ngx_connection_t *c, ngx_uint_t stream_id); | |
87 ngx_int_t ngx_http_v3_cancel_stream(ngx_connection_t *c, ngx_uint_t stream_id); | |
88 ngx_int_t ngx_http_v3_inc_insert_count(ngx_connection_t *c, ngx_uint_t inc); | |
89 ngx_http_v3_header_t *ngx_http_v3_lookup_table(ngx_connection_t *c, | |
90 ngx_uint_t dynamic, ngx_uint_t index); | |
91 ngx_int_t ngx_http_v3_check_insert_count(ngx_connection_t *c, | |
92 ngx_uint_t insert_count); | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
93 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
|
94 uint64_t value); |
7681 | 95 |
96 ngx_int_t ngx_http_v3_client_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, | |
97 ngx_uint_t index, ngx_str_t *value); | |
98 ngx_int_t ngx_http_v3_client_insert(ngx_connection_t *c, ngx_str_t *name, | |
99 ngx_str_t *value); | |
100 ngx_int_t ngx_http_v3_client_set_capacity(ngx_connection_t *c, | |
101 ngx_uint_t capacity); | |
102 ngx_int_t ngx_http_v3_client_duplicate(ngx_connection_t *c, ngx_uint_t index); | |
103 ngx_int_t ngx_http_v3_client_ack_header(ngx_connection_t *c, | |
104 ngx_uint_t stream_id); | |
105 ngx_int_t ngx_http_v3_client_cancel_stream(ngx_connection_t *c, | |
106 ngx_uint_t stream_id); | |
107 ngx_int_t ngx_http_v3_client_inc_insert_count(ngx_connection_t *c, | |
108 ngx_uint_t inc); | |
109 | |
110 | |
111 extern ngx_module_t ngx_http_v3_module; | |
112 | |
113 | |
114 #endif /* _NGX_HTTP_V3_H_INCLUDED_ */ |