#include "discovery/mdns/public/mdns_records.h"
#include <algorithm>
#include <cctype>
#include <limits>
#include <ostream>
#include <sstream>
#include <vector>
#include "absl/strings/str_join.h"
#include "discovery/mdns/public/mdns_writer.h"
namespace openscreen::discovery {
namespace {
constexpr size_t kMaxRawRecordSize = …;
constexpr size_t kMaxMessageFieldEntryCount = …;
inline int CompareIgnoreCase(const std::string& x, const std::string& y) { … }
template <typename RDataType>
bool IsGreaterThan(const Rdata& lhs, const Rdata& rhs) { … }
bool IsGreaterThan(DnsType type, const Rdata& lhs, const Rdata& rhs) { … }
}
bool IsValidDomainLabel(std::string_view label) { … }
DomainName::DomainName() = default;
DomainName::DomainName(std::vector<std::string> labels)
: … { … }
DomainName::DomainName(const std::vector<std::string_view>& labels)
: … { … }
DomainName::DomainName(std::initializer_list<std::string_view> labels)
: … { … }
DomainName::DomainName(std::vector<std::string> labels, size_t max_wire_size)
: … { … }
DomainName::DomainName(const DomainName& other) = default;
DomainName::DomainName(DomainName&& other) noexcept = default;
DomainName& DomainName::operator=(const DomainName& rhs) = default;
DomainName& DomainName::operator=(DomainName&& rhs) = default;
bool DomainName::operator<(const DomainName& rhs) const { … }
bool DomainName::operator<=(const DomainName& rhs) const { … }
bool DomainName::operator>(const DomainName& rhs) const { … }
bool DomainName::operator>=(const DomainName& rhs) const { … }
bool DomainName::operator==(const DomainName& rhs) const { … }
bool DomainName::operator!=(const DomainName& rhs) const { … }
size_t DomainName::MaxWireSize() const { … }
std::ostream& operator<<(std::ostream& os, const DomainName& domain_name) { … }
ErrorOr<RawRecordRdata> RawRecordRdata::TryCreate(std::vector<uint8_t> rdata) { … }
RawRecordRdata::RawRecordRdata() = default;
RawRecordRdata::RawRecordRdata(std::vector<uint8_t> rdata)
: … { … }
RawRecordRdata::RawRecordRdata(const uint8_t* begin, size_t size)
: … { … }
RawRecordRdata::RawRecordRdata(const RawRecordRdata& other) = default;
RawRecordRdata::RawRecordRdata(RawRecordRdata&& other) noexcept = default;
RawRecordRdata& RawRecordRdata::operator=(const RawRecordRdata& rhs) = default;
RawRecordRdata& RawRecordRdata::operator=(RawRecordRdata&& rhs) = default;
bool RawRecordRdata::operator==(const RawRecordRdata& rhs) const { … }
bool RawRecordRdata::operator!=(const RawRecordRdata& rhs) const { … }
size_t RawRecordRdata::MaxWireSize() const { … }
SrvRecordRdata::SrvRecordRdata() = default;
SrvRecordRdata::SrvRecordRdata(uint16_t priority,
uint16_t weight,
uint16_t port,
DomainName target)
: … { … }
SrvRecordRdata::SrvRecordRdata(const SrvRecordRdata& other) = default;
SrvRecordRdata::SrvRecordRdata(SrvRecordRdata&& other) noexcept = default;
SrvRecordRdata& SrvRecordRdata::operator=(const SrvRecordRdata& rhs) = default;
SrvRecordRdata& SrvRecordRdata::operator=(SrvRecordRdata&& rhs) = default;
bool SrvRecordRdata::operator==(const SrvRecordRdata& rhs) const { … }
bool SrvRecordRdata::operator!=(const SrvRecordRdata& rhs) const { … }
size_t SrvRecordRdata::MaxWireSize() const { … }
ARecordRdata::ARecordRdata() = default;
ARecordRdata::ARecordRdata(IPAddress ipv4_address,
NetworkInterfaceIndex interface_index)
: … { … }
ARecordRdata::ARecordRdata(const ARecordRdata& other) = default;
ARecordRdata::ARecordRdata(ARecordRdata&& other) noexcept = default;
ARecordRdata& ARecordRdata::operator=(const ARecordRdata& rhs) = default;
ARecordRdata& ARecordRdata::operator=(ARecordRdata&& rhs) = default;
bool ARecordRdata::operator==(const ARecordRdata& rhs) const { … }
bool ARecordRdata::operator!=(const ARecordRdata& rhs) const { … }
size_t ARecordRdata::MaxWireSize() const { … }
AAAARecordRdata::AAAARecordRdata() = default;
AAAARecordRdata::AAAARecordRdata(IPAddress ipv6_address,
NetworkInterfaceIndex interface_index)
: … { … }
AAAARecordRdata::AAAARecordRdata(const AAAARecordRdata& other) = default;
AAAARecordRdata::AAAARecordRdata(AAAARecordRdata&& other) noexcept = default;
AAAARecordRdata& AAAARecordRdata::operator=(const AAAARecordRdata& rhs) =
default;
AAAARecordRdata& AAAARecordRdata::operator=(AAAARecordRdata&& rhs) = default;
bool AAAARecordRdata::operator==(const AAAARecordRdata& rhs) const { … }
bool AAAARecordRdata::operator!=(const AAAARecordRdata& rhs) const { … }
size_t AAAARecordRdata::MaxWireSize() const { … }
PtrRecordRdata::PtrRecordRdata() = default;
PtrRecordRdata::PtrRecordRdata(DomainName ptr_domain)
: … { … }
PtrRecordRdata::PtrRecordRdata(const PtrRecordRdata& other) = default;
PtrRecordRdata::PtrRecordRdata(PtrRecordRdata&& other) noexcept = default;
PtrRecordRdata& PtrRecordRdata::operator=(const PtrRecordRdata& rhs) = default;
PtrRecordRdata& PtrRecordRdata::operator=(PtrRecordRdata&& rhs) = default;
bool PtrRecordRdata::operator==(const PtrRecordRdata& rhs) const { … }
bool PtrRecordRdata::operator!=(const PtrRecordRdata& rhs) const { … }
size_t PtrRecordRdata::MaxWireSize() const { … }
ErrorOr<TxtRecordRdata> TxtRecordRdata::TryCreate(std::vector<Entry> texts) { … }
TxtRecordRdata::TxtRecordRdata() = default;
TxtRecordRdata::TxtRecordRdata(std::vector<Entry> texts) { … }
TxtRecordRdata::TxtRecordRdata(std::vector<Entry> texts, size_t max_wire_size)
: … { … }
TxtRecordRdata::TxtRecordRdata(const TxtRecordRdata& other) = default;
TxtRecordRdata::TxtRecordRdata(TxtRecordRdata&& other) noexcept = default;
TxtRecordRdata& TxtRecordRdata::operator=(const TxtRecordRdata& rhs) = default;
TxtRecordRdata& TxtRecordRdata::operator=(TxtRecordRdata&& rhs) = default;
bool TxtRecordRdata::operator==(const TxtRecordRdata& rhs) const { … }
bool TxtRecordRdata::operator!=(const TxtRecordRdata& rhs) const { … }
size_t TxtRecordRdata::MaxWireSize() const { … }
NsecRecordRdata::NsecRecordRdata() = default;
NsecRecordRdata::NsecRecordRdata(DomainName next_domain_name,
std::vector<DnsType> types)
: … { … }
NsecRecordRdata::NsecRecordRdata(const NsecRecordRdata& other) = default;
NsecRecordRdata::NsecRecordRdata(NsecRecordRdata&& other) noexcept = default;
NsecRecordRdata& NsecRecordRdata::operator=(const NsecRecordRdata& rhs) =
default;
NsecRecordRdata& NsecRecordRdata::operator=(NsecRecordRdata&& rhs) = default;
bool NsecRecordRdata::operator==(const NsecRecordRdata& rhs) const { … }
bool NsecRecordRdata::operator!=(const NsecRecordRdata& rhs) const { … }
size_t NsecRecordRdata::MaxWireSize() const { … }
size_t OptRecordRdata::Option::MaxWireSize() const { … }
bool OptRecordRdata::Option::operator>(
const OptRecordRdata::Option& rhs) const { … }
bool OptRecordRdata::Option::operator<(
const OptRecordRdata::Option& rhs) const { … }
bool OptRecordRdata::Option::operator>=(
const OptRecordRdata::Option& rhs) const { … }
bool OptRecordRdata::Option::operator<=(
const OptRecordRdata::Option& rhs) const { … }
bool OptRecordRdata::Option::operator==(
const OptRecordRdata::Option& rhs) const { … }
bool OptRecordRdata::Option::operator!=(
const OptRecordRdata::Option& rhs) const { … }
OptRecordRdata::OptRecordRdata() = default;
OptRecordRdata::OptRecordRdata(std::vector<Option> options)
: … { … }
OptRecordRdata::OptRecordRdata(const OptRecordRdata& other) = default;
OptRecordRdata::OptRecordRdata(OptRecordRdata&& other) noexcept = default;
OptRecordRdata& OptRecordRdata::operator=(const OptRecordRdata& rhs) = default;
OptRecordRdata& OptRecordRdata::operator=(OptRecordRdata&& rhs) = default;
bool OptRecordRdata::operator==(const OptRecordRdata& rhs) const { … }
bool OptRecordRdata::operator!=(const OptRecordRdata& rhs) const { … }
ErrorOr<MdnsRecord> MdnsRecord::TryCreate(DomainName name,
DnsType dns_type,
DnsClass dns_class,
RecordType record_type,
std::chrono::seconds ttl,
Rdata rdata) { … }
MdnsRecord::MdnsRecord() = default;
MdnsRecord::MdnsRecord(DomainName name,
DnsType dns_type,
DnsClass dns_class,
RecordType record_type,
std::chrono::seconds ttl,
Rdata rdata)
: … { … }
MdnsRecord::MdnsRecord(const MdnsRecord& other) = default;
MdnsRecord::MdnsRecord(MdnsRecord&& other) noexcept = default;
MdnsRecord& MdnsRecord::operator=(const MdnsRecord& rhs) = default;
MdnsRecord& MdnsRecord::operator=(MdnsRecord&& rhs) = default;
bool MdnsRecord::IsValidConfig(const DomainName& name,
DnsType dns_type,
std::chrono::seconds ttl,
const Rdata& rdata) { … }
bool MdnsRecord::operator==(const MdnsRecord& rhs) const { … }
bool MdnsRecord::operator!=(const MdnsRecord& rhs) const { … }
bool MdnsRecord::operator>(const MdnsRecord& rhs) const { … }
bool MdnsRecord::operator<(const MdnsRecord& rhs) const { … }
bool MdnsRecord::operator<=(const MdnsRecord& rhs) const { … }
bool MdnsRecord::operator>=(const MdnsRecord& rhs) const { … }
bool MdnsRecord::IsReannouncementOf(const MdnsRecord& rhs) const { … }
size_t MdnsRecord::MaxWireSize() const { … }
#ifdef _DEBUG
std::ostream& operator<<(std::ostream& os, const MdnsRecord& mdns_record) { … }
#endif
MdnsRecord CreateAddressRecord(DomainName name, const IPAddress& address) { … }
ErrorOr<MdnsQuestion> MdnsQuestion::TryCreate(DomainName name,
DnsType dns_type,
DnsClass dns_class,
ResponseType response_type) { … }
MdnsQuestion::MdnsQuestion(DomainName name,
DnsType dns_type,
DnsClass dns_class,
ResponseType response_type)
: … { … }
bool MdnsQuestion::operator==(const MdnsQuestion& rhs) const { … }
bool MdnsQuestion::operator!=(const MdnsQuestion& rhs) const { … }
size_t MdnsQuestion::MaxWireSize() const { … }
ErrorOr<MdnsMessage> MdnsMessage::TryCreate(
uint16_t id,
MessageType type,
std::vector<MdnsQuestion> questions,
std::vector<MdnsRecord> answers,
std::vector<MdnsRecord> authority_records,
std::vector<MdnsRecord> additional_records) { … }
MdnsMessage::MdnsMessage(uint16_t id, MessageType type)
: … { … }
MdnsMessage::MdnsMessage(uint16_t id,
MessageType type,
std::vector<MdnsQuestion> questions,
std::vector<MdnsRecord> answers,
std::vector<MdnsRecord> authority_records,
std::vector<MdnsRecord> additional_records)
: … { … }
bool MdnsMessage::operator==(const MdnsMessage& rhs) const { … }
bool MdnsMessage::operator!=(const MdnsMessage& rhs) const { … }
bool MdnsMessage::IsProbeQuery() const { … }
size_t MdnsMessage::MaxWireSize() const { … }
void MdnsMessage::AddQuestion(MdnsQuestion question) { … }
void MdnsMessage::AddAnswer(MdnsRecord record) { … }
void MdnsMessage::AddAuthorityRecord(MdnsRecord record) { … }
void MdnsMessage::AddAdditionalRecord(MdnsRecord record) { … }
bool MdnsMessage::CanAddRecord(const MdnsRecord& record) { … }
uint16_t CreateMessageId() { … }
bool CanBePublished(DnsType type) { … }
bool CanBePublished(const MdnsRecord& record) { … }
bool CanBeQueried(DnsType type) { … }
bool CanBeProcessed(DnsType type) { … }
}