Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / net / quic / quic_server_id.h
blob7236bfc88b89376b844b02a13a2eed4b840fcd8d
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.
5 #ifndef NET_QUIC_QUIC_SERVER_ID_H_
6 #define NET_QUIC_QUIC_SERVER_ID_H_
8 #include <string>
10 #include "net/base/host_port_pair.h"
11 #include "net/base/net_export.h"
12 #include "net/base/privacy_mode.h"
14 namespace net {
16 // The id used to identify sessions. Includes the hostname, port, scheme and
17 // privacy_mode.
18 class NET_EXPORT_PRIVATE QuicServerId {
19 public:
20 QuicServerId();
21 QuicServerId(const HostPortPair& host_port_pair,
22 bool is_https,
23 PrivacyMode privacy_mode);
24 QuicServerId(const std::string& host,
25 uint16 port,
26 bool is_https);
27 QuicServerId(const std::string& host,
28 uint16 port,
29 bool is_https,
30 PrivacyMode privacy_mode);
31 ~QuicServerId();
33 // Needed to be an element of std::set.
34 bool operator<(const QuicServerId& other) const;
35 bool operator==(const QuicServerId& other) const;
37 // ToString() will convert the QuicServerId to "scheme:hostname:port" or
38 // "scheme:hostname:port/private". "scheme" would either be "http" or "https"
39 // based on |is_https|.
40 std::string ToString() const;
42 // Used in Chromium, but not in the server.
43 const HostPortPair& host_port_pair() const { return host_port_pair_; }
45 const std::string& host() const { return host_port_pair_.host(); }
47 uint16 port() const { return host_port_pair_.port(); }
49 bool is_https() const { return is_https_; }
51 PrivacyMode privacy_mode() const { return privacy_mode_; }
53 private:
54 HostPortPair host_port_pair_;
55 bool is_https_;
56 PrivacyMode privacy_mode_;
59 } // namespace net
61 #endif // NET_QUIC_QUIC_SERVER_ID_H_