1 #ifndef PUBLISH_MDNS_H 2 #define PUBLISH_MDNS_H 3 4 #include <boost/asio.hpp> 5 #include <string> 6 #include <vector> 7 8 9 struct mDNSService 10 { mDNSServicemDNSService11 mDNSService(const std::string& name, size_t port) : name_(name), port_(port) 12 { 13 } 14 15 std::string name_; 16 size_t port_; 17 }; 18 19 20 class PublishmDNS 21 { 22 public: PublishmDNS(const std::string & serviceName,boost::asio::io_context & ioc)23 PublishmDNS(const std::string& serviceName, boost::asio::io_context& ioc) : serviceName_(serviceName), ioc_(ioc) 24 { 25 } 26 27 virtual ~PublishmDNS() = default; 28 29 virtual void publish(const std::vector<mDNSService>& services) = 0; 30 31 protected: 32 std::string serviceName_; 33 boost::asio::io_context& ioc_; 34 }; 35 36 #if defined(HAS_AVAHI) 37 #include "publish_avahi.hpp" 38 using PublishZeroConf = PublishAvahi; 39 #elif defined(HAS_BONJOUR) 40 #include "publish_bonjour.hpp" 41 using PublishZeroConf = PublishBonjour; 42 #endif 43 44 #endif 45