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 <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 virtual void OnClose(); | 60 virtual void OnClose(); |
61 | 61 |
62 // Called when we get a stream reset from the client. | 62 // Called when we get a stream reset from the client. |
63 virtual void OnStreamReset(QuicRstStreamErrorCode error); | 63 virtual void OnStreamReset(QuicRstStreamErrorCode error); |
64 | 64 |
65 // Called when we get or send a connection close, and should immediately | 65 // Called when we get or send a connection close, and should immediately |
66 // close the stream. This is not passed through the sequencer, | 66 // close the stream. This is not passed through the sequencer, |
67 // but is handled immediately. | 67 // but is handled immediately. |
68 virtual void ConnectionClose(QuicErrorCode error, bool from_peer); | 68 virtual void ConnectionClose(QuicErrorCode error, bool from_peer); |
69 | 69 |
70 // Called by the sequencer, when we should process a stream termination or | 70 // Called when we should process a stream termination or |
71 // stream close from the peer. | 71 // stream close from the peer. |
72 virtual void TerminateFromPeer(bool half_close); | 72 virtual void TerminateFromPeer(bool half_close); |
73 | 73 |
74 virtual uint32 ProcessRawData(const char* data, uint32 data_len); | 74 virtual uint32 ProcessRawData(const char* data, uint32 data_len); |
75 virtual uint32 ProcessHeaderData(); | 75 virtual uint32 ProcessHeaderData(); |
76 | 76 |
77 virtual uint32 ProcessData(const char* data, uint32 data_len) = 0; | 77 virtual uint32 ProcessData(const char* data, uint32 data_len) = 0; |
78 | 78 |
79 virtual bool OnDecompressedData(base::StringPiece data) OVERRIDE; | 79 virtual bool OnDecompressedData(base::StringPiece data) OVERRIDE; |
80 virtual void OnDecompressionError() OVERRIDE; | 80 virtual void OnDecompressionError() OVERRIDE; |
81 | 81 |
82 // Called to close the stream from this end. | 82 // Called to close the stream from this end. |
83 virtual void Close(QuicRstStreamErrorCode error); | 83 virtual void Close(QuicRstStreamErrorCode error); |
84 | 84 |
85 // This block of functions wraps the sequencer's functions of the same | 85 // This block of functions wraps the sequencer's functions of the same |
86 // name. These methods return uncompressed data until that has | 86 // name. These methods return uncompressed data until that has |
87 // been fully processed. Then they simply delegate to the sequencer. | 87 // been fully processed. Then they simply delegate to the sequencer. |
88 virtual size_t Readv(const struct iovec* iov, size_t iov_len); | 88 virtual size_t Readv(const struct iovec* iov, size_t iov_len); |
89 virtual int GetReadableRegions(iovec* iov, size_t iov_len); | 89 virtual int GetReadableRegions(iovec* iov, size_t iov_len); |
90 virtual bool IsHalfClosed() const; | 90 virtual bool IsHalfClosed() const; |
91 virtual bool IsClosed() const; | |
92 virtual bool HasBytesToRead() const; | 91 virtual bool HasBytesToRead() const; |
93 | 92 |
94 // Called by the session when a decompression blocked stream | 93 // Called by the session when a decompression blocked stream |
95 // becomes unblocked. | 94 // becomes unblocked. |
96 virtual void OnDecompressorAvailable(); | 95 virtual void OnDecompressorAvailable(); |
97 | 96 |
98 QuicStreamId id() const { return id_; } | 97 QuicStreamId id() const { return id_; } |
99 | 98 |
100 QuicRstStreamErrorCode stream_error() const { return stream_error_; } | 99 QuicRstStreamErrorCode stream_error() const { return stream_error_; } |
101 QuicErrorCode connection_error() const { return connection_error_; } | 100 QuicErrorCode connection_error() const { return connection_error_; } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // True if the write side is closed, and further writes should fail. | 182 // True if the write side is closed, and further writes should fail. |
184 bool write_side_closed_; | 183 bool write_side_closed_; |
185 | 184 |
186 bool fin_buffered_; | 185 bool fin_buffered_; |
187 bool fin_sent_; | 186 bool fin_sent_; |
188 }; | 187 }; |
189 | 188 |
190 } // namespace net | 189 } // namespace net |
191 | 190 |
192 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 191 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
OLD | NEW |