Mercurial > hg > nginx-quic
annotate src/http/v3/ngx_http_v3.h @ 7870:e169cce912c7 quic
Avoid retransmitting of packets with discarded keys.
Sections 4.10.1 and 4.10.2 of quic transport describe discarding of initial
and handshake keys. Since the keys are discarded, we no longer need
to retransmit packets and corresponding queues should be emptied.
This patch removes previously added workaround that did not require
acknowledgement for initial packets, resulting in avoiding retransmission,
which is wrong because a packet could be lost and we have to retransmit it.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Mon, 18 May 2020 13:54:53 +0300 |
parents | 5649079a41f4 |
children | d2759e4cc437 |
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 | |
7735
c9c3a73df6e8
Support for HTTP/3 ALPN.
Roman Arutyunyan <arut@nginx.com>
parents:
7713
diff
changeset
|
18 #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
|
19 #define NGX_HTTP_V3_ALPN_DRAFT(s) "\x05h3-" #s |
c9c3a73df6e8
Support for HTTP/3 ALPN.
Roman Arutyunyan <arut@nginx.com>
parents:
7713
diff
changeset
|
20 #define NGX_HTTP_V3_ALPN_ADVERTISE NGX_HTTP_V3_ALPN(NGX_QUIC_DRAFT_VERSION) |
7681 | 21 |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
22 #define NGX_HTTP_V3_VARLEN_INT_LEN 4 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
23 #define NGX_HTTP_V3_PREFIX_INT_LEN 11 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
24 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
25 #define NGX_HTTP_V3_STREAM_CONTROL 0x00 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
26 #define NGX_HTTP_V3_STREAM_PUSH 0x01 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
27 #define NGX_HTTP_V3_STREAM_ENCODER 0x02 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
28 #define NGX_HTTP_V3_STREAM_DECODER 0x03 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
29 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
30 #define NGX_HTTP_V3_FRAME_DATA 0x00 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
31 #define NGX_HTTP_V3_FRAME_HEADERS 0x01 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
32 #define NGX_HTTP_V3_FRAME_CANCEL_PUSH 0x03 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
33 #define NGX_HTTP_V3_FRAME_SETTINGS 0x04 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
34 #define NGX_HTTP_V3_FRAME_PUSH_PROMISE 0x05 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
35 #define NGX_HTTP_V3_FRAME_GOAWAY 0x07 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
36 #define NGX_HTTP_V3_FRAME_MAX_PUSH_ID 0x0d |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
37 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
38 #define NGX_HTTP_V3_PARAM_MAX_TABLE_CAPACITY 0x01 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
39 #define NGX_HTTP_V3_PARAM_MAX_HEADER_LIST_SIZE 0x06 |
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
40 #define NGX_HTTP_V3_PARAM_BLOCKED_STREAMS 0x07 |
7681 | 41 |
7749
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
7735
diff
changeset
|
42 #define NGX_HTTP_V3_STREAM_CLIENT_CONTROL 0 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
7735
diff
changeset
|
43 #define NGX_HTTP_V3_STREAM_SERVER_CONTROL 1 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
7735
diff
changeset
|
44 #define NGX_HTTP_V3_STREAM_CLIENT_ENCODER 2 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
7735
diff
changeset
|
45 #define NGX_HTTP_V3_STREAM_SERVER_ENCODER 3 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
7735
diff
changeset
|
46 #define NGX_HTTP_V3_STREAM_CLIENT_DECODER 4 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
7735
diff
changeset
|
47 #define NGX_HTTP_V3_STREAM_SERVER_DECODER 5 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
7735
diff
changeset
|
48 #define NGX_HTTP_V3_MAX_KNOWN_STREAM 6 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
7735
diff
changeset
|
49 |
7681 | 50 |
51 typedef struct { | |
7713
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
52 ngx_quic_tp_t quic; |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
53 } ngx_http_v3_srv_conf_t; |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
54 |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
55 |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7692
diff
changeset
|
56 typedef struct { |
7681 | 57 ngx_http_connection_t hc; |
58 | |
59 ngx_array_t *dynamic; | |
7749
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
7735
diff
changeset
|
60 ngx_connection_t *known_streams[NGX_HTTP_V3_MAX_KNOWN_STREAM]; |
7681 | 61 } ngx_http_v3_connection_t; |
62 | |
63 | |
64 typedef struct { | |
65 ngx_str_t name; | |
66 ngx_str_t value; | |
67 } ngx_http_v3_header_t; | |
68 | |
69 | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
70 ngx_int_t ngx_http_v3_parse_header(ngx_http_request_t *r, ngx_buf_t *b); |
7761
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7758
diff
changeset
|
71 ngx_int_t ngx_http_v3_parse_request_body(ngx_http_request_t *r, ngx_buf_t *b, |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7758
diff
changeset
|
72 ngx_http_chunked_t *ctx); |
7681 | 73 ngx_chain_t *ngx_http_v3_create_header(ngx_http_request_t *r); |
7758
46e3542d51b3
Chunked response body in HTTP/3.
Roman Arutyunyan <arut@nginx.com>
parents:
7749
diff
changeset
|
74 ngx_chain_t *ngx_http_v3_create_trailers(ngx_http_request_t *r); |
7681 | 75 |
76 uintptr_t ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value); | |
77 uintptr_t ngx_http_v3_encode_prefix_int(u_char *p, uint64_t value, | |
78 ngx_uint_t prefix); | |
79 | |
80 void ngx_http_v3_handle_client_uni_stream(ngx_connection_t *c); | |
81 | |
82 ngx_int_t ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, | |
83 ngx_uint_t index, ngx_str_t *value); | |
84 ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name, | |
85 ngx_str_t *value); | |
86 ngx_int_t ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity); | |
87 ngx_int_t ngx_http_v3_duplicate(ngx_connection_t *c, ngx_uint_t index); | |
88 ngx_int_t ngx_http_v3_ack_header(ngx_connection_t *c, ngx_uint_t stream_id); | |
89 ngx_int_t ngx_http_v3_cancel_stream(ngx_connection_t *c, ngx_uint_t stream_id); | |
90 ngx_int_t ngx_http_v3_inc_insert_count(ngx_connection_t *c, ngx_uint_t inc); | |
91 ngx_http_v3_header_t *ngx_http_v3_lookup_table(ngx_connection_t *c, | |
92 ngx_uint_t dynamic, ngx_uint_t index); | |
93 ngx_int_t ngx_http_v3_check_insert_count(ngx_connection_t *c, | |
94 ngx_uint_t insert_count); | |
7692
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
7681
diff
changeset
|
95 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
|
96 uint64_t value); |
7681 | 97 |
98 ngx_int_t ngx_http_v3_client_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, | |
99 ngx_uint_t index, ngx_str_t *value); | |
100 ngx_int_t ngx_http_v3_client_insert(ngx_connection_t *c, ngx_str_t *name, | |
101 ngx_str_t *value); | |
102 ngx_int_t ngx_http_v3_client_set_capacity(ngx_connection_t *c, | |
103 ngx_uint_t capacity); | |
104 ngx_int_t ngx_http_v3_client_duplicate(ngx_connection_t *c, ngx_uint_t index); | |
105 ngx_int_t ngx_http_v3_client_ack_header(ngx_connection_t *c, | |
106 ngx_uint_t stream_id); | |
107 ngx_int_t ngx_http_v3_client_cancel_stream(ngx_connection_t *c, | |
108 ngx_uint_t stream_id); | |
109 ngx_int_t ngx_http_v3_client_inc_insert_count(ngx_connection_t *c, | |
110 ngx_uint_t inc); | |
111 | |
112 | |
113 extern ngx_module_t ngx_http_v3_module; | |
114 | |
115 | |
116 #endif /* _NGX_HTTP_V3_H_INCLUDED_ */ |