Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_connection.h @ 8747:c8bda5e1e662 quic
QUIC: headers cleanup.
The "ngx_event_quic.h" header file now contains only public definitions,
used by modules. All internal definitions are moved into
the "ngx_event_quic_connection.h" header file.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 14 Apr 2021 14:47:37 +0300 |
parents | 76f476ce4d31 |
children | e0cb1e58ca13 |
comparison
equal
deleted
inserted
replaced
8746:0c628de2e2b7 | 8747:c8bda5e1e662 |
---|---|
8 | 8 |
9 | 9 |
10 #include <ngx_config.h> | 10 #include <ngx_config.h> |
11 #include <ngx_core.h> | 11 #include <ngx_core.h> |
12 #include <ngx_event.h> | 12 #include <ngx_event.h> |
13 | |
13 #include <ngx_event_quic_transport.h> | 14 #include <ngx_event_quic_transport.h> |
14 #include <ngx_event_quic_protection.h> | 15 #include <ngx_event_quic_protection.h> |
15 | 16 |
16 | |
17 #define NGX_QUIC_SEND_CTX_LAST (NGX_QUIC_ENCRYPTION_LAST - 1) | |
18 | |
19 | |
20 typedef struct ngx_quic_connection_s ngx_quic_connection_t; | 17 typedef struct ngx_quic_connection_s ngx_quic_connection_t; |
18 | |
19 #include <ngx_event_quic_migration.h> | |
20 | |
21 | |
22 #define NGX_QUIC_MAX_SHORT_HEADER 25 /* 1 flags + 20 dcid + 4 pn */ | |
23 #define NGX_QUIC_MAX_LONG_HEADER 56 | |
24 /* 1 flags + 4 version + 2 x (1 + 20) s/dcid + 4 pn + 4 len + token len */ | |
25 | |
26 #define NGX_QUIC_MAX_UDP_PAYLOAD_OUT 1252 | |
27 #define NGX_QUIC_MAX_UDP_PAYLOAD_OUT6 1232 | |
28 | |
29 #define NGX_QUIC_RETRY_TOKEN_LIFETIME 3 /* seconds */ | |
30 #define NGX_QUIC_NEW_TOKEN_LIFETIME 600 /* seconds */ | |
31 #define NGX_QUIC_RETRY_BUFFER_SIZE 256 | |
32 /* 1 flags + 4 version + 3 x (1 + 20) s/o/dcid + itag + token(64) */ | |
33 #define NGX_QUIC_MAX_TOKEN_SIZE 64 | |
34 /* SHA-1(addr)=20 + sizeof(time_t) + retry(1) + odcid.len(1) + odcid */ | |
35 | |
36 /* quic-recovery, section 6.2.2, kInitialRtt */ | |
37 #define NGX_QUIC_INITIAL_RTT 333 /* ms */ | |
38 | |
39 /* quic-recovery, section 6.1.1, Packet Threshold */ | |
40 #define NGX_QUIC_PKT_THR 3 /* packets */ | |
41 /* quic-recovery, section 6.1.2, Time Threshold */ | |
42 #define NGX_QUIC_TIME_THR 1.125 | |
43 #define NGX_QUIC_TIME_GRANULARITY 1 /* ms */ | |
44 | |
45 #define NGX_QUIC_CC_MIN_INTERVAL 1000 /* 1s */ | |
46 | |
47 #define NGX_QUIC_MAX_SERVER_IDS 8 | |
48 | |
49 #define NGX_QUIC_BUFFER_SIZE 4096 | |
50 | |
51 #define NGX_QUIC_SEND_CTX_LAST (NGX_QUIC_ENCRYPTION_LAST - 1) | |
21 | 52 |
22 /* 0-RTT and 1-RTT data exist in the same packet number space, | 53 /* 0-RTT and 1-RTT data exist in the same packet number space, |
23 * so we have 3 packet number spaces: | 54 * so we have 3 packet number spaces: |
24 * | 55 * |
25 * 0 - Initial | 56 * 0 - Initial |
29 #define ngx_quic_get_send_ctx(qc, level) \ | 60 #define ngx_quic_get_send_ctx(qc, level) \ |
30 ((level) == ssl_encryption_initial) ? &((qc)->send_ctx[0]) \ | 61 ((level) == ssl_encryption_initial) ? &((qc)->send_ctx[0]) \ |
31 : (((level) == ssl_encryption_handshake) ? &((qc)->send_ctx[1]) \ | 62 : (((level) == ssl_encryption_handshake) ? &((qc)->send_ctx[1]) \ |
32 : &((qc)->send_ctx[2])) | 63 : &((qc)->send_ctx[2])) |
33 | 64 |
65 #define ngx_quic_get_connection(c) \ | |
66 (((c)->udp) ? (((ngx_quic_server_id_t *)((c)->udp))->quic) : NULL) | |
67 | |
34 | 68 |
35 typedef struct { | 69 typedef struct { |
36 ngx_queue_t queue; | 70 ngx_queue_t queue; |
37 uint64_t seqnum; | 71 uint64_t seqnum; |
38 size_t len; | 72 size_t len; |
187 ngx_quic_frame_t *ngx_quic_alloc_frame(ngx_connection_t *c); | 221 ngx_quic_frame_t *ngx_quic_alloc_frame(ngx_connection_t *c); |
188 void ngx_quic_queue_frame(ngx_quic_connection_t *qc, ngx_quic_frame_t *frame); | 222 void ngx_quic_queue_frame(ngx_quic_connection_t *qc, ngx_quic_frame_t *frame); |
189 void ngx_quic_close_connection(ngx_connection_t *c, ngx_int_t rc); | 223 void ngx_quic_close_connection(ngx_connection_t *c, ngx_int_t rc); |
190 ngx_msec_t ngx_quic_pto(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx); | 224 ngx_msec_t ngx_quic_pto(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx); |
191 | 225 |
192 #endif | 226 /********************************* DEBUG *************************************/ |
227 | |
228 /* #define NGX_QUIC_DEBUG_PACKETS */ /* dump packet contents */ | |
229 /* #define NGX_QUIC_DEBUG_FRAMES */ /* dump frames contents */ | |
230 /* #define NGX_QUIC_DEBUG_ALLOC */ /* log frames and bufs alloc */ | |
231 /* #define NGX_QUIC_DEBUG_CRYPTO */ | |
232 | |
233 #endif /* _NGX_EVENT_QUIC_CONNECTION_H_INCLUDED_ */ |