OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BUFFERED_SPDY_FRAMER_H_ | 5 #ifndef NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
6 #define NET_SPDY_BUFFERED_SPDY_FRAMER_H_ | 6 #define NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
16 #include "net/socket/next_proto.h" | 16 #include "net/socket/next_proto.h" |
| 17 #include "net/spdy/header_coalescer.h" |
17 #include "net/spdy/spdy_framer.h" | 18 #include "net/spdy/spdy_framer.h" |
18 #include "net/spdy/spdy_header_block.h" | 19 #include "net/spdy/spdy_header_block.h" |
19 #include "net/spdy/spdy_protocol.h" | 20 #include "net/spdy/spdy_protocol.h" |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 | 23 |
23 // Returns the SPDY major version corresponding to the given NextProto | 24 // Returns the SPDY major version corresponding to the given NextProto |
24 // value, which must represent a SPDY-like protocol. | 25 // value, which must represent a SPDY-like protocol. |
25 NET_EXPORT_PRIVATE SpdyMajorVersion NextProtoToSpdyMajorVersion( | 26 NET_EXPORT_PRIVATE SpdyMajorVersion NextProtoToSpdyMajorVersion( |
26 NextProto next_proto); | 27 NextProto next_proto); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 75 |
75 // Called when the other side has finished sending data on this stream. | 76 // Called when the other side has finished sending data on this stream. |
76 // |stream_id| The stream that was receivin data. | 77 // |stream_id| The stream that was receivin data. |
77 virtual void OnStreamEnd(SpdyStreamId stream_id) = 0; | 78 virtual void OnStreamEnd(SpdyStreamId stream_id) = 0; |
78 | 79 |
79 // Called when padding is received (padding length field or padding octets). | 80 // Called when padding is received (padding length field or padding octets). |
80 // |stream_id| The stream receiving data. | 81 // |stream_id| The stream receiving data. |
81 // |len| The number of padding octets. | 82 // |len| The number of padding octets. |
82 virtual void OnStreamPadding(SpdyStreamId stream_id, size_t len) = 0; | 83 virtual void OnStreamPadding(SpdyStreamId stream_id, size_t len) = 0; |
83 | 84 |
84 // Called just before processing the payload of a frame containing header | |
85 // data. Should return an implementation of SpdyHeadersHandlerInterface that | |
86 // will receive headers for stream |stream_id|. The caller will not take | |
87 // ownership of the headers handler. The same instance should be returned | |
88 // for all header frames comprising a logical header block (i.e. until | |
89 // OnHeaderFrameEnd() is called with end_headers == true). | |
90 virtual SpdyHeadersHandlerInterface* OnHeaderFrameStart( | |
91 SpdyStreamId stream_id) = 0; | |
92 | |
93 // Called after processing the payload of a frame containing header data. | |
94 // |end_headers| is true if there will not be any subsequent CONTINUATION | |
95 // frames. | |
96 virtual void OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) = 0; | |
97 | |
98 // Called when a SETTINGS frame is received. | 85 // Called when a SETTINGS frame is received. |
99 // |clear_persisted| True if the respective flag is set on the SETTINGS frame. | 86 // |clear_persisted| True if the respective flag is set on the SETTINGS frame. |
100 virtual void OnSettings(bool clear_persisted) = 0; | 87 virtual void OnSettings(bool clear_persisted) = 0; |
101 | 88 |
102 // Called when an individual setting within a SETTINGS frame has been parsed | 89 // Called when an individual setting within a SETTINGS frame has been parsed |
103 // and validated. | 90 // and validated. |
104 virtual void OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) = 0; | 91 virtual void OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) = 0; |
105 | 92 |
106 // Called when a SETTINGS frame is received with the ACK flag set. | 93 // Called when a SETTINGS frame is received with the ACK flag set. |
107 virtual void OnSettingsAck() {} | 94 virtual void OnSettingsAck() {} |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 std::unique_ptr<ControlFrameFields> control_frame_fields_; | 291 std::unique_ptr<ControlFrameFields> control_frame_fields_; |
305 | 292 |
306 // Collection of fields of a GOAWAY frame that this class needs to buffer. | 293 // Collection of fields of a GOAWAY frame that this class needs to buffer. |
307 struct GoAwayFields { | 294 struct GoAwayFields { |
308 SpdyStreamId last_accepted_stream_id; | 295 SpdyStreamId last_accepted_stream_id; |
309 SpdyGoAwayStatus status; | 296 SpdyGoAwayStatus status; |
310 std::string debug_data; | 297 std::string debug_data; |
311 }; | 298 }; |
312 std::unique_ptr<GoAwayFields> goaway_fields_; | 299 std::unique_ptr<GoAwayFields> goaway_fields_; |
313 | 300 |
| 301 std::unique_ptr<HeaderCoalescer> coalescer_; |
| 302 |
314 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); | 303 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); |
315 }; | 304 }; |
316 | 305 |
317 } // namespace net | 306 } // namespace net |
318 | 307 |
319 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ | 308 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
OLD | NEW |