QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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 QUICHE_QUIC_CORE_QUIC_SERVER_ID_H_ |
| 6 | #define QUICHE_QUIC_CORE_QUIC_SERVER_ID_H_ |
| 7 | |
| 8 | #include <cstdint> |
vasilvv | 872e7a3 | 2019-03-12 16:42:44 -0700 | [diff] [blame] | 9 | #include <string> |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 10 | |
QUICHE team | 5be974e | 2020-12-29 18:35:24 -0500 | [diff] [blame] | 11 | #include "quic/platform/api/quic_export.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 12 | |
| 13 | namespace quic { |
| 14 | |
| 15 | // The id used to identify sessions. Includes the hostname, port, scheme and |
| 16 | // privacy_mode. |
| 17 | class QUIC_EXPORT_PRIVATE QuicServerId { |
| 18 | public: |
| 19 | QuicServerId(); |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 20 | QuicServerId(const std::string& host, uint16_t port); |
| 21 | QuicServerId(const std::string& host, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 22 | uint16_t port, |
| 23 | bool privacy_mode_enabled); |
| 24 | ~QuicServerId(); |
| 25 | |
| 26 | // Needed to be an element of std::set. |
| 27 | bool operator<(const QuicServerId& other) const; |
| 28 | bool operator==(const QuicServerId& other) const; |
| 29 | |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 30 | const std::string& host() const { return host_; } |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 31 | |
| 32 | uint16_t port() const { return port_; } |
| 33 | |
| 34 | bool privacy_mode_enabled() const { return privacy_mode_enabled_; } |
| 35 | |
| 36 | size_t EstimateMemoryUsage() const; |
| 37 | |
| 38 | private: |
vasilvv | c48c871 | 2019-03-11 13:38:16 -0700 | [diff] [blame] | 39 | std::string host_; |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 40 | uint16_t port_; |
| 41 | bool privacy_mode_enabled_; |
| 42 | }; |
| 43 | |
| 44 | } // namespace quic |
| 45 | |
| 46 | #endif // QUICHE_QUIC_CORE_QUIC_SERVER_ID_H_ |