| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_QUIC_QUIC_SESSION_KEY_H_ | 5 #ifndef NET_QUIC_QUIC_SESSION_KEY_H_ |
| 6 #define NET_QUIC_QUIC_SESSION_KEY_H_ | 6 #define NET_QUIC_QUIC_SESSION_KEY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" |
| 11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 #include "net/base/privacy_mode.h" | 12 #include "net/base/privacy_mode.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 // The key used to identify sessions. Includes the hostname, port, and scheme. | 16 // The id used to identify sessions. Includes the hostname, port, scheme and |
| 17 class NET_EXPORT_PRIVATE QuicSessionKey { | 17 // privacy_mode. |
| 18 class NET_EXPORT_PRIVATE QuicServerId { |
| 18 public: | 19 public: |
| 19 QuicSessionKey(); | 20 QuicServerId(); |
| 20 QuicSessionKey(const HostPortPair& host_port_pair, | 21 QuicServerId(const HostPortPair& host_port_pair, |
| 21 bool is_https, | 22 bool is_https, |
| 22 PrivacyMode privacy_mode); | 23 PrivacyMode privacy_mode); |
| 23 QuicSessionKey(const std::string& host, | 24 QuicServerId(const std::string& host, |
| 24 uint16 port, | 25 uint16 port, |
| 25 bool is_https, | 26 bool is_https, |
| 26 PrivacyMode privacy_mode); | 27 PrivacyMode privacy_mode); |
| 27 ~QuicSessionKey(); | 28 ~QuicServerId(); |
| 28 | 29 |
| 29 // Needed to be an element of std::set. | 30 // Needed to be an element of std::set. |
| 30 bool operator<(const QuicSessionKey& other) const; | 31 bool operator<(const QuicServerId& other) const; |
| 31 bool operator==(const QuicSessionKey& other) const; | 32 bool operator==(const QuicServerId& other) const; |
| 32 | 33 |
| 33 // ToString() will convert the QuicSessionKey to "scheme:hostname:port". | 34 // ToString() will convert the QuicServerId to "scheme:hostname:port" or |
| 34 // "scheme" would either be "http" or "https" based on |is_https|. | 35 // "scheme:hostname:port/private". "scheme" would either be "http" or "https" |
| 36 // based on |is_https|. |
| 35 std::string ToString() const; | 37 std::string ToString() const; |
| 36 | 38 |
| 37 const HostPortPair& host_port_pair() const { | 39 const HostPortPair& host_port_pair() const { return host_port_pair_; } |
| 38 return host_port_pair_; | |
| 39 } | |
| 40 | 40 |
| 41 const std::string& host() const { return host_port_pair_.host(); } | 41 const std::string& host() const { return host_port_pair_.host(); } |
| 42 | 42 |
| 43 uint16 port() const { return host_port_pair_.port(); } | 43 uint16 port() const { return host_port_pair_.port(); } |
| 44 | 44 |
| 45 bool is_https() const { return is_https_; } | 45 bool is_https() const { return is_https_; } |
| 46 | 46 |
| 47 PrivacyMode privacy_mode() const { return privacy_mode_; } | 47 PrivacyMode privacy_mode() const { return privacy_mode_; } |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 HostPortPair host_port_pair_; | 50 HostPortPair host_port_pair_; |
| 51 bool is_https_; | 51 bool is_https_; |
| 52 PrivacyMode privacy_mode_; | 52 PrivacyMode privacy_mode_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace net | 55 } // namespace net |
| 56 | 56 |
| 57 #endif // NET_QUIC_QUIC_SESSION_KEY_H_ | 57 #endif // NET_QUIC_QUIC_SESSION_KEY_H_ |
| OLD | NEW |