blob: 7fd02b495f6178788632303816efcb0a06bc893e [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_RECEIVE_CONTROL_STREAM_H_
6#define QUICHE_QUIC_CORE_HTTP_QUIC_RECEIVE_CONTROL_STREAM_H_
7
8#include "net/third_party/quiche/src/quic/core/http/http_decoder.h"
9#include "net/third_party/quiche/src/quic/core/quic_stream.h"
bnca2b13be2019-07-31 12:04:20 -070010#include "net/third_party/quiche/src/quic/core/quic_types.h"
renjietangfee2cc32019-04-05 11:32:07 -070011#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
12
13namespace quic {
14
15class QuicSpdySession;
16
17// 3.2.1 Control Stream.
18// The receive control stream is peer initiated and is read only.
bnc17c433b2020-03-30 11:15:27 -070019class QUIC_EXPORT_PRIVATE QuicReceiveControlStream
20 : public QuicStream,
21 public HttpDecoder::Visitor {
renjietangfee2cc32019-04-05 11:32:07 -070022 public:
bncb4e7b992020-01-21 18:36:14 -080023 explicit QuicReceiveControlStream(PendingStream* pending,
24 QuicSpdySession* spdy_session);
renjietangfee2cc32019-04-05 11:32:07 -070025 QuicReceiveControlStream(const QuicReceiveControlStream&) = delete;
26 QuicReceiveControlStream& operator=(const QuicReceiveControlStream&) = delete;
27 ~QuicReceiveControlStream() override;
28
29 // Overriding QuicStream::OnStreamReset to make sure control stream is never
30 // closed before connection.
31 void OnStreamReset(const QuicRstStreamFrame& frame) override;
32
33 // Implementation of QuicStream.
34 void OnDataAvailable() override;
35
bnc17c433b2020-03-30 11:15:27 -070036 // HttpDecoderVisitor implementation.
37 void OnError(HttpDecoder* decoder) override;
38 bool OnCancelPushFrame(const CancelPushFrame& frame) override;
39 bool OnMaxPushIdFrame(const MaxPushIdFrame& frame) override;
40 bool OnGoAwayFrame(const GoAwayFrame& frame) override;
41 bool OnSettingsFrameStart(QuicByteCount header_length) override;
42 bool OnSettingsFrame(const SettingsFrame& frame) override;
43 bool OnDataFrameStart(QuicByteCount header_length,
44 QuicByteCount payload_length) override;
45 bool OnDataFramePayload(quiche::QuicheStringPiece payload) override;
46 bool OnDataFrameEnd() override;
47 bool OnHeadersFrameStart(QuicByteCount header_length,
48 QuicByteCount payload_length) override;
49 bool OnHeadersFramePayload(quiche::QuicheStringPiece payload) override;
50 bool OnHeadersFrameEnd() override;
51 bool OnPushPromiseFrameStart(QuicByteCount header_length) override;
52 bool OnPushPromiseFramePushId(PushId push_id,
53 QuicByteCount push_id_length,
54 QuicByteCount header_block_length) override;
55 bool OnPushPromiseFramePayload(quiche::QuicheStringPiece payload) override;
56 bool OnPushPromiseFrameEnd() override;
57 bool OnPriorityUpdateFrameStart(QuicByteCount header_length) override;
58 bool OnPriorityUpdateFrame(const PriorityUpdateFrame& frame) override;
59 bool OnUnknownFrameStart(uint64_t frame_type,
60 QuicByteCount header_length,
61 QuicByteCount payload_length) override;
62 bool OnUnknownFramePayload(quiche::QuicheStringPiece payload) override;
63 bool OnUnknownFrameEnd() override;
64
renjietang3a1bb802019-06-11 10:42:41 -070065 void SetUnblocked() { sequencer()->SetUnblocked(); }
66
bncb4e7b992020-01-21 18:36:14 -080067 QuicSpdySession* spdy_session() { return spdy_session_; }
68
renjietangfee2cc32019-04-05 11:32:07 -070069 private:
bnc17c433b2020-03-30 11:15:27 -070070 void OnWrongFrame(quiche::QuicheStringPiece frame_type);
renjietang7498c8c2019-07-02 19:28:42 -070071
bnc03401022019-07-15 15:38:46 -070072 // False until a SETTINGS frame is received.
73 bool settings_frame_received_;
renjietangfee2cc32019-04-05 11:32:07 -070074
bnca9bb4692019-07-09 17:29:48 -070075 HttpDecoder decoder_;
bncb4e7b992020-01-21 18:36:14 -080076 QuicSpdySession* const spdy_session_;
renjietangfee2cc32019-04-05 11:32:07 -070077};
78
79} // namespace quic
80
81#endif // QUICHE_QUIC_CORE_HTTP_QUIC_RECEIVE_CONTROL_STREAM_H_