• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 The Chromium Authors
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 NET_QUIC_QUIC_SESSION_ALIAS_KEY_H_
6 #define NET_QUIC_QUIC_SESSION_ALIAS_KEY_H_
7 
8 #include "net/base/net_export.h"
9 #include "net/quic/quic_session_key.h"
10 #include "url/scheme_host_port.h"
11 
12 namespace net {
13 
14 // This class encompasses `destination()` and `server_id()`.
15 // `destination()` is a SchemeHostPort which is resolved
16 // and a quic::QuicConnection is made to the resulting IP address.
17 // `server_id()` identifies the origin of the request,
18 // the crypto handshake advertises `server_id().host()` to the server,
19 // and the certificate is also matched against `server_id().host()`.
20 class NET_EXPORT_PRIVATE QuicSessionAliasKey {
21  public:
22   QuicSessionAliasKey() = default;
23   QuicSessionAliasKey(url::SchemeHostPort destination,
24                       QuicSessionKey session_key);
25   ~QuicSessionAliasKey() = default;
26 
27   QuicSessionAliasKey(const QuicSessionAliasKey& other) = default;
28   QuicSessionAliasKey& operator=(const QuicSessionAliasKey& other) = default;
29 
30   QuicSessionAliasKey(QuicSessionAliasKey&& other) = default;
31   QuicSessionAliasKey& operator=(QuicSessionAliasKey&& other) = default;
32 
33   // Needed to be an element of std::set.
34   bool operator<(const QuicSessionAliasKey& other) const;
35   bool operator==(const QuicSessionAliasKey& other) const;
36 
destination()37   const url::SchemeHostPort& destination() const { return destination_; }
server_id()38   const quic::QuicServerId& server_id() const {
39     return session_key_.server_id();
40   }
session_key()41   const QuicSessionKey& session_key() const { return session_key_; }
42 
43  private:
44   url::SchemeHostPort destination_;
45   QuicSessionKey session_key_;
46 };
47 
48 }  // namespace net
49 
50 #endif  // NET_QUIC_QUIC_SESSION_ALIAS_KEY_H_
51