blob: eee95c131cb4a3c471f9495336eea005ff460bcf [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// Copyright (c) 2018 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_DECODER_STREAM_SENDER_H_
6#define QUICHE_QUIC_CORE_QPACK_QPACK_DECODER_STREAM_SENDER_H_
7
8#include <cstdint>
9
10#include "net/third_party/quiche/src/quic/core/qpack/qpack_instruction_encoder.h"
renjietangc2aa5cb2019-06-20 12:22:53 -070011#include "net/third_party/quiche/src/quic/core/qpack/qpack_stream_sender_delegate.h"
QUICHE teama6ef0a62019-03-07 20:34:33 -050012#include "net/third_party/quiche/src/quic/core/quic_types.h"
13#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
QUICHE teama6ef0a62019-03-07 20:34:33 -050014
15namespace quic {
16
bnc6b1fc8a2019-10-11 17:17:14 -070017// This class serializes instructions for transmission on the decoder stream.
18// Serialized instructions are buffered until Flush() is called.
QUICHE teama6ef0a62019-03-07 20:34:33 -050019class QUIC_EXPORT_PRIVATE QpackDecoderStreamSender {
20 public:
renjietang8a2df8f2019-08-07 10:43:52 -070021 QpackDecoderStreamSender();
QUICHE teama6ef0a62019-03-07 20:34:33 -050022 QpackDecoderStreamSender(const QpackDecoderStreamSender&) = delete;
23 QpackDecoderStreamSender& operator=(const QpackDecoderStreamSender&) = delete;
24
bnc6b1fc8a2019-10-11 17:17:14 -070025 // Methods for serializing and buffering instructions, see
QUICHE teama6ef0a62019-03-07 20:34:33 -050026 // https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#rfc.section.5.3
27
28 // 5.3.1 Insert Count Increment
29 void SendInsertCountIncrement(uint64_t increment);
30 // 5.3.2 Header Acknowledgement
31 void SendHeaderAcknowledgement(QuicStreamId stream_id);
32 // 5.3.3 Stream Cancellation
33 void SendStreamCancellation(QuicStreamId stream_id);
34
bnc6b1fc8a2019-10-11 17:17:14 -070035 // Writes all buffered instructions on the decoder stream.
36 void Flush();
37
renjietang8a2df8f2019-08-07 10:43:52 -070038 // delegate must be set if dynamic table capacity is not zero.
39 void set_qpack_stream_sender_delegate(QpackStreamSenderDelegate* delegate) {
40 delegate_ = delegate;
41 }
42
QUICHE teama6ef0a62019-03-07 20:34:33 -050043 private:
renjietang8a2df8f2019-08-07 10:43:52 -070044 QpackStreamSenderDelegate* delegate_;
QUICHE teama6ef0a62019-03-07 20:34:33 -050045 QpackInstructionEncoder instruction_encoder_;
bnc6b1fc8a2019-10-11 17:17:14 -070046 std::string buffer_;
QUICHE teama6ef0a62019-03-07 20:34:33 -050047};
48
49} // namespace quic
50
51#endif // QUICHE_QUIC_CORE_QPACK_QPACK_DECODER_STREAM_SENDER_H_