lsquic_ietf.h revision f5bc7647
1/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc.  See LICENSE. */
2#ifndef LSQUIC_IETF_H
3#define LSQUIC_IETF_H 1
4
5/* Things specific to the IETF version of QUIC that do not fit anywhere else */
6
7/* [draft-ietf-quic-transport-33] Section 20 */
8enum trans_error_code
9{
10    TEC_NO_ERROR                   =  0x0,
11    TEC_INTERNAL_ERROR             =  0x1,
12    TEC_CONNECTION_REFUSED         =  0x2,
13    TEC_FLOW_CONTROL_ERROR         =  0x3,
14    TEC_STREAM_LIMIT_ERROR         =  0x4,
15    TEC_STREAM_STATE_ERROR         =  0x5,
16    TEC_FINAL_SIZE_ERROR           =  0x6,
17    TEC_FRAME_ENCODING_ERROR       =  0x7,
18    TEC_TRANSPORT_PARAMETER_ERROR  =  0x8,
19    TEC_CONNECTION_ID_LIMIT_ERROR  =  0x9,
20    TEC_PROTOCOL_VIOLATION         =  0xA,
21    TEC_INVALID_TOKEN              =  0xB,
22    TEC_APPLICATION_ERROR          =  0xC,
23    TEC_CRYPTO_BUFFER_EXCEEDED     =  0xD,
24    TEC_KEY_UPDATE_ERROR           =  0xE,
25    TEC_AEAD_LIMIT_REACHED         =  0xF,
26    TEC_NO_VIABLE_PATH             = 0x10,
27};
28
29/* Must be at least two */
30#define MAX_IETF_CONN_DCIDS 8
31
32/* [draft-ietf-quic-tls-25] Section 5.8 */
33#define IETF_RETRY_KEY_SZ 16
34#define IETF_RETRY_NONCE_SZ 12
35
36#define N_IETF_RETRY_VERSIONS 3
37extern const unsigned char *const lsquic_retry_key_buf[N_IETF_RETRY_VERSIONS];
38extern const unsigned char *const lsquic_retry_nonce_buf[N_IETF_RETRY_VERSIONS];
39#define lsquic_version_2_retryver(ver_) (                       \
40    (ver_) <= LSQVER_ID27 ? 0 :                                 \
41    (ver_) < LSQVER_I001 ? 1 :                                 \
42    2)
43
44#endif
45