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" | |
18 #include "net/spdy/spdy_framer.h" | 17 #include "net/spdy/spdy_framer.h" |
19 #include "net/spdy/spdy_header_block.h" | 18 #include "net/spdy/spdy_header_block.h" |
20 #include "net/spdy/spdy_protocol.h" | 19 #include "net/spdy/spdy_protocol.h" |
21 | 20 |
22 namespace net { | 21 namespace net { |
23 | 22 |
24 // Returns the SPDY major version corresponding to the given NextProto | 23 // Returns the SPDY major version corresponding to the given NextProto |
25 // value, which must represent a SPDY-like protocol. | 24 // value, which must represent a SPDY-like protocol. |
26 NET_EXPORT_PRIVATE SpdyMajorVersion NextProtoToSpdyMajorVersion( | 25 NET_EXPORT_PRIVATE SpdyMajorVersion NextProtoToSpdyMajorVersion( |
27 NextProto next_proto); | 26 NextProto next_proto); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 74 |
76 // Called when the other side has finished sending data on this stream. | 75 // Called when the other side has finished sending data on this stream. |
77 // |stream_id| The stream that was receivin data. | 76 // |stream_id| The stream that was receivin data. |
78 virtual void OnStreamEnd(SpdyStreamId stream_id) = 0; | 77 virtual void OnStreamEnd(SpdyStreamId stream_id) = 0; |
79 | 78 |
80 // Called when padding is received (padding length field or padding octets). | 79 // Called when padding is received (padding length field or padding octets). |
81 // |stream_id| The stream receiving data. | 80 // |stream_id| The stream receiving data. |
82 // |len| The number of padding octets. | 81 // |len| The number of padding octets. |
83 virtual void OnStreamPadding(SpdyStreamId stream_id, size_t len) = 0; | 82 virtual void OnStreamPadding(SpdyStreamId stream_id, size_t len) = 0; |
84 | 83 |
| 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 |
85 // Called when a SETTINGS frame is received. | 98 // Called when a SETTINGS frame is received. |
86 // |clear_persisted| True if the respective flag is set on the SETTINGS frame. | 99 // |clear_persisted| True if the respective flag is set on the SETTINGS frame. |
87 virtual void OnSettings(bool clear_persisted) = 0; | 100 virtual void OnSettings(bool clear_persisted) = 0; |
88 | 101 |
89 // Called when an individual setting within a SETTINGS frame has been parsed | 102 // Called when an individual setting within a SETTINGS frame has been parsed |
90 // and validated. | 103 // and validated. |
91 virtual void OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) = 0; | 104 virtual void OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) = 0; |
92 | 105 |
93 // Called when a SETTINGS frame is received with the ACK flag set. | 106 // Called when a SETTINGS frame is received with the ACK flag set. |
94 virtual void OnSettingsAck() {} | 107 virtual void OnSettingsAck() {} |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 std::unique_ptr<ControlFrameFields> control_frame_fields_; | 304 std::unique_ptr<ControlFrameFields> control_frame_fields_; |
292 | 305 |
293 // Collection of fields of a GOAWAY frame that this class needs to buffer. | 306 // Collection of fields of a GOAWAY frame that this class needs to buffer. |
294 struct GoAwayFields { | 307 struct GoAwayFields { |
295 SpdyStreamId last_accepted_stream_id; | 308 SpdyStreamId last_accepted_stream_id; |
296 SpdyGoAwayStatus status; | 309 SpdyGoAwayStatus status; |
297 std::string debug_data; | 310 std::string debug_data; |
298 }; | 311 }; |
299 std::unique_ptr<GoAwayFields> goaway_fields_; | 312 std::unique_ptr<GoAwayFields> goaway_fields_; |
300 | 313 |
301 std::unique_ptr<HeaderCoalescer> coalescer_; | |
302 | |
303 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); | 314 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); |
304 }; | 315 }; |
305 | 316 |
306 } // namespace net | 317 } // namespace net |
307 | 318 |
308 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ | 319 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
OLD | NEW |