blob: 1d6762270b2d5b4017c1caf9ffd5444771ec9171 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SRC_CONNECTIVITY_NETWORK_MDNS_SERVICE_ENCODING_DNS_FORMATTING_H_
#define SRC_CONNECTIVITY_NETWORK_MDNS_SERVICE_ENCODING_DNS_FORMATTING_H_
#include <iomanip>
#include <iostream>
#include <memory>
#include "src/connectivity/network/mdns/service/encoding/dns_message.h"
#include "src/lib/fostr/indent.h"
namespace mdns {
std::ostream& operator<<(std::ostream& os, DnsType value);
#ifdef MDNS_TRACE
template <typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& value) {
if (value.size() == 0) {
return os << "<empty>\n";
}
int index = 0;
for (const T& element : value) {
os << fostr::NewLine << "[" << index++ << "] " << element;
}
return os;
}
template <typename T>
std::ostream& operator<<(std::ostream& os, const std::shared_ptr<T>& value) {
return os << *value;
}
std::ostream& operator<<(std::ostream& os, DnsClass value);
std::ostream& operator<<(std::ostream& os, const DnsName& value);
std::ostream& operator<<(std::ostream& os, const DnsV4Address& value);
std::ostream& operator<<(std::ostream& os, const DnsV6Address& value);
std::ostream& operator<<(std::ostream& os, const DnsHeader& value);
std::ostream& operator<<(std::ostream& os, const DnsQuestion& value);
std::ostream& operator<<(std::ostream& os, const DnsResource& value);
std::ostream& operator<<(std::ostream& os, const DnsMessage& value);
#endif // ifdef MDNS_TRACE
} // namespace mdns
#endif // SRC_CONNECTIVITY_NETWORK_MDNS_SERVICE_ENCODING_DNS_FORMATTING_H_