comparison src/event/quic/ngx_event_quic.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 9ce6d80df113
children 915c2f7092ed
comparison
equal deleted inserted replaced
8746:0c628de2e2b7 8747:c8bda5e1e662
14 14
15 #ifndef NGX_QUIC_DRAFT_VERSION 15 #ifndef NGX_QUIC_DRAFT_VERSION
16 #define NGX_QUIC_DRAFT_VERSION 29 16 #define NGX_QUIC_DRAFT_VERSION 29
17 #endif 17 #endif
18 18
19 #define NGX_QUIC_MAX_SHORT_HEADER 25 /* 1 flags + 20 dcid + 4 pn */
20 #define NGX_QUIC_MAX_LONG_HEADER 56
21 /* 1 flags + 4 version + 2 x (1 + 20) s/dcid + 4 pn + 4 len + token len */
22
23 #define NGX_QUIC_MAX_UDP_PAYLOAD_SIZE 65527 19 #define NGX_QUIC_MAX_UDP_PAYLOAD_SIZE 65527
24 #define NGX_QUIC_MAX_UDP_PAYLOAD_OUT 1252
25 #define NGX_QUIC_MAX_UDP_PAYLOAD_OUT6 1232
26 20
27 #define NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT 3 21 #define NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT 3
28 #define NGX_QUIC_DEFAULT_MAX_ACK_DELAY 25 22 #define NGX_QUIC_DEFAULT_MAX_ACK_DELAY 25
29 #define NGX_QUIC_DEFAULT_HOST_KEY_LEN 32 23 #define NGX_QUIC_DEFAULT_HOST_KEY_LEN 32
30 #define NGX_QUIC_SR_KEY_LEN 32 24 #define NGX_QUIC_SR_KEY_LEN 32
31 #define NGX_QUIC_AV_KEY_LEN 32 25 #define NGX_QUIC_AV_KEY_LEN 32
32 26
33 #define NGX_QUIC_RETRY_TOKEN_LIFETIME 3 /* seconds */ 27 #define NGX_QUIC_SR_TOKEN_LEN 16
34 #define NGX_QUIC_NEW_TOKEN_LIFETIME 600 /* seconds */
35 #define NGX_QUIC_RETRY_BUFFER_SIZE 256
36 /* 1 flags + 4 version + 3 x (1 + 20) s/o/dcid + itag + token(64) */
37 #define NGX_QUIC_MAX_TOKEN_SIZE 64
38 /* SHA-1(addr)=20 + sizeof(time_t) + retry(1) + odcid.len(1) + odcid */
39
40 /* quic-recovery, section 6.2.2, kInitialRtt */
41 #define NGX_QUIC_INITIAL_RTT 333 /* ms */
42
43 /* quic-recovery, section 6.1.1, Packet Threshold */
44 #define NGX_QUIC_PKT_THR 3 /* packets */
45 /* quic-recovery, section 6.1.2, Time Threshold */
46 #define NGX_QUIC_TIME_THR 1.125
47 #define NGX_QUIC_TIME_GRANULARITY 1 /* ms */
48
49 #define NGX_QUIC_CC_MIN_INTERVAL 1000 /* 1s */
50 28
51 #define NGX_QUIC_MIN_INITIAL_SIZE 1200 29 #define NGX_QUIC_MIN_INITIAL_SIZE 1200
52 30
53 #define NGX_QUIC_STREAM_SERVER_INITIATED 0x01 31 #define NGX_QUIC_STREAM_SERVER_INITIATED 0x01
54 #define NGX_QUIC_STREAM_UNIDIRECTIONAL 0x02 32 #define NGX_QUIC_STREAM_UNIDIRECTIONAL 0x02
55 33
56 #define NGX_QUIC_STREAM_BUFSIZE 65536 34 #define NGX_QUIC_STREAM_BUFSIZE 65536
57
58 #define NGX_QUIC_MAX_CID_LEN 20
59 #define NGX_QUIC_SERVER_CID_LEN NGX_QUIC_MAX_CID_LEN
60
61 #define NGX_QUIC_SR_TOKEN_LEN 16
62
63 #define NGX_QUIC_MAX_SERVER_IDS 8
64
65 #define NGX_QUIC_BUFFER_SIZE 4096
66
67 #define ngx_quic_get_connection(c) \
68 (((c)->udp) ? (((ngx_quic_server_id_t *)((c)->udp))->quic) : NULL)
69 35
70 36
71 typedef struct { 37 typedef struct {
72 /* configurable */ 38 /* configurable */
73 ngx_msec_t max_idle_timeout; 39 ngx_msec_t max_idle_timeout;
137 ngx_int_t ngx_quic_reset_stream(ngx_connection_t *c, ngx_uint_t err); 103 ngx_int_t ngx_quic_reset_stream(ngx_connection_t *c, ngx_uint_t err);
138 uint32_t ngx_quic_version(ngx_connection_t *c); 104 uint32_t ngx_quic_version(ngx_connection_t *c);
139 ngx_int_t ngx_quic_get_packet_dcid(ngx_log_t *log, u_char *data, size_t len, 105 ngx_int_t ngx_quic_get_packet_dcid(ngx_log_t *log, u_char *data, size_t len,
140 ngx_str_t *dcid); 106 ngx_str_t *dcid);
141 107
142
143 /********************************* DEBUG *************************************/
144
145 /* #define NGX_QUIC_DEBUG_PACKETS */ /* dump packet contents */
146 /* #define NGX_QUIC_DEBUG_FRAMES */ /* dump frames contents */
147 /* #define NGX_QUIC_DEBUG_ALLOC */ /* log frames and bufs alloc */
148 /* #define NGX_QUIC_DEBUG_CRYPTO */
149
150 #endif /* _NGX_EVENT_QUIC_H_INCLUDED_ */ 108 #endif /* _NGX_EVENT_QUIC_H_INCLUDED_ */