blob: 653152df84bab7a4387f335348accce2a2be1c29 [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#include "net/third_party/quiche/src/quic/core/quic_server_id.h"
6
vasilvv872e7a32019-03-12 16:42:44 -07007#include <string>
QUICHE teama6ef0a62019-03-07 20:34:33 -05008#include <tuple>
9
10#include "net/third_party/quiche/src/quic/platform/api/quic_estimate_memory_usage.h"
QUICHE teama6ef0a62019-03-07 20:34:33 -050011
12namespace quic {
13
14QuicServerId::QuicServerId() : QuicServerId("", 0, false) {}
15
vasilvvc48c8712019-03-11 13:38:16 -070016QuicServerId::QuicServerId(const std::string& host, uint16_t port)
QUICHE teama6ef0a62019-03-07 20:34:33 -050017 : QuicServerId(host, port, false) {}
18
vasilvvc48c8712019-03-11 13:38:16 -070019QuicServerId::QuicServerId(const std::string& host,
QUICHE teama6ef0a62019-03-07 20:34:33 -050020 uint16_t port,
21 bool privacy_mode_enabled)
22 : host_(host), port_(port), privacy_mode_enabled_(privacy_mode_enabled) {}
23
24QuicServerId::~QuicServerId() {}
25
26bool QuicServerId::operator<(const QuicServerId& other) const {
27 return std::tie(port_, host_, privacy_mode_enabled_) <
28 std::tie(other.port_, other.host_, other.privacy_mode_enabled_);
29}
30
31bool QuicServerId::operator==(const QuicServerId& other) const {
32 return privacy_mode_enabled_ == other.privacy_mode_enabled_ &&
33 host_ == other.host_ && port_ == other.port_;
34}
35
36size_t QuicServerId::EstimateMemoryUsage() const {
37 return QuicEstimateMemoryUsage(host_);
38}
39
40} // namespace quic