blob: 0952159189843e88a8ea69c1b5963d28fd5db9a2 [file] [log] [blame]
dschinazi1c99fcf2019-12-13 11:54:22 -08001// Copyright 2019 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_MASQUE_MASQUE_ENCAPSULATED_CLIENT_SESSION_H_
6#define QUICHE_QUIC_MASQUE_MASQUE_ENCAPSULATED_CLIENT_SESSION_H_
7
QUICHE team5be974e2020-12-29 18:35:24 -05008#include "quic/core/http/quic_spdy_client_session.h"
9#include "quic/masque/masque_client_session.h"
10#include "quic/platform/api/quic_export.h"
dschinazi1c99fcf2019-12-13 11:54:22 -080011
12namespace quic {
13
14// QUIC client session for QUIC encapsulated in MASQUE. This client session is
15// maintained end-to-end between the client and the web-server (the MASQUE
16// session does not have access to the cryptographic keys for the end-to-end
17// session), but its packets are sent encapsulated inside DATAGRAM frames in a
18// MASQUE session, as opposed to regular QUIC packets. Multiple encapsulated
19// sessions can coexist inside a MASQUE session.
20class QUIC_NO_EXPORT MasqueEncapsulatedClientSession
21 : public QuicSpdyClientSession,
22 public MasqueClientSession::EncapsulatedClientSession {
23 public:
24 // Takes ownership of |connection|, but not of |crypto_config| or
25 // |push_promise_index| or |masque_client_session|. All pointers must be
26 // non-null. Caller must ensure that |push_promise_index| and
27 // |masque_client_session| stay valid for the lifetime of the newly created
28 // MasqueEncapsulatedClientSession.
29 MasqueEncapsulatedClientSession(
30 const QuicConfig& config,
31 const ParsedQuicVersionVector& supported_versions,
32 QuicConnection* connection,
33 const QuicServerId& server_id,
34 QuicCryptoClientConfig* crypto_config,
35 QuicClientPushPromiseIndex* push_promise_index,
36 MasqueClientSession* masque_client_session);
37
38 // Disallow copy and assign.
39 MasqueEncapsulatedClientSession(const MasqueEncapsulatedClientSession&) =
40 delete;
41 MasqueEncapsulatedClientSession& operator=(
42 const MasqueEncapsulatedClientSession&) = delete;
43
44 // From MasqueClientSession::EncapsulatedClientSession.
vasilvv3049b2b2020-10-08 08:18:31 -070045 void ProcessPacket(absl::string_view packet,
dschinazi1c99fcf2019-12-13 11:54:22 -080046 QuicSocketAddress server_address) override;
dschinazida88cd12021-02-25 11:44:05 -080047 void CloseConnection(
48 QuicErrorCode error,
49 const std::string& details,
50 ConnectionCloseBehavior connection_close_behavior) override;
dschinazi1c99fcf2019-12-13 11:54:22 -080051
52 // From QuicSession.
53 void OnConnectionClosed(const QuicConnectionCloseFrame& frame,
54 ConnectionCloseSource source) override;
55
56 private:
57 MasqueClientSession* masque_client_session_; // Unowned.
58};
59
60} // namespace quic
61
62#endif // QUICHE_QUIC_MASQUE_MASQUE_ENCAPSULATED_CLIENT_SESSION_H_