| 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_SERVER_ID_H_ | 5 #ifndef NET_QUIC_QUIC_SERVER_ID_H_ |
| 6 #define NET_QUIC_QUIC_SERVER_ID_H_ | 6 #define NET_QUIC_QUIC_SERVER_ID_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 id used to identify sessions. Includes the hostname, port, scheme and | 16 // The id used to identify sessions. Includes the hostname, port, scheme and |
| 17 // privacy_mode. | 17 // privacy_mode. |
| 18 class NET_EXPORT_PRIVATE QuicServerId { | 18 class NET_EXPORT_PRIVATE QuicServerId { |
| 19 public: | 19 public: |
| 20 QuicServerId(); | 20 QuicServerId(); |
| 21 QuicServerId(const HostPortPair& host_port_pair, | 21 QuicServerId(const HostPortPair& host_port_pair, |
| 22 bool is_https, | |
| 23 PrivacyMode privacy_mode); | 22 PrivacyMode privacy_mode); |
| 23 QuicServerId(const std::string& host, uint16 port); |
| 24 QuicServerId(const std::string& host, | 24 QuicServerId(const std::string& host, |
| 25 uint16 port, | 25 uint16 port, |
| 26 bool is_https); | |
| 27 QuicServerId(const std::string& host, | |
| 28 uint16 port, | |
| 29 bool is_https, | |
| 30 PrivacyMode privacy_mode); | 26 PrivacyMode privacy_mode); |
| 31 ~QuicServerId(); | 27 ~QuicServerId(); |
| 32 | 28 |
| 33 // Needed to be an element of std::set. | 29 // Needed to be an element of std::set. |
| 34 bool operator<(const QuicServerId& other) const; | 30 bool operator<(const QuicServerId& other) const; |
| 35 bool operator==(const QuicServerId& other) const; | 31 bool operator==(const QuicServerId& other) const; |
| 36 | 32 |
| 37 // Creates a QuicServerId from a string formatted in same manner as | 33 // Creates a QuicServerId from a string formatted in same manner as |
| 38 // ToString(). | 34 // ToString(). |
| 39 static QuicServerId FromString(const std::string& str); | 35 static QuicServerId FromString(const std::string& str); |
| 40 | 36 |
| 41 // ToString() will convert the QuicServerId to "scheme:hostname:port" or | 37 // ToString() will convert the QuicServerId to "scheme:hostname:port" or |
| 42 // "scheme:hostname:port/private". "scheme" would either be "http" or "https" | 38 // "scheme:hostname:port/private". "scheme" will be "https". |
| 43 // based on |is_https|. | |
| 44 std::string ToString() const; | 39 std::string ToString() const; |
| 45 | 40 |
| 46 // Used in Chromium, but not in the server. | 41 // Used in Chromium, but not in the server. |
| 47 const HostPortPair& host_port_pair() const { return host_port_pair_; } | 42 const HostPortPair& host_port_pair() const { return host_port_pair_; } |
| 48 | 43 |
| 49 const std::string& host() const { return host_port_pair_.host(); } | 44 const std::string& host() const { return host_port_pair_.host(); } |
| 50 | 45 |
| 51 uint16 port() const { return host_port_pair_.port(); } | 46 uint16 port() const { return host_port_pair_.port(); } |
| 52 | 47 |
| 53 bool is_https() const { return is_https_; } | |
| 54 | |
| 55 PrivacyMode privacy_mode() const { return privacy_mode_; } | 48 PrivacyMode privacy_mode() const { return privacy_mode_; } |
| 56 | 49 |
| 57 private: | 50 private: |
| 58 HostPortPair host_port_pair_; | 51 HostPortPair host_port_pair_; |
| 59 bool is_https_; | |
| 60 PrivacyMode privacy_mode_; | 52 PrivacyMode privacy_mode_; |
| 61 }; | 53 }; |
| 62 | 54 |
| 63 } // namespace net | 55 } // namespace net |
| 64 | 56 |
| 65 #endif // NET_QUIC_QUIC_SERVER_ID_H_ | 57 #endif // NET_QUIC_QUIC_SERVER_ID_H_ |
| OLD | NEW |