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 QUIC streams. | 5 // The base class for client/server QUIC 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 QuicStream | 9 // accessing the owning session object. A subclass of QuicStream |
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 QuicStream object has a dependent QuicStreamSequencer object, | 13 // The QuicStream 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_CORE_QUIC_STREAM_H_ | 17 #ifndef NET_QUIC_CORE_QUIC_STREAM_H_ |
18 #define NET_QUIC_CORE_QUIC_STREAM_H_ | 18 #define NET_QUIC_CORE_QUIC_STREAM_H_ |
19 | 19 |
20 #include <cstddef> | 20 #include <cstddef> |
21 #include <cstdint> | 21 #include <cstdint> |
22 #include <list> | 22 #include <list> |
23 #include <string> | 23 #include <string> |
24 | 24 |
25 #include "base/macros.h" | 25 #include "base/macros.h" |
26 #include "base/strings/string_piece.h" | |
27 #include "net/base/iovec.h" | 26 #include "net/base/iovec.h" |
28 #include "net/quic/core/quic_flow_controller.h" | 27 #include "net/quic/core/quic_flow_controller.h" |
29 #include "net/quic/core/quic_iovector.h" | 28 #include "net/quic/core/quic_iovector.h" |
30 #include "net/quic/core/quic_packets.h" | 29 #include "net/quic/core/quic_packets.h" |
31 #include "net/quic/core/quic_stream_sequencer.h" | 30 #include "net/quic/core/quic_stream_sequencer.h" |
32 #include "net/quic/core/quic_types.h" | 31 #include "net/quic/core/quic_types.h" |
33 #include "net/quic/platform/api/quic_export.h" | 32 #include "net/quic/platform/api/quic_export.h" |
34 #include "net/quic/platform/api/quic_reference_counted.h" | 33 #include "net/quic/platform/api/quic_reference_counted.h" |
| 34 #include "net/quic/platform/api/quic_string_piece.h" |
35 | 35 |
36 namespace net { | 36 namespace net { |
37 | 37 |
38 namespace test { | 38 namespace test { |
39 class QuicStreamPeer; | 39 class QuicStreamPeer; |
40 } // namespace test | 40 } // namespace test |
41 | 41 |
42 class QuicSession; | 42 class QuicSession; |
43 | 43 |
44 class QUIC_EXPORT_PRIVATE QuicStream { | 44 class QUIC_EXPORT_PRIVATE QuicStream { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 virtual void StopReading(); | 175 virtual void StopReading(); |
176 | 176 |
177 // Get peer IP of the lastest packet which connection is dealing/delt with. | 177 // Get peer IP of the lastest packet which connection is dealing/delt with. |
178 virtual const QuicSocketAddress& PeerAddressOfLatestPacket() const; | 178 virtual const QuicSocketAddress& PeerAddressOfLatestPacket() const; |
179 | 179 |
180 // Sends as much of 'data' to the connection as the connection will consume, | 180 // Sends as much of 'data' to the connection as the connection will consume, |
181 // and then buffers any remaining data in queued_data_. | 181 // and then buffers any remaining data in queued_data_. |
182 // If fin is true: if it is immediately passed on to the session, | 182 // If fin is true: if it is immediately passed on to the session, |
183 // write_side_closed() becomes true, otherwise fin_buffered_ becomes true. | 183 // write_side_closed() becomes true, otherwise fin_buffered_ becomes true. |
184 void WriteOrBufferData( | 184 void WriteOrBufferData( |
185 base::StringPiece data, | 185 QuicStringPiece data, |
186 bool fin, | 186 bool fin, |
187 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); | 187 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); |
188 | 188 |
189 protected: | 189 protected: |
190 // Sends as many bytes in the first |count| buffers of |iov| to the connection | 190 // Sends as many bytes in the first |count| buffers of |iov| to the connection |
191 // as the connection will consume. | 191 // as the connection will consume. |
192 // If |ack_listener| is provided, then it will be notified once all | 192 // If |ack_listener| is provided, then it will be notified once all |
193 // the ACKs for this write have been received. | 193 // the ACKs for this write have been received. |
194 // Returns the number of bytes consumed by the connection. | 194 // Returns the number of bytes consumed by the connection. |
195 QuicConsumedData WritevData( | 195 QuicConsumedData WritevData( |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // A counter incremented when OnCanWrite() is called and no progress is made. | 316 // A counter incremented when OnCanWrite() is called and no progress is made. |
317 // For debugging only. | 317 // For debugging only. |
318 size_t busy_counter_; | 318 size_t busy_counter_; |
319 | 319 |
320 DISALLOW_COPY_AND_ASSIGN(QuicStream); | 320 DISALLOW_COPY_AND_ASSIGN(QuicStream); |
321 }; | 321 }; |
322 | 322 |
323 } // namespace net | 323 } // namespace net |
324 | 324 |
325 #endif // NET_QUIC_CORE_QUIC_STREAM_H_ | 325 #endif // NET_QUIC_CORE_QUIC_STREAM_H_ |
OLD | NEW |