| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // before returning an error. | 37 // before returning an error. |
| 38 const uint32 kDefaultMaxStringLiteralSize = 16 * 1024; | 38 const uint32 kDefaultMaxStringLiteralSize = 16 * 1024; |
| 39 | 39 |
| 40 // Maximum amount of encoded header buffer HpackDecoder will retain before | 40 // Maximum amount of encoded header buffer HpackDecoder will retain before |
| 41 // returning an error. | 41 // returning an error. |
| 42 // TODO(jgraettinger): Remove with SpdyHeadersHandlerInterface switch. | 42 // TODO(jgraettinger): Remove with SpdyHeadersHandlerInterface switch. |
| 43 const uint32 kMaxDecodeBufferSize = 32 * 1024; | 43 const uint32 kMaxDecodeBufferSize = 32 * 1024; |
| 44 | 44 |
| 45 // The marker for a string literal that is stored unmodified (i.e., | 45 // The marker for a string literal that is stored unmodified (i.e., |
| 46 // without Huffman encoding) (from 4.1.2). | 46 // without Huffman encoding) (from 4.1.2). |
| 47 const HpackPrefix kStringLiteralIdentityEncoded = { 0x0, 1 }; | 47 const HpackPrefix kStringLiteralIdentityEncoded = {0x0, 1}; |
| 48 | 48 |
| 49 // The marker for a string literal that is stored with Huffman | 49 // The marker for a string literal that is stored with Huffman |
| 50 // encoding (from 4.1.2). | 50 // encoding (from 4.1.2). |
| 51 const HpackPrefix kStringLiteralHuffmanEncoded = { 0x1, 1 }; | 51 const HpackPrefix kStringLiteralHuffmanEncoded = {0x1, 1}; |
| 52 | 52 |
| 53 // The opcode for an encoding context update (from 4.2). | 53 // The opcode for an encoding context update (from 4.2). |
| 54 // This is an indexed header representation with special index zero, | 54 // This is an indexed header representation with special index zero, |
| 55 // and as such this opcode must be tested prior to |kIndexedOpcode|. | 55 // and as such this opcode must be tested prior to |kIndexedOpcode|. |
| 56 const HpackPrefix kEncodingContextOpcode = { 0x80, 8 }; | 56 const HpackPrefix kEncodingContextOpcode = {0x80, 8}; |
| 57 | 57 |
| 58 // Follows an |kEncodingContextOpcode| to indicate the reference set should be | 58 // Follows an |kEncodingContextOpcode| to indicate the reference set should be |
| 59 // cleared. (Section 4.4). | 59 // cleared. (Section 4.4). |
| 60 const HpackPrefix kEncodingContextEmptyReferenceSet = { 0x80, 8 }; | 60 const HpackPrefix kEncodingContextEmptyReferenceSet = {0x80, 8}; |
| 61 | 61 |
| 62 // Follows an |kEncodingContextOpcode| to indicate the encoder is using a new | 62 // Follows an |kEncodingContextOpcode| to indicate the encoder is using a new |
| 63 // maximum headers table size. (Section 4.4). | 63 // maximum headers table size. (Section 4.4). |
| 64 const HpackPrefix kEncodingContextNewMaximumSize = { 0x0, 1 }; | 64 const HpackPrefix kEncodingContextNewMaximumSize = {0x0, 1}; |
| 65 | 65 |
| 66 // The opcode for an indexed header field (from 4.2). | 66 // The opcode for an indexed header field (from 4.2). |
| 67 const HpackPrefix kIndexedOpcode = { 0x1, 1 }; | 67 const HpackPrefix kIndexedOpcode = {0x1, 1}; |
| 68 | 68 |
| 69 // The opcode for a literal header field without indexing (from | 69 // The opcode for a literal header field without indexing (from |
| 70 // 4.3.1). | 70 // 4.3.1). |
| 71 const HpackPrefix kLiteralNoIndexOpcode = { 0x01, 2 }; | 71 const HpackPrefix kLiteralNoIndexOpcode = {0x01, 2}; |
| 72 | 72 |
| 73 // The opcode for a literal header field with incremental indexing | 73 // The opcode for a literal header field with incremental indexing |
| 74 // (from 4.3.2). | 74 // (from 4.3.2). |
| 75 const HpackPrefix kLiteralIncrementalIndexOpcode = { 0x00, 2 }; | 75 const HpackPrefix kLiteralIncrementalIndexOpcode = {0x00, 2}; |
| 76 | 76 |
| 77 // Returns symbol code table from "Appendix C. Huffman Codes". | 77 // Returns symbol code table from "Appendix C. Huffman Codes". |
| 78 NET_EXPORT_PRIVATE std::vector<HpackHuffmanSymbol> HpackHuffmanCode(); | 78 NET_EXPORT_PRIVATE std::vector<HpackHuffmanSymbol> HpackHuffmanCode(); |
| 79 | 79 |
| 80 // Returns a HpackHuffmanTable instance initialized with |kHpackHuffmanCode|. | 80 // Returns a HpackHuffmanTable instance initialized with |kHpackHuffmanCode|. |
| 81 // The instance is read-only, has static lifetime, and is safe to share amoung | 81 // The instance is read-only, has static lifetime, and is safe to share amoung |
| 82 // threads. This function is thread-safe. | 82 // threads. This function is thread-safe. |
| 83 NET_EXPORT_PRIVATE const HpackHuffmanTable& ObtainHpackHuffmanTable(); | 83 NET_EXPORT_PRIVATE const HpackHuffmanTable& ObtainHpackHuffmanTable(); |
| 84 | 84 |
| 85 } // namespace net | 85 } // namespace net |
| 86 | 86 |
| 87 #endif // NET_SPDY_HPACK_CONSTANTS_H_ | 87 #endif // NET_SPDY_HPACK_CONSTANTS_H_ |
| OLD | NEW |