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 | #include "net/third_party/quiche/src/quic/core/qpack/qpack_decoder_stream_sender.h" |
| 6 | |
| 7 | #include <cstddef> |
| 8 | #include <limits> |
vasilvv | 872e7a3 | 2019-03-12 16:42:44 -0700 | [diff] [blame] | 9 | #include <string> |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 10 | |
| 11 | #include "net/third_party/quiche/src/quic/core/qpack/qpack_constants.h" |
| 12 | #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 13 | |
| 14 | namespace quic { |
| 15 | |
renjietang | c2aa5cb | 2019-06-20 12:22:53 -0700 | [diff] [blame] | 16 | QpackDecoderStreamSender::QpackDecoderStreamSender( |
| 17 | QpackStreamSenderDelegate* delegate) |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 18 | : delegate_(delegate) { |
| 19 | DCHECK(delegate_); |
| 20 | } |
| 21 | |
| 22 | void QpackDecoderStreamSender::SendInsertCountIncrement(uint64_t increment) { |
bnc | 28bb06c | 2019-07-17 05:21:10 -0700 | [diff] [blame] | 23 | values_.varint = increment; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 24 | |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 25 | std::string output; |
bnc | 28bb06c | 2019-07-17 05:21:10 -0700 | [diff] [blame] | 26 | instruction_encoder_.Encode(InsertCountIncrementInstruction(), values_, |
| 27 | &output); |
renjietang | c2aa5cb | 2019-06-20 12:22:53 -0700 | [diff] [blame] | 28 | delegate_->WriteStreamData(output); |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | void QpackDecoderStreamSender::SendHeaderAcknowledgement( |
| 32 | QuicStreamId stream_id) { |
bnc | 28bb06c | 2019-07-17 05:21:10 -0700 | [diff] [blame] | 33 | values_.varint = stream_id; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 34 | |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 35 | std::string output; |
bnc | 28bb06c | 2019-07-17 05:21:10 -0700 | [diff] [blame] | 36 | instruction_encoder_.Encode(HeaderAcknowledgementInstruction(), values_, |
| 37 | &output); |
renjietang | c2aa5cb | 2019-06-20 12:22:53 -0700 | [diff] [blame] | 38 | delegate_->WriteStreamData(output); |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | void QpackDecoderStreamSender::SendStreamCancellation(QuicStreamId stream_id) { |
bnc | 28bb06c | 2019-07-17 05:21:10 -0700 | [diff] [blame] | 42 | values_.varint = stream_id; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 43 | |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 44 | std::string output; |
bnc | 28bb06c | 2019-07-17 05:21:10 -0700 | [diff] [blame] | 45 | instruction_encoder_.Encode(StreamCancellationInstruction(), values_, |
| 46 | &output); |
renjietang | c2aa5cb | 2019-06-20 12:22:53 -0700 | [diff] [blame] | 47 | delegate_->WriteStreamData(output); |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | } // namespace quic |