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