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_SESSION_KEY_H_ | 5 #ifndef NET_QUIC_QUIC_SESSION_KEY_H_ |
6 #define NET_QUIC_QUIC_SESSION_KEY_H_ | 6 #define NET_QUIC_QUIC_SESSION_KEY_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 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 // The key used to identify sessions. Includes the hostname, port, and scheme. | 15 // The key used to identify sessions. Includes the hostname, port, and scheme. |
16 class NET_EXPORT_PRIVATE QuicSessionKey { | 16 class NET_EXPORT_PRIVATE QuicSessionKey { |
17 public: | 17 public: |
18 QuicSessionKey(); | 18 QuicSessionKey(); |
19 QuicSessionKey(const HostPortPair& host_port_pair, bool is_https); | 19 QuicSessionKey(const HostPortPair& host_port_pair, bool is_https); |
20 QuicSessionKey(const std::string& host, uint16 port, bool is_https); | |
20 ~QuicSessionKey(); | 21 ~QuicSessionKey(); |
21 | 22 |
22 // Needed to be an element of std::set. | 23 // Needed to be an element of std::set. |
23 bool operator<(const QuicSessionKey &other) const; | 24 bool operator<(const QuicSessionKey &other) const; |
24 bool operator==(const QuicSessionKey &other) const; | 25 bool operator==(const QuicSessionKey &other) const; |
25 | 26 |
26 // ToString() will convert the QuicSessionKey to "scheme:hostname:port". | 27 // ToString() will convert the QuicSessionKey to "scheme:hostname:port". |
27 // "scheme" would either be "http" or "https" based on |is_https|. | 28 // "scheme" would either be "http" or "https" based on |is_https|. |
28 std::string ToString() const; | 29 std::string ToString() const; |
29 | 30 |
30 const HostPortPair& host_port_pair() const { | 31 const HostPortPair& host_port_pair() const { |
wtc
2014/03/17 17:13:21
Nit: Please see if we can get rid of the host_port
ramant (doing other things)
2014/03/17 18:27:36
It is being used by quic_stream_factory. Will leav
wtc
2014/03/18 23:50:13
Thanks for the reply. Please keep the getter metho
| |
31 return host_port_pair_; | 32 return host_port_pair_; |
32 } | 33 } |
33 | 34 |
35 const std::string& host() const { return host_port_pair_.host(); } | |
36 | |
37 uint16 port() const { return host_port_pair_.port(); } | |
38 | |
34 bool is_https() const { return is_https_; } | 39 bool is_https() const { return is_https_; } |
35 | 40 |
36 private: | 41 private: |
37 HostPortPair host_port_pair_; | 42 HostPortPair host_port_pair_; |
38 bool is_https_; | 43 bool is_https_; |
39 }; | 44 }; |
40 | 45 |
41 } // namespace net | 46 } // namespace net |
42 | 47 |
43 #endif // NET_QUIC_QUIC_SESSION_KEY_H_ | 48 #endif // NET_QUIC_QUIC_SESSION_KEY_H_ |
OLD | NEW |