• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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_HTTP2_HPACK_HTTP2_HPACK_CONSTANTS_H_
6 #define QUICHE_HTTP2_HPACK_HTTP2_HPACK_CONSTANTS_H_
7 
8 // Enum HpackEntryType identifies the 5 basic types of HPACK Block Entries.
9 //
10 // See the spec for details:
11 // https://http2.github.io/http2-spec/compression.html#rfc.section.6
12 
13 #include <ostream>
14 #include <string>
15 
16 #include "quiche/common/platform/api/quiche_export.h"
17 
18 namespace http2 {
19 
20 const size_t kFirstDynamicTableIndex = 62;
21 
22 enum class HpackEntryType {
23   // Entry is an index into the static or dynamic table. Decoding it has no
24   // effect on the dynamic table.
25   kIndexedHeader,
26 
27   // The entry contains a literal value. The name may be either a literal or a
28   // reference to an entry in the static or dynamic table.
29   // The entry is added to the dynamic table after decoding.
30   kIndexedLiteralHeader,
31 
32   // The entry contains a literal value. The name may be either a literal or a
33   // reference to an entry in the static or dynamic table.
34   // The entry is not added to the dynamic table after decoding, but a proxy
35   // may choose to insert the entry into its dynamic table when forwarding
36   // to another endpoint.
37   kUnindexedLiteralHeader,
38 
39   // The entry contains a literal value. The name may be either a literal or a
40   // reference to an entry in the static or dynamic table.
41   // The entry is not added to the dynamic table after decoding, and a proxy
42   // must NOT insert the entry into its dynamic table when forwarding to another
43   // endpoint.
44   kNeverIndexedLiteralHeader,
45 
46   // Entry conveys the size limit of the dynamic table of the encoder to
47   // the decoder. May be used to flush the table by sending a zero and then
48   // resetting the size back up to the maximum that the encoder will use
49   // (within the limits of SETTINGS_HEADER_TABLE_SIZE sent by the
50   // decoder to the encoder, with the default of 4096 assumed).
51   kDynamicTableSizeUpdate,
52 };
53 
54 // Returns the name of the enum member.
55 QUICHE_EXPORT std::string HpackEntryTypeToString(HpackEntryType v);
56 
57 // Inserts the name of the enum member into |out|.
58 QUICHE_EXPORT std::ostream& operator<<(std::ostream& out, HpackEntryType v);
59 
60 }  // namespace http2
61 
62 #endif  // QUICHE_HTTP2_HPACK_HTTP2_HPACK_CONSTANTS_H_
63