xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/http/quic_spdy_client_session_base.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2014 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_HTTP_QUIC_SPDY_CLIENT_SESSION_BASE_H_
6 #define QUICHE_QUIC_CORE_HTTP_QUIC_SPDY_CLIENT_SESSION_BASE_H_
7 
8 #include <string>
9 
10 #include "absl/container/flat_hash_map.h"
11 #include "quiche/quic/core/http/quic_spdy_session.h"
12 #include "quiche/quic/core/quic_crypto_client_stream.h"
13 #include "quiche/quic/platform/api/quic_export.h"
14 #include "quiche/spdy/core/http2_header_block.h"
15 
16 namespace quic {
17 
18 // Base class for all client-specific QuicSession subclasses.
19 class QUICHE_EXPORT QuicSpdyClientSessionBase
20     : public QuicSpdySession,
21       public QuicCryptoClientStream::ProofHandler {
22  public:
23   // Takes ownership of |connection|.
24   QuicSpdyClientSessionBase(QuicConnection* connection,
25                             QuicSession::Visitor* visitor,
26                             const QuicConfig& config,
27                             const ParsedQuicVersionVector& supported_versions);
28   QuicSpdyClientSessionBase(const QuicSpdyClientSessionBase&) = delete;
29   QuicSpdyClientSessionBase& operator=(const QuicSpdyClientSessionBase&) =
30       delete;
31 
32   ~QuicSpdyClientSessionBase() override;
33 
34   void OnConfigNegotiated() override;
35 
36   // Release headers stream's sequencer buffer if it's empty.
37   void OnStreamClosed(QuicStreamId stream_id) override;
38 
39   // Returns true if there are no active requests.
40   bool ShouldReleaseHeadersStreamSequencerBuffer() override;
41 
42   // Override to wait for all received responses to be consumed by application.
43   bool ShouldKeepConnectionAlive() const override;
44 
45   // Override to serialize the settings and pass it down to the handshaker.
46   bool OnSettingsFrame(const SettingsFrame& frame) override;
47 };
48 
49 }  // namespace quic
50 
51 #endif  // QUICHE_QUIC_CORE_HTTP_QUIC_SPDY_CLIENT_SESSION_BASE_H_
52