#include "net/dns/dns_response_result_extractor.h"
#include <limits.h>
#include <stdint.h>
#include <iterator>
#include <map>
#include <memory>
#include <optional>
#include <ostream>
#include <set>
#include <string>
#include <string_view>
#include <unordered_set>
#include <vector>
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/dcheck_is_on.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/numerics/checked_math.h"
#include "base/numerics/ostream_operators.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "net/base/address_list.h"
#include "net/base/connection_endpoint_metadata.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/dns/dns_alias_utility.h"
#include "net/dns/dns_names_util.h"
#include "net/dns/dns_response.h"
#include "net/dns/dns_util.h"
#include "net/dns/host_cache.h"
#include "net/dns/host_resolver_internal_result.h"
#include "net/dns/https_record_rdata.h"
#include "net/dns/public/dns_protocol.h"
#include "net/dns/public/dns_query_type.h"
#include "net/dns/record_parsed.h"
#include "net/dns/record_rdata.h"
namespace net {
namespace {
AliasMap;
ExtractionError;
RecordsOrError;
ResultsOrError;
Source;
void SaveMetricsForAdditionalHttpsRecord(const RecordParsed& record,
bool is_unsolicited) { … }
std::vector<HostPortPair> SortServiceTargets(
const std::vector<const SrvRecordRdata*>& rdatas) { … }
ExtractionError ValidateNamesAndAliases(
std::string_view query_name,
const AliasMap& aliases,
const std::vector<std::unique_ptr<const RecordParsed>>& data_records,
std::string& out_final_chain_name) { … }
RecordsOrError ExtractResponseRecords(
const DnsResponse& response,
DnsQueryType query_type,
base::Time now,
base::TimeTicks now_ticks,
std::set<std::unique_ptr<HostResolverInternalResult>>&
out_non_data_results) { … }
ResultsOrError ExtractAddressResults(const DnsResponse& response,
DnsQueryType query_type,
base::Time now,
base::TimeTicks now_ticks) { … }
ResultsOrError ExtractTxtResults(const DnsResponse& response,
base::Time now,
base::TimeTicks now_ticks) { … }
ResultsOrError ExtractPointerResults(const DnsResponse& response,
base::Time now,
base::TimeTicks now_ticks) { … }
ResultsOrError ExtractServiceResults(const DnsResponse& response,
base::Time now,
base::TimeTicks now_ticks) { … }
const RecordParsed* UnwrapRecordPtr(
const std::unique_ptr<const RecordParsed>& ptr) { … }
bool RecordIsAlias(const RecordParsed* record) { … }
ResultsOrError ExtractHttpsResults(const DnsResponse& response,
std::string_view original_domain_name,
uint16_t request_port,
base::Time now,
base::TimeTicks now_ticks) { … }
}
DnsResponseResultExtractor::DnsResponseResultExtractor(
const DnsResponse& response,
const base::Clock& clock,
const base::TickClock& tick_clock)
: … { … }
DnsResponseResultExtractor::~DnsResponseResultExtractor() = default;
ResultsOrError DnsResponseResultExtractor::ExtractDnsResults(
DnsQueryType query_type,
std::string_view original_domain_name,
uint16_t request_port) const { … }
}