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 // The base class for client/server reliable streams. | 5 // The base class for client/server reliable streams. |
6 | 6 |
7 // It does not contain the entire interface needed by an application to interact | 7 // It does not contain the entire interface needed by an application to interact |
8 // with a QUIC stream. Some parts of the interface must be obtained by | 8 // with a QUIC stream. Some parts of the interface must be obtained by |
9 // accessing the owning session object. A subclass of ReliableQuicStream | 9 // accessing the owning session object. A subclass of ReliableQuicStream |
10 // connects the object and the application that generates and consumes the data | 10 // connects the object and the application that generates and consumes the data |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 uint64_t queued_data_bytes() const { return queued_data_bytes_; } | 112 uint64_t queued_data_bytes() const { return queued_data_bytes_; } |
113 | 113 |
114 uint64_t stream_bytes_read() const { return stream_bytes_read_; } | 114 uint64_t stream_bytes_read() const { return stream_bytes_read_; } |
115 uint64_t stream_bytes_written() const { return stream_bytes_written_; } | 115 uint64_t stream_bytes_written() const { return stream_bytes_written_; } |
116 | 116 |
117 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } | 117 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } |
118 void set_fin_received(bool fin_received) { fin_received_ = fin_received; } | 118 void set_fin_received(bool fin_received) { fin_received_ = fin_received; } |
119 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } | 119 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } |
120 | 120 |
121 void set_fec_policy(FecPolicy fec_policy) { fec_policy_ = fec_policy; } | |
122 FecPolicy fec_policy() const { return fec_policy_; } | |
123 | |
124 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } | 121 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } |
125 void set_stream_error(QuicRstStreamErrorCode error) { stream_error_ = error; } | 122 void set_stream_error(QuicRstStreamErrorCode error) { stream_error_ = error; } |
126 | 123 |
127 // Adjust the flow control window according to new offset in |frame|. | 124 // Adjust the flow control window according to new offset in |frame|. |
128 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); | 125 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); |
129 | 126 |
130 // Used in Chrome. | 127 // Used in Chrome. |
131 int num_frames_received() const; | 128 int num_frames_received() const; |
132 int num_early_frames_received() const; | 129 int num_early_frames_received() const; |
133 int num_duplicate_frames_received() const; | 130 int num_duplicate_frames_received() const; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 QuicConsumedData WritevData(const struct iovec* iov, | 188 QuicConsumedData WritevData(const struct iovec* iov, |
192 int iov_count, | 189 int iov_count, |
193 bool fin, | 190 bool fin, |
194 QuicAckListenerInterface* ack_listener); | 191 QuicAckListenerInterface* ack_listener); |
195 | 192 |
196 // Close the write side of the socket. Further writes will fail. | 193 // Close the write side of the socket. Further writes will fail. |
197 // Can be called by the subclass or internally. | 194 // Can be called by the subclass or internally. |
198 // Does not send a FIN. May cause the stream to be closed. | 195 // Does not send a FIN. May cause the stream to be closed. |
199 virtual void CloseWriteSide(); | 196 virtual void CloseWriteSide(); |
200 | 197 |
201 // Helper method that returns FecProtection to use when writing. | |
202 FecProtection GetFecProtection(); | |
203 | |
204 bool fin_buffered() const { return fin_buffered_; } | 198 bool fin_buffered() const { return fin_buffered_; } |
205 | 199 |
206 const QuicSession* session() const { return session_; } | 200 const QuicSession* session() const { return session_; } |
207 QuicSession* session() { return session_; } | 201 QuicSession* session() { return session_; } |
208 | 202 |
209 const QuicStreamSequencer* sequencer() const { return &sequencer_; } | 203 const QuicStreamSequencer* sequencer() const { return &sequencer_; } |
210 QuicStreamSequencer* sequencer() { return &sequencer_; } | 204 QuicStreamSequencer* sequencer() { return &sequencer_; } |
211 | 205 |
212 void DisableConnectionFlowControlForThisStream() { | 206 void DisableConnectionFlowControlForThisStream() { |
213 stream_contributes_to_connection_flow_control_ = false; | 207 stream_contributes_to_connection_flow_control_ = false; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 bool fin_received_; | 274 bool fin_received_; |
281 | 275 |
282 // True if an RST_STREAM has been sent to the session. | 276 // True if an RST_STREAM has been sent to the session. |
283 // In combination with fin_sent_, used to ensure that a FIN and/or a | 277 // In combination with fin_sent_, used to ensure that a FIN and/or a |
284 // RST_STREAM is always sent to terminate the stream. | 278 // RST_STREAM is always sent to terminate the stream. |
285 bool rst_sent_; | 279 bool rst_sent_; |
286 | 280 |
287 // True if this stream has received a RST_STREAM frame. | 281 // True if this stream has received a RST_STREAM frame. |
288 bool rst_received_; | 282 bool rst_received_; |
289 | 283 |
290 // FEC policy to be used for this stream. | |
291 FecPolicy fec_policy_; | |
292 | |
293 // Tracks if the session this stream is running under was created by a | 284 // Tracks if the session this stream is running under was created by a |
294 // server or a client. | 285 // server or a client. |
295 Perspective perspective_; | 286 Perspective perspective_; |
296 | 287 |
297 QuicFlowController flow_controller_; | 288 QuicFlowController flow_controller_; |
298 | 289 |
299 // The connection level flow controller. Not owned. | 290 // The connection level flow controller. Not owned. |
300 QuicFlowController* connection_flow_controller_; | 291 QuicFlowController* connection_flow_controller_; |
301 | 292 |
302 // Special streams, such as the crypto and headers streams, do not respect | 293 // Special streams, such as the crypto and headers streams, do not respect |
303 // connection level flow control limits (but are stream level flow control | 294 // connection level flow control limits (but are stream level flow control |
304 // limited). | 295 // limited). |
305 bool stream_contributes_to_connection_flow_control_; | 296 bool stream_contributes_to_connection_flow_control_; |
306 | 297 |
307 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); | 298 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); |
308 }; | 299 }; |
309 | 300 |
310 } // namespace net | 301 } // namespace net |
311 | 302 |
312 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 303 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
OLD | NEW |