blob: 75ccc1f58ec23f3addf92167e3ba41c7a3bdf805 [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
8#include "net/third_party/quiche/src/quic/core/http/quic_spdy_client_session.h"
9#include "net/third_party/quiche/src/quic/masque/masque_client_session.h"
10#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
11
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.
45 void ProcessPacket(quiche::QuicheStringPiece packet,
46 QuicSocketAddress server_address) override;
47
48 // From QuicSession.
49 void OnConnectionClosed(const QuicConnectionCloseFrame& frame,
50 ConnectionCloseSource source) override;
51
52 private:
53 MasqueClientSession* masque_client_session_; // Unowned.
54};
55
56} // namespace quic
57
58#endif // QUICHE_QUIC_MASQUE_MASQUE_ENCAPSULATED_CLIENT_SESSION_H_