#include "net/dns/dns_query.h"
#include <optional>
#include <string_view>
#include <utility>
#include "base/big_endian.h"
#include "base/containers/span.h"
#include "base/containers/span_writer.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/byte_conversions.h"
#include "base/numerics/safe_conversions.h"
#include "base/sys_byteorder.h"
#include "net/base/io_buffer.h"
#include "net/dns/dns_names_util.h"
#include "net/dns/opt_record_rdata.h"
#include "net/dns/public/dns_protocol.h"
#include "net/dns/record_rdata.h"
namespace net {
namespace {
const size_t kHeaderSize = …;
static const size_t kOptRRFixedSize = …;
const uint16_t kMaxUdpPayloadSize = …;
size_t QuestionSize(size_t qname_size) { … }
size_t OptRecordSize(const OptRecordRdata* rdata) { … }
size_t DeterminePaddingSize(size_t unpadded_size,
DnsQuery::PaddingStrategy padding_strategy) { … }
std::unique_ptr<OptRecordRdata> AddPaddingIfNecessary(
const OptRecordRdata* opt_rdata,
DnsQuery::PaddingStrategy padding_strategy,
size_t no_opt_buffer_size) { … }
}
DnsQuery::DnsQuery(uint16_t id,
base::span<const uint8_t> qname,
uint16_t qtype,
const OptRecordRdata* opt_rdata,
PaddingStrategy padding_strategy)
: … { … }
DnsQuery::DnsQuery(scoped_refptr<IOBufferWithSize> buffer)
: … { … }
DnsQuery::DnsQuery(const DnsQuery& query) { … }
DnsQuery& DnsQuery::operator=(const DnsQuery& query) { … }
DnsQuery::~DnsQuery() = default;
std::unique_ptr<DnsQuery> DnsQuery::CloneWithNewId(uint16_t id) const { … }
bool DnsQuery::Parse(size_t valid_bytes) { … }
uint16_t DnsQuery::id() const { … }
base::span<const uint8_t> DnsQuery::qname() const { … }
uint16_t DnsQuery::qtype() const { … }
std::string_view DnsQuery::question() const { … }
size_t DnsQuery::question_size() const { … }
void DnsQuery::set_flags(uint16_t flags) { … }
DnsQuery::DnsQuery(const DnsQuery& orig, uint16_t id) { … }
void DnsQuery::CopyFrom(const DnsQuery& orig) { … }
bool DnsQuery::ReadHeader(base::SpanReader<const uint8_t>* reader,
dns_protocol::Header* header) { … }
bool DnsQuery::ReadName(base::SpanReader<const uint8_t>* reader,
std::string* out) { … }
}