blob: 3c410d570b0282247a1965472c6e4a684e7da74a [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_ENCODER_STREAM_SENDER_H_
6#define QUICHE_QUIC_CORE_QPACK_QPACK_ENCODER_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/platform/api/quic_export.h"
13#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
14
15namespace quic {
16
17// This class serializes instructions for transmission on the encoder stream.
18class QUIC_EXPORT_PRIVATE QpackEncoderStreamSender {
19 public:
renjietang8a2df8f2019-08-07 10:43:52 -070020 QpackEncoderStreamSender();
QUICHE teama6ef0a62019-03-07 20:34:33 -050021 QpackEncoderStreamSender(const QpackEncoderStreamSender&) = delete;
22 QpackEncoderStreamSender& operator=(const QpackEncoderStreamSender&) = delete;
23
24 // Methods for sending instructions, see
25 // https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#rfc.section.5.2
26
27 // 5.2.1. Insert With Name Reference
28 void SendInsertWithNameReference(bool is_static,
29 uint64_t name_index,
30 QuicStringPiece value);
31 // 5.2.2. Insert Without Name Reference
32 void SendInsertWithoutNameReference(QuicStringPiece name,
33 QuicStringPiece value);
34 // 5.2.3. Duplicate
35 void SendDuplicate(uint64_t index);
36 // 5.2.4. Set Dynamic Table Capacity
37 void SendSetDynamicTableCapacity(uint64_t capacity);
38
renjietang8a2df8f2019-08-07 10:43:52 -070039 // delegate must be set if dynamic table capacity is not zero.
40 void set_qpack_stream_sender_delegate(QpackStreamSenderDelegate* delegate) {
41 delegate_ = delegate;
42 }
43
QUICHE teama6ef0a62019-03-07 20:34:33 -050044 private:
renjietang8a2df8f2019-08-07 10:43:52 -070045 QpackStreamSenderDelegate* delegate_;
QUICHE teama6ef0a62019-03-07 20:34:33 -050046 QpackInstructionEncoder instruction_encoder_;
bnc28bb06c2019-07-17 05:21:10 -070047 QpackInstructionEncoder::Values values_;
QUICHE teama6ef0a62019-03-07 20:34:33 -050048};
49
50} // namespace quic
51
52#endif // QUICHE_QUIC_CORE_QPACK_QPACK_ENCODER_STREAM_SENDER_H_