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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 private: | 115 private: |
116 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramerVisitorInterface); | 116 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramerVisitorInterface); |
117 }; | 117 }; |
118 | 118 |
119 class NET_EXPORT_PRIVATE BufferedSpdyFramer | 119 class NET_EXPORT_PRIVATE BufferedSpdyFramer |
120 : public SpdyFramerVisitorInterface { | 120 : public SpdyFramerVisitorInterface { |
121 public: | 121 public: |
122 BufferedSpdyFramer(SpdyMajorVersion version, | 122 BufferedSpdyFramer(SpdyMajorVersion version, |
123 bool enable_compression); | 123 bool enable_compression); |
124 virtual ~BufferedSpdyFramer(); | 124 ~BufferedSpdyFramer() override; |
125 | 125 |
126 // Sets callbacks to be called from the buffered spdy framer. A visitor must | 126 // Sets callbacks to be called from the buffered spdy framer. A visitor must |
127 // be set, or else the framer will likely crash. It is acceptable for the | 127 // be set, or else the framer will likely crash. It is acceptable for the |
128 // visitor to do nothing. If this is called multiple times, only the last | 128 // visitor to do nothing. If this is called multiple times, only the last |
129 // visitor will be used. | 129 // visitor will be used. |
130 void set_visitor(BufferedSpdyFramerVisitorInterface* visitor); | 130 void set_visitor(BufferedSpdyFramerVisitorInterface* visitor); |
131 | 131 |
132 // Set debug callbacks to be called from the framer. The debug visitor is | 132 // Set debug callbacks to be called from the framer. The debug visitor is |
133 // completely optional and need not be set in order for normal operation. | 133 // completely optional and need not be set in order for normal operation. |
134 // If this is called multiple times, only the last visitor will be used. | 134 // If this is called multiple times, only the last visitor will be used. |
135 void set_debug_visitor(SpdyFramerDebugVisitorInterface* debug_visitor); | 135 void set_debug_visitor(SpdyFramerDebugVisitorInterface* debug_visitor); |
136 | 136 |
137 // SpdyFramerVisitorInterface | 137 // SpdyFramerVisitorInterface |
138 virtual void OnError(SpdyFramer* spdy_framer) override; | 138 void OnError(SpdyFramer* spdy_framer) override; |
139 virtual void OnSynStream(SpdyStreamId stream_id, | 139 void OnSynStream(SpdyStreamId stream_id, |
140 SpdyStreamId associated_stream_id, | 140 SpdyStreamId associated_stream_id, |
141 SpdyPriority priority, | 141 SpdyPriority priority, |
142 bool fin, | 142 bool fin, |
143 bool unidirectional) override; | 143 bool unidirectional) override; |
144 virtual void OnSynReply(SpdyStreamId stream_id, bool fin) override; | 144 void OnSynReply(SpdyStreamId stream_id, bool fin) override; |
145 virtual void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) override; | 145 void OnHeaders(SpdyStreamId stream_id, bool fin, bool end) override; |
146 virtual bool OnControlFrameHeaderData(SpdyStreamId stream_id, | 146 bool OnControlFrameHeaderData(SpdyStreamId stream_id, |
147 const char* header_data, | 147 const char* header_data, |
148 size_t len) override; | 148 size_t len) override; |
149 virtual void OnStreamFrameData(SpdyStreamId stream_id, | 149 void OnStreamFrameData(SpdyStreamId stream_id, |
150 const char* data, | 150 const char* data, |
151 size_t len, | 151 size_t len, |
152 bool fin) override; | 152 bool fin) override; |
153 virtual void OnSettings(bool clear_persisted) override; | 153 void OnSettings(bool clear_persisted) override; |
154 virtual void OnSetting( | 154 void OnSetting(SpdySettingsIds id, uint8 flags, uint32 value) override; |
155 SpdySettingsIds id, uint8 flags, uint32 value) override; | 155 void OnSettingsAck() override; |
156 virtual void OnSettingsAck() override; | 156 void OnSettingsEnd() override; |
157 virtual void OnSettingsEnd() override; | 157 void OnPing(SpdyPingId unique_id, bool is_ack) override; |
158 virtual void OnPing(SpdyPingId unique_id, bool is_ack) override; | 158 void OnRstStream(SpdyStreamId stream_id, SpdyRstStreamStatus status) override; |
159 virtual void OnRstStream(SpdyStreamId stream_id, | 159 void OnGoAway(SpdyStreamId last_accepted_stream_id, |
160 SpdyRstStreamStatus status) override; | 160 SpdyGoAwayStatus status) override; |
161 virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, | 161 void OnWindowUpdate(SpdyStreamId stream_id, |
162 SpdyGoAwayStatus status) override; | 162 uint32 delta_window_size) override; |
163 virtual void OnWindowUpdate(SpdyStreamId stream_id, | 163 void OnPushPromise(SpdyStreamId stream_id, |
164 uint32 delta_window_size) override; | 164 SpdyStreamId promised_stream_id, |
165 virtual void OnPushPromise(SpdyStreamId stream_id, | 165 bool end) override; |
166 SpdyStreamId promised_stream_id, | 166 void OnDataFrameHeader(SpdyStreamId stream_id, |
167 bool end) override; | 167 size_t length, |
168 virtual void OnDataFrameHeader(SpdyStreamId stream_id, | 168 bool fin) override; |
169 size_t length, | 169 void OnContinuation(SpdyStreamId stream_id, bool end) override; |
170 bool fin) override; | 170 bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override; |
171 virtual void OnContinuation(SpdyStreamId stream_id, bool end) override; | |
172 virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override; | |
173 | 171 |
174 // SpdyFramer methods. | 172 // SpdyFramer methods. |
175 size_t ProcessInput(const char* data, size_t len); | 173 size_t ProcessInput(const char* data, size_t len); |
176 SpdyMajorVersion protocol_version(); | 174 SpdyMajorVersion protocol_version(); |
177 void Reset(); | 175 void Reset(); |
178 SpdyFramer::SpdyError error_code() const; | 176 SpdyFramer::SpdyError error_code() const; |
179 SpdyFramer::SpdyState state() const; | 177 SpdyFramer::SpdyState state() const; |
180 bool MessageFullyRead(); | 178 bool MessageFullyRead(); |
181 bool HasError(); | 179 bool HasError(); |
182 SpdyFrame* CreateSynStream(SpdyStreamId stream_id, | 180 SpdyFrame* CreateSynStream(SpdyStreamId stream_id, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 bool unidirectional; | 268 bool unidirectional; |
271 }; | 269 }; |
272 scoped_ptr<ControlFrameFields> control_frame_fields_; | 270 scoped_ptr<ControlFrameFields> control_frame_fields_; |
273 | 271 |
274 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); | 272 DISALLOW_COPY_AND_ASSIGN(BufferedSpdyFramer); |
275 }; | 273 }; |
276 | 274 |
277 } // namespace net | 275 } // namespace net |
278 | 276 |
279 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ | 277 #endif // NET_SPDY_BUFFERED_SPDY_FRAMER_H_ |
OLD | NEW |