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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 QuicStreamId id() const { return id_; } | 98 QuicStreamId id() const { return id_; } |
99 | 99 |
100 QuicRstStreamErrorCode stream_error() const { return stream_error_; } | 100 QuicRstStreamErrorCode stream_error() const { return stream_error_; } |
101 QuicErrorCode connection_error() const { return connection_error_; } | 101 QuicErrorCode connection_error() const { return connection_error_; } |
102 | 102 |
103 bool reading_stopped() const { | 103 bool reading_stopped() const { |
104 return sequencer_.ignore_read_data() || read_side_closed_; | 104 return sequencer_.ignore_read_data() || read_side_closed_; |
105 } | 105 } |
106 bool write_side_closed() const { return write_side_closed_; } | 106 bool write_side_closed() const { return write_side_closed_; } |
107 | 107 |
| 108 bool rst_received() { return rst_received_; } |
| 109 bool rst_sent() { return rst_sent_; } |
| 110 bool fin_received() { return fin_received_; } |
| 111 bool fin_sent() { return fin_sent_; } |
| 112 |
108 uint64 stream_bytes_read() const { return stream_bytes_read_; } | 113 uint64 stream_bytes_read() const { return stream_bytes_read_; } |
109 uint64 stream_bytes_written() const { return stream_bytes_written_; } | 114 uint64 stream_bytes_written() const { return stream_bytes_written_; } |
110 | 115 |
111 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } | 116 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } |
| 117 void set_fin_received(bool fin_received) { fin_received_ = fin_received; } |
112 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } | 118 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } |
113 | 119 |
114 void set_fec_policy(FecPolicy fec_policy) { fec_policy_ = fec_policy; } | 120 void set_fec_policy(FecPolicy fec_policy) { fec_policy_ = fec_policy; } |
115 FecPolicy fec_policy() const { return fec_policy_; } | 121 FecPolicy fec_policy() const { return fec_policy_; } |
116 | 122 |
117 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } | 123 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } |
118 void set_stream_error(QuicRstStreamErrorCode error) { stream_error_ = error; } | 124 void set_stream_error(QuicRstStreamErrorCode error) { stream_error_ = error; } |
119 | 125 |
120 // Adjust the flow control window according to new offset in |frame|. | 126 // Adjust the flow control window according to new offset in |frame|. |
121 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); | 127 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // the ACKs for this write have been received. | 188 // the ACKs for this write have been received. |
183 // Returns the number of bytes consumed by the connection. | 189 // Returns the number of bytes consumed by the connection. |
184 QuicConsumedData WritevData(const struct iovec* iov, | 190 QuicConsumedData WritevData(const struct iovec* iov, |
185 int iov_count, | 191 int iov_count, |
186 bool fin, | 192 bool fin, |
187 QuicAckListenerInterface* ack_listener); | 193 QuicAckListenerInterface* ack_listener); |
188 | 194 |
189 // Close the write side of the socket. Further writes will fail. | 195 // Close the write side of the socket. Further writes will fail. |
190 // Can be called by the subclass or internally. | 196 // Can be called by the subclass or internally. |
191 // Does not send a FIN. May cause the stream to be closed. | 197 // Does not send a FIN. May cause the stream to be closed. |
192 void CloseWriteSide(); | 198 virtual void CloseWriteSide(); |
193 | 199 |
194 // Helper method that returns FecProtection to use when writing. | 200 // Helper method that returns FecProtection to use when writing. |
195 FecProtection GetFecProtection(); | 201 FecProtection GetFecProtection(); |
196 | 202 |
197 bool fin_buffered() const { return fin_buffered_; } | 203 bool fin_buffered() const { return fin_buffered_; } |
198 | 204 |
199 const QuicSession* session() const { return session_; } | 205 const QuicSession* session() const { return session_; } |
200 QuicSession* session() { return session_; } | 206 QuicSession* session() { return session_; } |
201 | 207 |
202 const QuicStreamSequencer* sequencer() const { return &sequencer_; } | 208 const QuicStreamSequencer* sequencer() const { return &sequencer_; } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // connection level flow control limits (but are stream level flow control | 300 // connection level flow control limits (but are stream level flow control |
295 // limited). | 301 // limited). |
296 bool stream_contributes_to_connection_flow_control_; | 302 bool stream_contributes_to_connection_flow_control_; |
297 | 303 |
298 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); | 304 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); |
299 }; | 305 }; |
300 | 306 |
301 } // namespace net | 307 } // namespace net |
302 | 308 |
303 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 309 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
OLD | NEW |