Mercurial > hg > nginx
comparison src/event/ngx_event_quic_transport.c @ 8625:4416b7ab0a27 quic
QUIC: multiple versions support.
Draft-29 and beyond are now treated as compatible versions.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 10 Nov 2020 00:23:04 +0300 |
parents | 340cd26158fb |
children | 45db1b5c1706 |
comparison
equal
deleted
inserted
replaced
8624:340cd26158fb | 8625:4416b7ab0a27 |
---|---|
53 #define ngx_quic_varint_len(value) \ | 53 #define ngx_quic_varint_len(value) \ |
54 ((value) <= 63 ? 1 \ | 54 ((value) <= 63 ? 1 \ |
55 : ((uint32_t) value) <= 16383 ? 2 \ | 55 : ((uint32_t) value) <= 16383 ? 2 \ |
56 : ((uint64_t) value) <= 1073741823 ? 4 \ | 56 : ((uint64_t) value) <= 1073741823 ? 4 \ |
57 : 8) | 57 : 8) |
58 | |
59 #define NGX_QUIC_VERSION(c) (0xff000000 + (c)) | |
58 | 60 |
59 | 61 |
60 static u_char *ngx_quic_parse_int(u_char *pos, u_char *end, uint64_t *out); | 62 static u_char *ngx_quic_parse_int(u_char *pos, u_char *end, uint64_t *out); |
61 static void ngx_quic_build_int(u_char **pos, uint64_t value); | 63 static void ngx_quic_build_int(u_char **pos, uint64_t value); |
62 | 64 |
99 | 101 |
100 static ngx_int_t ngx_quic_parse_transport_param(u_char *p, u_char *end, | 102 static ngx_int_t ngx_quic_parse_transport_param(u_char *p, u_char *end, |
101 uint16_t id, ngx_quic_tp_t *dst); | 103 uint16_t id, ngx_quic_tp_t *dst); |
102 | 104 |
103 | 105 |
104 /* currently only single version (selected at compile-time) is supported */ | |
105 uint32_t ngx_quic_versions[] = { | 106 uint32_t ngx_quic_versions[] = { |
106 NGX_QUIC_VERSION | 107 #if (NGX_QUIC_DRAFT_VERSION >= 29) |
108 /* pretend we support all versions in range draft-29..v1 */ | |
109 NGX_QUIC_VERSION(29), | |
110 NGX_QUIC_VERSION(30), | |
111 NGX_QUIC_VERSION(31), | |
112 NGX_QUIC_VERSION(32), | |
113 /* QUICv1 */ | |
114 0x00000001 | |
115 #else | |
116 NGX_QUIC_VERSION(NGX_QUIC_DRAFT_VERSION) | |
117 #endif | |
107 }; | 118 }; |
108 | 119 |
109 #define NGX_QUIC_NVERSIONS \ | 120 #define NGX_QUIC_NVERSIONS \ |
110 (sizeof(ngx_quic_versions) / sizeof(ngx_quic_versions[0])) | 121 (sizeof(ngx_quic_versions) / sizeof(ngx_quic_versions[0])) |
111 | 122 |