OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SPDY_HPACK_CONSTANTS_H_ | 5 #ifndef NET_SPDY_HPACK_CONSTANTS_H_ |
6 #define NET_SPDY_HPACK_CONSTANTS_H_ | 6 #define NET_SPDY_HPACK_CONSTANTS_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <vector> | 11 #include <vector> |
9 | 12 |
10 #include "base/basictypes.h" | |
11 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
12 | 14 |
13 // All section references below are to | 15 // All section references below are to |
14 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-08 | 16 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-08 |
15 | 17 |
16 namespace net { | 18 namespace net { |
17 | 19 |
18 // An HpackPrefix signifies |bits| stored in the top |bit_size| bits | 20 // An HpackPrefix signifies |bits| stored in the top |bit_size| bits |
19 // of an octet. | 21 // of an octet. |
20 struct HpackPrefix { | 22 struct HpackPrefix { |
21 uint8 bits; | 23 uint8_t bits; |
22 size_t bit_size; | 24 size_t bit_size; |
23 }; | 25 }; |
24 | 26 |
25 // Represents a symbol and its Huffman code (stored in most-significant bits). | 27 // Represents a symbol and its Huffman code (stored in most-significant bits). |
26 struct HpackHuffmanSymbol { | 28 struct HpackHuffmanSymbol { |
27 uint32 code; | 29 uint32_t code; |
28 uint8 length; | 30 uint8_t length; |
29 uint16 id; | 31 uint16_t id; |
30 }; | 32 }; |
31 | 33 |
32 // An entry in the static table. Must be a POD in order to avoid static | 34 // An entry in the static table. Must be a POD in order to avoid static |
33 // initializers, i.e. no user-defined constructors or destructors. | 35 // initializers, i.e. no user-defined constructors or destructors. |
34 struct HpackStaticEntry { | 36 struct HpackStaticEntry { |
35 const char* const name; | 37 const char* const name; |
36 const size_t name_len; | 38 const size_t name_len; |
37 const char* const value; | 39 const char* const value; |
38 const size_t value_len; | 40 const size_t value_len; |
39 }; | 41 }; |
40 | 42 |
41 class HpackHuffmanTable; | 43 class HpackHuffmanTable; |
42 class HpackStaticTable; | 44 class HpackStaticTable; |
43 | 45 |
44 // Defined in RFC 7540 section 6.5.2. | 46 // Defined in RFC 7540 section 6.5.2. |
45 const uint32 kDefaultHeaderTableSizeSetting = 4096; | 47 const uint32_t kDefaultHeaderTableSizeSetting = 4096; |
46 | 48 |
47 // Largest string literal an HpackDecoder/HpackEncoder will attempt to process | 49 // Largest string literal an HpackDecoder/HpackEncoder will attempt to process |
48 // before returning an error. | 50 // before returning an error. |
49 const uint32 kDefaultMaxStringLiteralSize = 16 * 1024; | 51 const uint32_t kDefaultMaxStringLiteralSize = 16 * 1024; |
50 | 52 |
51 // Maximum amount of encoded header buffer HpackDecoder will retain before | 53 // Maximum amount of encoded header buffer HpackDecoder will retain before |
52 // returning an error. | 54 // returning an error. |
53 // TODO(jgraettinger): Remove with SpdyHeadersHandlerInterface switch. | 55 // TODO(jgraettinger): Remove with SpdyHeadersHandlerInterface switch. |
54 const uint32 kMaxDecodeBufferSize = 32 * 1024; | 56 const uint32_t kMaxDecodeBufferSize = 32 * 1024; |
55 | 57 |
56 // 6.2: Flag for a string literal that is stored unmodified (i.e., | 58 // 6.2: Flag for a string literal that is stored unmodified (i.e., |
57 // without Huffman encoding). | 59 // without Huffman encoding). |
58 const HpackPrefix kStringLiteralIdentityEncoded = {0x0, 1}; | 60 const HpackPrefix kStringLiteralIdentityEncoded = {0x0, 1}; |
59 | 61 |
60 // 6.2: Flag for a Huffman-coded string literal. | 62 // 6.2: Flag for a Huffman-coded string literal. |
61 const HpackPrefix kStringLiteralHuffmanEncoded = {0x1, 1}; | 63 const HpackPrefix kStringLiteralHuffmanEncoded = {0x1, 1}; |
62 | 64 |
63 // 7.1: Opcode for an indexed header field. | 65 // 7.1: Opcode for an indexed header field. |
64 const HpackPrefix kIndexedOpcode = {0x1, 1}; | 66 const HpackPrefix kIndexedOpcode = {0x1, 1}; |
(...skipping 26 matching lines...) Expand all Loading... |
91 // The instance is read-only, has static lifetime, and is safe to share amoung | 93 // The instance is read-only, has static lifetime, and is safe to share amoung |
92 // threads. This function is thread-safe. | 94 // threads. This function is thread-safe. |
93 NET_EXPORT_PRIVATE const HpackStaticTable& ObtainHpackStaticTable(); | 95 NET_EXPORT_PRIVATE const HpackStaticTable& ObtainHpackStaticTable(); |
94 | 96 |
95 // Pseudo-headers start with a colon. (HTTP2 8.1.2.1., HPACK 3.1.) | 97 // Pseudo-headers start with a colon. (HTTP2 8.1.2.1., HPACK 3.1.) |
96 const char kPseudoHeaderPrefix = ':'; | 98 const char kPseudoHeaderPrefix = ':'; |
97 | 99 |
98 } // namespace net | 100 } // namespace net |
99 | 101 |
100 #endif // NET_SPDY_HPACK_CONSTANTS_H_ | 102 #endif // NET_SPDY_HPACK_CONSTANTS_H_ |
OLD | NEW |