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