1a74702c6SGeorge Wang/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */ 25392f7a3SLiteSpeed Tech/* 3bc520ef7SDmitri Tikhonov * lsquic_hq.h -- HTTP/3 (originally "HTTP over QUIC" or HQ) types 45392f7a3SLiteSpeed Tech */ 55392f7a3SLiteSpeed Tech 65392f7a3SLiteSpeed Tech#ifndef LSQUIC_HQ_H 75392f7a3SLiteSpeed Tech#define LSQUIC_HQ_H 1 85392f7a3SLiteSpeed Tech 9fbc6cc04SDmitri Tikhonovstruct lsquic_ext_http_prio; 10fbc6cc04SDmitri Tikhonov 11bc520ef7SDmitri Tikhonov/* [draft-ietf-quic-http-27] Section 11.2.1 */ 125392f7a3SLiteSpeed Techenum hq_frame_type 135392f7a3SLiteSpeed Tech{ 145392f7a3SLiteSpeed Tech HQFT_DATA = 0, 155392f7a3SLiteSpeed Tech HQFT_HEADERS = 1, 165392f7a3SLiteSpeed Tech HQFT_CANCEL_PUSH = 3, 175392f7a3SLiteSpeed Tech HQFT_SETTINGS = 4, 185392f7a3SLiteSpeed Tech HQFT_PUSH_PROMISE = 5, 195392f7a3SLiteSpeed Tech HQFT_GOAWAY = 7, 205392f7a3SLiteSpeed Tech HQFT_MAX_PUSH_ID = 0xD, 21fbc6cc04SDmitri Tikhonov /* These made me expand shf_frame_type to 4 bytes from 1. If at some 22fbc6cc04SDmitri Tikhonov * point we have to support a frame that is wider than 4 byte, it will 23fbc6cc04SDmitri Tikhonov * be time to bite the bullet and use our own enum for these types 24fbc6cc04SDmitri Tikhonov * (just like we do for transport parameters). A simpler alternative 25fbc6cc04SDmitri Tikhonov * would be to drop the enum and use #define's, but it would stink... 26fbc6cc04SDmitri Tikhonov */ 27fbc6cc04SDmitri Tikhonov HQFT_PRIORITY_UPDATE_STREAM= 0xF0700, 28fbc6cc04SDmitri Tikhonov HQFT_PRIORITY_UPDATE_PUSH = 0xF0701, 295392f7a3SLiteSpeed Tech /* This frame is made up and its type is never written to stream. 305392f7a3SLiteSpeed Tech * Nevertheless, just to be on the safe side, give it a value as 315392f7a3SLiteSpeed Tech * described in [draft-ietf-quic-http-20] Section 4.2.10. 325392f7a3SLiteSpeed Tech */ 335392f7a3SLiteSpeed Tech HQFT_PUSH_PREAMBLE = 0x1F * 3 + 0x21, 345392f7a3SLiteSpeed Tech}; 355392f7a3SLiteSpeed Tech 365392f7a3SLiteSpeed Tech 375392f7a3SLiteSpeed Techenum hq_setting_id 385392f7a3SLiteSpeed Tech{ 395392f7a3SLiteSpeed Tech HQSID_QPACK_MAX_TABLE_CAPACITY = 1, 405392f7a3SLiteSpeed Tech HQSID_MAX_HEADER_LIST_SIZE = 6, 415392f7a3SLiteSpeed Tech HQSID_QPACK_BLOCKED_STREAMS = 7, 425392f7a3SLiteSpeed Tech}; 435392f7a3SLiteSpeed Tech 445392f7a3SLiteSpeed Tech/* As of 12/18/2018: */ 455392f7a3SLiteSpeed Tech#define HQ_DF_QPACK_MAX_TABLE_CAPACITY 0 465392f7a3SLiteSpeed Tech#define HQ_DF_MAX_HEADER_LIST_SIZE 0 475392f7a3SLiteSpeed Tech#define HQ_DF_QPACK_BLOCKED_STREAMS 0 485392f7a3SLiteSpeed Tech 495392f7a3SLiteSpeed Tech 505392f7a3SLiteSpeed Tech/* [draft-ietf-quic-http-19] Section 10.6, 515392f7a3SLiteSpeed Tech * [draft-ietf-quic-qpack-07] Section 8.2 525392f7a3SLiteSpeed Tech */ 535392f7a3SLiteSpeed Techenum hq_uni_stream_type 545392f7a3SLiteSpeed Tech{ 555392f7a3SLiteSpeed Tech HQUST_CONTROL = 0, 565392f7a3SLiteSpeed Tech HQUST_PUSH = 1, 575392f7a3SLiteSpeed Tech HQUST_QPACK_ENC = 2, 585392f7a3SLiteSpeed Tech HQUST_QPACK_DEC = 3, 595392f7a3SLiteSpeed Tech}; 605392f7a3SLiteSpeed Tech 615392f7a3SLiteSpeed Tech 6292f6e17bSDmitri Tikhonov/* [draft-ietf-quic-http-23] Section 8.1 and 635392f7a3SLiteSpeed Tech * [draft-ietf-quic-qpack-08], Section 8.3 645392f7a3SLiteSpeed Tech */ 655392f7a3SLiteSpeed Techenum http_error_code 665392f7a3SLiteSpeed Tech{ 6792f6e17bSDmitri Tikhonov HEC_NO_ERROR = 0x100, 6892f6e17bSDmitri Tikhonov HEC_GENERAL_PROTOCOL_ERROR = 0x101, 6992f6e17bSDmitri Tikhonov HEC_INTERNAL_ERROR = 0x102, 7092f6e17bSDmitri Tikhonov HEC_STREAM_CREATION_ERROR = 0x103, 7192f6e17bSDmitri Tikhonov HEC_CLOSED_CRITICAL_STREAM = 0x104, 7292f6e17bSDmitri Tikhonov HEC_FRAME_UNEXPECTED = 0x105, 7392f6e17bSDmitri Tikhonov HEC_FRAME_ERROR = 0x106, 7492f6e17bSDmitri Tikhonov HEC_EXCESSIVE_LOAD = 0x107, 7592f6e17bSDmitri Tikhonov HEC_ID_ERROR = 0x108, 7692f6e17bSDmitri Tikhonov HEC_SETTINGS_ERROR = 0x109, 7792f6e17bSDmitri Tikhonov HEC_MISSING_SETTINGS = 0x10A, 7892f6e17bSDmitri Tikhonov HEC_REQUEST_REJECTED = 0x10B, 7992f6e17bSDmitri Tikhonov HEC_REQUEST_CANCELLED = 0x10C, 8092f6e17bSDmitri Tikhonov HEC_REQUEST_INCOMPLETE = 0x10D, 8126e8f082SDmitri Tikhonov HEC_MESSAGE_ERROR = 0x10E, 8292f6e17bSDmitri Tikhonov HEC_CONNECT_ERROR = 0x10F, 8392f6e17bSDmitri Tikhonov HEC_VERSION_FALLBACK = 0x110, 845392f7a3SLiteSpeed Tech HEC_QPACK_DECOMPRESSION_FAILED = 0x200, 855392f7a3SLiteSpeed Tech HEC_QPACK_ENCODER_STREAM_ERROR = 0x201, 865392f7a3SLiteSpeed Tech HEC_QPACK_DECODER_STREAM_ERROR = 0x202, 875392f7a3SLiteSpeed Tech}; 885392f7a3SLiteSpeed Tech 895392f7a3SLiteSpeed Tech 90fbc6cc04SDmitri Tikhonovenum ppc_flags 91fbc6cc04SDmitri Tikhonov{ 92fbc6cc04SDmitri Tikhonov PPC_URG_NAME = 1 << 0, 93fbc6cc04SDmitri Tikhonov PPC_INC_NAME = 1 << 1, 94fbc6cc04SDmitri Tikhonov PPC_URG_SET = 1 << 2, /* 'urgency' is set */ 95fbc6cc04SDmitri Tikhonov PPC_INC_SET = 1 << 3, /* 'incremental' is set */ 96fbc6cc04SDmitri Tikhonov}; 97fbc6cc04SDmitri Tikhonov 98fbc6cc04SDmitri Tikhonov 99fbc6cc04SDmitri Tikhonovint 100fbc6cc04SDmitri Tikhonovlsquic_http_parse_pfv (const char *, size_t, enum ppc_flags * /* optional */, 101fbc6cc04SDmitri Tikhonov struct lsquic_ext_http_prio *, char *str, size_t); 102fbc6cc04SDmitri Tikhonov 1035392f7a3SLiteSpeed Tech#endif 104