1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef QUICHE_QUIC_CORE_QPACK_QPACK_RECEIVE_STREAM_H_ 6 #define QUICHE_QUIC_CORE_QPACK_QPACK_RECEIVE_STREAM_H_ 7 8 #include "quiche/quic/core/qpack/qpack_stream_receiver.h" 9 #include "quiche/quic/core/quic_stream.h" 10 #include "quiche/quic/platform/api/quic_export.h" 11 12 namespace quic { 13 14 class QuicSession; 15 16 // QPACK 4.2.1 Encoder and Decoder Streams. 17 // The QPACK receive stream is peer initiated and is read only. 18 class QUICHE_EXPORT QpackReceiveStream : public QuicStream { 19 public: 20 // Construct receive stream from pending stream, the |pending| object needs 21 // to be deleted after the construction. 22 QpackReceiveStream(PendingStream* pending, QuicSession* session, 23 QpackStreamReceiver* receiver); 24 QpackReceiveStream(const QpackReceiveStream&) = delete; 25 QpackReceiveStream& operator=(const QpackReceiveStream&) = delete; 26 ~QpackReceiveStream() override = default; 27 28 // Overriding QuicStream::OnStreamReset to make sure QPACK stream is never 29 // closed before connection. 30 void OnStreamReset(const QuicRstStreamFrame& frame) override; 31 32 // Implementation of QuicStream. 33 void OnDataAvailable() override; 34 35 // Number of incoming bytes that have been consumed on this stream. NumBytesConsumed()36 QuicStreamOffset NumBytesConsumed() const { 37 return sequencer()->NumBytesConsumed(); 38 } 39 40 private: 41 QpackStreamReceiver* receiver_; 42 }; 43 44 } // namespace quic 45 46 #endif // QUICHE_QUIC_CORE_QPACK_QPACK_RECEIVE_STREAM_H_ 47