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/header_coalescer.h" |
| 18 #include "net/spdy/spdy_alt_svc_wire_format.h" |
18 #include "net/spdy/spdy_framer.h" | 19 #include "net/spdy/spdy_framer.h" |
19 #include "net/spdy/spdy_header_block.h" | 20 #include "net/spdy/spdy_header_block.h" |
20 #include "net/spdy/spdy_protocol.h" | 21 #include "net/spdy/spdy_protocol.h" |
21 | 22 |
22 namespace net { | 23 namespace net { |
23 | 24 |
24 // Returns the SPDY major version corresponding to the given NextProto | 25 // Returns the SPDY major version corresponding to the given NextProto |
25 // value, which must represent a SPDY-like protocol. | 26 // value, which must represent a SPDY-like protocol. |
26 NET_EXPORT_PRIVATE SpdyMajorVersion NextProtoToSpdyMajorVersion( | 27 NET_EXPORT_PRIVATE SpdyMajorVersion NextProtoToSpdyMajorVersion( |
27 NextProto next_proto); | 28 NextProto next_proto); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 111 |
111 // Called when a WINDOW_UPDATE frame has been parsed. | 112 // Called when a WINDOW_UPDATE frame has been parsed. |
112 virtual void OnWindowUpdate(SpdyStreamId stream_id, | 113 virtual void OnWindowUpdate(SpdyStreamId stream_id, |
113 int delta_window_size) = 0; | 114 int delta_window_size) = 0; |
114 | 115 |
115 // Called when a PUSH_PROMISE frame has been parsed. | 116 // Called when a PUSH_PROMISE frame has been parsed. |
116 virtual void OnPushPromise(SpdyStreamId stream_id, | 117 virtual void OnPushPromise(SpdyStreamId stream_id, |
117 SpdyStreamId promised_stream_id, | 118 SpdyStreamId promised_stream_id, |
118 const SpdyHeaderBlock& headers) = 0; | 119 const SpdyHeaderBlock& headers) = 0; |
119 | 120 |
| 121 // Called when an ALTSVC frame has been parsed. |
| 122 virtual void OnAltSvc( |
| 123 SpdyStreamId stream_id, |
| 124 base::StringPiece origin, |
| 125 const SpdyAltSvcWireFormat::AlternativeServiceVector& altsvc_vector) = 0; |
| 126 |
120 // Called when a frame type we don't recognize is received. | 127 // Called when a frame type we don't recognize is received. |
121 // Return true if this appears to be a valid extension frame, false otherwise. | 128 // Return true if this appears to be a valid extension frame, false otherwise. |
122 // We distinguish between extension frames and nonsense by checking | 129 // We distinguish between extension frames and nonsense by checking |
123 // whether the stream id is valid. | 130 // whether the stream id is valid. |
124 virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) = 0; | 131 virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) = 0; |
125 | 132 |
126 protected: | 133 protected: |
127 virtual ~BufferedSpdyFramerVisitorInterface() {} | 134 virtual ~BufferedSpdyFramerVisitorInterface() {} |
128 | 135 |
129 private: | 136 private: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 void OnSettingsEnd() override; | 186 void OnSettingsEnd() override; |
180 void OnPing(SpdyPingId unique_id, bool is_ack) override; | 187 void OnPing(SpdyPingId unique_id, bool is_ack) override; |
181 void OnRstStream(SpdyStreamId stream_id, SpdyRstStreamStatus status) override; | 188 void OnRstStream(SpdyStreamId stream_id, SpdyRstStreamStatus status) override; |
182 void OnGoAway(SpdyStreamId last_accepted_stream_id, | 189 void OnGoAway(SpdyStreamId last_accepted_stream_id, |
183 SpdyGoAwayStatus status) override; | 190 SpdyGoAwayStatus status) override; |
184 bool OnGoAwayFrameData(const char* goaway_data, size_t len) override; | 191 bool OnGoAwayFrameData(const char* goaway_data, size_t len) override; |
185 void OnWindowUpdate(SpdyStreamId stream_id, int delta_window_size) override; | 192 void OnWindowUpdate(SpdyStreamId stream_id, int delta_window_size) override; |
186 void OnPushPromise(SpdyStreamId stream_id, | 193 void OnPushPromise(SpdyStreamId stream_id, |
187 SpdyStreamId promised_stream_id, | 194 SpdyStreamId promised_stream_id, |
188 bool end) override; | 195 bool end) override; |
| 196 void OnAltSvc(SpdyStreamId stream_id, |
| 197 base::StringPiece origin, |
| 198 const SpdyAltSvcWireFormat::AlternativeServiceVector& |
| 199 altsvc_vector) override; |
189 void OnDataFrameHeader(SpdyStreamId stream_id, | 200 void OnDataFrameHeader(SpdyStreamId stream_id, |
190 size_t length, | 201 size_t length, |
191 bool fin) override; | 202 bool fin) override; |
192 void OnContinuation(SpdyStreamId stream_id, bool end) override; | 203 void OnContinuation(SpdyStreamId stream_id, bool end) override; |
193 bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override; | 204 bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override; |
194 | 205 |
195 // SpdyFramer methods. | 206 // SpdyFramer methods. |
196 size_t ProcessInput(const char* data, size_t len); | 207 size_t ProcessInput(const char* data, size_t len); |
197 SpdyMajorVersion protocol_version(); | 208 SpdyMajorVersion protocol_version(); |
198 void Reset(); | 209 void Reset(); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 std::unique_ptr<GoAwayFields> goaway_fields_; | 311 std::unique_ptr<GoAwayFields> goaway_fields_; |
301 | 312 |
302 std::unique_ptr<HeaderCoalescer> coalescer_; | 313 std::unique_ptr<HeaderCoalescer> coalescer_; |
303 | 314 |
304 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); | 315 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); |
305 }; | 316 }; |
306 | 317 |
307 } // namespace net | 318 } // namespace net |
308 | 319 |
309 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ | 320 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
OLD | NEW |