lsquic_hq.h revision fbc6cc04
1/* Copyright (c) 2017 - 2020 LiteSpeed Technologies Inc.  See LICENSE. */
2/*
3 * lsquic_hq.h -- HTTP/3 (originally "HTTP over QUIC" or HQ) types
4 */
5
6#ifndef LSQUIC_HQ_H
7#define LSQUIC_HQ_H 1
8
9struct lsquic_ext_http_prio;
10
11/* [draft-ietf-quic-http-27] Section 11.2.1 */
12enum hq_frame_type
13{
14    HQFT_DATA           = 0,
15    HQFT_HEADERS        = 1,
16    HQFT_CANCEL_PUSH    = 3,
17    HQFT_SETTINGS       = 4,
18    HQFT_PUSH_PROMISE   = 5,
19    HQFT_GOAWAY         = 7,
20    HQFT_MAX_PUSH_ID    = 0xD,
21    /* These made me expand shf_frame_type to 4 bytes from 1.  If at some
22     * point we have to support a frame that is wider than 4 byte, it will
23     * be time to bite the bullet and use our own enum for these types
24     * (just like we do for transport parameters).  A simpler alternative
25     * would be to drop the enum and use #define's, but it would stink...
26     */
27    HQFT_PRIORITY_UPDATE_STREAM= 0xF0700,
28    HQFT_PRIORITY_UPDATE_PUSH  = 0xF0701,
29    /* This frame is made up and its type is never written to stream.
30     * Nevertheless, just to be on the safe side, give it a value as
31     * described in [draft-ietf-quic-http-20] Section 4.2.10.
32     */
33    HQFT_PUSH_PREAMBLE  = 0x1F * 3 + 0x21,
34};
35
36
37enum hq_setting_id
38{
39    HQSID_QPACK_MAX_TABLE_CAPACITY  = 1,
40    HQSID_MAX_HEADER_LIST_SIZE      = 6,
41    HQSID_QPACK_BLOCKED_STREAMS     = 7,
42};
43
44/* As of 12/18/2018: */
45#define HQ_DF_QPACK_MAX_TABLE_CAPACITY 0
46#define HQ_DF_MAX_HEADER_LIST_SIZE 0
47#define HQ_DF_QPACK_BLOCKED_STREAMS 0
48
49
50/* [draft-ietf-quic-http-19] Section 10.6,
51 * [draft-ietf-quic-qpack-07] Section 8.2
52 */
53enum hq_uni_stream_type
54{
55    HQUST_CONTROL   = 0,
56    HQUST_PUSH      = 1,
57    HQUST_QPACK_ENC = 2,
58    HQUST_QPACK_DEC = 3,
59};
60
61
62/* [draft-ietf-quic-http-23] Section 8.1 and
63 * [draft-ietf-quic-qpack-08], Section 8.3
64 */
65enum http_error_code
66{
67    HEC_NO_ERROR                =  0x100,
68    HEC_GENERAL_PROTOCOL_ERROR  =  0x101,
69    HEC_INTERNAL_ERROR          =  0x102,
70    HEC_STREAM_CREATION_ERROR   =  0x103,
71    HEC_CLOSED_CRITICAL_STREAM  =  0x104,
72    HEC_FRAME_UNEXPECTED        =  0x105,
73    HEC_FRAME_ERROR             =  0x106,
74    HEC_EXCESSIVE_LOAD          =  0x107,
75    HEC_ID_ERROR                =  0x108,
76    HEC_SETTINGS_ERROR          =  0x109,
77    HEC_MISSING_SETTINGS        =  0x10A,
78    HEC_REQUEST_REJECTED        =  0x10B,
79    HEC_REQUEST_CANCELLED       =  0x10C,
80    HEC_REQUEST_INCOMPLETE      =  0x10D,
81    HEC_CONNECT_ERROR           =  0x10F,
82    HEC_VERSION_FALLBACK        =  0x110,
83    HEC_QPACK_DECOMPRESSION_FAILED  = 0x200,
84    HEC_QPACK_ENCODER_STREAM_ERROR  = 0x201,
85    HEC_QPACK_DECODER_STREAM_ERROR  = 0x202,
86};
87
88
89enum ppc_flags
90{
91    PPC_URG_NAME = 1 << 0,
92    PPC_INC_NAME = 1 << 1,
93    PPC_URG_SET  = 1 << 2,      /* 'urgency' is set */
94    PPC_INC_SET  = 1 << 3,      /* 'incremental' is set */
95};
96
97
98int
99lsquic_http_parse_pfv (const char *, size_t, enum ppc_flags * /* optional */,
100                           struct lsquic_ext_http_prio *, char *str, size_t);
101
102#endif
103