blob: 013200145850278b652251213448a4f24a7121ac [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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>
vasilvv872e7a32019-03-12 16:42:44 -07009#include <string>
QUICHE teama6ef0a62019-03-07 20:34:33 -050010
QUICHE team5be974e2020-12-29 18:35:24 -050011#include "quic/platform/api/quic_export.h"
QUICHE teama6ef0a62019-03-07 20:34:33 -050012
13namespace quic {
14
15// The id used to identify sessions. Includes the hostname, port, scheme and
16// privacy_mode.
17class QUIC_EXPORT_PRIVATE QuicServerId {
18 public:
19 QuicServerId();
vasilvvc48c8712019-03-11 13:38:16 -070020 QuicServerId(const std::string& host, uint16_t port);
21 QuicServerId(const std::string& host,
QUICHE teama6ef0a62019-03-07 20:34:33 -050022 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
vasilvvc48c8712019-03-11 13:38:16 -070030 const std::string& host() const { return host_; }
QUICHE teama6ef0a62019-03-07 20:34:33 -050031
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:
vasilvvc48c8712019-03-11 13:38:16 -070039 std::string host_;
QUICHE teama6ef0a62019-03-07 20:34:33 -050040 uint16_t port_;
41 bool privacy_mode_enabled_;
42};
43
44} // namespace quic
45
46#endif // QUICHE_QUIC_CORE_QUIC_SERVER_ID_H_