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_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" |
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/core/quic_types.h" |
| 13 | #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 14 | |
| 15 | namespace quic { |
| 16 | |
bnc | 6b1fc8a | 2019-10-11 17:17:14 -0700 | [diff] [blame] | 17 | // This class serializes instructions for transmission on the decoder stream. |
| 18 | // Serialized instructions are buffered until Flush() is called. |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 19 | class QUIC_EXPORT_PRIVATE QpackDecoderStreamSender { |
| 20 | public: |
renjietang | 8a2df8f | 2019-08-07 10:43:52 -0700 | [diff] [blame] | 21 | QpackDecoderStreamSender(); |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 22 | QpackDecoderStreamSender(const QpackDecoderStreamSender&) = delete; |
| 23 | QpackDecoderStreamSender& operator=(const QpackDecoderStreamSender&) = delete; |
| 24 | |
bnc | 6b1fc8a | 2019-10-11 17:17:14 -0700 | [diff] [blame] | 25 | // Methods for serializing and buffering instructions, see |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 26 | // 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 | |
bnc | 6b1fc8a | 2019-10-11 17:17:14 -0700 | [diff] [blame] | 35 | // Writes all buffered instructions on the decoder stream. |
| 36 | void Flush(); |
| 37 | |
renjietang | 8a2df8f | 2019-08-07 10:43:52 -0700 | [diff] [blame] | 38 | // 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 team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 43 | private: |
renjietang | 8a2df8f | 2019-08-07 10:43:52 -0700 | [diff] [blame] | 44 | QpackStreamSenderDelegate* delegate_; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 45 | QpackInstructionEncoder instruction_encoder_; |
bnc | 6b1fc8a | 2019-10-11 17:17:14 -0700 | [diff] [blame] | 46 | std::string buffer_; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | } // namespace quic |
| 50 | |
| 51 | #endif // QUICHE_QUIC_CORE_QPACK_QPACK_DECODER_STREAM_SENDER_H_ |