QUICHE team | fd50a40 | 2018-12-07 22:54:05 -0500 | [diff] [blame] | 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 | |
| 15 | #include "net/third_party/quiche/src/http2/platform/api/http2_export.h" |
| 16 | #include "net/third_party/quiche/src/http2/platform/api/http2_string.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 | HTTP2_EXPORT_PRIVATE Http2String HpackEntryTypeToString(HpackEntryType v); |
| 56 | |
| 57 | // Inserts the name of the enum member into |out|. |
| 58 | HTTP2_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out, |
| 59 | HpackEntryType v); |
| 60 | |
| 61 | } // namespace http2 |
| 62 | |
| 63 | #endif // QUICHE_HTTP2_HPACK_HTTP2_HPACK_CONSTANTS_H_ |