| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 virtual ~SpdyHeadersBlockParser(); | 54 virtual ~SpdyHeadersBlockParser(); |
| 55 | 55 |
| 56 // Handles headers block data as it arrives. Returns false if an error has | 56 // Handles headers block data as it arrives. Returns false if an error has |
| 57 // been set, which can include the recoverable error NEED_MORE_DATA. Returns | 57 // been set, which can include the recoverable error NEED_MORE_DATA. Returns |
| 58 // true if the invocation completes the parse of the entire headers block, | 58 // true if the invocation completes the parse of the entire headers block, |
| 59 // in which case the parser is ready for a new headers block. | 59 // in which case the parser is ready for a new headers block. |
| 60 bool HandleControlFrameHeadersData(SpdyStreamId stream_id, | 60 bool HandleControlFrameHeadersData(SpdyStreamId stream_id, |
| 61 const char* headers_data, | 61 const char* headers_data, |
| 62 size_t len); | 62 size_t len); |
| 63 enum ParserError { | 63 enum ParserError { |
| 64 OK, | 64 NO_PARSER_ERROR, |
| 65 // Set when parsing failed due to insufficient data. | 65 // Set when parsing failed due to insufficient data. |
| 66 // This error is recoverable, by passing in new data. | 66 // This error is recoverable, by passing in new data. |
| 67 NEED_MORE_DATA, | 67 NEED_MORE_DATA, |
| 68 // Set when a complete block has been read, but unprocessed data remains. | 68 // Set when a complete block has been read, but unprocessed data remains. |
| 69 TOO_MUCH_DATA, | 69 TOO_MUCH_DATA, |
| 70 // Set when a block exceeds |MaxNumberOfHeadersForVersion| headers. | 70 // Set when a block exceeds |MaxNumberOfHeadersForVersion| headers. |
| 71 HEADER_BLOCK_TOO_LARGE, | 71 HEADER_BLOCK_TOO_LARGE, |
| 72 // Set when a header key or value exceeds |kMaximumFieldLength|. | 72 // Set when a header key or value exceeds |kMaximumFieldLength|. |
| 73 HEADER_FIELD_TOO_LARGE, | 73 HEADER_FIELD_TOO_LARGE, |
| 74 // Set when the parser is given an unexpected stream ID. | 74 // Set when the parser is given an unexpected stream ID. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 SpdyStreamId stream_id_; | 138 SpdyStreamId stream_id_; |
| 139 | 139 |
| 140 ParserError error_; | 140 ParserError error_; |
| 141 | 141 |
| 142 const SpdyMajorVersion spdy_version_; | 142 const SpdyMajorVersion spdy_version_; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace net | 145 } // namespace net |
| 146 | 146 |
| 147 #endif // NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ | 147 #endif // NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ |
| OLD | NEW |