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 <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "net/base/host_port_pair.h" | 12 #include "net/base/host_port_pair.h" |
11 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
12 #include "net/base/privacy_mode.h" | 14 #include "net/base/privacy_mode.h" |
13 | 15 |
14 namespace net { | 16 namespace net { |
15 | 17 |
16 // The id used to identify sessions. Includes the hostname, port, scheme and | 18 // The id used to identify sessions. Includes the hostname, port, scheme and |
17 // privacy_mode. | 19 // privacy_mode. |
18 class NET_EXPORT_PRIVATE QuicServerId { | 20 class NET_EXPORT_PRIVATE QuicServerId { |
19 public: | 21 public: |
20 QuicServerId(); | 22 QuicServerId(); |
21 QuicServerId(const HostPortPair& host_port_pair, PrivacyMode privacy_mode); | 23 QuicServerId(const HostPortPair& host_port_pair, PrivacyMode privacy_mode); |
22 QuicServerId(const std::string& host, uint16 port); | 24 QuicServerId(const std::string& host, uint16_t port); |
23 QuicServerId(const std::string& host, uint16 port, PrivacyMode privacy_mode); | 25 QuicServerId(const std::string& host, |
| 26 uint16_t port, |
| 27 PrivacyMode privacy_mode); |
24 ~QuicServerId(); | 28 ~QuicServerId(); |
25 | 29 |
26 // Needed to be an element of std::set. | 30 // Needed to be an element of std::set. |
27 bool operator<(const QuicServerId& other) const; | 31 bool operator<(const QuicServerId& other) const; |
28 bool operator==(const QuicServerId& other) const; | 32 bool operator==(const QuicServerId& other) const; |
29 | 33 |
30 // Creates a QuicServerId from a string formatted in same manner as | 34 // Creates a QuicServerId from a string formatted in same manner as |
31 // ToString(). | 35 // ToString(). |
32 static QuicServerId FromString(const std::string& str); | 36 static QuicServerId FromString(const std::string& str); |
33 | 37 |
34 // ToString() will convert the QuicServerId to "scheme:hostname:port" or | 38 // ToString() will convert the QuicServerId to "scheme:hostname:port" or |
35 // "scheme:hostname:port/private". "scheme" will be "https". | 39 // "scheme:hostname:port/private". "scheme" will be "https". |
36 std::string ToString() const; | 40 std::string ToString() const; |
37 | 41 |
38 // Used in Chromium, but not in the server. | 42 // Used in Chromium, but not in the server. |
39 const HostPortPair& host_port_pair() const { return host_port_pair_; } | 43 const HostPortPair& host_port_pair() const { return host_port_pair_; } |
40 | 44 |
41 const std::string& host() const { return host_port_pair_.host(); } | 45 const std::string& host() const { return host_port_pair_.host(); } |
42 | 46 |
43 uint16 port() const { return host_port_pair_.port(); } | 47 uint16_t port() const { return host_port_pair_.port(); } |
44 | 48 |
45 PrivacyMode privacy_mode() const { return privacy_mode_; } | 49 PrivacyMode privacy_mode() const { return privacy_mode_; } |
46 | 50 |
47 private: | 51 private: |
48 HostPortPair host_port_pair_; | 52 HostPortPair host_port_pair_; |
49 PrivacyMode privacy_mode_; | 53 PrivacyMode privacy_mode_; |
50 }; | 54 }; |
51 | 55 |
52 } // namespace net | 56 } // namespace net |
53 | 57 |
54 #endif // NET_QUIC_QUIC_SERVER_ID_H_ | 58 #endif // NET_QUIC_QUIC_SERVER_ID_H_ |
OLD | NEW |