chromium/net/dns/host_resolver_internal_result.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/dns/host_resolver_internal_result.h"

#include <map>
#include <memory>
#include <optional>
#include <ostream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/check_op.h"
#include "base/json/values_util.h"
#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "base/values.h"
#include "net/base/connection_endpoint_metadata.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/dns/https_record_rdata.h"
#include "net/dns/public/dns_query_type.h"
#include "url/url_canon.h"
#include "url/url_canon_stdstring.h"

namespace net {

namespace {

// base::Value keys
constexpr std::string_view kValueDomainNameKey =;
constexpr std::string_view kValueQueryTypeKey =;
constexpr std::string_view kValueTypeKey =;
constexpr std::string_view kValueSourceKey =;
constexpr std::string_view kValueTimedExpirationKey =;
constexpr std::string_view kValueEndpointsKey =;
constexpr std::string_view kValueStringsKey =;
constexpr std::string_view kValueHostsKey =;
constexpr std::string_view kValueMetadatasKey =;
constexpr std::string_view kValueMetadataWeightKey =;
constexpr std::string_view kValueMetadataValueKey =;
constexpr std::string_view kValueErrorKey =;
constexpr std::string_view kValueAliasTargetKey =;

// Returns `domain_name` as-is if it could not be canonicalized.
std::string MaybeCanonicalizeName(std::string domain_name) {}

base::Value EndpointMetadataPairToValue(
    const std::pair<HttpsRecordPriority, ConnectionEndpointMetadata>& pair) {}

std::optional<std::pair<HttpsRecordPriority, ConnectionEndpointMetadata>>
EndpointMetadataPairFromValue(const base::Value& value) {}

std::optional<DnsQueryType> QueryTypeFromValue(const base::Value& value) {}

base::Value TypeToValue(HostResolverInternalResult::Type type) {}

std::optional<HostResolverInternalResult::Type> TypeFromValue(
    const base::Value& value) {}

base::Value SourceToValue(HostResolverInternalResult::Source source) {}

std::optional<HostResolverInternalResult::Source> SourceFromValue(
    const base::Value& value) {}

}  // namespace

// static
std::unique_ptr<HostResolverInternalResult>
HostResolverInternalResult::FromValue(const base::Value& value) {}

const HostResolverInternalDataResult& HostResolverInternalResult::AsData()
    const {}

HostResolverInternalDataResult& HostResolverInternalResult::AsData() {}

const HostResolverInternalMetadataResult&
HostResolverInternalResult::AsMetadata() const {}

HostResolverInternalMetadataResult& HostResolverInternalResult::AsMetadata() {}

const HostResolverInternalErrorResult& HostResolverInternalResult::AsError()
    const {}

HostResolverInternalErrorResult& HostResolverInternalResult::AsError() {}

const HostResolverInternalAliasResult& HostResolverInternalResult::AsAlias()
    const {}

HostResolverInternalAliasResult& HostResolverInternalResult::AsAlias() {}

HostResolverInternalResult::HostResolverInternalResult(
    std::string domain_name,
    DnsQueryType query_type,
    std::optional<base::TimeTicks> expiration,
    std::optional<base::Time> timed_expiration,
    Type type,
    Source source)
    :{}

HostResolverInternalResult::HostResolverInternalResult(
    const base::Value::Dict& dict)
    :{}

// static
bool HostResolverInternalResult::ValidateValueBaseDict(
    const base::Value::Dict& dict,
    bool require_timed_expiration) {}

base::Value::Dict HostResolverInternalResult::ToValueBaseDict() const {}

// static
std::unique_ptr<HostResolverInternalDataResult>
HostResolverInternalDataResult::FromValue(const base::Value& value) {}

HostResolverInternalDataResult::HostResolverInternalDataResult(
    std::string domain_name,
    DnsQueryType query_type,
    std::optional<base::TimeTicks> expiration,
    base::Time timed_expiration,
    Source source,
    std::vector<IPEndPoint> endpoints,
    std::vector<std::string> strings,
    std::vector<HostPortPair> hosts)
    :{}

HostResolverInternalDataResult::~HostResolverInternalDataResult() = default;

std::unique_ptr<HostResolverInternalResult>
HostResolverInternalDataResult::Clone() const {}

base::Value HostResolverInternalDataResult::ToValue() const {}

HostResolverInternalDataResult::HostResolverInternalDataResult(
    const base::Value::Dict& dict,
    std::vector<IPEndPoint> endpoints,
    std::vector<std::string> strings,
    std::vector<HostPortPair> hosts)
    :{}

// static
std::unique_ptr<HostResolverInternalMetadataResult>
HostResolverInternalMetadataResult::FromValue(const base::Value& value) {}

HostResolverInternalMetadataResult::HostResolverInternalMetadataResult(
    std::string domain_name,
    DnsQueryType query_type,
    std::optional<base::TimeTicks> expiration,
    base::Time timed_expiration,
    Source source,
    std::multimap<HttpsRecordPriority, ConnectionEndpointMetadata> metadatas)
    :{}

HostResolverInternalMetadataResult::~HostResolverInternalMetadataResult() =
    default;

std::unique_ptr<HostResolverInternalResult>
HostResolverInternalMetadataResult::Clone() const {}

base::Value HostResolverInternalMetadataResult::ToValue() const {}

HostResolverInternalMetadataResult::HostResolverInternalMetadataResult(
    const base::Value::Dict& dict,
    std::multimap<HttpsRecordPriority, ConnectionEndpointMetadata> metadatas)
    :{}

// static
std::unique_ptr<HostResolverInternalErrorResult>
HostResolverInternalErrorResult::FromValue(const base::Value& value) {}

HostResolverInternalErrorResult::HostResolverInternalErrorResult(
    std::string domain_name,
    DnsQueryType query_type,
    std::optional<base::TimeTicks> expiration,
    std::optional<base::Time> timed_expiration,
    Source source,
    int error)
    :{}

std::unique_ptr<HostResolverInternalResult>
HostResolverInternalErrorResult::Clone() const {}

base::Value HostResolverInternalErrorResult::ToValue() const {}

HostResolverInternalErrorResult::HostResolverInternalErrorResult(
    const base::Value::Dict& dict,
    int error)
    :{}

// static
std::unique_ptr<HostResolverInternalAliasResult>
HostResolverInternalAliasResult::FromValue(const base::Value& value) {}

HostResolverInternalAliasResult::HostResolverInternalAliasResult(
    std::string domain_name,
    DnsQueryType query_type,
    std::optional<base::TimeTicks> expiration,
    base::Time timed_expiration,
    Source source,
    std::string alias_target)
    :{}

std::unique_ptr<HostResolverInternalResult>
HostResolverInternalAliasResult::Clone() const {}

base::Value HostResolverInternalAliasResult::ToValue() const {}

HostResolverInternalAliasResult::HostResolverInternalAliasResult(
    const base::Value::Dict& dict,
    std::string alias_target)
    :{}

}  // namespace net