QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 1 | // 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" |
renjietang | c2aa5cb | 2019-06-20 12:22:53 -0700 | [diff] [blame] | 11 | #include "net/third_party/quiche/src/quic/core/qpack/qpack_stream_sender_delegate.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 12 | #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 | |
| 15 | namespace quic { |
| 16 | |
| 17 | // This class serializes instructions for transmission on the encoder stream. |
| 18 | class QUIC_EXPORT_PRIVATE QpackEncoderStreamSender { |
| 19 | public: |
renjietang | 8a2df8f | 2019-08-07 10:43:52 -0700 | [diff] [blame] | 20 | QpackEncoderStreamSender(); |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 21 | 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 | |
renjietang | 8a2df8f | 2019-08-07 10:43:52 -0700 | [diff] [blame] | 39 | // 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 team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 44 | private: |
renjietang | 8a2df8f | 2019-08-07 10:43:52 -0700 | [diff] [blame] | 45 | QpackStreamSenderDelegate* delegate_; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 46 | QpackInstructionEncoder instruction_encoder_; |
bnc | 28bb06c | 2019-07-17 05:21:10 -0700 | [diff] [blame] | 47 | QpackInstructionEncoder::Values values_; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | } // namespace quic |
| 51 | |
| 52 | #endif // QUICHE_QUIC_CORE_QPACK_QPACK_ENCODER_STREAM_SENDER_H_ |