xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/tools/quic_simple_client_session.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 #ifndef QUICHE_QUIC_TOOLS_QUIC_SIMPLE_CLIENT_SESSION_H_
6 #define QUICHE_QUIC_TOOLS_QUIC_SIMPLE_CLIENT_SESSION_H_
7 
8 #include <functional>
9 #include <utility>
10 
11 #include "quiche/quic/core/http/quic_spdy_client_session.h"
12 #include "quiche/quic/tools/quic_client_base.h"
13 #include "quiche/quic/tools/quic_simple_client_stream.h"
14 #include "quiche/common/quiche_callbacks.h"
15 #include "quiche/spdy/core/http2_header_block.h"
16 
17 namespace quic {
18 
19 class QuicSimpleClientSession : public QuicSpdyClientSession {
20  public:
21   QuicSimpleClientSession(const QuicConfig& config,
22                           const ParsedQuicVersionVector& supported_versions,
23                           QuicConnection* connection,
24                           QuicClientBase::NetworkHelper* network_helper,
25                           const QuicServerId& server_id,
26                           QuicCryptoClientConfig* crypto_config,
27                           bool drop_response_body, bool enable_web_transport);
28 
29   QuicSimpleClientSession(const QuicConfig& config,
30                           const ParsedQuicVersionVector& supported_versions,
31                           QuicConnection* connection,
32                           QuicSession::Visitor* visitor,
33                           QuicClientBase::NetworkHelper* network_helper,
34                           const QuicServerId& server_id,
35                           QuicCryptoClientConfig* crypto_config,
36                           bool drop_response_body, bool enable_web_transport);
37 
38   std::unique_ptr<QuicSpdyClientStream> CreateClientStream() override;
39   WebTransportHttp3VersionSet LocallySupportedWebTransportVersions()
40       const override;
41   HttpDatagramSupport LocalHttpDatagramSupport() override;
42   void CreateContextForMultiPortPath(
43       std::unique_ptr<MultiPortPathContextObserver> context_observer) override;
44   void MigrateToMultiPortPath(
45       std::unique_ptr<QuicPathValidationContext> context) override;
drop_response_body()46   bool drop_response_body() const { return drop_response_body_; }
47 
set_on_interim_headers(quiche::MultiUseCallback<void (const spdy::Http2HeaderBlock &)> on_interim_headers)48   void set_on_interim_headers(
49       quiche::MultiUseCallback<void(const spdy::Http2HeaderBlock&)>
50           on_interim_headers) {
51     on_interim_headers_ = std::move(on_interim_headers);
52   }
53 
54  private:
55   quiche::MultiUseCallback<void(const spdy::Http2HeaderBlock&)>
56       on_interim_headers_;
57   QuicClientBase::NetworkHelper* network_helper_;
58   const bool drop_response_body_;
59   const bool enable_web_transport_;
60 };
61 
62 }  // namespace quic
63 
64 #endif  // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_CLIENT_SESSION_H_
65