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 #if defined(_WIN32) |
65 // On Windows, <WinError.h> defines the NO_ERROR macro as 0L, which | |
66 // breaks the compilation of the "NO_ERROR = 0" line. | |
67 #undef NO_ERROR | |
68 #endif | |
69 NO_ERROR, | |
Ryan Hamilton
2015/01/26 03:51:23
Since this is a bit ugly, consider renaming this t
Bence
2015/01/26 16:48:21
Done.
| |
65 // Set when parsing failed due to insufficient data. | 70 // Set when parsing failed due to insufficient data. |
66 // This error is recoverable, by passing in new data. | 71 // This error is recoverable, by passing in new data. |
67 NEED_MORE_DATA, | 72 NEED_MORE_DATA, |
68 // Set when a complete block has been read, but unprocessed data remains. | 73 // Set when a complete block has been read, but unprocessed data remains. |
69 TOO_MUCH_DATA, | 74 TOO_MUCH_DATA, |
70 // Set when a block exceeds |MaxNumberOfHeadersForVersion| headers. | 75 // Set when a block exceeds |MaxNumberOfHeadersForVersion| headers. |
71 HEADER_BLOCK_TOO_LARGE, | 76 HEADER_BLOCK_TOO_LARGE, |
72 // Set when a header key or value exceeds |kMaximumFieldLength|. | 77 // Set when a header key or value exceeds |kMaximumFieldLength|. |
73 HEADER_FIELD_TOO_LARGE, | 78 HEADER_FIELD_TOO_LARGE, |
74 // Set when the parser is given an unexpected stream ID. | 79 // 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_; | 143 SpdyStreamId stream_id_; |
139 | 144 |
140 ParserError error_; | 145 ParserError error_; |
141 | 146 |
142 const SpdyMajorVersion spdy_version_; | 147 const SpdyMajorVersion spdy_version_; |
143 }; | 148 }; |
144 | 149 |
145 } // namespace net | 150 } // namespace net |
146 | 151 |
147 #endif // NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ | 152 #endif // NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ |
OLD | NEW |