chromium/net/dns/dns_transaction.h

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

#ifndef NET_DNS_DNS_TRANSACTION_H_
#define NET_DNS_DNS_TRANSACTION_H_

#include <stdint.h>

#include <memory>
#include <optional>
#include <string>
#include <string_view>

#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "net/base/request_priority.h"
#include "net/dns/opt_record_rdata.h"
#include "net/dns/public/secure_dns_mode.h"
#include "net/dns/record_rdata.h"
#include "url/gurl.h"

namespace net {

class DnsResponse;
class DnsSession;
class NetLogWithSource;
class ResolveContext;

// The hostname probed by CreateDohProbeRunner().
inline constexpr std::string_view kDohProbeHostname =;

// DnsTransaction implements a stub DNS resolver as defined in RFC 1034.
// The DnsTransaction takes care of retransmissions, name server fallback (or
// round-robin), suffix search, and simple response validation ("does it match
// the query") to fight poisoning.
//
// Destroying DnsTransaction cancels the underlying network effort.
class NET_EXPORT_PRIVATE DnsTransaction {};

// Startable/Cancellable object to represent a DNS probe sequence.
class DnsProbeRunner {};

// Creates DnsTransaction which performs asynchronous DNS search.
// It does NOT perform caching, aggregation or prioritization of transactions.
//
// Destroying the factory does NOT affect any already created DnsTransactions.
//
// DnsProbeRunners, however, will safely abort themselves on destruction of
// their creating factory, and they should only be started or restarted while
// the factory is still alive.
class NET_EXPORT_PRIVATE DnsTransactionFactory {};

}  // namespace net

#endif  // NET_DNS_DNS_TRANSACTION_H_