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_SPDY_HEADERS_BLOCK_PARSER_H_ | 5 #ifndef NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ |
6 #define NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ | 6 #define NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 NEED_MORE_DATA, | 71 NEED_MORE_DATA, |
72 // Set when a complete block has been read, but unprocessed data remains. | 72 // Set when a complete block has been read, but unprocessed data remains. |
73 TOO_MUCH_DATA, | 73 TOO_MUCH_DATA, |
74 // Set when a block exceeds |MaxNumberOfHeadersForVersion| headers. | 74 // Set when a block exceeds |MaxNumberOfHeadersForVersion| headers. |
75 HEADER_BLOCK_TOO_LARGE, | 75 HEADER_BLOCK_TOO_LARGE, |
76 // Set when a header key or value exceeds |kMaximumFieldLength|. | 76 // Set when a header key or value exceeds |kMaximumFieldLength|. |
77 HEADER_FIELD_TOO_LARGE, | 77 HEADER_FIELD_TOO_LARGE, |
78 }; | 78 }; |
79 ParserError get_error() const { return error_; } | 79 ParserError get_error() const { return error_; } |
80 | 80 |
| 81 SpdyMajorVersion spdy_version() const { return spdy_version_; } |
| 82 |
81 // Returns the size in bytes of a length field in a SPDY header. | 83 // Returns the size in bytes of a length field in a SPDY header. |
82 static size_t LengthFieldSizeForVersion(SpdyMajorVersion spdy_version); | 84 static size_t LengthFieldSizeForVersion(SpdyMajorVersion spdy_version); |
83 | 85 |
84 // Returns the maximal number of headers in a SPDY headers block. | 86 // Returns the maximal number of headers in a SPDY headers block. |
85 static size_t MaxNumberOfHeadersForVersion(SpdyMajorVersion spdy_version); | 87 static size_t MaxNumberOfHeadersForVersion(SpdyMajorVersion spdy_version); |
86 | 88 |
87 private: | 89 private: |
88 typedef SpdyPrefixedBufferReader Reader; | 90 typedef SpdyPrefixedBufferReader Reader; |
89 | 91 |
90 // Parses and sanity-checks header block length. | 92 // Parses and sanity-checks header block length. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 SpdyPinnableBufferPiece headers_block_prefix_; | 133 SpdyPinnableBufferPiece headers_block_prefix_; |
132 | 134 |
133 // Holds the key of a partially processed header between calls to | 135 // Holds the key of a partially processed header between calls to |
134 // |HandleControlFrameHeadersData|. | 136 // |HandleControlFrameHeadersData|. |
135 SpdyPinnableBufferPiece key_; | 137 SpdyPinnableBufferPiece key_; |
136 | 138 |
137 // The current header block stream identifier. | 139 // The current header block stream identifier. |
138 SpdyStreamId stream_id_; | 140 SpdyStreamId stream_id_; |
139 | 141 |
140 ParserError error_; | 142 ParserError error_; |
| 143 |
| 144 const SpdyMajorVersion spdy_version_; |
141 }; | 145 }; |
142 | 146 |
143 } // namespace net | 147 } // namespace net |
144 | 148 |
145 #endif // NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ | 149 #endif // NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ |
OLD | NEW |