Add MulticastDnsClient

This commit is contained in:
2020-02-24 20:46:47 +01:00
parent f93b7ce8b1
commit 36d6b47f78
30 changed files with 2056 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
#ifndef NAME_H
#define NAME_H
#include <memory>
#include <sstream>
#include <string>
#include <vector>
namespace Network {
namespace Dns {
class NameImpl;
class Name
{
public:
Name();
template<typename ...Args>
Name(const Args& ...args) :
Name(toStringVector(args...))
{
}
Name(const std::vector<std::string>& labels);
std::string GetFirstLabel() const;
std::string GetName() const;
bool empty() const;
bool endsWith(const Name& suffix) const;
void append(const std::string& label);
void prepend(const std::string& label);
void swap(Name& x) noexcept;
bool operator==(const Name& name) const;
bool operator!=(const Name& name) const;
bool operator<(const Name& name) const;
private:
Name(std::shared_ptr<NameImpl> pNameImpl);
NameImpl* PImpl() const;
private:
template <class T>
std::string toString(T&& t)
{
std::stringstream s;
s << std::forward<T>(t);
return s.str();
}
template <class... T>
std::vector<std::string> toStringVector(T&&... args)
{
std::vector<std::string> res { toString(std::forward<T>(args))... };
return res;
}
private:
friend class Query;
friend class ResourceRecord;
private:
std::shared_ptr<NameImpl> m_pNameImpl;
};
} // namespace Dns
} // namespace Network
#endif // NAME_H