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 |
11 // of the stream. | 11 // of the stream. |
12 | 12 |
13 // The ReliableQuicStream object has a dependent QuicStreamSequencer object, | 13 // The ReliableQuicStream object has a dependent QuicStreamSequencer object, |
14 // which is given the stream frames as they arrive, and provides stream data in | 14 // which is given the stream frames as they arrive, and provides stream data in |
15 // order by invoking ProcessRawData(). | 15 // order by invoking ProcessRawData(). |
16 | 16 |
17 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 17 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
18 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 18 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
19 | 19 |
| 20 #include <stddef.h> |
| 21 #include <stdint.h> |
20 #include <sys/types.h> | 22 #include <sys/types.h> |
21 | 23 |
22 #include <list> | 24 #include <list> |
23 #include <string> | 25 #include <string> |
24 | 26 |
25 #include "base/basictypes.h" | 27 #include "base/macros.h" |
26 #include "base/memory/ref_counted.h" | 28 #include "base/memory/ref_counted.h" |
27 #include "base/strings/string_piece.h" | 29 #include "base/strings/string_piece.h" |
28 #include "net/base/iovec.h" | 30 #include "net/base/iovec.h" |
29 #include "net/base/net_export.h" | 31 #include "net/base/net_export.h" |
30 #include "net/quic/quic_flow_controller.h" | 32 #include "net/quic/quic_flow_controller.h" |
31 #include "net/quic/quic_protocol.h" | 33 #include "net/quic/quic_protocol.h" |
32 #include "net/quic/quic_stream_sequencer.h" | 34 #include "net/quic/quic_stream_sequencer.h" |
33 #include "net/quic/quic_types.h" | 35 #include "net/quic/quic_types.h" |
34 //#include "std::strings/std::stringpiece.h" | 36 //#include "std::strings/std::stringpiece.h" |
35 //#include "util/refcount/reffed_ptr.h" | 37 //#include "util/refcount/reffed_ptr.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool reading_stopped() const { | 107 bool reading_stopped() const { |
106 return sequencer_.ignore_read_data() || read_side_closed_; | 108 return sequencer_.ignore_read_data() || read_side_closed_; |
107 } | 109 } |
108 bool write_side_closed() const { return write_side_closed_; } | 110 bool write_side_closed() const { return write_side_closed_; } |
109 | 111 |
110 bool rst_received() { return rst_received_; } | 112 bool rst_received() { return rst_received_; } |
111 bool rst_sent() { return rst_sent_; } | 113 bool rst_sent() { return rst_sent_; } |
112 bool fin_received() { return fin_received_; } | 114 bool fin_received() { return fin_received_; } |
113 bool fin_sent() { return fin_sent_; } | 115 bool fin_sent() { return fin_sent_; } |
114 | 116 |
115 uint64 queued_data_bytes() const { return queued_data_bytes_; } | 117 uint64_t queued_data_bytes() const { return queued_data_bytes_; } |
116 | 118 |
117 uint64 stream_bytes_read() const { return stream_bytes_read_; } | 119 uint64_t stream_bytes_read() const { return stream_bytes_read_; } |
118 uint64 stream_bytes_written() const { return stream_bytes_written_; } | 120 uint64_t stream_bytes_written() const { return stream_bytes_written_; } |
119 | 121 |
120 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } | 122 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } |
121 void set_fin_received(bool fin_received) { fin_received_ = fin_received; } | 123 void set_fin_received(bool fin_received) { fin_received_ = fin_received; } |
122 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } | 124 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } |
123 | 125 |
124 void set_fec_policy(FecPolicy fec_policy) { fec_policy_ = fec_policy; } | 126 void set_fec_policy(FecPolicy fec_policy) { fec_policy_ = fec_policy; } |
125 FecPolicy fec_policy() const { return fec_policy_; } | 127 FecPolicy fec_policy() const { return fec_policy_; } |
126 | 128 |
127 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } | 129 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } |
128 void set_stream_error(QuicRstStreamErrorCode error) { stream_error_ = error; } | 130 void set_stream_error(QuicRstStreamErrorCode error) { stream_error_ = error; } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 }; | 243 }; |
242 | 244 |
243 // Calls MaybeSendBlocked on the stream's flow controller and the connection | 245 // Calls MaybeSendBlocked on the stream's flow controller and the connection |
244 // level flow controller. If the stream is flow control blocked by the | 246 // level flow controller. If the stream is flow control blocked by the |
245 // connection-level flow controller but not by the stream-level flow | 247 // connection-level flow controller but not by the stream-level flow |
246 // controller, marks this stream as connection-level write blocked. | 248 // controller, marks this stream as connection-level write blocked. |
247 void MaybeSendBlocked(); | 249 void MaybeSendBlocked(); |
248 | 250 |
249 std::list<PendingData> queued_data_; | 251 std::list<PendingData> queued_data_; |
250 // How many bytes are queued? | 252 // How many bytes are queued? |
251 uint64 queued_data_bytes_; | 253 uint64_t queued_data_bytes_; |
252 | 254 |
253 QuicStreamSequencer sequencer_; | 255 QuicStreamSequencer sequencer_; |
254 QuicStreamId id_; | 256 QuicStreamId id_; |
255 // Pointer to the owning QuicSession object. | 257 // Pointer to the owning QuicSession object. |
256 QuicSession* session_; | 258 QuicSession* session_; |
257 // Bytes read and written refer to payload bytes only: they do not include | 259 // Bytes read and written refer to payload bytes only: they do not include |
258 // framing, encryption overhead etc. | 260 // framing, encryption overhead etc. |
259 uint64 stream_bytes_read_; | 261 uint64_t stream_bytes_read_; |
260 uint64 stream_bytes_written_; | 262 uint64_t stream_bytes_written_; |
261 | 263 |
262 // Stream error code received from a RstStreamFrame or error code sent by the | 264 // Stream error code received from a RstStreamFrame or error code sent by the |
263 // visitor or sequencer in the RstStreamFrame. | 265 // visitor or sequencer in the RstStreamFrame. |
264 QuicRstStreamErrorCode stream_error_; | 266 QuicRstStreamErrorCode stream_error_; |
265 // Connection error code due to which the stream was closed. |stream_error_| | 267 // Connection error code due to which the stream was closed. |stream_error_| |
266 // is set to |QUIC_STREAM_CONNECTION_ERROR| when this happens and consumers | 268 // is set to |QUIC_STREAM_CONNECTION_ERROR| when this happens and consumers |
267 // should check |connection_error_|. | 269 // should check |connection_error_|. |
268 QuicErrorCode connection_error_; | 270 QuicErrorCode connection_error_; |
269 | 271 |
270 // True if the read side is closed and further frames should be rejected. | 272 // True if the read side is closed and further frames should be rejected. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // connection level flow control limits (but are stream level flow control | 308 // connection level flow control limits (but are stream level flow control |
307 // limited). | 309 // limited). |
308 bool stream_contributes_to_connection_flow_control_; | 310 bool stream_contributes_to_connection_flow_control_; |
309 | 311 |
310 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); | 312 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); |
311 }; | 313 }; |
312 | 314 |
313 } // namespace net | 315 } // namespace net |
314 | 316 |
315 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 317 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
OLD | NEW |