blob: 566bcc8f6f1f662bbf0f458269d964c1e587eef1 [file] [log] [blame]
renjietang96fc2282019-06-12 09:51:35 -07001// Copyright 2019 The Chromium Authors. All rights reserved.
renjietangfee2cc32019-04-05 11:32:07 -07002// 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
12namespace quic {
13
bnc1d774652019-07-22 10:06:56 -070014class QuicSession;
renjietangfee2cc32019-04-05 11:32:07 -070015
16// 3.2.1 Control Stream.
17// The send control stream is self initiated and is write only.
18class 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.
renjietang7498c8c2019-07-02 19:28:42 -070022 explicit QuicSendControlStream(QuicStreamId id,
bnc1d774652019-07-22 10:06:56 -070023 QuicSession* session,
renjietang7498c8c2019-07-02 19:28:42 -070024 uint64_t max_inbound_header_list_size);
renjietangfee2cc32019-04-05 11:32:07 -070025 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
renjietang7498c8c2019-07-02 19:28:42 -070033 // 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);
renjietangfee2cc32019-04-05 11:32:07 -070039
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_;
renjietang7498c8c2019-07-02 19:28:42 -070048
49 // Max inbound header list size that will send as setting.
50 const uint64_t max_inbound_header_list_size_;
renjietangfee2cc32019-04-05 11:32:07 -070051};
52
53} // namespace quic
54
55#endif // QUICHE_QUIC_CORE_HTTP_QUIC_SEND_CONTROL_STREAM_H_