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 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 7 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
8 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 8 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
9 | 9 |
10 #include "net/quic/quic_stream_sequencer.h" | 10 #include "net/quic/quic_stream_sequencer.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
| 14 class IPEndPoint; |
14 class QuicSession; | 15 class QuicSession; |
15 | 16 |
16 // All this does right now is send data to subclasses via the sequencer. | 17 // All this does right now is send data to subclasses via the sequencer. |
17 class NET_EXPORT_PRIVATE ReliableQuicStream { | 18 class NET_EXPORT_PRIVATE ReliableQuicStream { |
18 public: | 19 public: |
19 ReliableQuicStream(QuicStreamId id, | 20 ReliableQuicStream(QuicStreamId id, |
20 QuicSession* session); | 21 QuicSession* session); |
21 | 22 |
22 virtual ~ReliableQuicStream(); | 23 virtual ~ReliableQuicStream(); |
23 | 24 |
(...skipping 24 matching lines...) Expand all Loading... |
48 virtual bool IsHalfClosed() const; | 49 virtual bool IsHalfClosed() const; |
49 virtual bool HasBytesToRead() const; | 50 virtual bool HasBytesToRead() const; |
50 | 51 |
51 QuicStreamId id() const { return id_; } | 52 QuicStreamId id() const { return id_; } |
52 | 53 |
53 QuicErrorCode error() const { return error_; } | 54 QuicErrorCode error() const { return error_; } |
54 | 55 |
55 bool read_side_closed() const { return read_side_closed_; } | 56 bool read_side_closed() const { return read_side_closed_; } |
56 bool write_side_closed() const { return write_side_closed_; } | 57 bool write_side_closed() const { return write_side_closed_; } |
57 | 58 |
| 59 const IPEndPoint& GetPeerAddress() const; |
| 60 |
58 protected: | 61 protected: |
59 virtual int WriteData(base::StringPiece data, bool fin); | 62 virtual int WriteData(base::StringPiece data, bool fin); |
60 // Close the read side of the socket. Further frames will not be accepted. | 63 // Close the read side of the socket. Further frames will not be accepted. |
61 virtual void CloseReadSide(); | 64 virtual void CloseReadSide(); |
62 // Close the write side of the socket. Further writes will fail. | 65 // Close the write side of the socket. Further writes will fail. |
63 void CloseWriteSide(); | 66 void CloseWriteSide(); |
64 | 67 |
65 QuicSession* session() { return session_; } | 68 QuicSession* session() { return session_; } |
66 | 69 |
67 private: | 70 private: |
68 friend class ReliableQuicStreamPeer; | 71 friend class ReliableQuicStreamPeer; |
69 | 72 |
70 QuicStreamSequencer sequencer_; | 73 QuicStreamSequencer sequencer_; |
71 QuicStreamId id_; | 74 QuicStreamId id_; |
72 QuicStreamOffset offset_; | 75 QuicStreamOffset offset_; |
73 QuicSession* session_; | 76 QuicSession* session_; |
74 QuicErrorCode error_; | 77 QuicErrorCode error_; |
75 // True if the read side is closed and further frames should be rejected. | 78 // True if the read side is closed and further frames should be rejected. |
76 bool read_side_closed_; | 79 bool read_side_closed_; |
77 // True if the write side is closed, and further writes should fail. | 80 // True if the write side is closed, and further writes should fail. |
78 bool write_side_closed_; | 81 bool write_side_closed_; |
79 }; | 82 }; |
80 | 83 |
81 } // namespace net | 84 } // namespace net |
82 | 85 |
83 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 86 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
OLD | NEW |