• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef QUICHE_QUIC_CORE_HTTP_HTTP_CONSTANTS_H_
6 #define QUICHE_QUIC_CORE_HTTP_HTTP_CONSTANTS_H_
7 
8 #include <cstdint>
9 #include <string>
10 
11 #include "absl/strings/string_view.h"
12 #include "quiche/quic/core/quic_types.h"
13 #include "quiche/quic/platform/api/quic_export.h"
14 
15 namespace quic {
16 
17 // Unidirectional stream types.
18 enum : uint64_t {
19   // https://quicwg.org/base-drafts/draft-ietf-quic-http.html#unidirectional-streams
20   kControlStream = 0x00,
21   kServerPushStream = 0x01,
22   // https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#enc-dec-stream-def
23   kQpackEncoderStream = 0x02,
24   kQpackDecoderStream = 0x03,
25   // https://ietf-wg-webtrans.github.io/draft-ietf-webtrans-http3/draft-ietf-webtrans-http3.html#name-unidirectional-streams
26   kWebTransportUnidirectionalStream = 0x54,
27 };
28 
29 // This includes control stream, QPACK encoder stream, and QPACK decoder stream.
30 enum : QuicStreamCount { kHttp3StaticUnidirectionalStreamCount = 3 };
31 
32 // HTTP/3 and QPACK settings identifiers.
33 // https://quicwg.org/base-drafts/draft-ietf-quic-http.html#settings-parameters
34 // https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#configuration
35 enum Http3AndQpackSettingsIdentifiers : uint64_t {
36   // Same value as spdy::SETTINGS_HEADER_TABLE_SIZE.
37   SETTINGS_QPACK_MAX_TABLE_CAPACITY = 0x01,
38   // Same value as spdy::SETTINGS_MAX_HEADER_LIST_SIZE.
39   SETTINGS_MAX_FIELD_SECTION_SIZE = 0x06,
40   SETTINGS_QPACK_BLOCKED_STREAMS = 0x07,
41   // draft-ietf-masque-h3-datagram-04.
42   SETTINGS_H3_DATAGRAM_DRAFT04 = 0xffd277,
43   // RFC 9297.
44   SETTINGS_H3_DATAGRAM = 0x33,
45   // draft-ietf-webtrans-http3-00
46   SETTINGS_WEBTRANS_DRAFT00 = 0x2b603742,
47   // draft-ietf-httpbis-h3-websockets
48   SETTINGS_ENABLE_CONNECT_PROTOCOL = 0x08,
49   SETTINGS_ENABLE_METADATA = 0x4d44,
50 };
51 
52 // Returns HTTP/3 SETTINGS identifier as a string.
53 QUIC_EXPORT std::string H3SettingsToString(
54     Http3AndQpackSettingsIdentifiers identifier);
55 
56 // Default maximum dynamic table capacity, communicated via
57 // SETTINGS_QPACK_MAX_TABLE_CAPACITY.
58 enum : QuicByteCount {
59   kDefaultQpackMaxDynamicTableCapacity = 64 * 1024  // 64 KB
60 };
61 
62 // Default limit on the size of uncompressed headers,
63 // communicated via SETTINGS_MAX_HEADER_LIST_SIZE.
64 enum : QuicByteCount {
65   kDefaultMaxUncompressedHeaderSize = 16 * 1024  // 16 KB
66 };
67 
68 // Default limit on number of blocked streams, communicated via
69 // SETTINGS_QPACK_BLOCKED_STREAMS.
70 enum : uint64_t { kDefaultMaximumBlockedStreams = 100 };
71 
72 ABSL_CONST_INIT QUIC_EXPORT_PRIVATE extern const absl::string_view
73     kUserAgentHeaderName;
74 
75 }  // namespace quic
76 
77 #endif  // QUICHE_QUIC_CORE_HTTP_HTTP_CONSTANTS_H_
78