renjietang | 96fc228 | 2019-06-12 09:51:35 -0700 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors. All rights reserved. |
renjietang | fee2cc3 | 2019-04-05 11:32:07 -0700 | [diff] [blame] | 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_HTTP_QUIC_SEND_CONTROL_STREAM_H_ |
| 6 | #define QUICHE_QUIC_CORE_HTTP_QUIC_SEND_CONTROL_STREAM_H_ |
| 7 | |
| 8 | #include "net/third_party/quiche/src/quic/core/http/http_encoder.h" |
| 9 | #include "net/third_party/quiche/src/quic/core/quic_stream.h" |
| 10 | #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" |
| 11 | |
| 12 | namespace quic { |
| 13 | |
bnc | 1d77465 | 2019-07-22 10:06:56 -0700 | [diff] [blame] | 14 | class QuicSession; |
renjietang | fee2cc3 | 2019-04-05 11:32:07 -0700 | [diff] [blame] | 15 | |
| 16 | // 3.2.1 Control Stream. |
| 17 | // The send control stream is self initiated and is write only. |
| 18 | class QUIC_EXPORT_PRIVATE QuicSendControlStream : public QuicStream { |
| 19 | public: |
| 20 | // |session| can't be nullptr, and the ownership is not passed. The stream can |
| 21 | // only be accessed through the session. |
renjietang | 7498c8c | 2019-07-02 19:28:42 -0700 | [diff] [blame] | 22 | explicit QuicSendControlStream(QuicStreamId id, |
bnc | 1d77465 | 2019-07-22 10:06:56 -0700 | [diff] [blame] | 23 | QuicSession* session, |
renjietang | 7498c8c | 2019-07-02 19:28:42 -0700 | [diff] [blame] | 24 | uint64_t max_inbound_header_list_size); |
renjietang | fee2cc3 | 2019-04-05 11:32:07 -0700 | [diff] [blame] | 25 | QuicSendControlStream(const QuicSendControlStream&) = delete; |
| 26 | QuicSendControlStream& operator=(const QuicSendControlStream&) = delete; |
| 27 | ~QuicSendControlStream() override = default; |
| 28 | |
| 29 | // Overriding QuicStream::OnStreamReset to make sure control stream is never |
| 30 | // closed before connection. |
| 31 | void OnStreamReset(const QuicRstStreamFrame& frame) override; |
| 32 | |
renjietang | 7498c8c | 2019-07-02 19:28:42 -0700 | [diff] [blame] | 33 | // Consult the Spdy session to construct Settings frame and sends it on this |
| 34 | // stream. Settings frame must be the first frame sent on this stream. |
| 35 | void SendSettingsFrame(); |
| 36 | |
| 37 | // Send |Priority| on this stream. It must be sent after settings. |
| 38 | void WritePriority(const PriorityFrame& priority); |
renjietang | fee2cc3 | 2019-04-05 11:32:07 -0700 | [diff] [blame] | 39 | |
| 40 | // The send control stream is write unidirectional, so this method should |
| 41 | // never be called. |
| 42 | void OnDataAvailable() override { QUIC_NOTREACHED(); } |
| 43 | |
| 44 | private: |
| 45 | HttpEncoder encoder_; |
| 46 | // Track if a settings frame is already sent. |
| 47 | bool settings_sent_; |
renjietang | 7498c8c | 2019-07-02 19:28:42 -0700 | [diff] [blame] | 48 | |
| 49 | // Max inbound header list size that will send as setting. |
| 50 | const uint64_t max_inbound_header_list_size_; |
renjietang | fee2cc3 | 2019-04-05 11:32:07 -0700 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | } // namespace quic |
| 54 | |
| 55 | #endif // QUICHE_QUIC_CORE_HTTP_QUIC_SEND_CONTROL_STREAM_H_ |