reliable_quic_stream.h revision 1e9bf3e0803691d0a228da41fc608347b6db4340
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The base class for client/server reliable streams. 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define NET_QUIC_RELIABLE_QUIC_STREAM_H_ 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <sys/types.h> 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <list> 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 14b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "base/strings/string_piece.h" 15b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "net/base/iovec.h" 16b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "net/base/net_export.h" 1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "net/quic/quic_spdy_compressor.h" 18b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "net/quic/quic_spdy_decompressor.h" 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/quic/quic_stream_sequencer.h" 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net { 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace test { 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ReliableQuicStreamPeer; 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace test 262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class IPEndPoint; 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class QuicSession; 297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochclass SSLInfo; 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#define ENDPOINT (is_server_ ? "Server: " : " Client: ") 321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// All this does right now is send data to subclasses via the sequencer. 34b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)class NET_EXPORT_PRIVATE ReliableQuicStream : public 35b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) QuicSpdyDecompressor::Visitor { 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Visitor receives callbacks from the stream. 382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) class Visitor { 392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public: 402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) Visitor() {} 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Called when the stream is closed. 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void OnClose(ReliableQuicStream* stream) = 0; 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) protected: 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual ~Visitor() {} 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private: 492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(Visitor); 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) }; 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ReliableQuicStream(QuicStreamId id, 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) QuicSession* session); 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~ReliableQuicStream(); 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool WillAcceptStreamFrame(const QuicStreamFrame& frame) const; 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual bool OnStreamFrame(const QuicStreamFrame& frame); 592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void OnCanWrite(); 612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Called by the session just before the stream is deleted. 632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void OnClose(); 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Called when we get a stream reset from the client. 66c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) virtual void OnStreamReset(QuicRstStreamErrorCode error); 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Called when we get or send a connection close, and should immediately 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // close the stream. This is not passed through the sequencer, 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // but is handled immediately. 711e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer); 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 737d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) // Called when we should process a stream termination or 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // stream close from the peer. 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void TerminateFromPeer(bool half_close); 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 77b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) virtual uint32 ProcessRawData(const char* data, uint32 data_len); 78b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) virtual uint32 ProcessHeaderData(); 79b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual uint32 ProcessData(const char* data, uint32 data_len) = 0; 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 82b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) virtual bool OnDecompressedData(base::StringPiece data) OVERRIDE; 8390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) virtual void OnDecompressionError() OVERRIDE; 84b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Called to close the stream from this end. 86c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) virtual void Close(QuicRstStreamErrorCode error); 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 881e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Called to close the entire connection from this end. 891e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void CloseConnection(QuicErrorCode error); 901e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual void CloseConnectionWithDetails(QuicErrorCode error, 911e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) const string& details); 921e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // This block of functions wraps the sequencer's functions of the same 94b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // name. These methods return uncompressed data until that has 95b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // been fully processed. Then they simply delegate to the sequencer. 965e3f23d412006dc4db4e659864679f29341e113fTorne (Richard Coles) virtual size_t Readv(const struct iovec* iov, size_t iov_len); 97868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual int GetReadableRegions(iovec* iov, size_t iov_len); 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool IsHalfClosed() const; 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool HasBytesToRead() const; 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 101b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // Called by the session when a decompression blocked stream 102b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // becomes unblocked. 103b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) virtual void OnDecompressorAvailable(); 104b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 105d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // By default, this is the same as priority(), however it allows streams 106d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // to temporarily alter effective priority. For example if a SPDY stream has 107d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // compressed but not written headers it can write the headers with a higher 108d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // priority. 109d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) virtual QuicPriority EffectivePriority() const; 110d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) QuicStreamId id() const { return id_; } 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 113c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) QuicRstStreamErrorCode stream_error() const { return stream_error_; } 114c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) QuicErrorCode connection_error() const { return connection_error_; } 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool read_side_closed() const { return read_side_closed_; } 1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool write_side_closed() const { return write_side_closed_; } 1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 119b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) uint64 stream_bytes_read() { return stream_bytes_read_; } 120b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) uint64 stream_bytes_written() { return stream_bytes_written_; } 121b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 1222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const IPEndPoint& GetPeerAddress() const; 1232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void set_visitor(Visitor* visitor) { visitor_ = visitor; } 1252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 12690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) QuicSpdyCompressor* compressor(); 12790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 1287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Gets the SSL connection information. 1297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch bool GetSSLInfo(SSLInfo* ssl_info); 1307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 1312385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch bool headers_decompressed() const { return headers_decompressed_; } 1322385ea399aae016c0806a4f9ef3c9cfe3d2a39dfBen Murdoch 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 1342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns a pair with the number of bytes consumed from data, and a boolean 1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // indicating if the fin bit was consumed. This does not indicate the data 1362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // has been sent on the wire: it may have been turned into a packet and queued 1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // if the socket was unexpectedly blocked. 1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // 1392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The default implementation always consumed all bytes and any fin, but 1402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // this behavior is not guaranteed for subclasses so callers should check the 1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // return value. 1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual QuicConsumedData WriteData(base::StringPiece data, bool fin); 1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Close the read side of the socket. Further frames will not be accepted. 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void CloseReadSide(); 1462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Close the write side of the socket. Further writes will fail. 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void CloseWriteSide(); 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 15058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) bool HasBufferedData(); 15158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 152b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) bool fin_buffered() { return fin_buffered_; } 153b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) QuicSession* session() { return session_; } 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 156d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // Sets priority_ to priority. This should only be called before bytes are 157d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // written to the server. 158d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) void set_priority(QuicPriority priority); 159d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // This is protected because external classes should use EffectivePriority 160d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // instead. 161d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) QuicPriority priority() const { return priority_; } 162d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Sends as much of 'data' to the connection as the connection will consume, 1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // and then buffers any remaining data in queued_data_. 1652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns (data.size(), true) as it always consumed all data: it returns for 1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // convenience to have the same return type as WriteDataInternal. 1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) QuicConsumedData WriteOrBuffer(base::StringPiece data, bool fin); 1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Sends as much of 'data' to the connection as the connection will consume. 1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns the number of bytes consumed by the connection. 1712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) QuicConsumedData WriteDataInternal(base::StringPiece data, bool fin); 1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 173d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // Sends as many bytes in the first |count| buffers of |iov| to the connection 174d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // as the connection will consume. 175d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // Returns the number of bytes consumed by the connection. 176d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) QuicConsumedData WritevDataInternal(const struct iovec* iov, 177d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) int iov_count, 178d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) bool fin); 179d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 1812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) friend class test::ReliableQuicStreamPeer; 1822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) friend class QuicStreamUtils; 1832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 184424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) uint32 StripPriorityAndHeaderId(const char* data, uint32 data_len); 185424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 1862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::list<string> queued_data_; 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) QuicStreamSequencer sequencer_; 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) QuicStreamId id_; 1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) QuicSession* session_; 1912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Optional visitor of this stream to be notified when the stream is closed. 1922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) Visitor* visitor_; 1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Bytes read and written refer to payload bytes only: they do not include 1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // framing, encryption overhead etc. 1952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) uint64 stream_bytes_read_; 1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) uint64 stream_bytes_written_; 197b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // True if the headers have been completely decompresssed. 198b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) bool headers_decompressed_; 199424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // The priority of the stream, once parsed. 200424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) QuicPriority priority_; 201b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // ID of the header block sent by the peer, once parsed. 202b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) QuicHeaderId headers_id_; 203424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // Buffer into which we write bytes from priority_ and headers_id_ 204424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // until each is fully parsed. 205424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) string headers_id_and_priority_buffer_; 206b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // Contains a copy of the decompressed headers_ until they are consumed 207b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // via ProcessData or Readv. 208b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) string decompressed_headers_; 209558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch // True if an error was encountered during decompression. 210558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch bool decompression_failed_; 211c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 212c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Stream error code received from a RstStreamFrame or error code sent by the 213c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // visitor or sequencer in the RstStreamFrame. 214c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) QuicRstStreamErrorCode stream_error_; 215c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Connection error code due to which the stream was closed. |stream_error_| 216c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // is set to |QUIC_STREAM_CONNECTION_ERROR| when this happens and consumers 217c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // should check |connection_error_|. 218c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) QuicErrorCode connection_error_; 219c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // True if the read side is closed and further frames should be rejected. 2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool read_side_closed_; 2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // True if the write side is closed, and further writes should fail. 2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool write_side_closed_; 2242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 225424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // True if the priority has been read, false otherwise. 226424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) bool priority_parsed_; 2272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool fin_buffered_; 2282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool fin_sent_; 2291e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 2301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // True if the session this stream is running under is a server session. 2311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) bool is_server_; 2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace net 2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ 237