diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e737844a8..06a797f35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -523,7 +523,7 @@ jobs: timeout_minutes: 90 max_attempts: 3 retry_on: any - command: .\buildwin.ps1 -poco_base . -vs 170 -action build -linkmode all -config release -platform x64 -samples -tests -omit "Crypto,NetSSL_OpenSSL,Data/MySQL,Data/PostgreSQL,JWT" + command: .\buildwin.ps1 -poco_base . -vs 170 -action build -linkmode all -config release -platform x64 -samples -tests -omit "Crypto,NetSSL_OpenSSL,Data/MySQL,Data/PostgreSQL,JWT,DNSSD,DNSSD/Avahi,DNSSD/Bonjour" # windows-2022-msvc-buildwin-win32: # runs-on: windows-2022 diff --git a/.github/workflows/codeql-buildscript.sh b/.github/workflows/codeql-buildscript.sh index a8f9a8cb1..1cbba9822 100644 --- a/.github/workflows/codeql-buildscript.sh +++ b/.github/workflows/codeql-buildscript.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash sudo apt-get -y update && sudo apt-get -y install cmake ninja-build libssl-dev unixodbc-dev libmysqlclient-dev redis-server -cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all +cmake -H. -Bcmake-build -GNinja -DENABLE_PDF=OFF -DENABLE_DNSSD=OFF -DENABLE_TESTS=ON && cmake --build cmake-build --target all diff --git a/.gitignore b/.gitignore index 152101e6f..c23f0eb35 100644 --- a/.gitignore +++ b/.gitignore @@ -131,6 +131,7 @@ lib/ lib64/ pocomsg.h **/UpgradeLog*.XML +/out/build/x64-Debug .vs/ vcpkg_installed/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29bb..000000000 diff --git a/CMakeLists.txt b/CMakeLists.txt index e7b9d15b7..36d95502f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,6 +180,12 @@ option(ENABLE_JSON "Enable JSON" ON) option(ENABLE_MONGODB "Enable MongoDB" ON) option(ENABLE_DATA_SQLITE "Enable Data SQlite" ON) option(ENABLE_REDIS "Enable Redis" ON) +option(ENABLE_DNSSD "Enable DNSSD" OFF) +option(ENABLE_DNSSD_DEFAULT "Enable DNSSD Default" OFF) + +option(ENABLE_DNSSD_AVAHI "Enable DNSSD Avahi" OFF) +option(ENABLE_DNSSD_BONJOUR "Enable DNSSD Bonjour" OFF) + option(ENABLE_PROMETHEUS "Enable Prometheus" ON) option(ENABLE_PDF "Enable PDF" OFF) option(ENABLE_UTIL "Enable Util" ON) @@ -372,6 +378,11 @@ if(EXISTS ${PROJECT_SOURCE_DIR}/Redis AND ENABLE_REDIS) list(APPEND Poco_COMPONENTS "Redis") endif() +if(ENABLE_DNSSD) + add_subdirectory(DNSSD) + list(APPEND Poco_COMPONENTS "DNSSD") +endif() + if(EXISTS ${PROJECT_SOURCE_DIR}/Prometheus AND ENABLE_PROMETHEUS) add_subdirectory(Prometheus) list(APPEND Poco_COMPONENTS "Prometheus") diff --git a/DNSSD/Avahi/CMakeLists.txt b/DNSSD/Avahi/CMakeLists.txt new file mode 100644 index 000000000..2c7236294 --- /dev/null +++ b/DNSSD/Avahi/CMakeLists.txt @@ -0,0 +1,33 @@ +set(LIBNAME "DNSSDAvahi") +set(POCO_LIBNAME "Poco${LIBNAME}") + +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( Avahi_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( Avahi_SRCS ${HDRS_G}) + +add_definitions( ${Avahi_CFLAGS} -DTHREADSAFE) + +add_library( "${LIBNAME}" ${LIB_MODE} ${Avahi_SRCS} ) +add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") +set_target_properties( "${LIBNAME}" + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME ${POCO_LIBNAME} + DEFINE_SYMBOL Avahi_EXPORTS + ) + +target_link_libraries( "${LIBNAME}" Foundation Net DNSSD ${AVAHI_LIBRARIES}) +target_include_directories( "${LIBNAME}" + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src + ) +target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS}) + +POCO_INSTALL("${LIBNAME}") +POCO_GENERATE_PACKAGE("${LIBNAME}") diff --git a/DNSSD/Avahi/Makefile b/DNSSD/Avahi/Makefile new file mode 100644 index 000000000..974131bdf --- /dev/null +++ b/DNSSD/Avahi/Makefile @@ -0,0 +1,21 @@ +# +# Makefile +# +# $Id: //poco/1.7/DNSSD/Avahi/Makefile#1 $ +# +# Makefile for Poco DNSSD Avahi +# + +include $(POCO_BASE)/build/rules/global + +SYSLIBS += -lavahi-common -lavahi-client + +objects = \ + AvahiResponderImpl AvahiBrowserImpl + +target = PocoDNSSDAvahi +target_version = 1 +target_libs = PocoNet PocoDNSSD PocoFoundation + +include $(POCO_BASE)/build/rules/lib + diff --git a/DNSSD/Avahi/cmake/PocoDNSSDAvahiConfig.cmake b/DNSSD/Avahi/cmake/PocoDNSSDAvahiConfig.cmake new file mode 100644 index 000000000..915c53eba --- /dev/null +++ b/DNSSD/Avahi/cmake/PocoDNSSDAvahiConfig.cmake @@ -0,0 +1,5 @@ +include(CMakeFindDependencyMacro) +find_dependency(PocoFoundation) +find_dependency(PocoNet) +find_dependency(PocoDNSSD) +include("${CMAKE_CURRENT_LIST_DIR}/PocoDNSSDAvahiTargets.cmake") diff --git a/DNSSD/Avahi/dependencies b/DNSSD/Avahi/dependencies new file mode 100644 index 000000000..5ab5fc352 --- /dev/null +++ b/DNSSD/Avahi/dependencies @@ -0,0 +1,3 @@ +Foundation +Net +DNSSD diff --git a/DNSSD/Avahi/include/Poco/DNSSD/Avahi/Avahi.h b/DNSSD/Avahi/include/Poco/DNSSD/Avahi/Avahi.h new file mode 100644 index 000000000..1b6fe1d9a --- /dev/null +++ b/DNSSD/Avahi/include/Poco/DNSSD/Avahi/Avahi.h @@ -0,0 +1,76 @@ +// +// Avahi.h +// +// $Id: //poco/1.7/DNSSD/Avahi/include/Poco/DNSSD/Avahi/Avahi.h#1 $ +// +// Library: DNSSD/Avahi +// Package: Implementation +// Module: Avahi +// +// Basic definitions for the Poco DNSSD Avahi library. +// This file must be the first file included by every other DNSSD Avahi +// header file. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Avahi_Avahi_INCLUDED +#define DNSSD_Avahi_Avahi_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" + + +// +// The following block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the Avahi_EXPORTS +// symbol defined on the command line. This symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// DNSSD_Avahi_API functions as being imported from a DLL, wheras this DLL sees symbols +// defined with this macro as being exported. +// +#if defined(_WIN32) && defined(POCO_DLL) + #if defined(Avahi_EXPORTS) + #define DNSSD_Avahi_API __declspec(dllexport) + #else + #define DNSSD_Avahi_API __declspec(dllimport) + #endif +#endif + + +#if !defined(DNSSD_Avahi_API) + #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4) + #define DNSSD_Avahi_API __attribute__ ((visibility ("default"))) + #else + #define DNSSD_Avahi_API + #endif +#endif + + +#if defined(_MSC_VER) + #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Avahi_EXPORTS) + #pragma comment(lib, "PocoDNSSDAvahi" POCO_LIB_SUFFIX) + #endif +#endif + + +namespace Poco { +namespace DNSSD { + + +void DNSSD_Avahi_API initializeDNSSD(); + /// Initialize the DNSSD subsystem. + + +void DNSSD_Avahi_API uninitializeDNSSD(); + /// Uninitialize the DNSSD subsystem. + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_Avahi_Avahi_INCLUDED diff --git a/DNSSD/Avahi/include/Poco/DNSSD/Avahi/AvahiBrowserImpl.h b/DNSSD/Avahi/include/Poco/DNSSD/Avahi/AvahiBrowserImpl.h new file mode 100644 index 000000000..2ab34fe76 --- /dev/null +++ b/DNSSD/Avahi/include/Poco/DNSSD/Avahi/AvahiBrowserImpl.h @@ -0,0 +1,86 @@ +// +// AvahiBrowserImpl.h +// +// $Id: //poco/1.7/DNSSD/Avahi/include/Poco/DNSSD/Avahi/AvahiBrowserImpl.h#1 $ +// +// Library: DNSSD/Avahi +// Package: Implementation +// Module: AvahiBrowserImpl +// +// Definition of the AvahiBrowserImpl class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Avahi_AvahiBrowserImpl_INCLUDED +#define DNSSD_Avahi_AvahiBrowserImpl_INCLUDED + + +#include "Poco/DNSSD/Avahi/Avahi.h" +#include "Poco/DNSSD/DNSSDBrowser.h" +#include +#include + + +namespace Poco { +namespace DNSSD { +namespace Avahi { + + +class AvahiResponderImpl; + + +class DNSSD_Avahi_API AvahiBrowserImpl: public DNSSDBrowser + /// The DNSSDBrowser implementation for Avahi. +{ +public: + AvahiBrowserImpl(AvahiResponderImpl& responder); + /// Creates the AvahiBrowserImpl. + + ~AvahiBrowserImpl(); + /// Destroys the AvahiBrowserImpl. + + // DNSSDBrowser + BrowseHandle browse(const std::string& regType, const std::string& domain, int options, Poco::Int32 networkInterface); + BrowseHandle resolve(const Service& service, int options); + BrowseHandle enumerateBrowseDomains(Poco::Int32 networkInterface); + BrowseHandle enumerateRegistrationDomains(Poco::Int32 networkInterface); + BrowseHandle queryRecord(const std::string& name, Poco::UInt16 type, Poco::UInt16 clazz, int options, Poco::Int32 networkInterface); + BrowseHandle resolveHost(const std::string& host, int options, Poco::Int32 networkInterface); + void cancel(BrowseHandle& browseHandle); + + // Implementation + void onBrowseReply(AvahiServiceBrowser* browser, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char* name, const char* type, const char* domain, AvahiLookupResultFlags flags); + void onResolveReply(AvahiServiceResolver* resolver, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char* name, const char* type, const char* domain, const char* host, const AvahiAddress* a, uint16_t port, AvahiStringList* txt, AvahiLookupResultFlags flags); + void onEnumerateBrowseDomainsReply(AvahiDomainBrowser* browser, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char* domain, AvahiLookupResultFlags flags, bool isDefault); + void onEnumerateRegistrationDomainsReply(AvahiDomainBrowser* browser, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char* domain, AvahiLookupResultFlags flags, bool isDefault); + void onQueryRecordReply(AvahiRecordBrowser* browser, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char* name, uint16_t clazz, uint16_t type, const void* data, std::size_t size, AvahiLookupResultFlags flags); + +protected: + enum HandleTypes + { + DOMAIN_BROWSER_HANDLE, + SERVICE_BROWSER_HANDLE, + SERVICE_RESOLVER_HANDLE, + RECORD_BROWSER_HANDLE + }; + + static void parseTXTRecord(AvahiStringList* strList, Service::Properties& properties); + static void escape(const char* str, std::string& escaped); + +private: + typedef std::map AddressMap; + + AvahiResponderImpl& _responder; + AddressMap _addressMap; +}; + + +} } } // namespace Poco::DNSSD::Avahi + + +#endif // DNSSD_Avahi_AvahiBrowserImpl_INCLUDED diff --git a/DNSSD/Avahi/include/Poco/DNSSD/Avahi/AvahiResponderImpl.h b/DNSSD/Avahi/include/Poco/DNSSD/Avahi/AvahiResponderImpl.h new file mode 100644 index 000000000..b6889e514 --- /dev/null +++ b/DNSSD/Avahi/include/Poco/DNSSD/Avahi/AvahiResponderImpl.h @@ -0,0 +1,134 @@ +// +// AvahiResponderImpl.h +// +// $Id: //poco/1.7/DNSSD/Avahi/include/Poco/DNSSD/Avahi/AvahiResponderImpl.h#1 $ +// +// Library: DNSSD/Avahi +// Package: Implementation +// Module: AvahiResponderImpl +// +// Definition of the AvahiResponderImpl class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Avahi_AvahiResponderImpl_INCLUDED +#define DNSSD_Avahi_AvahiResponderImpl_INCLUDED + + +#include "Poco/DNSSD/Avahi/Avahi.h" +#include "Poco/DNSSD/Avahi/AvahiBrowserImpl.h" +#include "Poco/DNSSD/DNSSDResponderImpl.h" +#include "Poco/DNSSD/DNSSDResponder.h" +#include "Poco/ScopedLock.h" +#include "Poco/Mutex.h" +#include "Poco/Event.h" +#include "Poco/Thread.h" +#include "Poco/Runnable.h" +#include +#include +#include +#include + + +namespace Poco { +namespace DNSSD { +namespace Avahi { + + +class AvahiBrowserImpl; + +class DNSSD_Avahi_API AvahiResponderImpl: public Poco::DNSSD::DNSSDResponderImpl, public Poco::Runnable + /// The DNSSDResponderImpl implementation for Avahi. +{ +public: + typedef Poco::ScopedLock ScopedLock; + + AvahiResponderImpl(Poco::DNSSD::DNSSDResponder& owner); + /// Creates the AvahiResponder, using the given owner. + + ~AvahiResponderImpl(); + /// Destroys the AvahiResponderImpl. + + // DNSSDResponderImpl + DNSSDBrowser& browser(); + ServiceHandle registerService(const Service& service, int options); + void unregisterService(ServiceHandle& serviceHandle); + RecordHandle addRecord(ServiceHandle serviceHandle, const Record& record); + void updateRecord(ServiceHandle serviceHandle, RecordHandle recordHandle, const Record& record); + void removeRecord(ServiceHandle serviceHandle, RecordHandle& recordHandle); + void start(); + void stop(); + + // Runnable + void run(); + + // Implementation + static const char* describeError(int code); + /// Returns a human-readable string describing the error. + + void onClientStateChange(AvahiClientState state); + void onGroupStateChange(AvahiEntryGroup* avahiGroup, AvahiEntryGroupState state); + void lock(); + void unlock(); + +protected: + enum + { + START_TIMEOUT = 5000 // milliseconds + }; + + struct RecordInfo + { + Record record; + int id; + }; + typedef std::vector RecordVec; + + struct ServiceInfo + { + Service service; + RecordVec records; + int options; + }; + typedef std::map ServiceMap; + + void reregisterServices(); + void setupEntryGroup(AvahiEntryGroup* avahiGroup, const Service& service, const RecordVec& records, int options, bool rename); + static AvahiStringList* createTXTRecord(const Service::Properties& properties); + +private: + Poco::DNSSD::DNSSDResponder& _owner; + AvahiBrowserImpl _browser; + AvahiSimplePoll* _avahiPoll; + AvahiClient* _avahiClient; + Poco::Event _avahiClientReady; + ServiceMap _services; + bool _running; + int _nextRecordId; + Poco::Mutex _mutex; + Poco::Thread _pollThread; + + friend class AvahiBrowserImpl; +}; + + +class DNSSD_Avahi_API AvahiResponderImplFactory: public Poco::DNSSD::DNSSDResponderImplFactory + /// A factory for AvahiResponderImplFactory objects. +{ +public: + DNSSDResponderImpl* createResponderImpl(Poco::DNSSD::DNSSDResponder& owner) + { + return new AvahiResponderImpl(owner); + } +}; + + +} } } // namespace Poco::DNSSD::Avahi + + +#endif // DNSSD_Avahi_AvahiResponderImpl_INCLUDED diff --git a/DNSSD/Avahi/src/AvahiBrowserImpl.cpp b/DNSSD/Avahi/src/AvahiBrowserImpl.cpp new file mode 100644 index 000000000..fd08dddb1 --- /dev/null +++ b/DNSSD/Avahi/src/AvahiBrowserImpl.cpp @@ -0,0 +1,582 @@ +// +// AvahiBrowserImpl.cpp +// +// $Id: //poco/1.7/DNSSD/Avahi/src/AvahiBrowserImpl.cpp#1 $ +// +// Library: DNSSD/Avahi +// Package: Implementation +// Module: AvahiBrowserImpl +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/Avahi/AvahiBrowserImpl.h" +#include "Poco/DNSSD/Avahi/AvahiResponderImpl.h" +#include "Poco/DNSSD/DNSSDException.h" +#include "Poco/NumberFormatter.h" +#include +#include +#include +#include + + +namespace Poco { +namespace DNSSD { +namespace Avahi { + + +extern "C" void onBrowseReply( + AvahiServiceBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* name, + const char* type, + const char* domain, + AvahiLookupResultFlags flags, + void* context) +{ + try + { + AvahiBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onBrowseReply(browser, interface, protocol, event, name, type, domain, flags); + } + catch (...) + { + } +} + + +extern "C" void onResolveReply( + AvahiServiceResolver* resolver, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiResolverEvent event, + const char* name, + const char* type, + const char* domain, + const char* host, + const AvahiAddress* a, + uint16_t port, + AvahiStringList* txt, + AvahiLookupResultFlags flags, + void* context) +{ + try + { + AvahiBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onResolveReply(resolver, interface, protocol, event, name, type, domain, host, a, port, txt, flags); + } + catch (...) + { + } +} + + +extern "C" void onEnumerateBrowseDomainsReply( + AvahiDomainBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* domain, + AvahiLookupResultFlags flags, + void* context) +{ + try + { + AvahiBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onEnumerateBrowseDomainsReply(browser, interface, protocol, event, domain, flags, false); + } + catch (...) + { + } +} + + +extern "C" void onEnumerateDefaultBrowseDomainsReply( + AvahiDomainBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* domain, + AvahiLookupResultFlags flags, + void* context) +{ + try + { + AvahiBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onEnumerateBrowseDomainsReply(browser, interface, protocol, event, domain, flags, true); + } + catch (...) + { + } + if (event == AVAHI_BROWSER_ALL_FOR_NOW || event == AVAHI_BROWSER_FAILURE) + { + avahi_domain_browser_free(browser); + } +} + + +extern "C" void onEnumerateRegistrationDomainsReply( + AvahiDomainBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* domain, + AvahiLookupResultFlags flags, + void* context) +{ + try + { + AvahiBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onEnumerateRegistrationDomainsReply(browser, interface, protocol, event, domain, flags, false); + } + catch (...) + { + } +} + + +extern "C" void onEnumerateDefaultRegistrationDomainsReply( + AvahiDomainBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* domain, + AvahiLookupResultFlags flags, + void* context) +{ + try + { + AvahiBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onEnumerateRegistrationDomainsReply(browser, interface, protocol, event, domain, flags, true); + } + catch (...) + { + } + if (event == AVAHI_BROWSER_ALL_FOR_NOW || event == AVAHI_BROWSER_FAILURE) + { + avahi_domain_browser_free(browser); + } +} + + +extern "C" void onQueryRecordReply( + AvahiRecordBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* name, + uint16_t clazz, + uint16_t type, + const void* data, + std::size_t size, + AvahiLookupResultFlags flags, + void* context) +{ + try + { + AvahiBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onQueryRecordReply(browser, interface, protocol, event, name, clazz, type, data, size, flags); + } + catch (...) + { + } +} + + +AvahiBrowserImpl::AvahiBrowserImpl(AvahiResponderImpl& responder): + _responder(responder) +{ +} + + +AvahiBrowserImpl::~AvahiBrowserImpl() +{ +} + + +BrowseHandle AvahiBrowserImpl::browse(const std::string& regType, const std::string& domain, int options, Poco::Int32 networkInterface) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + AvahiIfIndex ifIndex = networkInterface == 0 ? AVAHI_IF_UNSPEC : networkInterface; + AvahiServiceBrowser* browser = avahi_service_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, regType.c_str(), domain.empty() ? NULL : domain.c_str(), (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onBrowseReply, this); + if (!browser) + { + int error = avahi_client_errno(_responder._avahiClient); + throw Poco::DNSSD::DNSSDException("Failed to browse for " + regType, AvahiResponderImpl::describeError(error), error); + } + return BrowseHandle(browser, SERVICE_BROWSER_HANDLE); +} + + +BrowseHandle AvahiBrowserImpl::resolve(const Service& service, int options) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + AvahiIfIndex ifIndex = service.networkInterface(); + AvahiServiceResolver* resolver = avahi_service_resolver_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, service.name().c_str(), service.type().c_str(), service.domain().c_str(), AVAHI_PROTO_UNSPEC, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onResolveReply, this); + if (!resolver) + { + int error = avahi_client_errno(_responder._avahiClient); + throw Poco::DNSSD::DNSSDException("Failed to resolve service " + service.name(), AvahiResponderImpl::describeError(error), error); + } + return BrowseHandle(resolver, SERVICE_RESOLVER_HANDLE); +} + + +BrowseHandle AvahiBrowserImpl::enumerateBrowseDomains(Poco::Int32 networkInterface) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + AvahiIfIndex ifIndex = networkInterface == 0 ? AVAHI_IF_UNSPEC : networkInterface; + AvahiDomainBrowser* browser = avahi_domain_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateBrowseDomainsReply, this); + if (!browser) + { + int error = avahi_client_errno(_responder._avahiClient); + throw Poco::DNSSD::DNSSDException("Failed to enumerate browse domains", AvahiResponderImpl::describeError(error), error); + } + AvahiDomainBrowser* defaultBrowser = avahi_domain_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE_DEFAULT, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateDefaultBrowseDomainsReply, this); + if (!defaultBrowser) + { + int error = avahi_client_errno(_responder._avahiClient); + avahi_domain_browser_free(browser); + throw Poco::DNSSD::DNSSDException("Failed to enumerate default browse domains", AvahiResponderImpl::describeError(error), error); + } + return BrowseHandle(browser, DOMAIN_BROWSER_HANDLE); +} + + +BrowseHandle AvahiBrowserImpl::enumerateRegistrationDomains(Poco::Int32 networkInterface) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + AvahiIfIndex ifIndex = networkInterface == 0 ? AVAHI_IF_UNSPEC : networkInterface; + AvahiDomainBrowser* browser = avahi_domain_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_REGISTER, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateRegistrationDomainsReply, this); + if (!browser) + { + int error = avahi_client_errno(_responder._avahiClient); + throw Poco::DNSSD::DNSSDException("Failed to enumerate registration domains", AvahiResponderImpl::describeError(error), error); + } + AvahiDomainBrowser* defaultBrowser = avahi_domain_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_REGISTER_DEFAULT, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onEnumerateDefaultRegistrationDomainsReply, this); + if (!defaultBrowser) + { + int error = avahi_client_errno(_responder._avahiClient); + avahi_domain_browser_free(browser); + throw Poco::DNSSD::DNSSDException("Failed to enumerate default registration domains", AvahiResponderImpl::describeError(error), error); + } + return BrowseHandle(browser, DOMAIN_BROWSER_HANDLE); +} + + +BrowseHandle AvahiBrowserImpl::queryRecord(const std::string& name, Poco::UInt16 type, Poco::UInt16 clazz, int options, Poco::Int32 networkInterface) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + AvahiIfIndex ifIndex = networkInterface == 0 ? AVAHI_IF_UNSPEC : networkInterface; + AvahiRecordBrowser* browser = avahi_record_browser_new(_responder._avahiClient, ifIndex, AVAHI_PROTO_UNSPEC, name.c_str(), clazz, type, (AvahiLookupFlags) 0, Poco::DNSSD::Avahi::onQueryRecordReply, this); + if (!browser) + { + int error = avahi_client_errno(_responder._avahiClient); + throw Poco::DNSSD::DNSSDException("Failed to query for record", AvahiResponderImpl::describeError(error), error); + } + return BrowseHandle(browser, RECORD_BROWSER_HANDLE); +} + + +BrowseHandle AvahiBrowserImpl::resolveHost(const std::string& host, int options, Poco::Int32 networkInterface) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + AddressMap::iterator it = _addressMap.find(host); + if (it != _addressMap.end()) + { + ResolveHostEventArgs args(BrowseHandle(), 0, host, it->second, networkInterface, 0); + hostResolved(this, args); + } + else + { + int err = AVAHI_ERR_DNS_NXDOMAIN; + Error error(networkInterface, err, AvahiResponderImpl::describeError(err)); + ErrorEventArgs args(BrowseHandle(), 0, error); + hostResolveError(this, args); + } + return BrowseHandle(); +} + + +void AvahiBrowserImpl::cancel(BrowseHandle& browseHandle) +{ + if (!browseHandle.isValid()) return; + + AvahiResponderImpl::ScopedLock lock(_responder); + + switch (browseHandle.subtype()) + { + case SERVICE_BROWSER_HANDLE: + avahi_service_browser_free(browseHandle.cast()); + break; + case SERVICE_RESOLVER_HANDLE: + avahi_service_resolver_free(browseHandle.cast()); + break; + case DOMAIN_BROWSER_HANDLE: + avahi_domain_browser_free(browseHandle.cast()); + break; + case RECORD_BROWSER_HANDLE: + avahi_record_browser_free(browseHandle.cast()); + break; + } + browseHandle.reset(); +} + + +void AvahiBrowserImpl::onBrowseReply( + AvahiServiceBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* name, + const char* type, + const char* domain, + AvahiLookupResultFlags flags) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) + { + int eventFlags(0); + Service service(interface, name, type, domain); + ServiceEventArgs args(BrowseHandle(browser), eventFlags, service); + if (event == AVAHI_BROWSER_NEW) + { + serviceFound(this, args); + } + else + { + serviceRemoved(this, args); + } + } + else if (event == AVAHI_BROWSER_FAILURE) + { + int err = avahi_client_errno(_responder._avahiClient); + Error error(interface, err, AvahiResponderImpl::describeError(err)); + ErrorEventArgs args(BrowseHandle(browser), 0, error); + browseError(this, args); + } +} + + +void AvahiBrowserImpl::onResolveReply( + AvahiServiceResolver* resolver, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiResolverEvent event, + const char* name, + const char* type, + const char* domain, + const char* host, + const AvahiAddress* a, + uint16_t port, + AvahiStringList* txt, + AvahiLookupResultFlags flags) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + if (event == AVAHI_RESOLVER_FOUND) + { + Poco::Net::IPAddress addr; + switch (a->proto) + { + case AVAHI_PROTO_INET: + addr = Poco::Net::IPAddress(&a->data.ipv4.address, sizeof(a->data.ipv4.address)); + break; +#if defined(POCO_HAVE_IPv6) + case AVAHI_PROTO_INET6: + addr = Poco::Net::IPAddress(&a->data.ipv6.address, sizeof(a->data.ipv6.address)); + break; +#endif + } + int eventFlags(0); + std::string fullName; + escape(name, fullName); + fullName += '.'; + fullName += type; + fullName += '.'; + fullName += domain; + fullName += '.'; + Service service(interface, name, fullName, type, domain, host, port); + _addressMap[service.host()] = addr; + parseTXTRecord(txt, service.properties()); + ServiceEventArgs args(BrowseHandle(resolver), eventFlags, service); + serviceResolved(this, args); + } + else if (event == AVAHI_RESOLVER_FAILURE) + { + int err = avahi_client_errno(_responder._avahiClient); + Error error(interface, err, AvahiResponderImpl::describeError(err)); + ErrorEventArgs args(BrowseHandle(resolver), 0, error); + resolveError(this, args); + } +} + + +void AvahiBrowserImpl::onEnumerateBrowseDomainsReply( + AvahiDomainBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* domain, + AvahiLookupResultFlags flags, + bool isDefault) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) + { + int eventFlags(0); + Poco::Int32 ifIndex = interface == AVAHI_IF_UNSPEC ? 0 : interface; + Domain dom(ifIndex, domain, isDefault); + DomainEventArgs args(BrowseHandle(browser), eventFlags, dom); + if (event == AVAHI_BROWSER_NEW) + { + browseDomainFound(this, args); + } + else + { + browseDomainRemoved(this, args); + } + } + else if (event == AVAHI_BROWSER_FAILURE) + { + int err = avahi_client_errno(_responder._avahiClient); + Error error(interface, err, AvahiResponderImpl::describeError(err)); + ErrorEventArgs args(BrowseHandle(browser), 0, error); + browseDomainError(this, args); + } +} + + +void AvahiBrowserImpl::onEnumerateRegistrationDomainsReply( + AvahiDomainBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* domain, + AvahiLookupResultFlags flags, + bool isDefault) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) + { + int eventFlags(0); + Poco::Int32 ifIndex = interface == AVAHI_IF_UNSPEC ? 0 : interface; + Domain dom(ifIndex, domain, isDefault); + DomainEventArgs args(BrowseHandle(browser), eventFlags, dom); + if (event == AVAHI_BROWSER_NEW) + { + registrationDomainFound(this, args); + } + else + { + registrationDomainRemoved(this, args); + } + } + else if (event == AVAHI_BROWSER_FAILURE) + { + int err = avahi_client_errno(_responder._avahiClient); + Error error(interface, err, AvahiResponderImpl::describeError(err)); + ErrorEventArgs args(BrowseHandle(browser), 0, error); + registrationDomainError(this, args); + } +} + + +void AvahiBrowserImpl::onQueryRecordReply( + AvahiRecordBrowser* browser, + AvahiIfIndex interface, + AvahiProtocol protocol, + AvahiBrowserEvent event, + const char* name, + uint16_t clazz, + uint16_t type, + const void* data, + std::size_t size, + AvahiLookupResultFlags flags) +{ + AvahiResponderImpl::ScopedLock lock(_responder); + + if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) + { + int eventFlags(0); + Poco::Int32 ifIndex = interface == AVAHI_IF_UNSPEC ? 0 : interface; + Record record(ifIndex, name, type, clazz, size, data, 0); + RecordEventArgs args(BrowseHandle(browser), eventFlags, record); + if (event == AVAHI_BROWSER_NEW) + { + recordFound(this, args); + } + else + { + recordRemoved(this, args); + } + } + else if (event == AVAHI_BROWSER_FAILURE) + { + int err = avahi_client_errno(_responder._avahiClient); + Error error(interface, err, AvahiResponderImpl::describeError(err)); + ErrorEventArgs args(BrowseHandle(browser), 0, error); + recordError(this, args); + } +} + + +void AvahiBrowserImpl::parseTXTRecord(AvahiStringList* strList, Service::Properties& properties) +{ + while (strList) + { + char* key; + char* value; + std::size_t size; + avahi_string_list_get_pair(strList, &key, &value, &size); + properties.set(key, std::string(value ? value : "", size)); + avahi_free(key); + avahi_free(value); + strList = avahi_string_list_get_next(strList); + } +} + + +void AvahiBrowserImpl::escape(const char* str, std::string& escaped) +{ + while (*str) + { + if (*str <= ' ' || *str >= 127) + { + escaped += '\\'; + Poco::NumberFormatter::append0(escaped, static_cast(static_cast(*str)), 3); + } + else if (*str == '\\') + { + escaped += "\\\\"; + } + else if (*str == '.') + { + escaped += "\\."; + } + else + { + escaped += *str; + } + ++str; + } +} + + +} } } // namespace Poco::DNSSD::Avahi + diff --git a/DNSSD/Avahi/src/AvahiResponderImpl.cpp b/DNSSD/Avahi/src/AvahiResponderImpl.cpp new file mode 100644 index 000000000..dfa1249e4 --- /dev/null +++ b/DNSSD/Avahi/src/AvahiResponderImpl.cpp @@ -0,0 +1,514 @@ +// +// AvahiResponderImpl.cpp +// +// $Id: //poco/1.7/DNSSD/Avahi/src/AvahiResponderImpl.cpp#1 $ +// +// Library: DNSSD/Avahi +// Package: Implementation +// Module: AvahiResponderImpl +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/Avahi/AvahiResponderImpl.h" +#include "Poco/DNSSD/DNSSDException.h" +#include "Poco/StringTokenizer.h" +#include +#include +#include + + +namespace Poco { +namespace DNSSD { +namespace Avahi { + + +extern "C" int avahiPollFunc(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) +{ + Poco::Mutex* pMutex = reinterpret_cast(userdata); + pMutex->unlock(); + int ret = poll(ufds, nfds, timeout); + pMutex->lock(); + return ret; +} + + +extern "C" void onClientStateChange(AvahiClient* avahiClient, AvahiClientState state, void* userdata) +{ + try + { + AvahiResponderImpl* pResponder = reinterpret_cast(userdata); + pResponder->onClientStateChange(state); + } + catch (...) + { + } +} + + +extern "C" void onGroupStateChange(AvahiEntryGroup* avahiGroup, AvahiEntryGroupState state, void* userdata) +{ + try + { + AvahiResponderImpl* pResponder = reinterpret_cast(userdata); + pResponder->onGroupStateChange(avahiGroup, state); + } + catch (...) + { + } +} + + +AvahiResponderImpl::AvahiResponderImpl(Poco::DNSSD::DNSSDResponder& owner): + _owner(owner), + _browser(*this), + _avahiPoll(0), + _avahiClient(0), + _running(false), + _nextRecordId(1) +{ + _avahiPoll = avahi_simple_poll_new(); + if (!_avahiPoll) throw DNSSDException("Cannot create Avahi simple poll object"); + avahi_simple_poll_set_func(_avahiPoll, Poco::DNSSD::Avahi::avahiPollFunc, &_mutex); + int error; + _avahiClient = avahi_client_new(avahi_simple_poll_get(_avahiPoll), AVAHI_CLIENT_NO_FAIL, Poco::DNSSD::Avahi::onClientStateChange, this, &error); + if (!_avahiClient) + { + avahi_simple_poll_free(_avahiPoll); + throw DNSSDException("Cannot create Avahi client", describeError(error), error); + } +} + + +AvahiResponderImpl::~AvahiResponderImpl() +{ + try + { + stop(); + avahi_client_free(_avahiClient); + avahi_simple_poll_free(_avahiPoll); + } + catch (...) + { + poco_unexpected(); + } +} + + +DNSSDBrowser& AvahiResponderImpl::browser() +{ + return _browser; +} + + +ServiceHandle AvahiResponderImpl::registerService(const Service& service, int options) +{ + ScopedLock lock(*this); + + AvahiEntryGroup* avahiGroup = avahi_entry_group_new(_avahiClient, Poco::DNSSD::Avahi::onGroupStateChange, this); + if (!avahiGroup) throw DNSSDException("Cannot create Avahi Entry Group"); + try + { + ServiceHandle serviceHandle(avahiGroup); + RecordVec records; + setupEntryGroup(avahiGroup, service, records, options, false); + _services[serviceHandle].options = options; + return serviceHandle; + } + catch (...) + { + avahi_entry_group_free(avahiGroup); + throw; + } +} + + +void AvahiResponderImpl::unregisterService(ServiceHandle& serviceHandle) +{ + ScopedLock lock(*this); + + ServiceMap::iterator it = _services.find(serviceHandle); + if (it != _services.end()) + { + _services.erase(it); + } + AvahiEntryGroup* avahiGroup = serviceHandle.cast(); + avahi_entry_group_free(avahiGroup); +} + + +RecordHandle AvahiResponderImpl::addRecord(ServiceHandle serviceHandle, const Record& record) +{ + ScopedLock lock(*this); + + ServiceMap::iterator it = _services.find(serviceHandle); + if (it != _services.end()) + { + RecordInfo recordInfo; + recordInfo.record = record; + recordInfo.id = _nextRecordId++; + it->second.records.push_back(recordInfo); + setupEntryGroup(serviceHandle.cast(), it->second.service, it->second.records, it->second.options, false); + return RecordHandle(reinterpret_cast(recordInfo.id)); + } + else throw Poco::InvalidArgumentException("Unknown ServiceHandle"); +} + + +void AvahiResponderImpl::updateRecord(ServiceHandle serviceHandle, RecordHandle recordHandle, const Record& record) +{ + ScopedLock lock(*this); + + ServiceMap::iterator it = _services.find(serviceHandle); + if (it != _services.end()) + { + bool found = false; + for (RecordVec::iterator itRec = it->second.records.begin(); itRec != it->second.records.end(); ++itRec) + { + if (itRec->id == static_cast(reinterpret_cast(recordHandle.cast()))) + { + itRec->record = record; + found = true; + break; + } + } + if (!found) throw Poco::NotFoundException("Record not found", record.name()); + setupEntryGroup(serviceHandle.cast(), it->second.service, it->second.records, it->second.options, false); + } + else throw Poco::InvalidArgumentException("Unknown ServiceHandle"); +} + + +void AvahiResponderImpl::removeRecord(ServiceHandle serviceHandle, RecordHandle& recordHandle) +{ + ScopedLock lock(*this); + + ServiceMap::iterator it = _services.find(serviceHandle); + if (it != _services.end()) + { + bool found = false; + for (RecordVec::iterator itRec = it->second.records.begin(); itRec != it->second.records.end(); ++itRec) + { + if (itRec->id == static_cast(reinterpret_cast(recordHandle.cast()))) + { + it->second.records.erase(itRec); + recordHandle.reset(); + found = true; + break; + } + } + if (!found) throw Poco::NotFoundException("Record not found"); + setupEntryGroup(serviceHandle.cast(), it->second.service, it->second.records, it->second.options, false); + } + else throw Poco::InvalidArgumentException("Unknown ServiceHandle"); +} + + +void AvahiResponderImpl::start() +{ + if (!_running) + { + if (!_pollThread.isRunning()) + { + _pollThread.start(*this); + } + if (!_avahiClientReady.tryWait(START_TIMEOUT)) + { + std::string state; + switch (avahi_client_get_state(_avahiClient)) + { + case AVAHI_CLIENT_S_REGISTERING: + state = "registering"; + break; + case AVAHI_CLIENT_S_RUNNING: + state = "running"; + break; + case AVAHI_CLIENT_S_COLLISION: + state = "collision"; + break; + case AVAHI_CLIENT_FAILURE: + state = "failure"; + break; + case AVAHI_CLIENT_CONNECTING: + state = "connecting"; + }; + throw DNSSDException("Avahi client not ready; current state", state); + } + _running = true; + } +} + + +void AvahiResponderImpl::stop() +{ + if (_running) + { + { + ScopedLock lock(*this); + avahi_simple_poll_quit(_avahiPoll); + } + _pollThread.join(); + _running = false; + } +} + + +const char* AvahiResponderImpl::describeError(int code) +{ + return avahi_strerror(code); +} + + +void AvahiResponderImpl::lock() +{ + _mutex.lock(); +} + + +void AvahiResponderImpl::unlock() +{ + _mutex.unlock(); +} + + +void AvahiResponderImpl::run() +{ + ScopedLock lock(*this); + avahi_simple_poll_loop(_avahiPoll); +} + + +void AvahiResponderImpl::setupEntryGroup(AvahiEntryGroup* avahiGroup, const Service& service, const RecordVec& records, int options, bool rename) +{ + avahi_entry_group_reset(avahiGroup); + AvahiStringList* txtList = createTXTRecord(service.properties()); + try + { + int ifIndex = service.networkInterface() == 0 ? AVAHI_IF_UNSPEC : service.networkInterface(); + std::string type = service.type(); + std::string subtypes; + std::string::size_type pos = type.find(','); + if (pos != std::string::npos) + { + subtypes.assign(type, pos + 1, type.size() - pos); + type.resize(pos); + } + std::string name(service.name()); + if (name.empty()) name = avahi_client_get_host_name(_avahiClient); + const char* domain = service.domain().empty() ? 0 : service.domain().c_str(); + const char* host = service.host().empty() ? 0 : service.host().c_str(); + + int error = rename ? AVAHI_ERR_COLLISION : avahi_entry_group_add_service_strlst( + avahiGroup, + ifIndex, + AVAHI_PROTO_UNSPEC, + (AvahiPublishFlags) 0, + name.c_str(), + type.c_str(), + domain, + host, + service.port(), + txtList + ); + while (error == AVAHI_ERR_COLLISION) + { + if (options & DNSSDResponder::REG_NO_AUTORENAME) throw DNSSDException("Cannot register service: " + name, describeError(error), error); + const char* newName = avahi_alternative_service_name(name.c_str()); + name = newName; + avahi_free(const_cast(newName)); + error = avahi_entry_group_add_service_strlst( + avahiGroup, + ifIndex, + AVAHI_PROTO_UNSPEC, + (AvahiPublishFlags) 0, + name.c_str(), + type.c_str(), + domain, + host, + service.port(), + txtList + ); + } + if (error) throw DNSSDException("Cannot add service to Avahi Entry Group: " + name, describeError(error), error); + + if (!subtypes.empty()) + { + Poco::StringTokenizer tok(subtypes, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM); + for (Poco::StringTokenizer::Iterator it = tok.begin(); it != tok.end(); ++it) + { + error = avahi_entry_group_add_service_subtype( + avahiGroup, + service.networkInterface(), + AVAHI_PROTO_UNSPEC, + (AvahiPublishFlags) 0, + name.c_str(), + type.c_str(), + domain, + it->c_str() + ); + if (error) throw DNSSDException("Cannot add service subtype to Avahi Entry Group", describeError(error), error); + } + } + + for (RecordVec::const_iterator it = records.begin(); it != records.end(); ++it) + { + error = avahi_entry_group_add_record( + avahiGroup, + ifIndex, + AVAHI_PROTO_UNSPEC, + (AvahiPublishFlags) 0, + it->record.name().c_str(), + it->record.clazz(), + it->record.type(), + it->record.ttl(), + it->record.data(), + it->record.length() + ); + if (error) throw DNSSDException("Cannot add record to Avahi Entry Group: " + it->record.name(), describeError(error), error); + } + + error = avahi_entry_group_commit(avahiGroup); + if (error) throw DNSSDException("Cannot commit Avahi Entry Group", describeError(error), error); + + ServiceHandle serviceHandle(avahiGroup); + _services[serviceHandle].service = Service(service.networkInterface(), name, "", service.type(), service.domain(), service.host(), service.port(), service.properties()); + + avahi_string_list_free(txtList); + } + catch (...) + { + avahi_entry_group_reset(avahiGroup); + avahi_string_list_free(txtList); + throw; + } +} + + +AvahiStringList* AvahiResponderImpl::createTXTRecord(const Service::Properties& properties) +{ + AvahiStringList* avahiList = 0; + Service::Properties::ConstIterator itVers = properties.find("txtvers"); + Service::Properties::ConstIterator itEnd = properties.end(); + std::string entry; + if (itVers != itEnd) + { + std::string entry(itVers->first); + entry += '='; + entry += itVers->second; + avahiList = avahi_string_list_new(entry.c_str(), NULL); + } + + Service::Properties::ConstIterator it = properties.begin(); + for (; it != itEnd; ++it) + { + if (it != itVers) + { + if (avahiList) + { + avahiList = avahi_string_list_add_pair_arbitrary(avahiList, it->first.c_str(), reinterpret_cast(it->second.empty() ? NULL : it->second.c_str()), it->second.size()); + } + else + { + std::string entry(it->first); + if (!it->second.empty()) + { + entry += '='; + entry += it->second; + } + avahiList = avahi_string_list_new(entry.c_str(), NULL); + } + } + } + + return avahiList; +} + + +void AvahiResponderImpl::onClientStateChange(AvahiClientState state) +{ + ScopedLock lock(*this); + + if (state == AVAHI_CLIENT_S_RUNNING) + { + _avahiClientReady.set(); + reregisterServices(); + } +} + + +void AvahiResponderImpl::onGroupStateChange(AvahiEntryGroup* avahiGroup, AvahiEntryGroupState state) +{ + ScopedLock lock(*this); + + ServiceHandle serviceHandle(avahiGroup); + ServiceMap::iterator it = _services.find(serviceHandle); + if (it != _services.end()) + { + if (state == AVAHI_ENTRY_GROUP_ESTABLISHED) + { + DNSSDResponder::ServiceEventArgs args(serviceHandle, it->second.service); + _owner.serviceRegistered(this, args); + } + else if (state == AVAHI_ENTRY_GROUP_COLLISION) + { + if (it->second.options & DNSSDResponder::REG_NO_AUTORENAME) + { + int error = AVAHI_ERR_COLLISION; + DNSSDResponder::ErrorEventArgs args(serviceHandle, it->second.service, Error(it->second.service.networkInterface(), error, describeError(error))); + _owner.serviceRegistrationFailed(this, args); + } + else + { + setupEntryGroup(avahiGroup, it->second.service, it->second.records, it->second.options, true); + } + } + else if (state == AVAHI_ENTRY_GROUP_FAILURE) + { + int error = avahi_client_errno(_avahiClient); + DNSSDResponder::ErrorEventArgs args(serviceHandle, it->second.service, Error(it->second.service.networkInterface(), error, describeError(error))); + _owner.serviceRegistrationFailed(this, args); + } + } +} + + +void AvahiResponderImpl::reregisterServices() +{ + for (ServiceMap::iterator it = _services.begin(); it != _services.end(); ++it) + { + setupEntryGroup(it->first.cast(), it->second.service, it->second.records, it->second.options, false); + } +} + + +} } } // namespace Poco::DNSSD::Avahi + + +namespace Poco { +namespace DNSSD { + + +namespace +{ + Poco::DNSSD::Avahi::AvahiResponderImplFactory implFactory; +} + + +void initializeDNSSD() +{ + Poco::DNSSD::DNSSDResponder::registerImplFactory(implFactory); +} + + +void uninitializeDNSSD() +{ + Poco::DNSSD::DNSSDResponder::unregisterImplFactory(); +} + + +} } // namespace Poco::DNSSD + diff --git a/DNSSD/Bonjour/Bonjour.progen b/DNSSD/Bonjour/Bonjour.progen new file mode 100644 index 000000000..294cfd3a0 --- /dev/null +++ b/DNSSD/Bonjour/Bonjour.progen @@ -0,0 +1,19 @@ +vc.project.guid = D9257FF3-3A9A-41F6-B60E-D077EFF94186 +vc.project.name = Bonjour +vc.project.target = PocoDNSSDBonjour +vc.project.type = library +vc.project.pocobase = ..\\.. +vc.project.outdir = ${vc.project.pocobase} +vc.project.platforms = Win32, x64, WinCE +vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md +vc.project.prototype = ${vc.project.name}_vs90.vcproj +vc.project.compiler.include = ..\\..\\DNSSD\\include;..\\..\\Foundation\\include;..\\..\\Net\\include +vc.project.compiler.defines = +vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS +vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared} +vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared} +vc.project.linker.dependencies = dnssd.lib +vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.x64 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.WinCE = ws2.lib iphlpapi.lib +vc.solution.create = true diff --git a/DNSSD/Bonjour/Bonjour_vs160.sln b/DNSSD/Bonjour/Bonjour_vs160.sln new file mode 100644 index 000000000..1b3d16f1c --- /dev/null +++ b/DNSSD/Bonjour/Bonjour_vs160.sln @@ -0,0 +1,61 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bonjour", "Bonjour_vs160.vcxproj", "{D9257FF3-3A9A-41F6-B60E-D077EFF94186}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Build.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Build.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.ActiveCfg = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Build.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Deploy.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Build.0 = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/Bonjour/Bonjour_vs160.vcxproj b/DNSSD/Bonjour/Bonjour_vs160.vcxproj new file mode 100644 index 000000000..f44b55d63 --- /dev/null +++ b/DNSSD/Bonjour/Bonjour_vs160.vcxproj @@ -0,0 +1,605 @@ + + + + + debug_shared + Win32 + + + debug_shared + x64 + + + debug_static_md + Win32 + + + debug_static_md + x64 + + + debug_static_mt + Win32 + + + debug_static_mt + x64 + + + release_shared + Win32 + + + release_shared + x64 + + + release_static_md + Win32 + + + release_static_md + x64 + + + release_static_mt + Win32 + + + release_static_mt + x64 + + + + 17.0 + Bonjour + {D9257FF3-3A9A-41F6-B60E-D077EFF94186} + Bonjour + Win32Proj + + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + DynamicLibrary + MultiByte + v142 + + + DynamicLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + DynamicLibrary + MultiByte + v142 + + + DynamicLibrary + MultiByte + v142 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.34511.75 + PocoDNSSDBonjourd + PocoDNSSDBonjourmdd + PocoDNSSDBonjourmtd + PocoDNSSDBonjour + PocoDNSSDBonjourmd + PocoDNSSDBonjourmt + PocoDNSSDBonjour64d + PocoDNSSDBonjourmdd + PocoDNSSDBonjourmtd + PocoDNSSDBonjour64 + PocoDNSSDBonjourmd + PocoDNSSDBonjourmt + + + ..\..\bin\ + obj\Bonjour\$(Configuration)\ + true + + + ..\..\bin\ + obj\Bonjour\$(Configuration)\ + false + + + ..\..\lib\ + obj\Bonjour\$(Configuration)\ + + + ..\..\lib\ + obj\Bonjour\$(Configuration)\ + + + ..\..\lib\ + obj\Bonjour\$(Configuration)\ + + + ..\..\lib\ + obj\Bonjour\$(Configuration)\ + + + ..\..\bin64\ + obj64\Bonjour\$(Configuration)\ + true + + + ..\..\bin64\ + obj64\Bonjour\$(Configuration)\ + false + + + ..\..\lib64\ + obj64\Bonjour\$(Configuration)\ + + + ..\..\lib64\ + obj64\Bonjour\$(Configuration)\ + + + ..\..\lib64\ + obj64\Bonjour\$(Configuration)\ + + + ..\..\lib64\ + obj64\Bonjour\$(Configuration)\ + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\bin\PocoDNSSDBonjourd.dll + true + true + $(OutDir)$(TargetName).pdb + ..\..\lib;%(AdditionalLibraryDirectories) + Console + ..\..\lib\PocoDNSSDBonjourd.lib + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\bin\PocoDNSSDBonjour.dll + true + false + ..\..\lib;%(AdditionalLibraryDirectories) + Console + true + true + ..\..\lib\PocoDNSSDBonjour.lib + MachineX86 + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\lib\PocoDNSSDBonjourmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\..\lib\PocoDNSSDBonjourmt.lib + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\lib\PocoDNSSDBonjourmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + + Default + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\lib\PocoDNSSDBonjourmd.lib + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\bin64\PocoDNSSDBonjour64d.dll + true + true + $(OutDir)$(TargetName).pdb + ..\..\lib64;%(AdditionalLibraryDirectories) + Console + ..\..\lib64\PocoDNSSDBonjourd.lib + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\bin64\PocoDNSSDBonjour64.dll + true + false + ..\..\lib64;%(AdditionalLibraryDirectories) + Console + true + true + ..\..\lib64\PocoDNSSDBonjour.lib + MachineX64 + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\lib64\PocoDNSSDBonjourmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\..\lib64\PocoDNSSDBonjourmt.lib + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\lib64\PocoDNSSDBonjourmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\..\lib64\PocoDNSSDBonjourmd.lib + + + + + + + + + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + + + diff --git a/DNSSD/Bonjour/Bonjour_vs160.vcxproj.filters b/DNSSD/Bonjour/Bonjour_vs160.vcxproj.filters new file mode 100644 index 000000000..64e885600 --- /dev/null +++ b/DNSSD/Bonjour/Bonjour_vs160.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {cf44555e-cc84-43dd-b198-44d32a1381e6} + + + {b2627011-451a-4b49-b7f3-708ed1647cd3} + + + {c328392b-6d49-4985-a0b7-c0f9f2e730d3} + + + + + Implementation\Header Files + + + Implementation\Header Files + + + Implementation\Header Files + + + Implementation\Header Files + + + + + Implementation\Source Files + + + Implementation\Source Files + + + Implementation\Source Files + + + \ No newline at end of file diff --git a/DNSSD/Bonjour/Bonjour_vs170.sln b/DNSSD/Bonjour/Bonjour_vs170.sln new file mode 100644 index 000000000..d4dc21a88 --- /dev/null +++ b/DNSSD/Bonjour/Bonjour_vs170.sln @@ -0,0 +1,85 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bonjour", "Bonjour_vs170.vcxproj", "{D9257FF3-3A9A-41F6-B60E-D077EFF94186}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|ARM64 = debug_shared|ARM64 + release_shared|ARM64 = release_shared|ARM64 + debug_static_mt|ARM64 = debug_static_mt|ARM64 + release_static_mt|ARM64 = release_static_mt|ARM64 + debug_static_md|ARM64 = debug_static_md|ARM64 + release_static_md|ARM64 = release_static_md|ARM64 + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|ARM64.ActiveCfg = debug_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|ARM64.Build.0 = debug_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|ARM64.Deploy.0 = debug_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|ARM64.ActiveCfg = release_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|ARM64.Build.0 = release_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|ARM64.Deploy.0 = release_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|ARM64.ActiveCfg = debug_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|ARM64.Build.0 = debug_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|ARM64.Deploy.0 = debug_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|ARM64.ActiveCfg = release_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|ARM64.Build.0 = release_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|ARM64.Deploy.0 = release_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|ARM64.ActiveCfg = debug_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|ARM64.Build.0 = debug_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|ARM64.Deploy.0 = debug_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|ARM64.ActiveCfg = release_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|ARM64.Build.0 = release_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|ARM64.Deploy.0 = release_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Build.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Build.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.ActiveCfg = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Build.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Deploy.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Build.0 = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/Bonjour/Bonjour_vs170.vcxproj b/DNSSD/Bonjour/Bonjour_vs170.vcxproj new file mode 100644 index 000000000..262ea4b7e --- /dev/null +++ b/DNSSD/Bonjour/Bonjour_vs170.vcxproj @@ -0,0 +1,885 @@ + + + + + debug_shared + ARM64 + + + debug_shared + Win32 + + + debug_shared + x64 + + + debug_static_md + ARM64 + + + debug_static_md + Win32 + + + debug_static_md + x64 + + + debug_static_mt + ARM64 + + + debug_static_mt + Win32 + + + debug_static_mt + x64 + + + release_shared + ARM64 + + + release_shared + Win32 + + + release_shared + x64 + + + release_static_md + ARM64 + + + release_static_md + Win32 + + + release_static_md + x64 + + + release_static_mt + ARM64 + + + release_static_mt + Win32 + + + release_static_mt + x64 + + + + 17.0 + Bonjour + {D9257FF3-3A9A-41F6-B60E-D077EFF94186} + Bonjour + Win32Proj + + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.34511.75 + PocoDNSSDBonjourA64d + PocoDNSSDBonjourmdd + PocoDNSSDBonjourmtd + PocoDNSSDBonjourA64 + PocoDNSSDBonjourmd + PocoDNSSDBonjourmt + PocoDNSSDBonjourd + PocoDNSSDBonjourmdd + PocoDNSSDBonjourmtd + PocoDNSSDBonjour + PocoDNSSDBonjourmd + PocoDNSSDBonjourmt + PocoDNSSDBonjour64d + PocoDNSSDBonjourmdd + PocoDNSSDBonjourmtd + PocoDNSSDBonjour64 + PocoDNSSDBonjourmd + PocoDNSSDBonjourmt + + + ..\..\binA64\ + objA64\Bonjour\$(Configuration)\ + true + + + ..\..\binA64\ + objA64\Bonjour\$(Configuration)\ + false + + + ..\..\libA64\ + objA64\Bonjour\$(Configuration)\ + + + ..\..\libA64\ + objA64\Bonjour\$(Configuration)\ + + + ..\..\libA64\ + objA64\Bonjour\$(Configuration)\ + + + ..\..\libA64\ + objA64\Bonjour\$(Configuration)\ + + + ..\..\bin\ + obj\Bonjour\$(Configuration)\ + true + + + ..\..\bin\ + obj\Bonjour\$(Configuration)\ + false + + + ..\..\lib\ + obj\Bonjour\$(Configuration)\ + + + ..\..\lib\ + obj\Bonjour\$(Configuration)\ + + + ..\..\lib\ + obj\Bonjour\$(Configuration)\ + + + ..\..\lib\ + obj\Bonjour\$(Configuration)\ + + + ..\..\bin64\ + obj64\Bonjour\$(Configuration)\ + true + + + ..\..\bin64\ + obj64\Bonjour\$(Configuration)\ + false + + + ..\..\lib64\ + obj64\Bonjour\$(Configuration)\ + + + ..\..\lib64\ + obj64\Bonjour\$(Configuration)\ + + + ..\..\lib64\ + obj64\Bonjour\$(Configuration)\ + + + ..\..\lib64\ + obj64\Bonjour\$(Configuration)\ + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\binA64\PocoDNSSDBonjourA64d.dll + true + true + $(OutDir)$(TargetName).pdb + ..\..\libA64;%(AdditionalLibraryDirectories) + Console + ..\..\libA64\PocoDNSSDBonjourd.lib + MachineARM64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\binA64\PocoDNSSDBonjourA64.dll + true + false + ..\..\libA64;%(AdditionalLibraryDirectories) + Console + true + true + ..\..\libA64\PocoDNSSDBonjour.lib + MachineARM64 + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\libA64\PocoDNSSDBonjourmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\..\libA64\PocoDNSSDBonjourmt.lib + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\libA64\PocoDNSSDBonjourmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\..\libA64\PocoDNSSDBonjourmd.lib + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\bin\PocoDNSSDBonjourd.dll + true + true + $(OutDir)$(TargetName).pdb + ..\..\lib;%(AdditionalLibraryDirectories) + Console + ..\..\lib\PocoDNSSDBonjourd.lib + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\bin\PocoDNSSDBonjour.dll + true + false + ..\..\lib;%(AdditionalLibraryDirectories) + Console + true + true + ..\..\lib\PocoDNSSDBonjour.lib + MachineX86 + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\lib\PocoDNSSDBonjourmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\..\lib\PocoDNSSDBonjourmt.lib + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\lib\PocoDNSSDBonjourmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + + Default + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\lib\PocoDNSSDBonjourmd.lib + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\bin64\PocoDNSSDBonjour64d.dll + true + true + $(OutDir)$(TargetName).pdb + ..\..\lib64;%(AdditionalLibraryDirectories) + Console + ..\..\lib64\PocoDNSSDBonjourd.lib + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;Bonjour_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\..\bin64\PocoDNSSDBonjour64.dll + true + false + ..\..\lib64;%(AdditionalLibraryDirectories) + Console + true + true + ..\..\lib64\PocoDNSSDBonjour.lib + MachineX64 + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\lib64\PocoDNSSDBonjourmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\..\lib64\PocoDNSSDBonjourmt.lib + + + + + Disabled + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\..\lib64\PocoDNSSDBonjourmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\DNSSD\include;..\..\Foundation\include;..\..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\..\lib64\PocoDNSSDBonjourmd.lib + + + + + + + + + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + + + diff --git a/DNSSD/Bonjour/Bonjour_vs170.vcxproj.filters b/DNSSD/Bonjour/Bonjour_vs170.vcxproj.filters new file mode 100644 index 000000000..b3cefbb5a --- /dev/null +++ b/DNSSD/Bonjour/Bonjour_vs170.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {b499a951-43a2-42e9-a50c-4d24706c15f5} + + + {3672f4ca-3574-44db-a470-1154d4d7882a} + + + {af80b2ee-d29e-4040-9abb-7e54c5d7dc57} + + + + + Implementation\Header Files + + + Implementation\Header Files + + + Implementation\Header Files + + + Implementation\Header Files + + + + + Implementation\Source Files + + + Implementation\Source Files + + + Implementation\Source Files + + + \ No newline at end of file diff --git a/DNSSD/Bonjour/Bonjour_vs90.sln b/DNSSD/Bonjour/Bonjour_vs90.sln new file mode 100644 index 000000000..574f9f962 --- /dev/null +++ b/DNSSD/Bonjour/Bonjour_vs90.sln @@ -0,0 +1,37 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bonjour", "Bonjour_vs90.vcproj", "{D9257FF3-3A9A-41F6-B60E-D077EFF94186}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Build.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/Bonjour/Bonjour_vs90.vcproj b/DNSSD/Bonjour/Bonjour_vs90.vcproj new file mode 100644 index 000000000..8ebe7442a --- /dev/null +++ b/DNSSD/Bonjour/Bonjour_vs90.vcproj @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DNSSD/Bonjour/Bonjour_x64_vs90.sln b/DNSSD/Bonjour/Bonjour_x64_vs90.sln new file mode 100644 index 000000000..edcee47d3 --- /dev/null +++ b/DNSSD/Bonjour/Bonjour_x64_vs90.sln @@ -0,0 +1,37 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bonjour", "Bonjour_x64_vs90.vcproj", "{D9257FF3-3A9A-41F6-B60E-D077EFF94186}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Build.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.ActiveCfg = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Build.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Deploy.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Build.0 = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/Bonjour/CMakeLists.txt b/DNSSD/Bonjour/CMakeLists.txt new file mode 100644 index 000000000..9ebe086be --- /dev/null +++ b/DNSSD/Bonjour/CMakeLists.txt @@ -0,0 +1,33 @@ +set(LIBNAME "DNSSDBonjour") +set(POCO_LIBNAME "Poco${LIBNAME}") + +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( Bonjour_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( Bonjour_SRCS ${HDRS_G}) + +add_definitions( ${Bonjour_CFLAGS} -DTHREADSAFE) + +add_library( "${LIBNAME}" ${LIB_MODE} ${Bonjour_SRCS} ) +add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") +set_target_properties( "${LIBNAME}" + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME ${POCO_LIBNAME} + DEFINE_SYMBOL Bonjour_EXPORTS + ) + +target_link_libraries( "${LIBNAME}" Foundation Net DNSSD ${BONJOUR_LIBRARIES}) +target_include_directories( "${LIBNAME}" + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src + ) +target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS}) + +POCO_INSTALL("${LIBNAME}") +POCO_GENERATE_PACKAGE("${LIBNAME}") diff --git a/DNSSD/Bonjour/Makefile b/DNSSD/Bonjour/Makefile new file mode 100644 index 000000000..7987c97b4 --- /dev/null +++ b/DNSSD/Bonjour/Makefile @@ -0,0 +1,18 @@ +# +# Makefile +# +# $Id: //poco/1.7/DNSSD/Bonjour/Makefile#1 $ +# +# Makefile for Poco DNSSD Bonjour +# + +include $(POCO_BASE)/build/rules/global + +objects = \ + BonjourBrowserImpl BonjourResponderImpl EventLoop + +target = PocoDNSSDBonjour +target_version = 1 +target_libs = PocoNet PocoDNSSD PocoFoundation + +include $(POCO_BASE)/build/rules/lib diff --git a/DNSSD/Bonjour/cmake/PocoDNSSDBonjourConfig.cmake b/DNSSD/Bonjour/cmake/PocoDNSSDBonjourConfig.cmake new file mode 100644 index 000000000..76cfea8b9 --- /dev/null +++ b/DNSSD/Bonjour/cmake/PocoDNSSDBonjourConfig.cmake @@ -0,0 +1,5 @@ +include(CMakeFindDependencyMacro) +find_dependency(PocoFoundation) +find_dependency(PocoNet) +find_dependency(PocoDNSSD) +include("${CMAKE_CURRENT_LIST_DIR}/PocoDNSSDBonjourTargets.cmake") diff --git a/DNSSD/Bonjour/dependencies b/DNSSD/Bonjour/dependencies new file mode 100644 index 000000000..5ab5fc352 --- /dev/null +++ b/DNSSD/Bonjour/dependencies @@ -0,0 +1,3 @@ +Foundation +Net +DNSSD diff --git a/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/Bonjour.h b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/Bonjour.h new file mode 100644 index 000000000..149c7d9be --- /dev/null +++ b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/Bonjour.h @@ -0,0 +1,76 @@ +// +// Bonjour.h +// +// $Id: //poco/1.7/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/Bonjour.h#1 $ +// +// Library: DNSSD/Bonjour +// Package: Implementation +// Module: Bonjour +// +// Basic definitions for the Poco DNSSD Bonjour library. +// This file must be the first file included by every other DNSSD Bonjour +// header file. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Bonjour_Bonjour_INCLUDED +#define DNSSD_Bonjour_Bonjour_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" + + +// +// The following block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the Bonjour_EXPORTS +// symbol defined on the command line. This symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// DNSSD_Bonjour_API functions as being imported from a DLL, wheras this DLL sees symbols +// defined with this macro as being exported. +// +#if defined(_WIN32) && defined(POCO_DLL) + #if defined(Bonjour_EXPORTS) + #define DNSSD_Bonjour_API __declspec(dllexport) + #else + #define DNSSD_Bonjour_API __declspec(dllimport) + #endif +#endif + + +#if !defined(DNSSD_Bonjour_API) + #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4) + #define DNSSD_Bonjour_API __attribute__ ((visibility ("default"))) + #else + #define DNSSD_Bonjour_API + #endif +#endif + + +#if defined(_MSC_VER) + #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Bonjour_EXPORTS) + #pragma comment(lib, "PocoDNSSDBonjour" POCO_LIB_SUFFIX) + #endif +#endif + + +namespace Poco { +namespace DNSSD { + + +void DNSSD_Bonjour_API initializeDNSSD(); + /// Initialize the DNSSD subsystem. + + +void DNSSD_Bonjour_API uninitializeDNSSD(); + /// Uninitialize the DNSSD subsystem. + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_Bonjour_Bonjour_INCLUDED diff --git a/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/BonjourBrowserImpl.h b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/BonjourBrowserImpl.h new file mode 100644 index 000000000..8acd77d32 --- /dev/null +++ b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/BonjourBrowserImpl.h @@ -0,0 +1,79 @@ +// +// BonjourBrowserImpl.h +// +// $Id: //poco/1.7/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/BonjourBrowserImpl.h#1 $ +// +// Library: DNSSD/Bonjour +// Package: Implementation +// Module: BonjourBrowserImpl +// +// Definition of the BonjourBrowserImpl class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Bonjour_BonjourBrowserImpl_INCLUDED +#define DNSSD_Bonjour_BonjourBrowserImpl_INCLUDED + + +#include "Poco/DNSSD/Bonjour/Bonjour.h" +#include "Poco/DNSSD/DNSSDBrowser.h" +#include "Poco/Timestamp.h" +#include "Poco/Event.h" +#include +#include + + +namespace Poco { +namespace DNSSD { +namespace Bonjour { + + +class EventLoop; + + +class DNSSD_Bonjour_API BonjourBrowserImpl: public DNSSDBrowser + /// The DNSSDBrowser implementation for Bonjour. +{ +public: + BonjourBrowserImpl(EventLoop& eventLoop); + /// Creates the BonjourBrowserImpl. + + ~BonjourBrowserImpl(); + /// Destroys the BonjourBrowserImpl. + + // DNSSDBrowser + BrowseHandle browse(const std::string& regType, const std::string& domain, int options, Poco::Int32 networkInterface) override; + BrowseHandle resolve(const Service& service, int options) override; + BrowseHandle enumerateBrowseDomains(Poco::Int32 networkInterface) override; + BrowseHandle enumerateRegistrationDomains(Poco::Int32 networkInterface) override; + BrowseHandle queryRecord(const std::string& name, Poco::UInt16 type, Poco::UInt16 clazz, int options, Poco::Int32 networkInterface) override; + BrowseHandle resolveHost(const std::string& host, int options, Poco::Int32 networkInterface) override; + void cancel(BrowseHandle& browseHandle) override; + + // Implementation + void onBrowseReply(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char* serviceName, const char* regtype, const char* domain); + void onResolveReply(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char* fullName, const char* host, uint16_t port, uint16_t txtLen, const unsigned char* txtRecord); + void onEnumerateBrowseDomainsReply(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char* replyDomain); + void onEnumerateRegistrationDomainsReply(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char* replyDomain); + void onQueryRecordReply(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char* fullName, uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void* rdata, uint32_t ttl); + void onResolveHostReply(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char* hostname, const struct sockaddr* address, uint32_t ttl); + +protected: + static void parseTXTRecord(Poco::UInt16 length, const void* data, Service::Properties& properties); + +private: + using ServiceMap = std::map; + EventLoop& _eventLoop; + ServiceMap _serviceMap; +}; + + +} } } // namespace Poco::DNSSD::Bonjour + + +#endif // DNSSD_Bonjour_BonjourBrowserImpl_INCLUDED diff --git a/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/BonjourResponderImpl.h b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/BonjourResponderImpl.h new file mode 100644 index 000000000..7c22a4e30 --- /dev/null +++ b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/BonjourResponderImpl.h @@ -0,0 +1,88 @@ +// +// BonjourResponderImpl.h +// +// $Id: //poco/1.7/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/BonjourResponderImpl.h#1 $ +// +// Library: DNSSD/Bonjour +// Package: Implementation +// Module: BonjourResponderImpl +// +// Definition of the BonjourResponderImpl class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Bonjour_BonjourResponderImpl_INCLUDED +#define DNSSD_Bonjour_BonjourResponderImpl_INCLUDED + + +#include "Poco/DNSSD/Bonjour/Bonjour.h" +#include "Poco/DNSSD/Bonjour/BonjourBrowserImpl.h" +#include "Poco/DNSSD/Bonjour/EventLoop.h" +#include "Poco/DNSSD/DNSSDResponderImpl.h" +#include "Poco/DNSSD/DNSSDResponder.h" +#include "Poco/Thread.h" + + +namespace Poco { +namespace DNSSD { +namespace Bonjour { + + +class DNSSD_Bonjour_API BonjourResponderImpl: public Poco::DNSSD::DNSSDResponderImpl + /// The DNSSDResponderImpl implementation for Bonjour. +{ +public: + BonjourResponderImpl(Poco::DNSSD::DNSSDResponder& owner); + /// Creates the BonjourResponder, using the given owner. + + ~BonjourResponderImpl(); + /// Destroys the BonjourResponderImpl. + + // DNSSDResponderImpl + DNSSDBrowser& browser() override; + ServiceHandle registerService(const Service& service, int options) override; + void unregisterService(ServiceHandle& serviceHandle) override; + RecordHandle addRecord(ServiceHandle serviceHandle, const Record& record) override; + void updateRecord(ServiceHandle serviceHandle, RecordHandle recordHandle, const Record& record) override; + void removeRecord(ServiceHandle serviceHandle, RecordHandle& recordHandle) override; + void start() override; + void stop() override; + + // Implementation + static const char* describeError(int code); + /// Returns a human-readable string describing the error. + + void onRegisterServiceReply(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, const char* name, const char* regtype, const char* domain); + +protected: + static std::string createTXTRecord(const Service::Properties& properties); + +private: + Poco::DNSSD::DNSSDResponder& _owner; + EventLoop _eventLoop; + Poco::Thread _eventLoopThread; + BonjourBrowserImpl _browser; + bool _running; +}; + + +class DNSSD_Bonjour_API BonjourResponderImplFactory: public Poco::DNSSD::DNSSDResponderImplFactory + /// A factory for BonjourResponderImplFactory objects. +{ +public: + DNSSDResponderImpl* createResponderImpl(Poco::DNSSD::DNSSDResponder& owner) + { + return new BonjourResponderImpl(owner); + } +}; + + +} } } // namespace Poco::DNSSD::Bonjour + + +#endif // DNSSD_Bonjour_BonjourResponderImpl_INCLUDED diff --git a/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/EventLoop.h b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/EventLoop.h new file mode 100644 index 000000000..27f6d573d --- /dev/null +++ b/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/EventLoop.h @@ -0,0 +1,120 @@ +// +// EventLoop.h +// +// $Id: //poco/1.7/DNSSD/Bonjour/include/Poco/DNSSD/Bonjour/EventLoop.h#1 $ +// +// Library: DNSSD/Bonjour +// Package: Implementation +// Module: EventLoop +// +// Definition of the EventLoop class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Bonjour_EventLoop_INCLUDED +#define DNSSD_Bonjour_EventLoop_INCLUDED + + +#include "Poco/DNSSD/Bonjour/Bonjour.h" +#include "Poco/Runnable.h" +#include "Poco/Mutex.h" +#include "Poco/Event.h" +#include "Poco/Net/Socket.h" +#include +#include +#include + + +namespace Poco { +namespace DNSSD { +namespace Bonjour { + + +class DNSSD_Bonjour_API EventLoop: public Poco::Runnable + /// The EventLoop class monitors all sockets used by Bonjour (for the connection + /// between the client and the daemon) in a thread and drives the + /// Bonjour machinery. +{ +public: + typedef Poco::ScopedLock ScopedLock; + + enum + { + EVENTLOOP_TIMEOUT = 250 + }; + + EventLoop(); + /// Creates the EventLoop. + + ~EventLoop(); + /// Destroys the EventLoop. + + void add(DNSServiceRef sdRef); + /// Adds the reference to the eventloop, monitoring it for data. + + void remove(DNSServiceRef sdRef); + /// Removes and destroys the DNSServiceRef. + + void stop(); + /// Requests to stop event loop processing. + + void shutdown(); + /// Cleans up and frees all DNSServiceRefs. + /// + /// Must be called after the event loop thread has been stopped. + + void lock(); + /// Locks the internal mutex. + + void unlock(); + /// Unlocks the internal mutex. + +protected: + void run() override; + void removeImpl(DNSServiceRef sdRef); + +private: + using SockToRef = std::map; + using RefToSock = std::map; + using RefSet = std::set; + + RefToSock _refs; + SockToRef _sockets; + RefSet _invalidatedRefs; + bool _stop; + Poco::Event _refAdded; + Poco::Mutex _mutex; +}; + + +// +// inlines +// +inline void EventLoop::stop() +{ + _stop = true; + _refAdded.set(); +} + + +inline void EventLoop::lock() +{ + _mutex.lock(); +} + + +inline void EventLoop::unlock() +{ + _mutex.unlock(); +} + + +} } } // namespace Poco::DNSSD::Bonjour + + +#endif // DNSSD_Bonjour_EventLoop_INCLUDED diff --git a/DNSSD/Bonjour/src/BonjourBrowserImpl.cpp b/DNSSD/Bonjour/src/BonjourBrowserImpl.cpp new file mode 100644 index 000000000..caef4992c --- /dev/null +++ b/DNSSD/Bonjour/src/BonjourBrowserImpl.cpp @@ -0,0 +1,486 @@ +// +// BonjourBrowserImpl.cpp +// +// $Id: //poco/1.7/DNSSD/Bonjour/src/BonjourBrowserImpl.cpp#1 $ +// +// Library: DNSSD/Bonjour +// Package: Implementation +// Module: BonjourBrowserImpl +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/Bonjour/BonjourBrowserImpl.h" +#include "Poco/DNSSD/Bonjour/BonjourResponderImpl.h" +#include "Poco/DNSSD/Bonjour/EventLoop.h" +#include "Poco/DNSSD/DNSSDException.h" +#include "Poco/ByteOrder.h" +#include + + +namespace Poco { +namespace DNSSD { +namespace Bonjour { + + +extern "C" void DNSSD_API onBrowseReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* serviceName, + const char* regtype, + const char* replyDomain, + void* context) +{ + try + { + BonjourBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onBrowseReply(sdRef, flags, interfaceIndex, errorCode, serviceName, regtype, replyDomain); + } + catch (...) + { + } +} + + +extern "C" void DNSSD_API onResolveReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* fullName, + const char* host, + uint16_t port, + uint16_t txtLen, +#if _DNS_SD_H+0 >= 1070600 + const unsigned char* txtRecord, +#else + const char* txtRecord, +#endif + void* context + ) +{ + try + { + BonjourBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onResolveReply(sdRef, flags, interfaceIndex, errorCode, fullName, host, port, txtLen, (const unsigned char*) txtRecord); + } + catch (...) + { + } +} + + +extern "C" void DNSSD_API onEnumerateBrowseDomainsReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* replyDomain, + void* context) +{ + try + { + BonjourBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onEnumerateBrowseDomainsReply(sdRef, flags, interfaceIndex, errorCode, replyDomain); + } + catch (...) + { + } +} + + +extern "C" void DNSSD_API onEnumerateRegistrationDomainsReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* replyDomain, + void* context) +{ + try + { + BonjourBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onEnumerateRegistrationDomainsReply(sdRef, flags, interfaceIndex, errorCode, replyDomain); + } + catch (...) + { + } +} + + +extern "C" void DNSSD_API onQueryRecordReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* fullName, + uint16_t rrtype, + uint16_t rrclass, + uint16_t rdlen, + const void* rdata, + uint32_t ttl, + void* context) +{ + try + { + BonjourBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onQueryRecordReply(sdRef, flags, interfaceIndex, errorCode, fullName, rrtype, rrclass, rdlen, rdata, ttl); + } + catch (...) + { + } +} + + +extern "C" void DNSSD_API onResolveHostReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* hostname, + const struct sockaddr* address, + uint32_t ttl, + void* context) +{ + try + { + BonjourBrowserImpl* pBrowser = reinterpret_cast(context); + pBrowser->onResolveHostReply(sdRef, flags, interfaceIndex, errorCode, hostname, address, ttl); + } + catch (...) + { + } +} + + +BonjourBrowserImpl::BonjourBrowserImpl(EventLoop& eventLoop): + _eventLoop(eventLoop) +{ +} + + +BonjourBrowserImpl::~BonjourBrowserImpl() +{ +} + + +BrowseHandle BonjourBrowserImpl::browse(const std::string& regType, const std::string& domain, int options, Poco::Int32 networkInterface) +{ + DNSServiceRef sdRef(nullptr); + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceErrorType err = DNSServiceBrowse(&sdRef, 0, networkInterface, regType.c_str(), domain.empty() ? 0 : domain.c_str(), Poco::DNSSD::Bonjour::onBrowseReply, this); + if (err == kDNSServiceErr_NoError) + { + _eventLoop.add(sdRef); + return BrowseHandle(sdRef); + } + else throw Poco::DNSSD::DNSSDException("Failed to browse for " + regType, BonjourResponderImpl::describeError(err), err); +} + + +BrowseHandle BonjourBrowserImpl::resolve(const Service& service, int options) +{ + DNSServiceRef sdRef(0); + Poco::Int32 ifIndex = (options & RESOLVE_ON_ALL_INTERFACES) ? 0 : service.networkInterface(); + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceErrorType err = DNSServiceResolve(&sdRef, 0, ifIndex, service.name().c_str(), service.type().c_str(), service.domain().c_str(), Poco::DNSSD::Bonjour::onResolveReply, this); + if (err == kDNSServiceErr_NoError) + { + _serviceMap[sdRef] = service; + _eventLoop.add(sdRef); + return BrowseHandle(sdRef); + } + else throw Poco::DNSSD::DNSSDException("Failed to resolve " + service.name(), BonjourResponderImpl::describeError(err), err); +} + + +BrowseHandle BonjourBrowserImpl::enumerateBrowseDomains(Poco::Int32 networkInterface) +{ + DNSServiceRef sdRef(0); + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceErrorType err = DNSServiceEnumerateDomains(&sdRef, kDNSServiceFlagsBrowseDomains, networkInterface, Poco::DNSSD::Bonjour::onEnumerateBrowseDomainsReply, this); + if (err == kDNSServiceErr_NoError) + { + _eventLoop.add(sdRef); + return BrowseHandle(sdRef); + } + else throw Poco::DNSSD::DNSSDException("Failed to enumerate browse domains", BonjourResponderImpl::describeError(err), err); +} + + +BrowseHandle BonjourBrowserImpl::enumerateRegistrationDomains(Poco::Int32 networkInterface) +{ + DNSServiceRef sdRef(0); + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceErrorType err = DNSServiceEnumerateDomains(&sdRef, kDNSServiceFlagsRegistrationDomains, networkInterface, Poco::DNSSD::Bonjour::onEnumerateRegistrationDomainsReply, this); + if (err == kDNSServiceErr_NoError) + { + _eventLoop.add(sdRef); + return BrowseHandle(sdRef); + } + else throw Poco::DNSSD::DNSSDException("Failed to enumerate registration domains", BonjourResponderImpl::describeError(err), err); +} + + +BrowseHandle BonjourBrowserImpl::queryRecord(const std::string& name, Poco::UInt16 type, Poco::UInt16 clazz, int options, Poco::Int32 networkInterface) +{ + DNSServiceRef sdRef(nullptr); + DNSServiceFlags flags(0); + if (options & BROWSE_FORCE_MULTICAST) flags |= kDNSServiceFlagsForceMulticast; + if (options & BROWSE_LONG_LIVED_QUERY) flags |= kDNSServiceFlagsLongLivedQuery; + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceErrorType err = DNSServiceQueryRecord(&sdRef, flags, networkInterface, name.c_str(), type, clazz, Poco::DNSSD::Bonjour::onQueryRecordReply, this); + if (err == kDNSServiceErr_NoError) + { + _eventLoop.add(sdRef); + return BrowseHandle(sdRef); + } + else throw Poco::DNSSD::DNSSDException("Failed to query record " + name, BonjourResponderImpl::describeError(err), err); +} + + +BrowseHandle BonjourBrowserImpl::resolveHost(const std::string& host, int options, Poco::Int32 networkInterface) +{ + DNSServiceRef sdRef(0); + DNSServiceFlags flags(0); + if (options & BROWSE_FORCE_MULTICAST) flags |= kDNSServiceFlagsForceMulticast; + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceErrorType err = DNSServiceGetAddrInfo(&sdRef, flags, networkInterface, 0, host.c_str(), Poco::DNSSD::Bonjour::onResolveHostReply, this); + if (err == kDNSServiceErr_NoError) + { + _eventLoop.add(sdRef); + return BrowseHandle(sdRef); + } + else throw Poco::DNSSD::DNSSDException("Failed to resolve host " + host, BonjourResponderImpl::describeError(err), err); +} + + +void BonjourBrowserImpl::cancel(BrowseHandle& browseHandle) +{ + DNSServiceRef sdRef = browseHandle.cast(); + ServiceMap::iterator it = _serviceMap.find(sdRef); + if (it != _serviceMap.end()) _serviceMap.erase(it); + _eventLoop.remove(sdRef); + browseHandle.reset(); +} + + +void BonjourBrowserImpl::onBrowseReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* serviceName, + const char* regtype, + const char* replyDomain) +{ + if (errorCode == kDNSServiceErr_NoError) + { + int eventFlags((flags & kDNSServiceFlagsMoreComing) ? BROWSE_MORE_COMING : 0); + Service service(interfaceIndex, serviceName, regtype, replyDomain); + ServiceEventArgs args(BrowseHandle(sdRef), eventFlags, service); + if (flags & kDNSServiceFlagsAdd) + { + serviceFound(this, args); + } + else + { + serviceRemoved(this, args); + } + } + else + { + Error error(interfaceIndex, errorCode, BonjourResponderImpl::describeError(errorCode)); + ErrorEventArgs args(BrowseHandle(sdRef), 0, error); + browseError(this, args); + } +} + + +void BonjourBrowserImpl::onResolveReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* fullName, + const char* host, + uint16_t port, + uint16_t txtLen, + const unsigned char* txtRecord) +{ + ServiceMap::iterator it = _serviceMap.find(sdRef); + _eventLoop.remove(sdRef); + if (errorCode == kDNSServiceErr_NoError) + { + if (it != _serviceMap.end()) + { + Service service(interfaceIndex, it->second.name(), fullName, it->second.type(), it->second.domain(), host, Poco::ByteOrder::fromNetwork(port)); + _serviceMap.erase(it); + parseTXTRecord(txtLen, txtRecord, service.properties()); + int eventFlags((flags & kDNSServiceFlagsMoreComing) ? BROWSE_MORE_COMING : 0); + ServiceEventArgs args(BrowseHandle(sdRef), eventFlags, service); + serviceResolved(this, args); + } + } + else + { + if (it != _serviceMap.end()) _serviceMap.erase(it); + Error error(interfaceIndex, errorCode, BonjourResponderImpl::describeError(errorCode)); + ErrorEventArgs args(BrowseHandle(sdRef), 0, error); + resolveError(this, args); + } +} + + +void BonjourBrowserImpl::onEnumerateBrowseDomainsReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* replyDomain) +{ + if (errorCode == kDNSServiceErr_NoError) + { + int eventFlags((flags & kDNSServiceFlagsMoreComing) ? BROWSE_MORE_COMING : 0); + Domain domain(interfaceIndex, replyDomain, (flags & kDNSServiceFlagsDefault) != 0); + DomainEventArgs args(BrowseHandle(sdRef), eventFlags, domain); + if (flags & kDNSServiceFlagsAdd) + { + browseDomainFound(this, args); + } + else + { + browseDomainRemoved(this, args); + } + } + else + { + Error error(interfaceIndex, errorCode, BonjourResponderImpl::describeError(errorCode)); + ErrorEventArgs args(BrowseHandle(sdRef), 0, error); + browseDomainError(this, args); + } +} + + +void BonjourBrowserImpl::onEnumerateRegistrationDomainsReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* replyDomain) +{ + if (errorCode == kDNSServiceErr_NoError) + { + int eventFlags((flags & kDNSServiceFlagsMoreComing) ? BROWSE_MORE_COMING : 0); + Domain domain(interfaceIndex, replyDomain, (flags & kDNSServiceFlagsDefault) != 0); + DomainEventArgs args(BrowseHandle(sdRef), eventFlags, domain); + if (flags & kDNSServiceFlagsAdd) + { + registrationDomainFound(this, args); + } + else + { + registrationDomainRemoved(this, args); + } + } + else + { + Error error(interfaceIndex, errorCode, BonjourResponderImpl::describeError(errorCode)); + ErrorEventArgs args(BrowseHandle(sdRef), 0, error); + registrationDomainError(this, args); + } +} + + +void BonjourBrowserImpl::onQueryRecordReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + uint32_t interfaceIndex, + DNSServiceErrorType errorCode, + const char* fullName, + uint16_t rrtype, + uint16_t rrclass, + uint16_t rdlen, + const void* rdata, + uint32_t ttl) +{ + if (errorCode == kDNSServiceErr_NoError) + { + int eventFlags((flags & kDNSServiceFlagsMoreComing) ? BROWSE_MORE_COMING : 0); + Record record(interfaceIndex, fullName, rrtype, rrclass, rdlen, rdata, ttl); + RecordEventArgs args(BrowseHandle(sdRef), eventFlags, record); + if (flags & kDNSServiceFlagsAdd) + { + recordFound(this, args); + } + else + { + recordRemoved(this, args); + } + } + else + { + Error error(interfaceIndex, errorCode, BonjourResponderImpl::describeError(errorCode)); + ErrorEventArgs args(BrowseHandle(sdRef), 0, error); + recordError(this, args); + } +} + + +void BonjourBrowserImpl::onResolveHostReply(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char* hostname, const struct sockaddr* address, uint32_t ttl) +{ + _eventLoop.remove(sdRef); + if (errorCode == kDNSServiceErr_NoError) + { + Poco::Net::IPAddress addr; + switch (address->sa_family) + { + case AF_INET: + addr = Poco::Net::IPAddress(&reinterpret_cast(address)->sin_addr, sizeof(in_addr)); + break; +#if defined(POCO_HAVE_IPv6) + case AF_INET6: + addr = Poco::Net::IPAddress(&reinterpret_cast(address)->sin6_addr, sizeof(in6_addr)); + break; +#endif + } + int eventFlags((flags & kDNSServiceFlagsMoreComing) ? BROWSE_MORE_COMING : 0); + std::string host(hostname); + ResolveHostEventArgs args(BrowseHandle(sdRef), eventFlags, host, addr, interfaceIndex, ttl); + hostResolved(this, args); + } + else + { + Error error(interfaceIndex, errorCode, BonjourResponderImpl::describeError(errorCode)); + ErrorEventArgs args(BrowseHandle(sdRef), 0, error); + hostResolveError(this, args); + } +} + + +void BonjourBrowserImpl::parseTXTRecord(Poco::UInt16 length, const void* data, Service::Properties& properties) +{ + Poco::UInt16 n = TXTRecordGetCount(length, data); + char key[256]; + std::string strKey; + for (Poco::UInt16 i = 0; i < n; ++i) + { + Poco::UInt8 valueLength = 0; + const void* value; + TXTRecordGetItemAtIndex(length, data, i, sizeof(key), key, &valueLength, &value); + strKey.assign(key); + if (!strKey.empty()) // An empty TXT record will contain one key with an empty name. + { + properties.add(strKey, std::string(value ? reinterpret_cast(value) : "", valueLength)); + } + } +} + + +} } } // namespace Poco::DNSSD::Bonjour diff --git a/DNSSD/Bonjour/src/BonjourResponderImpl.cpp b/DNSSD/Bonjour/src/BonjourResponderImpl.cpp new file mode 100644 index 000000000..96cd5ddf8 --- /dev/null +++ b/DNSSD/Bonjour/src/BonjourResponderImpl.cpp @@ -0,0 +1,341 @@ +// +// BonjourResponderImpl.cpp +// +// $Id: //poco/1.7/DNSSD/Bonjour/src/BonjourResponderImpl.cpp#1 $ +// +// Library: DNSSD/Bonjour +// Package: Implementation +// Module: BonjourResponderImpl +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/Bonjour/BonjourResponderImpl.h" +#include "Poco/DNSSD/DNSSDException.h" +#include "Poco/ByteOrder.h" +#include "Poco/Buffer.h" +#include + + +namespace Poco { +namespace DNSSD { +namespace Bonjour { + + +extern "C" void DNSSD_API onRegisterServiceReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + DNSServiceErrorType errorCode, + const char* name, + const char* regtype, + const char* domain, + void *context) +{ + try + { + BonjourResponderImpl* pResponder = reinterpret_cast(context); + pResponder->onRegisterServiceReply(sdRef, flags, errorCode, name, regtype, domain); + } + catch (...) + { + } +} + + +BonjourResponderImpl::BonjourResponderImpl(Poco::DNSSD::DNSSDResponder& owner): + _owner(owner), + _browser(_eventLoop), + _running(false) +{ +} + + +BonjourResponderImpl::~BonjourResponderImpl() +{ + try + { + stop(); + } + catch (...) + { + poco_unexpected(); + } +} + + +DNSSDBrowser& BonjourResponderImpl::browser() +{ + return _browser; +} + + +ServiceHandle BonjourResponderImpl::registerService(const Service& service, int options) +{ + DNSServiceRef sdRef(nullptr); + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceFlags flags(0); + uint32_t intf = (options & DNSSDResponder::REG_LOCAL_ONLY) ? kDNSServiceInterfaceIndexLocalOnly : service.networkInterface(); + if (options & DNSSDResponder::REG_NO_AUTORENAME) flags |= kDNSServiceFlagsNoAutoRename; +#if (_DNS_SD_H <10960002) + // kDNSServiceFlagsNonBrowsable was removed in 1096.0.2 + if (options & DNSSDResponder::REG_NON_BROWSABLE) flags |= kDNSServiceFlagsNonBrowsable; +#endif + std::string txtRecord = createTXTRecord(service.properties()); + DNSServiceErrorType err = DNSServiceRegister(&sdRef, flags, intf, service.name().empty() ? 0 : service.name().c_str(), service.type().c_str(), service.domain().empty() ? 0 : service.domain().c_str(), service.host().empty() ? 0 : service.host().c_str(), Poco::ByteOrder::toNetwork(service.port()), txtRecord.size(), txtRecord.empty() ? 0 : txtRecord.data(), Poco::DNSSD::Bonjour::onRegisterServiceReply, this); + if (err == kDNSServiceErr_NoError) + { + _eventLoop.add(sdRef); + return ServiceHandle(sdRef); + } + else throw Poco::DNSSD::DNSSDException("Failed to register " + service.type(), describeError(err), err); +} + + +void BonjourResponderImpl::unregisterService(ServiceHandle& serviceHandle) +{ + DNSServiceRef sdRef = serviceHandle.cast(); + _eventLoop.remove(sdRef); + serviceHandle.reset(); +} + + +RecordHandle BonjourResponderImpl::addRecord(ServiceHandle serviceHandle, const Record& record) +{ + DNSRecordRef recRef(0); + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceErrorType err = DNSServiceAddRecord(serviceHandle.cast(), &recRef, 0, record.type(), record.length(), record.data(), record.ttl()); + if (err == kDNSServiceErr_NoError) + { + return RecordHandle(recRef); + } + else throw Poco::DNSSD::DNSSDException("Failed to add record " + record.name(), describeError(err), err); +} + + +void BonjourResponderImpl::updateRecord(ServiceHandle serviceHandle, RecordHandle recordHandle, const Record& record) +{ + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceErrorType err = DNSServiceUpdateRecord(serviceHandle.cast(), recordHandle.cast(), 0, record.length(), record.data(), record.ttl()); + if (err != kDNSServiceErr_NoError) + { + throw Poco::DNSSD::DNSSDException("Failed to update record " + record.name(), describeError(err), err); + } +} + + +void BonjourResponderImpl::removeRecord(ServiceHandle serviceHandle, RecordHandle& recordHandle) +{ + EventLoop::ScopedLock lock(_eventLoop); + DNSServiceErrorType err = DNSServiceRemoveRecord(serviceHandle.cast(), recordHandle.cast(), 0); + if (err == kDNSServiceErr_NoError) + { + recordHandle.reset(); + } + else throw Poco::DNSSD::DNSSDException("Failed to remove record", describeError(err), err); +} + + +void BonjourResponderImpl::start() +{ + poco_assert (!_running); + + _eventLoopThread.start(_eventLoop); + _running = true; +} + + +void BonjourResponderImpl::stop() +{ + if (_running) + { + _eventLoop.stop(); + _eventLoopThread.join(); + _eventLoop.shutdown(); + _running = false; + } +} + + +const char* BonjourResponderImpl::describeError(int code) +{ + switch (code) + { + case kDNSServiceErr_Unknown: + return "Unknown"; + case kDNSServiceErr_NoSuchName: + return "No such name"; + case kDNSServiceErr_NoMemory: + return "No memory"; + case kDNSServiceErr_BadParam: + return "Bad parameter"; + case kDNSServiceErr_BadReference: + return "Bad reference"; + case kDNSServiceErr_BadState: + return "Bad state"; + case kDNSServiceErr_BadFlags: + return "Bad flags"; + case kDNSServiceErr_Unsupported: + return "Unsupported"; + case kDNSServiceErr_NotInitialized: + return "Not initialized"; + case kDNSServiceErr_AlreadyRegistered: + return "Already registered"; + case kDNSServiceErr_NameConflict: + return "Name conflict"; + case kDNSServiceErr_Invalid: + return "Invalid"; + case kDNSServiceErr_Firewall: + return "Firewall"; + case kDNSServiceErr_Incompatible: + return "Client library incompatible with daemon"; + case kDNSServiceErr_BadInterfaceIndex: + return "Bad interface index"; + case kDNSServiceErr_Refused: + return "Refused"; + case kDNSServiceErr_NoSuchRecord: + return "No such record"; + case kDNSServiceErr_NoAuth: + return "No auth"; + case kDNSServiceErr_NoSuchKey: + return "No such key"; + case kDNSServiceErr_NATTraversal: + return "NAT traversal"; + case kDNSServiceErr_DoubleNAT: + return "Double NAT"; + case kDNSServiceErr_BadTime: + return "Bad time"; + case kDNSServiceErr_BadSig: + return "Bad signature"; + case kDNSServiceErr_BadKey: + return "Bad key"; + case kDNSServiceErr_Transient: + return "Transient error"; + case kDNSServiceErr_ServiceNotRunning: + return "Service not running"; + case kDNSServiceErr_NATPortMappingUnsupported: + return "NAT port mapping not supported"; + case kDNSServiceErr_NATPortMappingDisabled: + return "NAT port mapping disabled"; +#if _DNS_SD_H+0 >= 2580000 + case kDNSServiceErr_NoRouter: + return "No router"; + case kDNSServiceErr_PollingMode: + return "Polling mode"; +#endif + default: + return "Error"; + } +} + + +std::string BonjourResponderImpl::createTXTRecord(const Service::Properties& properties) +{ + if (properties.empty()) return std::string(1, '\0'); + + Service::Properties::ConstIterator it = properties.begin(); + Service::Properties::ConstIterator itEnd = properties.end(); + std::size_t requiredSize = 0; + for (; it != itEnd; ++it) + { + if (it->first.size() == 0) + throw Poco::InvalidArgumentException("Empty property name is not allowed"); + + std::size_t prevSize = requiredSize; + requiredSize += it->first.size() + 1; // add length byte + if (!it->second.empty()) + { + requiredSize += it->second.size() + 1; // add '=' character + } + if (requiredSize - prevSize > 256) + throw Poco::InvalidArgumentException("Property too large: size of key and value together must not exceed 254 bytes"); + } + + if (requiredSize > 65535) + throw Poco::InvalidArgumentException("Too many properties: maximum TXT record size of 65535 bytes exceeded"); + + Poco::UInt16 size = static_cast(requiredSize); + Poco::Buffer buffer(requiredSize); + + TXTRecordRef ref; + TXTRecordCreate(&ref, size, buffer.begin()); + + // if present, txtvers must be first key in TXT record + Service::Properties::ConstIterator itVers = properties.find("txtvers"); + if (itVers != itEnd) + { + Poco::UInt8 valueSize = static_cast(itVers->second.size()); + TXTRecordSetValue(&ref, itVers->first.c_str(), valueSize, valueSize == 0 ? 0 : itVers->second.c_str()); + } + + it = properties.begin(); + for (; it != itEnd; ++it) + { + if (it != itVers) + { + Poco::UInt8 valueSize = static_cast(it->second.size()); + TXTRecordSetValue(&ref, it->first.c_str(), valueSize, valueSize == 0 ? 0 : it->second.c_str()); + } + } + const void* txtRecord = TXTRecordGetBytesPtr(&ref); + Poco::UInt16 txtSize = TXTRecordGetLength(&ref); + std::string result(reinterpret_cast(txtRecord), txtSize); + TXTRecordDeallocate(&ref); + + return result; +} + + +void BonjourResponderImpl::onRegisterServiceReply( + DNSServiceRef sdRef, + DNSServiceFlags flags, + DNSServiceErrorType errorCode, + const char* name, + const char* regtype, + const char* domain) +{ + if (errorCode == kDNSServiceErr_NoError) + { + Service service(0, name, regtype, domain); + DNSSDResponder::ServiceEventArgs args(ServiceHandle(sdRef), service); + _owner.serviceRegistered(this, args); + } + else + { + Service service(0, name, regtype, domain); + Error error(0, errorCode, describeError(errorCode)); + DNSSDResponder::ErrorEventArgs args(ServiceHandle(sdRef), service, error); + _owner.serviceRegistrationFailed(this, args); + } +} + + +} } } // namespace Poco::DNSSD::Bonjour + + +namespace Poco { +namespace DNSSD { + + +namespace +{ + Poco::DNSSD::Bonjour::BonjourResponderImplFactory implFactory; +} + + +void initializeDNSSD() +{ + Poco::DNSSD::DNSSDResponder::registerImplFactory(implFactory); +} + + +void uninitializeDNSSD() +{ + Poco::DNSSD::DNSSDResponder::unregisterImplFactory(); +} + + +} } // namespace Poco::DNSSD diff --git a/DNSSD/Bonjour/src/EventLoop.cpp b/DNSSD/Bonjour/src/EventLoop.cpp new file mode 100644 index 000000000..b74a5cfe7 --- /dev/null +++ b/DNSSD/Bonjour/src/EventLoop.cpp @@ -0,0 +1,157 @@ +// +// EventLoop.cpp +// +// $Id: //poco/1.7/DNSSD/Bonjour/src/EventLoop.cpp#1 $ +// +// Library: DNSSD/Bonjour +// Package: Implementation +// Module: EventLoop +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/Bonjour/EventLoop.h" +#include "Poco/Net/StreamSocket.h" +#include "Poco/Net/StreamSocketImpl.h" +#include + + +namespace Poco { +namespace DNSSD { +namespace Bonjour { + + +EventLoop::EventLoop(): + _stop(false) +{ +} + + +EventLoop::~EventLoop() +{ + try + { + shutdown(); + } + catch (...) + { + poco_unexpected(); + } +} + + +void EventLoop::shutdown() +{ + RefToSock::iterator it = _refs.begin(); + RefToSock::iterator itEnd = _refs.end(); + for (; it != itEnd; ++it) + { + DNSServiceRefDeallocate(it->first); + } + _refs.clear(); + _sockets.clear(); + _invalidatedRefs.clear(); +} + + +void EventLoop::add(DNSServiceRef sdRef) +{ + int sockfd = DNSServiceRefSockFD(sdRef); + Poco::Net::StreamSocket sock(new Poco::Net::StreamSocketImpl(sockfd)); + + { + Poco::Mutex::ScopedLock lock(_mutex); + _sockets[sock] = sdRef; + _refs[sdRef] = sock; + } + + _refAdded.set(); +} + + +void EventLoop::remove(DNSServiceRef sdRef) +{ + Poco::Mutex::ScopedLock lock(_mutex); + + _invalidatedRefs.insert(sdRef); +} + + +void EventLoop::removeImpl(DNSServiceRef sdRef) +{ + RefToSock::iterator it = _refs.find(sdRef); + if (it != _refs.end()) + { + _sockets.erase(it->second); + _refs.erase(it); + } + DNSServiceRefDeallocate(sdRef); +} + + +void EventLoop::run() +{ + Poco::Net::Socket::SocketList readList; + Poco::Net::Socket::SocketList writeList; + Poco::Net::Socket::SocketList errList; + + while (!_stop) + { + readList.clear(); + if (!_refs.empty() || _refAdded.tryWait(EVENTLOOP_TIMEOUT)) + { + Poco::Mutex::ScopedLock lock(_mutex); + + RefToSock::const_iterator it = _refs.begin(); + RefToSock::const_iterator itEnd = _refs.end(); + for (; it != itEnd; ++it) + { + readList.push_back(it->second); + } + } + + if (!readList.empty()) + { + Poco::Timespan timeout(1000*EVENTLOOP_TIMEOUT); + int ready = Poco::Net::Socket::select(readList, writeList, errList, timeout); + if (ready > 0) + { + Poco::Net::Socket::SocketList::iterator it = readList.begin(); + Poco::Net::Socket::SocketList::iterator itEnd = readList.end(); + for (; it != itEnd; ++it) + { + Poco::Mutex::ScopedLock lock(_mutex); + + SockToRef::iterator itSock = _sockets.find(*it); + poco_assert_dbg (itSock != _sockets.end()); + RefSet::iterator itSet = _invalidatedRefs.find(itSock->second); + if (itSet != _invalidatedRefs.end()) + { + removeImpl(itSock->second); + _invalidatedRefs.erase(itSet); + } + else + { + DNSServiceProcessResult(itSock->second); + } + } + } + } + + Poco::Mutex::ScopedLock lock(_mutex); + RefSet::iterator itSet =_invalidatedRefs.begin(); + RefSet::iterator itSetEnd = _invalidatedRefs.end(); + for (; itSet != itSetEnd; ++itSet) + { + removeImpl(*itSet); + } + _invalidatedRefs.clear(); + } +} + + +} } } // namespace Poco::DNSSD::Bonjour diff --git a/DNSSD/CMakeLists.txt b/DNSSD/CMakeLists.txt new file mode 100644 index 000000000..833a2c6ec --- /dev/null +++ b/DNSSD/CMakeLists.txt @@ -0,0 +1,88 @@ +# ITNOA + +set(DNSSD_IMPLEMENTATION_LIBRARY "") + +macro(ADD_AVAHI) + find_package(Avahi REQUIRED) + if(AVAHI_FOUND) + include_directories("${AVAHI_INCLUDE_DIR}") + message(STATUS "Avahi Support Enabled") + add_subdirectory( Avahi ) + set(DNSSD_IMPLEMENTATION_LIBRARY "DNSSDAvahi") + else() + message(ERROR "Avahi does not found, please make install it") + endif() +endmacro() + +macro(ADD_BONJOUR) + find_package(Bonjour REQUIRED) + if(BONJOUR_FOUND) + if(NOT APPLE) + include_directories("${BONJOUR_INCLUDE_DIR}") + endif() + message(STATUS "Bonjour Support Enabled") + add_subdirectory( Bonjour ) + set(DNSSD_IMPLEMENTATION_LIBRARY "DNSSDBonjour") + else() + message(ERROR "Bonjour does not found, please make install sdk") + endif() +endmacro() + +set(LIBNAME "DNSSD") +set(POCO_LIBNAME "Poco${LIBNAME}") + +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) + +if (NOT POCO_STATIC) + add_definitions(-DTHREADSAFE) +endif (NOT POCO_STATIC) + +add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) +add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}") +set_target_properties( "${LIBNAME}" + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + OUTPUT_NAME ${POCO_LIBNAME} + DEFINE_SYMBOL DNSSD_EXPORTS + ) + +target_link_libraries( "${LIBNAME}" Foundation Net) +target_include_directories( "${LIBNAME}" + PUBLIC + $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src + ) +target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS}) + +POCO_INSTALL("${LIBNAME}") +POCO_GENERATE_PACKAGE("${LIBNAME}") + +if(ENABLE_DNSSD_DEFAULT) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") # `UNIX AND NOT APPLE` it is not equal to Linux ;) + set(LINUX TRUE) + endif() + if(LINUX) + ADD_AVAHI() + else() + ADD_BONJOUR() + endif() +endif() + +if(ENABLE_DNSSD_AVHAI) + ADD_AVAHI() +endif() + +if(ENABLE_DNSSD_BONJOUR) + ADD_BONJOUR() +endif() + +if (ENABLE_SAMPLES) + add_subdirectory(samples) +endif () diff --git a/DNSSD/DNSSD.progen b/DNSSD/DNSSD.progen new file mode 100644 index 000000000..eb0c92b90 --- /dev/null +++ b/DNSSD/DNSSD.progen @@ -0,0 +1,18 @@ +vc.project.guid = D9257FF3-3A9A-41F6-B60E-D077EFF94186 +vc.project.name = DNSSD +vc.project.target = Poco${vc.project.name} +vc.project.type = library +vc.project.pocobase = .. +vc.project.outdir = ${vc.project.pocobase} +vc.project.platforms = Win32, x64, WinCE +vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md +vc.project.prototype = ${vc.project.name}_vs90.vcproj +vc.project.compiler.include = ..\\Foundation\\include;..\\Net\\include +vc.project.compiler.defines = +vc.project.compiler.defines.shared = ${vc.project.name}_EXPORTS +vc.project.compiler.defines.debug_shared = ${vc.project.compiler.defines.shared} +vc.project.compiler.defines.release_shared = ${vc.project.compiler.defines.shared} +vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.x64 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.WinCE = ws2.lib iphlpapi.lib +vc.solution.create = true diff --git a/DNSSD/DNSSD_vs160.sln b/DNSSD/DNSSD_vs160.sln new file mode 100644 index 000000000..060001943 --- /dev/null +++ b/DNSSD/DNSSD_vs160.sln @@ -0,0 +1,61 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DNSSD", "DNSSD_vs160.vcxproj", "{D9257FF3-3A9A-41F6-B60E-D077EFF94186}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Build.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Build.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.ActiveCfg = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Build.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Deploy.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Build.0 = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/DNSSD_vs160.vcxproj b/DNSSD/DNSSD_vs160.vcxproj new file mode 100644 index 000000000..2cf9269d4 --- /dev/null +++ b/DNSSD/DNSSD_vs160.vcxproj @@ -0,0 +1,635 @@ + + + + + debug_shared + Win32 + + + debug_shared + x64 + + + debug_static_md + Win32 + + + debug_static_md + x64 + + + debug_static_mt + Win32 + + + debug_static_mt + x64 + + + release_shared + Win32 + + + release_shared + x64 + + + release_static_md + Win32 + + + release_static_md + x64 + + + release_static_mt + Win32 + + + release_static_mt + x64 + + + + 17.0 + DNSSD + {D9257FF3-3A9A-41F6-B60E-D077EFF94186} + DNSSD + Win32Proj + + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + DynamicLibrary + MultiByte + v142 + + + DynamicLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + StaticLibrary + MultiByte + v142 + + + DynamicLibrary + MultiByte + v142 + + + DynamicLibrary + MultiByte + v142 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.34511.75 + PocoDNSSDd + PocoDNSSDmdd + PocoDNSSDmtd + PocoDNSSD + PocoDNSSDmd + PocoDNSSDmt + PocoDNSSD64d + PocoDNSSDmdd + PocoDNSSDmtd + PocoDNSSD64 + PocoDNSSDmd + PocoDNSSDmt + + + ..\bin\ + obj\DNSSD\$(Configuration)\ + true + + + ..\bin\ + obj\DNSSD\$(Configuration)\ + false + + + ..\lib\ + obj\DNSSD\$(Configuration)\ + + + ..\lib\ + obj\DNSSD\$(Configuration)\ + + + ..\lib\ + obj\DNSSD\$(Configuration)\ + + + ..\lib\ + obj\DNSSD\$(Configuration)\ + + + ..\bin64\ + obj64\DNSSD\$(Configuration)\ + true + + + ..\bin64\ + obj64\DNSSD\$(Configuration)\ + false + + + ..\lib64\ + obj64\DNSSD\$(Configuration)\ + + + ..\lib64\ + obj64\DNSSD\$(Configuration)\ + + + ..\lib64\ + obj64\DNSSD\$(Configuration)\ + + + ..\lib64\ + obj64\DNSSD\$(Configuration)\ + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\bin\PocoDNSSDd.dll + true + true + $(OutDir)$(TargetName).pdb + ..\lib;%(AdditionalLibraryDirectories) + Console + ..\lib\PocoDNSSDd.lib + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\bin\PocoDNSSD.dll + true + false + ..\lib;%(AdditionalLibraryDirectories) + Console + true + true + ..\lib\PocoDNSSD.lib + MachineX86 + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\lib\PocoDNSSDmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\lib\PocoDNSSDmt.lib + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\lib\PocoDNSSDmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + + Default + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\lib\PocoDNSSDmd.lib + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\bin64\PocoDNSSD64d.dll + true + true + $(OutDir)$(TargetName).pdb + ..\lib64;%(AdditionalLibraryDirectories) + Console + ..\lib64\PocoDNSSDd.lib + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\bin64\PocoDNSSD64.dll + true + false + ..\lib64;%(AdditionalLibraryDirectories) + Console + true + true + ..\lib64\PocoDNSSD.lib + MachineX64 + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\lib64\PocoDNSSDmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\lib64\PocoDNSSDmt.lib + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\lib64\PocoDNSSDmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\lib64\PocoDNSSDmd.lib + + + + + + + + + + + + + + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + + + diff --git a/DNSSD/DNSSD_vs160.vcxproj.filters b/DNSSD/DNSSD_vs160.vcxproj.filters new file mode 100644 index 000000000..b6ecb4e67 --- /dev/null +++ b/DNSSD/DNSSD_vs160.vcxproj.filters @@ -0,0 +1,69 @@ + + + + + {99303623-ebed-4008-92f1-ea9429ece898} + + + {018aa474-204b-4604-8dd1-8d1089d23bb6} + + + {ce1ab056-bb91-4f68-be21-d2cd905c33d3} + + + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + \ No newline at end of file diff --git a/DNSSD/DNSSD_vs170.sln b/DNSSD/DNSSD_vs170.sln new file mode 100644 index 000000000..444853056 --- /dev/null +++ b/DNSSD/DNSSD_vs170.sln @@ -0,0 +1,85 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DNSSD", "DNSSD_vs170.vcxproj", "{D9257FF3-3A9A-41F6-B60E-D077EFF94186}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|ARM64 = debug_shared|ARM64 + release_shared|ARM64 = release_shared|ARM64 + debug_static_mt|ARM64 = debug_static_mt|ARM64 + release_static_mt|ARM64 = release_static_mt|ARM64 + debug_static_md|ARM64 = debug_static_md|ARM64 + release_static_md|ARM64 = release_static_md|ARM64 + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|ARM64.ActiveCfg = debug_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|ARM64.Build.0 = debug_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|ARM64.Deploy.0 = debug_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|ARM64.ActiveCfg = release_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|ARM64.Build.0 = release_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|ARM64.Deploy.0 = release_shared|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|ARM64.ActiveCfg = debug_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|ARM64.Build.0 = debug_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|ARM64.Deploy.0 = debug_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|ARM64.ActiveCfg = release_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|ARM64.Build.0 = release_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|ARM64.Deploy.0 = release_static_mt|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|ARM64.ActiveCfg = debug_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|ARM64.Build.0 = debug_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|ARM64.Deploy.0 = debug_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|ARM64.ActiveCfg = release_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|ARM64.Build.0 = release_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|ARM64.Deploy.0 = release_static_md|ARM64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Build.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Build.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.ActiveCfg = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Build.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Deploy.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Build.0 = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/DNSSD_vs170.vcxproj b/DNSSD/DNSSD_vs170.vcxproj new file mode 100644 index 000000000..cc7714344 --- /dev/null +++ b/DNSSD/DNSSD_vs170.vcxproj @@ -0,0 +1,915 @@ + + + + + debug_shared + ARM64 + + + debug_shared + Win32 + + + debug_shared + x64 + + + debug_static_md + ARM64 + + + debug_static_md + Win32 + + + debug_static_md + x64 + + + debug_static_mt + ARM64 + + + debug_static_mt + Win32 + + + debug_static_mt + x64 + + + release_shared + ARM64 + + + release_shared + Win32 + + + release_shared + x64 + + + release_static_md + ARM64 + + + release_static_md + Win32 + + + release_static_md + x64 + + + release_static_mt + ARM64 + + + release_static_mt + Win32 + + + release_static_mt + x64 + + + + 17.0 + DNSSD + {D9257FF3-3A9A-41F6-B60E-D077EFF94186} + DNSSD + Win32Proj + + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + StaticLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + DynamicLibrary + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.34511.75 + PocoDNSSDA64d + PocoDNSSDmdd + PocoDNSSDmtd + PocoDNSSDA64 + PocoDNSSDmd + PocoDNSSDmt + PocoDNSSDd + PocoDNSSDmdd + PocoDNSSDmtd + PocoDNSSD + PocoDNSSDmd + PocoDNSSDmt + PocoDNSSD64d + PocoDNSSDmdd + PocoDNSSDmtd + PocoDNSSD64 + PocoDNSSDmd + PocoDNSSDmt + + + ..\binA64\ + objA64\DNSSD\$(Configuration)\ + true + + + ..\binA64\ + objA64\DNSSD\$(Configuration)\ + false + + + ..\libA64\ + objA64\DNSSD\$(Configuration)\ + + + ..\libA64\ + objA64\DNSSD\$(Configuration)\ + + + ..\libA64\ + objA64\DNSSD\$(Configuration)\ + + + ..\libA64\ + objA64\DNSSD\$(Configuration)\ + + + ..\bin\ + obj\DNSSD\$(Configuration)\ + true + + + ..\bin\ + obj\DNSSD\$(Configuration)\ + false + + + ..\lib\ + obj\DNSSD\$(Configuration)\ + + + ..\lib\ + obj\DNSSD\$(Configuration)\ + + + ..\lib\ + obj\DNSSD\$(Configuration)\ + + + ..\lib\ + obj\DNSSD\$(Configuration)\ + + + ..\bin64\ + obj64\DNSSD\$(Configuration)\ + true + + + ..\bin64\ + obj64\DNSSD\$(Configuration)\ + false + + + ..\lib64\ + obj64\DNSSD\$(Configuration)\ + + + ..\lib64\ + obj64\DNSSD\$(Configuration)\ + + + ..\lib64\ + obj64\DNSSD\$(Configuration)\ + + + ..\lib64\ + obj64\DNSSD\$(Configuration)\ + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\binA64\PocoDNSSDA64d.dll + true + true + $(OutDir)$(TargetName).pdb + ..\libA64;%(AdditionalLibraryDirectories) + Console + ..\libA64\PocoDNSSDd.lib + MachineARM64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\binA64\PocoDNSSDA64.dll + true + false + ..\libA64;%(AdditionalLibraryDirectories) + Console + true + true + ..\libA64\PocoDNSSD.lib + MachineARM64 + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\libA64\PocoDNSSDmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\libA64\PocoDNSSDmt.lib + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\libA64\PocoDNSSDmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\libA64\PocoDNSSDmd.lib + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\bin\PocoDNSSDd.dll + true + true + $(OutDir)$(TargetName).pdb + ..\lib;%(AdditionalLibraryDirectories) + Console + ..\lib\PocoDNSSDd.lib + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\bin\PocoDNSSD.dll + true + false + ..\lib;%(AdditionalLibraryDirectories) + Console + true + true + ..\lib\PocoDNSSD.lib + MachineX86 + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\lib\PocoDNSSDmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\lib\PocoDNSSDmt.lib + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\lib\PocoDNSSDmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + + Default + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\lib\PocoDNSSDmd.lib + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\bin64\PocoDNSSD64d.dll + true + true + $(OutDir)$(TargetName).pdb + ..\lib64;%(AdditionalLibraryDirectories) + Console + ..\lib64\PocoDNSSDd.lib + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;DNSSD_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ..\bin64\PocoDNSSD64.dll + true + false + ..\lib64;%(AdditionalLibraryDirectories) + Console + true + true + ..\lib64\PocoDNSSD.lib + MachineX64 + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\lib64\PocoDNSSDmtd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\lib64\PocoDNSSDmt.lib + + + + + Disabled + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + $(OutDir)$(TargetName).pdb + Level3 + ProgramDatabase + Default + true + stdcpp17 + stdc11 + + + ..\lib64\PocoDNSSDmdd.lib + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\Foundation\include;..\Net\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + ..\lib64\PocoDNSSDmd.lib + + + + + + + + + + + + + + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + true + stdcpp17 + stdc11 + + + + + diff --git a/DNSSD/DNSSD_vs170.vcxproj.filters b/DNSSD/DNSSD_vs170.vcxproj.filters new file mode 100644 index 000000000..e0af9e4c9 --- /dev/null +++ b/DNSSD/DNSSD_vs170.vcxproj.filters @@ -0,0 +1,69 @@ + + + + + {e8bdfc7b-57e4-484b-8d16-a3b65bd75b59} + + + {7dda570e-7773-45fd-8646-6f1d9c0a1fc3} + + + {084794a0-8344-4ddf-8fb3-937553fd8d9f} + + + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + Core\Header Files + + + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + Core\Source Files + + + \ No newline at end of file diff --git a/DNSSD/DNSSD_vs90.sln b/DNSSD/DNSSD_vs90.sln new file mode 100644 index 000000000..a2a04a19d --- /dev/null +++ b/DNSSD/DNSSD_vs90.sln @@ -0,0 +1,37 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DNSSD", "DNSSD_vs90.vcproj", "{D9257FF3-3A9A-41F6-B60E-D077EFF94186}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Build.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/DNSSD_vs90.vcproj b/DNSSD/DNSSD_vs90.vcproj new file mode 100644 index 000000000..c91131f9f --- /dev/null +++ b/DNSSD/DNSSD_vs90.vcproj @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DNSSD/DNSSD_x64_vs90.sln b/DNSSD/DNSSD_x64_vs90.sln new file mode 100644 index 000000000..146f0f93e --- /dev/null +++ b/DNSSD/DNSSD_x64_vs90.sln @@ -0,0 +1,37 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DNSSD", "DNSSD_x64_vs90.vcproj", "{D9257FF3-3A9A-41F6-B60E-D077EFF94186}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Build.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.ActiveCfg = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Build.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_shared|x64.Deploy.0 = release_shared|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Build.0 = release_static_md|x64 + {D9257FF3-3A9A-41F6-B60E-D077EFF94186}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/Default/Makefile b/DNSSD/Default/Makefile new file mode 100644 index 000000000..c5f4755c9 --- /dev/null +++ b/DNSSD/Default/Makefile @@ -0,0 +1,21 @@ +# +# Makefile +# +# $Id: //poco/1.7/DNSSD/Default/Makefile#1 $ +# +# Makefile for DNSSD Default Implementation. +# Use Avahi on Linux, otherwise Bonjour +# + +include $(POCO_BASE)/build/rules/global + +ifeq ($(OSNAME),Linux) +DNSSDLibrary = Avahi +else +DNSSDLibrary = Bonjour +endif + +.PHONY: projects +clean all: projects +projects: + $(MAKE) -C $(POCO_BASE)/DNSSD/$(DNSSDLibrary) $(MAKECMDGOALS) diff --git a/DNSSD/Default/dependencies b/DNSSD/Default/dependencies new file mode 100644 index 000000000..5ab5fc352 --- /dev/null +++ b/DNSSD/Default/dependencies @@ -0,0 +1,3 @@ +Foundation +Net +DNSSD diff --git a/DNSSD/LICENSE b/DNSSD/LICENSE new file mode 100644 index 000000000..2f2f957ce --- /dev/null +++ b/DNSSD/LICENSE @@ -0,0 +1,32 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +--------------------------------------------------------------------------- +Note: +Individual files contain the following tag instead of the full license text. + + SPDX-License-Identifier: BSL-1.0 + +This enables machine processing of license information based on the SPDX +License Identifiers that are here available: http://spdx.org/licenses/ diff --git a/DNSSD/Makefile b/DNSSD/Makefile new file mode 100644 index 000000000..9506c395b --- /dev/null +++ b/DNSSD/Makefile @@ -0,0 +1,20 @@ +# +# Makefile +# +# $Id: //poco/1.7/DNSSD/Makefile#1 $ +# +# Makefile for Poco DNSSD +# + +include $(POCO_BASE)/build/rules/global + +objects = \ + Domain Error Record Service \ + DNSSDBrowser DNSSDResponder DNSSDResponderImpl \ + DNSSDException + +target = PocoDNSSD +target_version = 1 +target_libs = PocoNet PocoFoundation + +include $(POCO_BASE)/build/rules/lib diff --git a/DNSSD/README.md b/DNSSD/README.md new file mode 100644 index 000000000..2af727108 --- /dev/null +++ b/DNSSD/README.md @@ -0,0 +1,49 @@ +POCO DNS-SD (Zeroconf) Wrapper Library for Bonjour and Avahi +============================================================ + +This is a POCO-based wrapper library providing an easy-to-use and +unified programming interface to Apple Bonjour and Avahi libraries +implementing DNS Service Discovery (DNS-SD, also known as Zeroconf). + +Prerequisites +------------- + +The [Apple Bonjour SDK](https://developer.apple.com/bonjour/) is needed on Windows (and OS X, of course). The Avahi client libraries are needed on Linux. + +Getting Started +--------------- + +Clone into the root of an existing POCO source tree. + + + $ git clone https://github.com/pocoproject/poco-dnssd.git DNSSD + +On Linux, build with cmake like below. + + $ git apply DNSSD/CMakeLists.diff + $ sudo ./build_cmake.sh + +On Windows or OS X, build with cmake like below. + + $ git apply DNSSD/CMakeLists.diff + $ mkdir build + $ cd build + $ cmake .. + $ make -j8 + +For build without using cmake on Windows, build the included Visual C++ solution. On Linux/OS X, build with POCO_BASE environment variable set to the root of +the POCO source tree. + + $ export POCO_BASE=`pwd` + $ cd DNSSD + $ make -s -j8 + $ make -s -j8 -C Default + +See the [doc](https://github.com/pocoproject/poco-dnssd/tree/master/doc) directory for documentation and the samples directory for sample +applications. + + +License +------- + +Boost Software License 1.0 diff --git a/DNSSD/cmake/PocoDNSSDConfig.cmake b/DNSSD/cmake/PocoDNSSDConfig.cmake new file mode 100644 index 000000000..c603d8c63 --- /dev/null +++ b/DNSSD/cmake/PocoDNSSDConfig.cmake @@ -0,0 +1,4 @@ +include(CMakeFindDependencyMacro) +find_dependency(PocoFoundation) +find_dependency(PocoNet) +include("${CMAKE_CURRENT_LIST_DIR}/PocoDNSSDTargets.cmake") diff --git a/DNSSD/dependencies b/DNSSD/dependencies new file mode 100644 index 000000000..f6d54af82 --- /dev/null +++ b/DNSSD/dependencies @@ -0,0 +1,2 @@ +Foundation +Net diff --git a/DNSSD/doc/00100-DNSSDOverview.page b/DNSSD/doc/00100-DNSSDOverview.page new file mode 100644 index 000000000..1da4ed3df --- /dev/null +++ b/DNSSD/doc/00100-DNSSDOverview.page @@ -0,0 +1,208 @@ +DNS Service Discovery and Zero Configuration Networking Overview +DNS-SD + +!!!Introduction + +A growing number of embedded devices are connected to TCP/IP networks. +And many of these devices are no longer passive network nodes, waiting +for someone else to control them. They are full-blown network citizens, +actively communicating with their peers and often relying on the network +services provided by other devices to do their job. For this to work, +all these devices must be configured properly. Configuring the network +parameters (e.g., IP address, netmask, etc.) of a device is a tedious task, +as many devices do not have an appropriate user interface to do this comfortably. +This is especially an issue with consumer devices, where the user might not even have the +necessary technical knowledge to configure such a device. And as the +number of devices in a network grows, configuring each device separately +is no longer practical. There from comes the need for the automatic +configuration of network devices and the automatic discovery of network +services. In recent years, the industry has come up with a variety of +different technologies and specifications to address this. + + +!!!Fundamental Issues + +Generally, there are three fundamental issues that must be dealt with +for the automatic discovery of network devices and services, and three +more issues that must be dealt with for the actual invocation or use of +the discovered services. + + +!!Address Assignment + +Every device must be assigned a unique network address. In case of +TCP/IP networks this can be done with the help of a DHCP (Dynamic Host +Configuration Protocol) server. Should, however, no DHCP server be +available (for example, in typical home user networks), another way of +assigning an IP addresses must be found. Apart from manual +configuration, which is often undesirable, a method called APIPA +(Automatic Private IP Addressing, or AutoIP for short) is used. In this +case, a device's TCP/IP stack randomly chooses an IP address in the +private (link-local) IP address range 169.254.0.0 to 169.254.255.255. To +prevent two or more devices from accidentally selecting the same address, +each device must probe, using the ARP (Address Resolution Protocol), +whether the chosen address is available. + + +!!Name Resolution + +Whenever a user (or device) wants to access another device over the +network, he usually wants to refer to the device by its name, not by its +IP address. In a typical TCP/IP network, a DNS (Domain Name System) +server is used to map domain names to IP addresses. Again, if no DNS +server is available, such as in a typical home network, another way of +resolving names to IP addresses is required. Multicast DNS (mDNS), as +used by Zeroconf, is such an alternative technology. + + +!!Service Discovery + +A user or device must be able to find a service provided by one or more +devices in the network. The important part here is that the user (or +device) usually does not care which device implements the service, as +long as the service with specific properties is available and +accessible. A typical example for service discovery is: <*I need to print +a document in color. Give me an IP address and port number where I can +send the print job to, using the Internet Printing Protocol (IPP), so +that the document will be printed in color.*> + +What all technologies for service discovery have in common is, that they +make use of IP multicasting. IP multicasting uses addresses in a special +address range (224.0.0.0 to 239.255.255.255). A packet (typically, a UDP +packet) sent to a multicast address is received by all hosts listening +to that specific address. + +Service discovery is implemented in the following way: + + - An application or device that needs a certain service sends a request + describing the required properties of the service to a specific multicast + address (and port number). + - Other applications or devices on the same network receive the request, + and if they provide the requested service themselves (or know another device + that implements the service), respond with a message describing where the + service can be found. + - The application or device searching for the service collects all responses, + and from the responses chooses the one service provider it is going to use. + +In addition, devices that join or leave a network can send announcements to other +devices describing the availability of the services they provide. + + +!!Service Description + +Once a certain service has been discovered, it may be necessary to +obtain more information about the service. For example, if a service +consists of multiple operations, it is necessary to find out exactly +what operations are supported, and what arguments must be passed to +them. This is the purpose of service description. + +In case only well-defined service protocols are used (e.g., HTTP, +Internet Printing, or media streaming), service description is not +necessary, because the only information needed to access the service is +the network address (IP address and port number, or URI), and this +information can be obtained by service discovery. In other cases, the +information obtained via service discovery is insufficient to +successfully access the service. In such a case, service discovery only +returns the address of a network resource that provides detailed +information about the capabilities of the service, and how to access +them. + + +!!Service Invocation + +After an application has obtained enough information about the services +it wants to access -- either via service discovery alone, or together +with service description, the application will access or invoke them. +This is usually beyond the scope of most service discovery technologies, +and the domain of specialized technologies and protocols. Examples for +such technologies are HTTP (HyperText Transfer Protocol), SOAP, +Java RMI (Remote Method Invocation), CORBA (Common Object Request Broker +Architecture), or media streaming protocols such as RTSP +(Real Time Streaming Protocol). + + +!!Service Presentation + +Some technologies (UPnP and Jini) provide facilities to present a device +specific user interface to the user, via another device (e.g., a central +management workstation, the user's PC or TV set). Such a user interface +can be used to allow the user to directly interact with a device, in +order to configure it, or to use some of its functions not available +otherwise. + +This requires that the user interface is implemented in a device +independent way. One way to do this is to implement the user interface +in HTML (HyperText Markup Language), served by an embedded web server +built into the device. Another way is to implement the user interface in +Java, so that it can be run everywhere a Java Virtual Machine is +available. The user interface code than talks to the device over a +network connection, using a possibly proprietary protocol. + + +!!!Zero Configuration Networking (Zeroconf) + +Zero Configuration Networking (Zeroconf) is a technology originally developed +by Apple and promoted under the trademark name Bonjour. Zeroconf is +built upon technologies known as multicast DNS (mDNS) and DNS +Service Discovery (DNS-SD), which themselves are based on the proven +DNS protocol. Its most popular uses are in network printers, network +cameras and for sharing music using Apple's iTunes music jukebox +software. Open source implementations are available from Apple and +others for all important platforms. + +Zeroconf uses DHCP and AutoIP for address assignment if no DHCP server +is available. A special variant of the well-known DNS protocol, +multicast DNS, is used for name resolution in case no DNS server is +available. In mDNS, a name resolution query is sent not directly to a +DNS server, as with traditional DNS, but to a multicast address. All +network devices supporting Zeroconf and listening to this multicast +address respond to name resolution queries, if they have the requested +information. + +Finally, for service discovery, an extension of the DNS protocol called +DNS Service Discovery is used. DNS-SD can be used both with multicast +DNS (the usual way), or with traditional unicast queries to a DNS +server. With the additional support for DNS Update and DNS Long Lived +Queries, two extensions of the DNS protocol, Zeroconf can be used to +announce services across the global internet. In this case, an ordinary +DNS server is used to make the service information available. Periodic +automatic updates of the DNS server's database ensure that its service +information is up to date. + +A major advantage of Zeroconf is that it is based on proven technology. +Also, it can be implemented in a very resource efficient way, making it +a good choice for resource constrained embedded devices. + +Beside heavy use by Apple in many of its applications for Mac OS X and +Windows (iTunes), Zeroconf is popular among manufacturers of printers +and network cameras. + + +!!Zeroconf Implementations + +Two implementations of Zeroconf are currently in widespread use. + +Apple's Bonjour was the first implementation of Zeroconf. The +implementation is available under an open source license and +can be used on different platforms like Mac OS X, Windows, Linux or +VxWorks. Bonjour is an integrated part of Mac OS X and iOS. +A Windows installer (and SDK) is available as well. + +Avahi is another open source implementation of Zeroconf, targeted +mostly at Linux, although it can also be used on other POSIX platforms +like FreeBSD or Solaris. Avahi has been integrated into many +Linux distributions such as Debian, Ubuntu, SuSE and others. + + +!!The POCO DNS-SD Library + +The POCO DNS-SD library provides an easy-to-use +and unified programming interface for integrating Zeroconf features +(service discovery and host name resolution) into a C++ application. +The library does not implement its own mDNS and DNS-SD protocol stacks, +but rather uses an existing Zeroconf implementation for that purpose. +Apple's Bonjour and Avahi can be used as backend for the DNS-SD library. + +A great advantage of the library is that it provides a unified +programming interface. For the programmer, it's completely +transparent whether Avahi or Bonjour is used as backend. diff --git a/DNSSD/doc/00200-DNSSDTutorialAndUserGuide.page b/DNSSD/doc/00200-DNSSDTutorialAndUserGuide.page new file mode 100644 index 000000000..038ec101f --- /dev/null +++ b/DNSSD/doc/00200-DNSSDTutorialAndUserGuide.page @@ -0,0 +1,406 @@ +DNS-SD Tuturial And User Guide +DNS-SD + +!!!Introduction + +The POCO DNS-SD POCO library provides an easy-to-use and +unified programming interface for integrating Zeroconf features +(service discovery and host name resolution) into a C++ application. +The Applied Informatics DNS-SD library does not +implement its own mDNS and DNS-SD protocol stacks, but rather uses +an existing Zeroconf implementation for that purpose. Apple's Bonjour +and Avahi can be used as backend for the DNS-SD library. + +A great advantage of the library is that it provides a unified +programming interface. For the programmer, it's completely +transparent whether Avahi or Bonjour is used as backend. + + +!!!Programming Basics + +The DNS-SD library provides an asynchronous programming interface. +This means that the application starts a browse or resolve operation +by calling a member function of the Poco::DNSSD::DNSSDBrowser class, +and this function returns immediately. The actual browse or resolve +operation (which involves sending queries over the network and +receiving responses from other hosts) is carried out in a separate +thread, and as soon as results become available, these are reported +to the application via events. + + +!!Event Handlers + +The event handlers registered by the application should +complete their work and return as quick as possible, otherwise they may +interfere with DNS-SD processing. Event handlers should never +wait for other events to happen. Specifically, they must never +wait for an other DNSSDBrowser event to happen, as this will +result in a deadlock. + + +!!Service Types + +Service types (or registration types) are the most important concept when +handling with DNS Service Discovery. A service type consists of a +short name (maximum of 15 characters) specifying the protocol implemented +by the service (prepended by an underscore), followed by a dot, followed +by a name identifying the primary transport protocol, which is either +"_tcp" or "_udp". Service types should be registered at <[dns-sd.org]>. +A list of currently registered service types, as well as information on how +to register a new service type can be found at the +[[http://www.dns-sd.org/ServiceTypes.html DNS-SD website]]. + +Examples for service types are "_daap._tcp" (Digital Audio Access Protocol, +the protocol used by iTunes music sharing), "_http._tcp" (web server) +or "_printer._tcp" for a printing service. + +Service names are not case sensitive. + + +!!!Programming Tasks + +In the following sections, the basic programming Tasks +that need to be performed when working with the DNS-SD library +are described. + + +!!Initializing the DNS-SD Library + +The DNS-SD core library only defines the classes that are part +of the programming interfaces, it does not provide an actual +implementation of these interfaces. So, in addition to the DNS-SD +core library, a backend library must be linked with the application +as well. Depending on which backend library is used, either Apple's +Bonjour or Avahi will be used. + +Before the DNS-SD library can be used it must be initialized. +This is done by calling the Poco::DNSSD::initializeDNSSD() function. +This function is actually defined implemented in a backend library, +so the backend libraries's header file must be included. + +It is good practice to control which backend header is being +included via the preprocessor. For a cross-platform application, +one would use Avahi on Linux platforms and Bonjour on Mac OS X and +Windows platforms. + +Typically, the <[#include]> statements for the DNS-SD library +would be as follows: + + #include "Poco/DNSSD/DNSSDResponder.h" + #include "Poco/DNSSD/DNSSDBrowser.h" + #if POCO_OS == POCO_OS_LINUX && !defined(POCO_DNSSD_USE_BONJOUR) + #include "Poco/DNSSD/Avahi/Avahi.h" + #else + #include "Poco/DNSSD/Bonjour/Bonjour.h" + #endif +---- + +These statements will include the header files for the Poco::DNSSD::DNSSDResponder +and Poco::DNSSD::DNSSDBrowser classes, as well as the core header +file for a backend. Note that an application that only registers a service, +but does not browse for services, does not need to include the +<*Poco/DNSSD/DNSSDBrowser.h*> header file. + +The Poco::DNSSD::initializeDNSSD() function must be called before an +instance of the Poco::DNSSD::DNSSDResponder class is created. If the +application uses the Poco::Util::Application class (or its server +counterpart), this can happen in the constructor of the application +subclass. It is also good practice to uninitialize the DNS-SD library +when the application exits by calling Poco::DNSSD::uninitializeDNSSD(), +which can be done in the application class destructor. + +After initializing the DNS-SD library, the application should +create an instance of the Poco::DNSSD::DNSSDResponder class. +This class provides the main entry point into the DNS-SD library. +Although it is possible to create more than one instance of +the Poco::DNSSD::DNSSDResponder class, application programmers +should refrain from doing so. The Poco::DNSSD::DNSSDResponder +object should be kept alive during the entire lifetime of +the application, or at least as long as DNS-SD services +are required. + +After the responder object has been created, its <[start()]> method +must be called. This will start a thread that handles all +DNS-SD related network activity for the application. + +Similarly, when the application terminates, or when DNS-SD +services are no longer required, the <[stop()]> method should +be called to orderly shut-down the background thread. + + +!!Registering A Service + +Registering a service, and thus making it discoverable to other +DNS-SD capable applications, is a two step process. +First, an instance of Poco::DNSSD::Service must be created +and properly initialized. At least the following information +must be specified: + + - the service type (e.g., "_http._tcp"), and + - the port number of the service. + +Other information can be specified, but defaults will be +used if not. This includes: + + - The service name, which defaults to the local hosts's machine name. + - The network interface (by its interface index), on which the + service shall be announced. The default is to announce the + service on all interfaces (interface index is zero). + - The domain, on which the service will be announced. + - The domain name of the host providing the service. + - Service properties, which will be announced in the TXT + record of the service. + +The service properties (basically, a list of key-value pairs) +can be used to provide additional information +necessary for invoking the service. These will be announced along +with the basic service information (host name, port number, etc.). +The content of the service properties is specific to the application +or network protocol the application uses. +When specifying service properties, a few restrictions must be +considered: + + - The total length of a key-value pair must not exceed 254 bytes. + - The total length of all key-value pairs, including two additional + bytes for each pair, must not exceed 65535 bytes. + - The length of the key should not exceed nine bytes. + - Values can contain text strings or arbitrary binary values, and + can also be empty. + + +The following code shows how to register and publish a HTTP server +(running on port 8080) on a Zeroconf network: + + Poco::DNSSD::DNSSDResponder dnssdResponder; + dnssdResponder.start(); + + Poco::DNSSD::Service service("_http._tcp", 8080); + Poco::DNSSD::ServiceHandle serviceHandle = dnssdResponder.registerService(service); +---- + +Another example, the following code shows how to register +and publish a network postscript-capable printer on a Zeroconf network. + + Poco::DNSSD::DNSSDResponder dnssdResponder; + dnssdResponder.start(); + + Poco::DNSSD::Service::Properties props; + props.add("txtvers", "1"); + props.add("pdl", "application/postscript"); + props.add("qtotal", "1"); + props.add("rp", "ThePrinter"); + props.add("ty", "A Postscript Printer"); + Poco::DNSSD::Service service(0, "The Printer", "", "_printer._tcp", "", "", 515, props); + Poco::DNSSD::ServiceHandle serviceHandle = dnssdResponder.registerService(service); +---- + +!Unregistering A Service + +The <[registerService()]> method returns a Poco::DNSSD::ServiceHandle object. +This object is used to unregister the service when it's no longer available, +by passing it as argument to the <[unregisterService()]> method. + + dnssdResponder.unregisterService(serviceHandle); +---- + + +!Handling Registration Errors + +The above code examples don't do a very good job of error handling. +Registration on the network may fail for various reasons. +The Poco::DNSSD::DNSSDResponder class provides two events that can be +used to check the status of a service registration. +If the registration was successful, the <[serviceRegistered]> event +will be fired. If registration failed, the <[serviceRegistrationFailed]> +event will be fired. Please see the class documentation for a +description of the available event arguments. + +Usually, there's not much an application can do when service registration +fails. This is especially true for embedded devices, which often don't +even have a way to communicate this error to the user. However, an application +should at least log a registration error in a log file, to help with +error diagnostics. + +Handling the <[serviceRegistered]> event is only necessary if the application +needs to know the actual service name used to announce the service. +In case of a name conflict (duplicate service names on the network), the +name specified when registering the service may have been changed by +the Bonjour or Avahi backend. + +The following example shows an event handler (delegate) function for handling +registration errors. + + void onError(const void* sender, const Poco::DNSSD::DNSSDResponder::ErrorEventArgs& args) + { + std::cerr + << "Service registration failed: " + << args.error.message() + << " (" << args.error.code() << ")" + << std::endl; + } +---- + +To register this function as delegate for the <[serviceRegistrationFailed]> event: + + dnssdResponder.serviceRegistrationFailed += Poco::delegate(onError); +---- + + +!!Browsing For Services + +To discover available services of a specific type on the network, a browse operation +for a specific service type must be initiated. For this purpose, the +Poco::DNSSD::DNSSDBrowser class is used. An instance of this class can be obtained +from the Poco::DNSSD::DNSSDResponder object, by calling the <[browswer()]> method. + +After a browse operation for a service type has been started, services becoming +available or unavailable will be reported via events. A service that has been +discovered will be reported via the <[serviceFound]> event. +If a service is no longer available, it will be reported via the <[serviceRemoved]> +event. The name, type and domain of the discovered service can be obtained from the +Poco::DNSSD::Service object passed as event argument. + +The following sample shows how to write a delegate function for +the <[serviceFound]> event. + + void onServiceFound(const void* sender, const Poco::DNSSD::DNSSDBrowser::ServiceEventArgs& args) + { + std::cout << "Service Found: \n" + << " Name: " << args.service.name() << "\n" + << " Domain: " << args.service.domain() << "\n" + << " Type: " << args.service.type() << "\n" + << " Interface: " << args.service.networkInterface() << "\n" << std::endl; + } +---- + +The next sample shows how to start a browse operation: + + Poco::DNSSD::DNSSDResponder dnssdResponder; + dnssdResponder.start(); + + dnssdResponder.browser().serviceFound += Poco::delegate(onServiceFound); + Poco::DNSSD::BrowseHandle bh = dnssdResponder.browser().browse("_printer._tcp", ""); +---- + +Poco::DNSSD::DNSSDBrowser::browse() returns a Poco::DNSSD::BrowseHandle object, which can +later be used to cancel a browse operation, by passing it to the <[cancel()]> method, as +shown in the following example: + + dnssdResponder.browser().cancel(bh); +---- + +After a service has been discovered, the next step is resolving the service, to obtain +its host name, port number and properties, so that the service can be invoked. + + +!!Resolving A Service + +Like browsing for services, resolving a service is an asynchronous operation. +A resolve operation is started with a call to <[resolve()]>, passing the +Poco::DNSSD::Service object obtained from the <[serviceFound]> event as +argument. Once the service has been resolved, the result is reported via +the <[serviceResolved]> event. The resolve operation can be started +directly from the <[serviceFound]> event handler, as shown in the +following sample: + + void onServiceFound(const void* sender, const Poco::DNSSD::DNSSDBrowser::ServiceEventArgs& args) + { + std::cout << "Service Found: \n" + << " Name: " << args.service.name() << "\n" + << " Domain: " << args.service.domain() << "\n" + << " Type: " << args.service.type() << "\n" + << " Interface: " << args.service.networkInterface() << "\n" << std::endl; + + reinterpret_cast(const_cast(sender))->resolve(args.service); + } +---- + +After a successful resolve, the service host name, port number and properties +are available through the Poco::DNSSD::Service object passed to the event handler, +as shown in the sample below: + + void onServiceResolved(const void* sender, const Poco::DNSSD::DNSSDBrowser::ServiceEventArgs& args) + { + std::cout << "Service Resolved: \n" + << " Name: " << args.service.name() << "\n" + << " Full Name: " << args.service.fullName() << "\n" + << " Domain: " << args.service.domain() << "\n" + << " Type: " << args.service.type() << "\n" + << " Interface: " << args.service.networkInterface() << "\n" + << " Host: " << args.service.host() << "\n" + << " Port: " << args.service.port() << "\n" + << " Properties: \n"; + + for (Poco::DNSSD::Service::Properties::ConstIterator it = args.service.properties().begin(); it != args.service.properties().end(); ++it) + { + std::cout << " " << it->first << ": " << it->second << "\n"; + } + std::cout << std::endl; + } +---- + +Of course, the event delegate for the <[serviceResolved]> event must be registered: + + dnssdResponder.browser().serviceResolved += Poco::delegate(onServiceResolved); +---- + + +!!Resolving A Service's Host Name + +The last step necessary before invoking a service is to resolve the service's host name +into an IP address. On systems where mDNS is integrated into the DNS resolver (e.g., +Mac OS X, Windows with Bonjour or most Linux distributions with Avahi), this +can simply be done by creating a Poco::Net::SocketAddress instance from the service's +host name and port number. However if the systems's DNS resolver cannot handle +Multicast DNS queries, the host name must be resolved through the +Poco::DNSSD::DNSSDBrowser::resolveHost() method. Like resolving a service, resolving +a host name is an asynchronous operation, and the result will be reported via +an event -- the <[hostResolved]> event. + +The following sample shows how to implement the delegate function for the +<[hostResolved]> event: + + void onHostResolved(const void* sender, const Poco::DNSSD::DNSSDBrowser::ResolveHostEventArgs& args) + { + std::cout << "Host Resolved: \n" + << " Host: " << args.host << "\n" + << " Interface: " << args.networkInterface << "\n" + << " Address: " << args.address.toString() << "\n" + << " TTL: " << args.ttl << "\n" << std::endl; + } +---- + +Like with resolving a service, it is possible to initiate resolving a host name directly +from within the event delegate for the <[serviceResolved]> event. + + +!!!Advanced Programming Tasks + +!!Enumerating Domains + +Available domains for browsing and registration can be enumerated by calling the +Poco::DNSSD::DNSSDBrowser::enumerateBrowseDomains() and +Poco::DNSSD::DNSSDBrowser::enumerateRegistrationDomains() methods. As usual, +results are reported via events. + + +!!Registering And Browsing For Records + +Additional DNS records for a specific service can be published on a Zeroconf network +by invoking the Poco::DNSSD::DNSSDResponder::addRecord() method. It is also possible +to alter a published record, or remove it. Records can be queried by invoking +Poco::DNSSD::DNSSDBrowser::queryRecord(). Results are reported via +events. + + +!!Enumerating Available Service Types + +It is possible to enumerate all available services types on a domain by +browsing for the special service type "_services._dns-sd._udp". + +Results will be reported via the <[serviceDiscovered]> event. +The service type (without the primary transport protocol part, +as in "_http") can be obtained from the service name stored +in the Poco::DNSSD::Service object passed as event argument. +The primary transport protocol and the domain can be obtained +from the service type. diff --git a/DNSSD/include/Poco/DNSSD/DNSSD.h b/DNSSD/include/Poco/DNSSD/DNSSD.h new file mode 100644 index 000000000..3d352373a --- /dev/null +++ b/DNSSD/include/Poco/DNSSD/DNSSD.h @@ -0,0 +1,194 @@ +// +// DNSSD.h +// +// $Id: //poco/1.7/DNSSD/include/Poco/DNSSD/DNSSD.h#1 $ +// +// Library: DNSSD +// Package: Core +// Module: DNSSD +// +// Basic definitions for the Poco DNSSD library. +// This file must be the first file included by every other DNSSD +// header file. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_DNSSD_INCLUDED +#define DNSSD_DNSSD_INCLUDED + + +#include "Poco/Poco.h" + + +// +// The following block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the DNSSD_EXPORTS +// symbol defined on the command line. this symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// DNSSD_API functions as being imported from a DLL, wheras this DLL sees symbols +// defined with this macro as being exported. +// +#if defined(_WIN32) && defined(POCO_DLL) + #if defined(DNSSD_EXPORTS) + #define DNSSD_API __declspec(dllexport) + #else + #define DNSSD_API __declspec(dllimport) + #endif +#endif + + +#if !defined(DNSSD_API) + #define DNSSD_API +#endif + + +#if defined(_MSC_VER) && !defined(POCO_LIB_SUFFIX) + #if defined(POCO_DLL) + #if defined(_DEBUG) + #define POCO_LIB_SUFFIX "d.lib" + #else + #define POCO_LIB_SUFFIX ".lib" + #endif + #elif defined(_DLL) + #if defined(_DEBUG) + #define POCO_LIB_SUFFIX "mdd.lib" + #else + #define POCO_LIB_SUFFIX "md.lib" + #endif + #else + #if defined(_DEBUG) + #define POCO_LIB_SUFFIX "mtd.lib" + #else + #define POCO_LIB_SUFFIX "mt.lib" + #endif + #endif +#endif + + +#if defined(_MSC_VER) + #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(DNSSD_EXPORTS) + #pragma comment(lib, "PocoDNSSD" POCO_LIB_SUFFIX) + #endif +#endif + + +namespace Poco { +namespace DNSSD { + + +enum HandleType +{ + SD_SERVICE_HANDLE = 1, + SD_RECORD_HANDLE = 2, + SD_BROWSE_HANDLE = 3 +}; + + +template +class OpaqueHandle +{ +public: + enum + { + TYPE = Type + }; + + OpaqueHandle(): + _h(Invalid), + _subtype(0) + { + } + + OpaqueHandle(Base h, int subtype = 0): + _h(h), + _subtype(subtype) + { + } + + template + OpaqueHandle(T h, int subtype = 0): + _h(reinterpret_cast(h)), + _subtype(subtype) + { + } + + ~OpaqueHandle() + { + } + + int subtype() const + { + return _subtype; + } + + template + T cast() const + { + return reinterpret_cast(_h); + } + + bool operator == (const OpaqueHandle& other) const + { + return _h == other._h; + } + + bool operator != (const OpaqueHandle& other) const + { + return _h != other._h; + } + + bool operator <= (const OpaqueHandle& other) const + { + return _h <= other._h; + } + + bool operator < (const OpaqueHandle& other) const + { + return _h < other._h; + } + + bool operator >= (const OpaqueHandle& other) const + { + return _h >= other._h; + } + + bool operator > (const OpaqueHandle& other) const + { + return _h > other._h; + } + + void reset() + { + _h = Invalid; + } + + bool isValid() const + { + return _h != Invalid; + } + + bool isNull() const + { + return _h == Invalid; + } + +private: + Base _h; + int _subtype; +}; + + +typedef OpaqueHandle ServiceHandle; +typedef OpaqueHandle RecordHandle; +typedef OpaqueHandle BrowseHandle; + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_DNSSD_INCLUDED diff --git a/DNSSD/include/Poco/DNSSD/DNSSDBrowser.h b/DNSSD/include/Poco/DNSSD/DNSSDBrowser.h new file mode 100644 index 000000000..deaa42419 --- /dev/null +++ b/DNSSD/include/Poco/DNSSD/DNSSDBrowser.h @@ -0,0 +1,346 @@ +// +// DNSSDBrowser.h +// +// $Id: //poco/1.7/DNSSD/include/Poco/DNSSD/DNSSDBrowser.h#1 $ +// +// Library: DNSSD +// Package: Core +// Module: DNSSDBrowser +// +// Definition of the DNSSDBrowser class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_DNSSDBrowser_INCLUDED +#define DNSSD_DNSSDBrowser_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" +#include "Poco/DNSSD/Service.h" +#include "Poco/DNSSD/Domain.h" +#include "Poco/DNSSD/Record.h" +#include "Poco/DNSSD/Error.h" +#include "Poco/Net/IPAddress.h" +#include "Poco/BasicEvent.h" + + +namespace Poco { +namespace DNSSD { + + +class DNSSD_API DNSSDBrowser + /// The DNSSDBrowser class allows browsing for services, domains and records, + /// resolving services and error handling. Browse and resolve operations + /// are asynchronous. Discovered services, records and domains, as well as + /// error conditions are reported via events. + /// + /// A DNSSDBrowser object is never created directly. It can be obtained + /// from the DNSSDResponder by calling the DNSSDResponder::serviceBrowser() + /// method. + /// + /// A note on implementing event handlers: An event handler should + /// complete its work and return as quick as possible, otherwise it may + /// interfere with DNS-SD processing. An event handler should never + /// wait for other events to happen. Specifically, it must never + /// wait for an other DNSSDBrowser event to happen, as this will + /// result in a deadlock. +{ +public: + enum Options + /// Options for browsing, resolving and DNS queries. + { + RESOLVE_ON_DISCOVERED_INTERFACE = 0x01, + /// Attempt to resolve the service on the interface it was discovered on only. + + RESOLVE_ON_ALL_INTERFACES = 0x02, + /// Attempt to resolve the service on all interfaces. + + BROWSE_FORCE_MULTICAST = 0x04, + /// Force query to be performed with a link-local mDNS query, + /// even if the name is an apparently non-local name (i.e. a + /// name not ending in ".local."). + + BROWSE_LONG_LIVED_QUERY = 0x08 + /// Create a "long-lived" unicast query in a non-local domain. + /// Without enabling this option, unicast queries will be one-shot -- + /// that is, only answers available at the time of the call + /// will be returned. By setting this flag, answers that become available + /// after the initial call is made will generate + /// events. This flag has no effect on link-local multicast queries. + }; + + enum BrowseFlags + /// Flags reported in event arguments. + { + BROWSE_MORE_COMING = 0x01 + /// This flag signals that more events will follow + /// immediately. For the application this means for + /// example that updates to the user interface can be + /// delayed until an event is fired that does not have + /// this flag set. + }; + + struct CommonEventArgs + { + CommonEventArgs(BrowseHandle h, int f): + browseHandle(h), + flags(f) + { + } + + BrowseHandle browseHandle; + int flags; + }; + + struct ServiceEventArgs: public CommonEventArgs + { + ServiceEventArgs(BrowseHandle h, int f, const Service& s): + CommonEventArgs(h, f), + service(s) + { + } + + const Service& service; + }; + + struct DomainEventArgs: public CommonEventArgs + { + DomainEventArgs(BrowseHandle h, int f, const Domain& d): + CommonEventArgs(h, f), + domain(d) + { + } + + const Domain& domain; + }; + + struct RecordEventArgs: public CommonEventArgs + { + RecordEventArgs(BrowseHandle h, int f, const Record& r): + CommonEventArgs(h, f), + record(r) + { + } + + const Record& record; + }; + + struct ResolveHostEventArgs: public CommonEventArgs + { + ResolveHostEventArgs(BrowseHandle h, int f, const std::string& n, const Poco::Net::IPAddress& a, Poco::Int32 i, Poco::UInt32 t): + CommonEventArgs(h, f), + host(n), + address(a), + networkInterface(i), + ttl(t) + { + } + + std::string host; + Poco::Net::IPAddress address; + Poco::Int32 networkInterface; + Poco::UInt32 ttl; + }; + + struct ErrorEventArgs: public CommonEventArgs + { + ErrorEventArgs(BrowseHandle h, int f, const Error& e): + CommonEventArgs(h, f), + error(e) + { + } + + const Error& error; + }; + + Poco::BasicEvent browseError; + /// Fired when an error occures while browsing for services. + /// + /// The specific error condition can be found by looking at the + /// Error object in the argument. + + Poco::BasicEvent serviceFound; + /// Fired when a service has been found. + /// + /// The Service object given in the argument can be passed to resolve() + /// to resolve the service, and to obtain the service's host and port + /// number. + + Poco::BasicEvent serviceRemoved; + /// Fired when a service has been removed and is no longer available. + /// + /// The Service object given in the argument can be passed to resolve() + /// to resolve the service, and to obtain the service's host and port + /// number. + + Poco::BasicEvent resolveError; + /// Fired when an error occures while resolving a service. + /// + /// The specific error condition can be found by looking at the + /// ServiceError object in the argument. + + Poco::BasicEvent serviceResolved; + /// Fired when a service has been successfully resolved. + + Poco::BasicEvent browseDomainFound; + /// Fired when a browse domain has been found. + + Poco::BasicEvent browseDomainRemoved; + /// Fired when a browse domain has been removed and is no longer available. + + Poco::BasicEvent browseDomainError; + /// Fired when an error occures while browsing for browse domains. + /// + /// The specific error condition can be found by looking at the + /// Error object in the argument. + + Poco::BasicEvent registrationDomainFound; + /// Fired when a registration domain has been found. + + Poco::BasicEvent registrationDomainRemoved; + /// Fired when a registration domain has been removed and is no longer available. + + Poco::BasicEvent registrationDomainError; + /// Fired when an error occures while browsing for registration domains. + /// + /// The specific error condition can be found by looking at the + /// Error object in the argument. + + Poco::BasicEvent recordFound; + /// Fired when a record has been found. + + Poco::BasicEvent recordRemoved; + /// Fired when a record has been removed and is no longer available. + + Poco::BasicEvent recordError; + /// Fired when an error occures while browsing for a record type. + /// + /// The specific error condition can be found by looking at the + /// Error object in the argument. + + Poco::BasicEvent hostResolved; + /// Fired when a host name has been resolved. + + Poco::BasicEvent hostResolveError; + /// Fired when an error occurs while resolving a host name. + /// + /// The specific error condition can be found by looking at the + /// Error object in the argument. + + virtual BrowseHandle browse(const std::string& regType, const std::string& domain, int options = 0, Poco::Int32 networkInterface = 0) = 0; + /// Browse for a service type on a specific network interface, given by its index in networkInterface. + /// An interface with index 0 can be specified to search on all interfaces. + /// + /// - regType specifies the service type and protocol, separated by a dot + /// (e.g., "_ftp._tcp"). The transport protocol must be either "_tcp" or "_udp". + /// Optionally, a single subtype may be specified to perform filtered browsing: + /// e.g. browsing for "_primarytype._tcp,_subtype" will discover only those + /// instances of "_primarytype._tcp" that were registered specifying "_subtype" + /// in their list of registered subtypes. + /// - domain specifies the domain on which to browse for services. + /// If an empty string is specified, the default domain(s) will be browsed. + /// - options should be 0, as no browse options are currently supported. + /// + /// Results will be reported asynchronously via the serviceFound, serviceRemoved and serviceError events. + /// + /// The returned BrowseHandle can be passed to cancel() to cancel browsing. + /// + /// Note: It is possible to enumerate all service types registered on the local network + /// by browsing for the special regType "_services._dns-sd._udp". Available service types will + /// be reported with the Service object's name containing the service type (e.g., "_ftp") + /// and the Service's type containing the protocol and domain (e.g., "_tcp.local."). + + virtual BrowseHandle resolve(const Service& service, int options = RESOLVE_ON_DISCOVERED_INTERFACE) = 0; + /// Resolves the service specified by the given Service object. The given + /// Service object must be one obtained via the serviceFound event. + /// + /// Results will be sent asnychronously via the serviceResolved and resolveError events. + /// + /// If RESOLVE_ON_ALL_INTERFACES is specified in options, resolving will be attempted + /// on all network interfaces. Otherwise, if RESOLVE_ON_DISCOVERED_INTERFACE is specified, + /// resolving will only be attempted on the interfaces on which the service has + /// been discovered. + /// + /// The returned BrowseHandle can be passed to cancel() to cancel resolving. + /// However, this should be done before either the serviceResolved or resolveError event + /// has been fired. In practice, this has high potential for a race condition, + /// so calling cancel() with a BrowseHandle returned from this function is + /// not recommended. + /// After either the serviceResolved or resolveError event has been + /// fired, the returned BrowseHandle is no longer valid. + + virtual BrowseHandle enumerateBrowseDomains(Poco::Int32 networkInterface = 0) = 0; + /// Discovers domains for browse operations on the given interface, given by its index. + /// An interface with index 0 can be specified to search on all interfaces. + /// + /// Results will be sent asnychronously via the browseDomainFound, browseDomainRemoved and browseDomainError events. + + virtual BrowseHandle enumerateRegistrationDomains(Poco::Int32 networkInterface = 0) = 0; + /// Discovers domains for service registration on the given interface, given by its index. + /// An interface with index 0 can be specified to search on all interfaces. + /// + /// Results will be sent asnychronously via the registrationDomainFound, registrationDomainRemoved and registrationDomainError events. + /// + /// The returned BrowseHandle can be passed to cancel() to cancel resolving. + + virtual BrowseHandle queryRecord(const std::string& name, Poco::UInt16 type, Poco::UInt16 clazz = Record::RC_IN, int options = 0, Poco::Int32 networkInterface = 0) = 0; + /// Starts a query for a DNS record, specified by name, type and clazz, on the specified interface, given by its index. + /// An interface with index 0 can be specified to search on all interfaces. + /// + /// - name specifies the full domain name of the record. + /// - type specifies the record's type (e.g., RT_PTR). + /// Suitable values can be found in the RecordType enumeration. + /// - clazz specifies the record's class (usually RC_IN). + /// - options can be 0, BROWSE_FORCE_MULTICAST or BROWSE_LONG_LIVED_QUERY. + /// + /// Results will be sent asnychronously via the recordFound, recordRemoved and recordError events. + /// + /// The returned BrowseHandle can be passed to cancel() to cancel the query. + + virtual BrowseHandle resolveHost(const std::string& host, int options = 0, Poco::Int32 networkInterface = 0) = 0; + /// Resolves the given host name. The given host name should have + /// been obtained by resolving a service. + /// An interface with index 0 can be specified to search on all interfaces. + /// + /// - host specifies the hostname to resolve. It should be a hostname + /// obtained by resolving a service. + /// - options can be 0 or BROWSE_FORCE_MULTICAST. + /// + /// This should be used instead of Poco::Net::DNS to resolve host names + /// via Multicast DNS, if the system's domain name resolver does not + /// support Multicast DNS. + /// + /// Results will be sent asnychronously via the hostResolved and hostResolveError events. + /// + /// The returned BrowseHandle can be passed to cancel() to cancel resolving. + /// However, this should be done before either the hostResolved or hostResolveError event + /// has been fired. In practice, this has high potential for a race condition, + /// so calling cancel() with a BrowseHandle returned from this function is + /// not recommended. + /// After either the hostResolved or hostResolveError event has been + /// fired, the returned BrowseHandle is no longer valid. + + virtual void cancel(BrowseHandle& browseHandle) = 0; + /// Cancels the browse or resolve activity associated with the given BrowseHandle. + /// + /// The BrowseHandle is invalidated. + +protected: + DNSSDBrowser(); + virtual ~DNSSDBrowser(); + +private: + DNSSDBrowser(const DNSSDBrowser&); + DNSSDBrowser& operator = (const DNSSDBrowser&); +}; + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_DNSSDBrowser_INCLUDED diff --git a/DNSSD/include/Poco/DNSSD/DNSSDException.h b/DNSSD/include/Poco/DNSSD/DNSSDException.h new file mode 100644 index 000000000..e659c9239 --- /dev/null +++ b/DNSSD/include/Poco/DNSSD/DNSSDException.h @@ -0,0 +1,37 @@ +// +// DNSSDException.h +// +// $Id: //poco/1.7/DNSSD/include/Poco/DNSSD/DNSSDException.h#1 $ +// +// Library: DNSSD +// Package: Core +// Module: DNSSDException +// +// Definition of the DNSSDException class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_DNSSDException_INCLUDED +#define DNSSD_DNSSDException_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" +#include "Poco/Exception.h" + + +namespace Poco { +namespace DNSSD { + + +POCO_DECLARE_EXCEPTION(DNSSD_API, DNSSDException, Poco::RuntimeException) + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_DNSSDException_INCLUDED diff --git a/DNSSD/include/Poco/DNSSD/DNSSDResponder.h b/DNSSD/include/Poco/DNSSD/DNSSDResponder.h new file mode 100644 index 000000000..1c25023c1 --- /dev/null +++ b/DNSSD/include/Poco/DNSSD/DNSSDResponder.h @@ -0,0 +1,193 @@ +// +// DNSSDResponder.h +// +// $Id: //poco/1.7/DNSSD/include/Poco/DNSSD/DNSSDResponder.h#1 $ +// +// Library: DNSSD +// Package: Core +// Module: DNSSDResponder +// +// Definition of the DNSSDResponder class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_DNSSDResponder_INCLUDED +#define DNSSD_DNSSDResponder_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" +#include "Poco/DNSSD/Service.h" +#include "Poco/DNSSD/Record.h" +#include "Poco/DNSSD/Error.h" +#include "Poco/BasicEvent.h" + + +namespace Poco { +namespace DNSSD { + + +class DNSSDBrowser; +class DNSSDResponderImpl; +class DNSSDResponderImplFactory; + + +class DNSSD_API DNSSDResponder + /// DNSSDResponder provides a unified interface to the underlying + /// DNS Service Discovery implementation, which can be Apple's Bonjour + /// or Avahi. + /// + /// An application should not create more than one instance of + /// the DNSSDResponder class. + /// + /// To register a service with the DNSSDResponder, and thus to + /// announce a service on the network, create an instance + /// of Service with appropriate values. Then pass this object + /// to registerService(). Example: + /// + /// DNSSDResponder dnssdResponder; + /// dnssdResponder.start(): + /// ... + /// Service::Properties props; + /// Service myService(0, "My Service", "_mysvc._tcp", "", "", 1234, props); + /// ServiceHandle myServiceHandle = dnssdResponder.registerService(myService); + /// + /// Note that service registration is asynchronous, so the serviceRegistered + /// and serviceRegistrationFailed events must be observed to ensure the + /// service has actually been registered. + /// + /// A registered service can be unregistered, by passing its ServiceHandle + /// to unregisterService(). + /// + /// Before a DNSSDResponder instance can be created, registerImplFactory() must + /// be called to register a DNSSDResponderImplFactory. This is done by + /// calling the initializeDNSSD() function provided by an implementation library + /// (e.g., Bonjour or Avahi). +{ +public: + enum RegistrationOptions + /// Options for service registration. + { + REG_LOCAL_ONLY = 0x01, /// Service is visible on local host only. + REG_NO_AUTORENAME = 0x02, /// Do not allow automatic renaming in case another service with the same name exists. + REG_NON_BROWSABLE = 0x04 /// Service is not visible when browsing, but can be resolved (only for DNSSD version < 1096.0.2). + }; + + struct ServiceEventArgs + { + ServiceEventArgs(ServiceHandle h, const Service& s): + serviceHandle(h), + service(s) + { + } + + ServiceHandle serviceHandle; + const Service& service; + }; + + struct ErrorEventArgs + { + ErrorEventArgs(ServiceHandle h, const Service& s, const Error& e): + serviceHandle(h), + service(s), + error(e) + { + } + + ServiceHandle serviceHandle; + const Service& service; + const Error& error; + }; + + Poco::BasicEvent serviceRegistered; + /// Fired after the service has been registered successfully. + /// + /// If auto-rename has been enabled, the service name may be different from the + /// name originally specified. + + Poco::BasicEvent serviceRegistrationFailed; + /// Fired when service registration fails. + + DNSSDResponder(); + /// Creates a DNSSDResponder. + + ~DNSSDResponder(); + /// Destroys the DNSSDResponder. + + DNSSDBrowser& browser(); + /// Returns the DNSServiceBrowser, which is used to + /// discover and resolve services and domains. + + ServiceHandle registerService(const Service& service, int options = 0); + /// Registers a service, specified by the given Service object. + /// + /// Valid option values are defined in the RegistrationOptions enumeration. + /// + /// Service registration will be asynchronously. When the service + /// has been registered successfully, a serviceRegistered event + /// will be fired. Otherwise, a ServiceRegistrationFailed event + /// will be fired. + /// + /// Returns a ServiceHandle that can later be used to unregister + /// the service, or to add DNS records to the service. + + void unregisterService(ServiceHandle& serviceHandle); + /// Unregisters the service specified by serviceHandle. + /// + /// The ServiceHandle is invalidated. + + RecordHandle addRecord(ServiceHandle serviceHandle, const Record& record); + /// Add a record to a registered service. The name of the record will be the same as the + /// registered service's name. + /// + /// The record can later be updated or deregistered by passing the RecordHandle returned + /// by this function to updateRecord() or removeRecord(). + + void updateRecord(ServiceHandle serviceHandle, RecordHandle recordHandle, const Record& record); + /// Update a registered resource record. The record must either be: + /// - the primary txt record of a service registered via registerService() + /// (if recordHandle is a null handle), or + /// - a record added to a registered service via addRecord(). + + void removeRecord(ServiceHandle serviceHandle, RecordHandle& recordHandle); + /// Remove a registered resource record. The record must be + /// a record added to a registered service via addRecord(). + /// + /// The RecordHandle is invalidated. + + void start(); + /// Starts the responder. + /// + /// Must be called before services can be registered + /// or before browsing for domains and services. + + void stop(); + /// Stops the responder. + + static void registerImplFactory(DNSSDResponderImplFactory& factory); + /// Registers the factory for creating DNSSDResponderImpl objects. + /// + /// A factory must be registered before the first instance of + /// DNSSDResponder is created. + + static void unregisterImplFactory(); + /// Unregisters the currently registered DNSSDResponderImplFactory. + +private: + DNSSDResponder(const DNSSDResponder&); + DNSSDResponder& operator = (const DNSSDResponder&); + + DNSSDResponderImpl* _pImpl; + + static DNSSDResponderImplFactory* _pImplFactory; +}; + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_DNSSDResponder_INCLUDED diff --git a/DNSSD/include/Poco/DNSSD/DNSSDResponderImpl.h b/DNSSD/include/Poco/DNSSD/DNSSDResponderImpl.h new file mode 100644 index 000000000..982f2cd7f --- /dev/null +++ b/DNSSD/include/Poco/DNSSD/DNSSDResponderImpl.h @@ -0,0 +1,119 @@ +// +// DNSSDResponderImpl.h +// +// $Id: //poco/1.7/DNSSD/include/Poco/DNSSD/DNSSDResponderImpl.h#1 $ +// +// Library: DNSSD +// Package: Core +// Module: DNSSDResponderImpl +// +// Definition of the DNSSDResponderImpl class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_DNSSDResponderImpl_INCLUDED +#define DNSSD_DNSSDResponderImpl_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" + + +namespace Poco { +namespace DNSSD { + + +class DNSSDBrowser; +class DNSSDResponder; +class Service; +class Record; + + +class DNSSD_API DNSSDResponderImpl + /// DNSSDResponderImpl subclasses implement the actual binding + /// to the underlying DNSSD engine (e.g., Bonjour or Avahi). +{ +public: + virtual ~DNSSDResponderImpl(); + /// Destroys the DNSSDResponderImpl. + + virtual DNSSDBrowser& browser() = 0; + /// Returns the DNSSDBrowser, which is used to + /// discover and resolve services and domains. + + virtual ServiceHandle registerService(const Service& service, int options) = 0; + /// Registers a service. + /// + /// Service registration will be asynchronously. When the service + /// has been registered successfully, a serviceRegistered event + /// will be fired. Otherwise, a ServiceRegistrationFailed event + /// will be fired. + /// + /// Returns a ServiceHandle that can later be used to unregister + /// the service, or to add DNS records to the service. + + virtual void unregisterService(ServiceHandle& serviceHandle) = 0; + /// Unregisters the service specified by serviceHandle. + /// + /// The ServiceHandle is invalidated. + + virtual RecordHandle addRecord(ServiceHandle serviceHandle, const Record& record) = 0; + /// Add a record to a registered service. The name of the record will be the same as the + /// registered service's name. + /// + /// The record can later be updated or deregistered by passing the RecordHandle returned + /// by this function to updateRecord() or removeRecord(). + + virtual void updateRecord(ServiceHandle serviceHandle, RecordHandle recordHandle, const Record& record) = 0; + /// Update a registered resource record. The record must either be: + /// - the primary txt record of a service registered via registerService() + /// (if recordHandle is a null handle), or + /// - a record added to a registered service via addRecord(). + + virtual void removeRecord(ServiceHandle serviceHandle, RecordHandle& recordHandle) = 0; + /// Remove a registered resource record. The record must either be: + /// a record added to a registered service via addRecord(). + /// + /// The RecordHandle is invalidated. + + virtual void start() = 0; + /// Starts the responder. + /// + /// Must be called before services can be registered + /// or before browsing for domains and services. + + virtual void stop() = 0; + /// Stops the responder. + +protected: + DNSSDResponderImpl(); + +private: + DNSSDResponderImpl(const DNSSDResponderImpl&); + DNSSDResponderImpl& operator = (const DNSSDResponderImpl&); +}; + + +class DNSSD_API DNSSDResponderImplFactory + /// A factory for DNSSDResponderImpl objects. + /// + /// A subclass of this class must be provided by DNSSD + /// implementations and registered with the DNSSDResponder class. +{ +public: + virtual DNSSDResponderImpl* createResponderImpl(DNSSDResponder& owner) = 0; + /// Creates a new DNSSDResponderImpl. + +protected: + virtual ~DNSSDResponderImplFactory(); +}; + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_DNSSDResponderImpl_INCLUDED diff --git a/DNSSD/include/Poco/DNSSD/Domain.h b/DNSSD/include/Poco/DNSSD/Domain.h new file mode 100644 index 000000000..5087c290d --- /dev/null +++ b/DNSSD/include/Poco/DNSSD/Domain.h @@ -0,0 +1,87 @@ +// +// Domain.h +// +// $Id: //poco/1.7/DNSSD/include/Poco/DNSSD/Domain.h#1 $ +// +// Library: DNSSD +// Package: Core +// Module: Domain +// +// Definition of the Domain class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Domain_INCLUDED +#define DNSSD_Domain_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" + + +namespace Poco { +namespace DNSSD { + + +class DNSSD_API Domain + /// Domain stores information about a browse domain. +{ +public: + Domain(); + /// Creates an empty Domain. + + Domain(Poco::Int32 networkInterface, const std::string& name, bool isDefault); + /// Creates a Domain using the given information. + /// + /// - networkInterface specifies the index of the interface the domain was discovered on. + /// - name specifies the name of the domain. + /// - isDefault specifies whether the domain is the default domain. + + ~Domain(); + /// Destroys the Domain. + + Poco::Int32 networkInterface() const; + /// Returns the index of the network interface the domain was discovered on. + + const std::string& name() const; + /// Returns the name of the domain. + + bool isDefault() const; + /// Returns true if the domain is the default domain. + +private: + Poco::Int32 _networkInterface; + std::string _name; + bool _isDefault; +}; + + +// +// inlines +// +inline Poco::Int32 Domain::networkInterface() const +{ + return _networkInterface; +} + + +inline const std::string& Domain::name() const +{ + return _name; +} + + +inline bool Domain::isDefault() const +{ + return _isDefault; +} + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_Domain_INCLUDED diff --git a/DNSSD/include/Poco/DNSSD/Error.h b/DNSSD/include/Poco/DNSSD/Error.h new file mode 100644 index 000000000..0033877be --- /dev/null +++ b/DNSSD/include/Poco/DNSSD/Error.h @@ -0,0 +1,89 @@ +// +// Error.h +// +// $Id: //poco/1.7/DNSSD/include/Poco/DNSSD/Error.h#1 $ +// +// Library: DNSSD +// Package: Core +// Module: Error +// +// Definition of the Error class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Error_INCLUDED +#define DNSSD_Error_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" + + +namespace Poco { +namespace DNSSD { + + +class DNSSD_API Error + /// Error stores information about an error + /// that occured during browsing or service + /// registration. +{ +public: + Error(); + /// Creates an uninitialized ServiceError. + + Error(Poco::Int32 networkInterface, Poco::Int32 code, const std::string& message); + /// Creates the ServiceError using the given information. + /// + /// - networkInterface specifies the index of the interface the error occured on. + /// - code contains the implementation-specific error code. + /// - message contains a human-readable error message. + + ~Error(); + /// Destroys the ServiceError. + + Poco::Int32 networkInterface() const; + /// Returns the network interface on which the error occurred. + + Poco::Int32 code() const; + /// Returns the implementation-specific error code. + + const std::string& message() const; + /// Returns the human-readable error message. + +private: + Poco::Int32 _networkInterface; + Poco::Int32 _code; + std::string _message; +}; + + +// +// inlines +// +inline Poco::Int32 Error::networkInterface() const +{ + return _networkInterface; +} + + +inline Poco::Int32 Error::code() const +{ + return _code; +} + + +inline const std::string& Error::message() const +{ + return _message; +} + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_Error_INCLUDED diff --git a/DNSSD/include/Poco/DNSSD/Record.h b/DNSSD/include/Poco/DNSSD/Record.h new file mode 100644 index 000000000..ede194c5e --- /dev/null +++ b/DNSSD/include/Poco/DNSSD/Record.h @@ -0,0 +1,223 @@ +// +// Record.h +// +// $Id: //poco/1.7/DNSSD/include/Poco/DNSSD/Record.h#1 $ +// +// Library: DNSSD +// Package: Core +// Module: Record +// +// Definition of the Record class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Record_INCLUDED +#define DNSSD_Record_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" + + +namespace Poco { +namespace DNSSD { + + +class DNSSD_API Record + /// Service stores the information found in a DNSSD record. +{ +public: + enum RecordType + { + RT_A = 1, /// Host address. + RT_NS = 2, /// Authoritative server. + RT_MD = 3, /// Mail destination. + RT_MF = 4, /// Mail forwarder. + RT_CNAME = 5, /// Canonical name. + RT_SOA = 6, /// Start of authority zone. + RT_MB = 7, /// Mailbox domain name. + RT_MG = 8, /// Mail group member. + RT_MR = 9, /// Mail rename name. + RT_NULL = 10, /// Null resource record. + RT_WKS = 11, /// Well known service. + RT_PTR = 12, /// Domain name pointer. + RT_HINFO = 13, /// Host information. + RT_MINFO = 14, /// Mailbox information. + RT_MX = 15, /// Mail routing information. + RT_TXT = 16, /// One or more text strings (NOT "zero or more..."). + RT_RP = 17, /// Responsible person. + RT_AFSDB = 18, /// AFS cell database. + RT_X25 = 19, /// X_25 calling address. + RT_ISDN = 20, /// ISDN calling address. + RT_RT = 21, /// Router. + RT_NSAP = 22, /// NSAP address. + RT_NSAP_PTR = 23, /// Reverse NSAP lookup (deprecated). + RT_SIG = 24, /// Security signature. + RT_KEY = 25, /// Security key. + RT_PX = 26, /// X.400 mail mapping. + RT_GPOS = 27, /// Geographical position (withdrawn). + RT_AAAA = 28, /// IPv6 Address. + RT_LOC = 29, /// Location Information. + RT_NXT = 30, /// Next domain (security). + RT_EID = 31, /// Endpoint identifier. + RT_NIMLOC = 32, /// Nimrod Locator. + RT_SRV = 33, /// Server Selection. + RT_ATMA = 34, /// ATM Address + RT_NAPTR = 35, /// Naming Authority PoinTeR + RT_KX = 36, /// Key Exchange + RT_CERT = 37, /// Certification record + RT_A6 = 38, /// IPv6 Address (deprecated) + RT_DNAME = 39, /// Non-terminal DNAME (for IPv6) + RT_SINK = 40, /// Kitchen sink (experimental) + RT_OPT = 41, /// EDNS0 option (meta-RR) + RT_APL = 42, /// Address Prefix List + RT_DS = 43, /// Delegation Signer + RT_SSHFP = 44, /// SSH Key Fingerprint + RT_IPSECKEY = 45, /// IPSECKEY + RT_RRSIG = 46, /// RRSIG + RT_NSEC = 47, /// Denial of Existence + RT_DNSKEY = 48, /// DNSKEY + RT_DHCID = 49, /// DHCP Client Identifier + RT_NSEC3 = 50, /// Hashed Authenticated Denial of Existence + RT_NSEC3PARAM= 51, /// Hashed Authenticated Denial of Existence + RT_HIP = 55, /// Host Identity Protocol + + RT_SPF = 99, /// Sender Policy Framework for E-Mail + RT_UINFO = 100, /// IANA-Reserved + RT_UID = 101, /// IANA-Reserved + RT_GID = 102, /// IANA-Reserved + RT_UNSPEC = 103, /// IANA-Reserved + + RT_TKEY = 249, /// Transaction key + RT_TSIG = 250, /// Transaction signature. + RT_IXFR = 251, /// Incremental zone transfer. + RT_AXFR = 252, /// Transfer zone of authority. + RT_MAILB = 253, /// Transfer mailbox records. + RT_MAILA = 254, /// Transfer mail agent records. + RT_ANY = 255 /// Wildcard match. + }; + + enum RecordClass + { + RC_IN = 1 /// Internet + }; + + Record(); + /// Creates an empty Record. + + Record(Poco::Int32 networkInterface, const std::string& name, Poco::UInt16 type, Poco::UInt16 clazz, Poco::UInt16 length, const void* data, Poco::UInt32 ttl); + /// Creates the Record using the given information. + /// + /// - networkInterface specifies the index of the interface the record was discovered on. + /// - name specifies the full domain name of the record. + /// - type specifies the record's type (e.g., RT_PTR). + /// Suitable values can be found in the RecordType enumeration. + /// - clazz specifies the record's class (usually RC_IN). + /// - length specifies the length in bytes of the record's data. + /// - data points to the actual data. This pointer must be valid for the entire + /// lifetime of the Record object, as it's content is not copied. + /// - ttl specifies the time-to-live of the record in seconds. + + Record(const std::string& name, Poco::UInt16 type, Poco::UInt16 length, const void* data, Poco::UInt32 ttl = 0); + /// Creates the Record using the given information. + /// + /// - name specifies the full domain name of the record. + /// - type specifies the record's type (e.g., RT_PTR). + /// Suitable values can be found in the RecordType enumeration. + /// - length specifies the length in bytes of the record's data. + /// - data points to the actual data. This pointer must be valid for the entire + /// lifetime of the Record object, as it's content is not copied. + /// - ttl specifies the time-to-live of the record in seconds. + /// If ttl is 0, the system will chose an appropriate value. + /// + /// The record class is set to RT_IN. + + ~Record(); + /// Destroys the Service. + + Poco::Int32 networkInterface() const; + /// The id of the interface on which the remote service is running, or zero + /// if no interface has been specified. + + const std::string& name() const; + /// The full domain name of the record. + + Poco::UInt16 type() const; + /// The record's type (e.g., RT_PTR). + + Poco::UInt16 clazz() const; + /// The record's class, which is usually RC_IN. + + Poco::UInt16 length() const; + /// The length of the record. + + const void* data() const; + /// The actual data. + + Poco::UInt32 ttl() const; + /// The time-to-live for the record in seconds. + +private: + Poco::Int32 _networkInterface; + std::string _name; + Poco::UInt16 _type; + Poco::UInt16 _clazz; + Poco::UInt16 _length; + const void* _data; + Poco::UInt32 _ttl; +}; + + +// +// inlines +// +inline Poco::Int32 Record::networkInterface() const +{ + return _networkInterface; +} + + +inline const std::string& Record::name() const +{ + return _name; +} + + +inline Poco::UInt16 Record::type() const +{ + return _type; +} + + +inline Poco::UInt16 Record::clazz() const +{ + return _clazz; +} + + +inline Poco::UInt16 Record::length() const +{ + return _length; +} + + +inline const void* Record::data() const +{ + return _data; +} + + +inline Poco::UInt32 Record::ttl() const +{ + return _ttl; +} + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_Service_INCLUDED diff --git a/DNSSD/include/Poco/DNSSD/Service.h b/DNSSD/include/Poco/DNSSD/Service.h new file mode 100644 index 000000000..61435348b --- /dev/null +++ b/DNSSD/include/Poco/DNSSD/Service.h @@ -0,0 +1,247 @@ +// +// Service.h +// +// $Id$ +// +// Library: DNSSD +// Package: Core +// Module: Service +// +// Definition of the Service class. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DNSSD_Service_INCLUDED +#define DNSSD_Service_INCLUDED + + +#include "Poco/DNSSD/DNSSD.h" +#include "Poco/Net/NameValueCollection.h" + + +namespace Poco { +namespace DNSSD { + + +class DNSSD_API Service + /// Service holds information for a registered or resolved service. +{ +public: + typedef Poco::Net::NameValueCollection Properties; + /// The Properties of a resolved service contains the + /// contents of the associated TXT record. + /// + /// The TXT record contains key-value pairs in + /// the form =. Each pair is preceded + /// by a length byte giving the total length + /// of the pair. Thus the total length of key + /// plus value must not exceed 254 bytes. + /// Keys are case insensitive and must consists + /// entirely of printable US-ASCII characters. + /// The length of a key should not exceed nine bytes, + /// to keep packet sizes small. Values can contain + /// arbitrary bytes. A value can also be empty; in + /// this case the '=' character can be omitted in + /// the record. + + Service(); + /// Creates an empty Service. + + Service(Poco::Int32 networkInterface, const std::string& name, const std::string& type, const std::string& domain); + /// Creates the Service using the given information. + /// + /// - networkInterface specifies the index of the interface the service was discovered on. + /// When registering a service, can be set to 0 to register the service on all + /// available interfaces. + /// - name specifies the human-readable service name. + /// When registering a service, can be left empty. In this case + /// the computer's name is used. Must be 1 - 63 bytes of UTF-8 text. + /// - type specifies the registration type of the service, consisting of service type + /// and network protocol (delimited by a dot, as in "_ftp._tcp"), + /// and an optional subtype (e.g., "_primarytype._tcp,_subtype"). + /// The protocol is always either "_tcp" or "_udp". + /// - domain specifies the name of the domain the service is registered on. + /// When registering a service, can be left empty to register in the default domain. + + Service(const std::string& type, Poco::UInt16 port, const Properties& properties = Properties()); + /// Creates the Service using the given information. This is the easiest way + /// to create a Service instance for registration. + /// + /// The service will be registered on all available network interfaces. The computer's name + /// will be used as the service name. The default domain is used, and the computer's host name + /// is used as host name for registering. + /// + /// - type specifies the registration type of the service, consisting of service type + /// and network protocol (delimited by a dot, as in "_ftp._tcp"), + /// and an optional subtype (e.g., "_primarytype._tcp,_subtype"). + /// The protocol is always either "_tcp" or "_udp". + /// - properties contains the contents of the service's TXT record. + + Service(Poco::Int32 networkInterface, const std::string& name, const std::string& fullName, const std::string& type, const std::string& domain, const std::string& host, Poco::UInt16 port); + /// Creates the Service using the given information. + /// + /// - networkInterface specifies the index of the interface the service was discovered on. + /// When registering a service, can be set to 0 to register the service on all + /// available interfaces. + /// - name specifies the human-readable service name. + /// When registering a service, can be left empty. In this case + /// the computer's name is used. Must be 1 - 63 bytes of UTF-8 text. + /// - fullName specifies the full service name in the form "...". + /// When registering a service, this should be left empty. + /// - type specifies the registration type of the service, consisting of service type + /// and network protocol (delimited by a dot, as in "_ftp._tcp"), + /// and an optional subtype (e.g., "_primarytype._tcp,_subtype"). + /// The protocol is always either "_tcp" or "_udp". + /// - domain specifies the name of the domain the service is registered on. + /// When registering a service, can be left empty to register in the default domain. + /// - host specifies the name of the host providing the service. + /// When registering a service, can be left empty to use the machine's default host name. + /// - port specifies the port number on which the service is available. + + Service(Poco::Int32 networkInterface, const std::string& name, const std::string& fullName, const std::string& type, const std::string& domain, const std::string& host, Poco::UInt16 port, const Properties& properties); + /// Creates the Service using the given information. + /// + /// - networkInterface specifies the index of the interface the service was discovered on. + /// When registering a service, can be set to 0 to register the service on all + /// available interfaces. + /// - name specifies the human-readable service name. + /// When registering a service, can be left empty. In this case + /// the computer's name is used. Must be 1 - 63 bytes of UTF-8 text. + /// - fullName specifies the full service name in the form "...". + /// When registering a service, this should be left empty. + /// - type specifies the registration type of the service, consisting of service type + /// and network protocol (delimited by a dot, as in "_ftp._tcp"), + /// and an optional subtype (e.g., "_primarytype._tcp,_subtype"). + /// The protocol is always either "_tcp" or "_udp". + /// - domain specifies the name of the domain the service is registered on. + /// When registering a service, can be left empty to register in the default domain. + /// - host specifies the name of the host providing the service. + /// When registering a service, can be left empty to use the machine's default host name. + /// - port specifies the port number on which the service is available. + /// - properties contains the contents of the service's TXT record. + + ~Service(); + /// Destroys the Service. + + Poco::Int32 networkInterface() const; + /// The id of the interface on which the remote service is running, or zero + /// if the service is available on all interfaces. + + const std::string& name() const; + /// The name of the service. + + const std::string& fullName() const; + /// Returns the full name of the service. + /// + /// The format of the full name is "...". + /// This name is escaped following standard DNS rules. + /// The full name will be empty for an unresolved service. + + const std::string& type() const; + /// The registration type of the service, consisting of service type + /// and network protocol (delimited by a dot, as in "_ftp._tcp"), + /// and an optional subtype (e.g., "_primarytype._tcp,_subtype"). + /// + /// The protocol is always either "_tcp" or "_udp". + + const std::string& domain() const; + /// The domain the service is registered on. + + const std::string& host() const; + /// Returns the host name of the host providing the service. + /// + /// Will be empty for an unresolved service. + + Poco::UInt16 port() const; + /// Returns the port number on which the service is available. + /// + /// Will be 0 for an unresolved service. + + const Properties& properties() const; + /// Returns the contents of the TXT record associated with the service. + /// + /// Will be empty for an unresolved service. + + Properties& properties(); + /// Returns the contents of the TXT record associated with the service. + /// + /// Will be empty for an unresolved service. + +private: + Poco::Int32 _networkInterface; + std::string _name; + std::string _fullName; + std::string _type; + std::string _domain; + std::string _host; + Poco::UInt16 _port; + Properties _properties; +}; + + +// +// inlines +// +inline Poco::Int32 Service::networkInterface() const +{ + return _networkInterface; +} + + +inline const std::string& Service::name() const +{ + return _name; +} + + +inline const std::string& Service::fullName() const +{ + return _fullName; +} + + +inline const std::string& Service::type() const +{ + return _type; +} + + +inline const std::string& Service::domain() const +{ + return _domain; +} + + +inline const std::string& Service::host() const +{ + return _host; +} + + +inline Poco::UInt16 Service::port() const +{ + return _port; +} + + +inline const Service::Properties& Service::properties() const +{ + return _properties; +} + + +inline Service::Properties& Service::properties() +{ + return _properties; +} + + +} } // namespace Poco::DNSSD + + +#endif // DNSSD_Service_INCLUDED diff --git a/DNSSD/samples/CMakeLists.txt b/DNSSD/samples/CMakeLists.txt new file mode 100644 index 000000000..790d90078 --- /dev/null +++ b/DNSSD/samples/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(DNSSDBrowser) +add_subdirectory(HTTPTimeServer) diff --git a/DNSSD/samples/DNSSDBrowser/CMakeLists.txt b/DNSSD/samples/DNSSDBrowser/CMakeLists.txt new file mode 100644 index 000000000..0970f51ae --- /dev/null +++ b/DNSSD/samples/DNSSDBrowser/CMakeLists.txt @@ -0,0 +1,7 @@ +set(SAMPLE_NAME "DNSSDBrowser") + +set(LOCAL_SRCS "") +aux_source_directory(src LOCAL_SRCS) + +add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) +target_link_libraries( ${SAMPLE_NAME} Foundation Net Util XML DNSSD ${DNSSD_IMPLEMENTATION_LIBRARY} ) diff --git a/DNSSD/samples/DNSSDBrowser/DNSSDBrowser.progen b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser.progen new file mode 100644 index 000000000..1375cd8e3 --- /dev/null +++ b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser.progen @@ -0,0 +1,13 @@ +vc.project.guid = ${vc.project.guidFromName} +vc.project.name = ${vc.project.baseName} +vc.project.target = ${vc.project.name} +vc.project.type = executable +vc.project.pocobase = ..\\..\\.. +vc.project.platforms = Win32, x64, WinCE +vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md +vc.project.prototype = ${vc.project.name}_vs90.vcproj +vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include;..\\..\\..\\DNSSD\\include;..\\..\\..\\DNSSD\\Bonjour\\include +vc.project.linker.dependencies = dnssd.lib +vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.x64 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.WinCE = ws2.lib iphlpapi.lib diff --git a/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs160.vcxproj b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs160.vcxproj new file mode 100644 index 000000000..76ab8cce0 --- /dev/null +++ b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs160.vcxproj @@ -0,0 +1,646 @@ + + + + + debug_shared + Win32 + + + debug_shared + x64 + + + debug_static_md + Win32 + + + debug_static_md + x64 + + + debug_static_mt + Win32 + + + debug_static_mt + x64 + + + release_shared + Win32 + + + release_shared + x64 + + + release_static_md + Win32 + + + release_static_md + x64 + + + release_static_mt + Win32 + + + release_static_mt + x64 + + + + 17.0 + DNSSDBrowser + {36D5972E-D503-3863-AFC5-8740752A3A8F} + DNSSDBrowser + Win32Proj + + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.34511.75 + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowser + DNSSDBrowser + DNSSDBrowser + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowser + DNSSDBrowser + DNSSDBrowser + + + bin\ + obj\DNSSDBrowser\$(Configuration)\ + true + + + bin\ + obj\DNSSDBrowser\$(Configuration)\ + false + + + bin\static_mt\ + obj\DNSSDBrowser\$(Configuration)\ + true + + + bin\static_mt\ + obj\DNSSDBrowser\$(Configuration)\ + false + + + bin\static_md\ + obj\DNSSDBrowser\$(Configuration)\ + true + + + bin\static_md\ + obj\DNSSDBrowser\$(Configuration)\ + false + + + bin64\ + obj64\DNSSDBrowser\$(Configuration)\ + true + + + bin64\ + obj64\DNSSDBrowser\$(Configuration)\ + false + + + bin64\static_mt\ + obj64\DNSSDBrowser\$(Configuration)\ + true + + + bin64\static_mt\ + obj64\DNSSDBrowser\$(Configuration)\ + false + + + bin64\static_md\ + obj64\DNSSDBrowser\$(Configuration)\ + true + + + bin64\static_md\ + obj64\DNSSDBrowser\$(Configuration)\ + false + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\DNSSDBrowserd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\DNSSDBrowser.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\DNSSDBrowserd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\DNSSDBrowser.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\DNSSDBrowserd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\DNSSDBrowser.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\DNSSDBrowserd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\DNSSDBrowser.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\DNSSDBrowserd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\DNSSDBrowser.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\DNSSDBrowserd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\DNSSDBrowser.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + true + stdcpp17 + stdc11 + + + + + diff --git a/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs160.vcxproj.filters b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs160.vcxproj.filters new file mode 100644 index 000000000..712d84321 --- /dev/null +++ b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs160.vcxproj.filters @@ -0,0 +1,13 @@ + + + + + {9c9e8a3d-2ef3-43c9-8fd2-96e940dea679} + + + + + Source Files + + + \ No newline at end of file diff --git a/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs170.vcxproj b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs170.vcxproj new file mode 100644 index 000000000..b0b0c4287 --- /dev/null +++ b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs170.vcxproj @@ -0,0 +1,955 @@ + + + + + debug_shared + ARM64 + + + debug_shared + Win32 + + + debug_shared + x64 + + + debug_static_md + ARM64 + + + debug_static_md + Win32 + + + debug_static_md + x64 + + + debug_static_mt + ARM64 + + + debug_static_mt + Win32 + + + debug_static_mt + x64 + + + release_shared + ARM64 + + + release_shared + Win32 + + + release_shared + x64 + + + release_static_md + ARM64 + + + release_static_md + Win32 + + + release_static_md + x64 + + + release_static_mt + ARM64 + + + release_static_mt + Win32 + + + release_static_mt + x64 + + + + 17.0 + DNSSDBrowser + {36D5972E-D503-3863-AFC5-8740752A3A8F} + DNSSDBrowser + Win32Proj + + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.34511.75 + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowser + DNSSDBrowser + DNSSDBrowser + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowser + DNSSDBrowser + DNSSDBrowser + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowserd + DNSSDBrowser + DNSSDBrowser + DNSSDBrowser + + + binA64\ + objA64\DNSSDBrowser\$(Configuration)\ + true + + + binA64\ + objA64\DNSSDBrowser\$(Configuration)\ + false + + + binA64\static_mt\ + objA64\DNSSDBrowser\$(Configuration)\ + true + + + binA64\static_mt\ + objA64\DNSSDBrowser\$(Configuration)\ + false + + + binA64\static_md\ + objA64\DNSSDBrowser\$(Configuration)\ + true + + + binA64\static_md\ + objA64\DNSSDBrowser\$(Configuration)\ + false + + + bin\ + obj\DNSSDBrowser\$(Configuration)\ + true + + + bin\ + obj\DNSSDBrowser\$(Configuration)\ + false + + + bin\static_mt\ + obj\DNSSDBrowser\$(Configuration)\ + true + + + bin\static_mt\ + obj\DNSSDBrowser\$(Configuration)\ + false + + + bin\static_md\ + obj\DNSSDBrowser\$(Configuration)\ + true + + + bin\static_md\ + obj\DNSSDBrowser\$(Configuration)\ + false + + + bin64\ + obj64\DNSSDBrowser\$(Configuration)\ + true + + + bin64\ + obj64\DNSSDBrowser\$(Configuration)\ + false + + + bin64\static_mt\ + obj64\DNSSDBrowser\$(Configuration)\ + true + + + bin64\static_mt\ + obj64\DNSSDBrowser\$(Configuration)\ + false + + + bin64\static_md\ + obj64\DNSSDBrowser\$(Configuration)\ + true + + + bin64\static_md\ + obj64\DNSSDBrowser\$(Configuration)\ + false + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName).exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineARM64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + binA64\DNSSDBrowser.exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineARM64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + binA64\static_mt\DNSSDBrowserd.exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineARM64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + binA64\static_mt\DNSSDBrowser.exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineARM64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + binA64\static_md\DNSSDBrowserd.exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineARM64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName).exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineARM64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\DNSSDBrowserd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\DNSSDBrowser.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\DNSSDBrowserd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\DNSSDBrowser.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\DNSSDBrowserd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\DNSSDBrowser.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\DNSSDBrowserd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\DNSSDBrowser.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\DNSSDBrowserd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\DNSSDBrowser.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\DNSSDBrowserd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\DNSSDBrowser.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + true + stdcpp17 + stdc11 + + + + + diff --git a/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs170.vcxproj.filters b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs170.vcxproj.filters new file mode 100644 index 000000000..89378db0a --- /dev/null +++ b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs170.vcxproj.filters @@ -0,0 +1,13 @@ + + + + + {2bbee48a-22d9-405c-9f0d-cb65b4fa8c5e} + + + + + Source Files + + + \ No newline at end of file diff --git a/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs90.vcproj b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs90.vcproj new file mode 100644 index 000000000..2615db21d --- /dev/null +++ b/DNSSD/samples/DNSSDBrowser/DNSSDBrowser_vs90.vcproj @@ -0,0 +1,445 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DNSSD/samples/DNSSDBrowser/Makefile b/DNSSD/samples/DNSSDBrowser/Makefile new file mode 100644 index 000000000..a5d2fc882 --- /dev/null +++ b/DNSSD/samples/DNSSDBrowser/Makefile @@ -0,0 +1,23 @@ +# +# Makefile +# +# $Id: //poco/1.7/DNSSD/samples/DNSSDBrowser/Makefile#1 $ +# +# Makefile for DNSSDBrowser sample +# + +include $(POCO_BASE)/build/rules/global + +ifeq ($(OSNAME),Linux) +DNSSDLibrary = PocoDNSSDAvahi +else +DNSSDLibrary = PocoDNSSDBonjour +endif + +objects = DNSSDBrowser + +target = DNSSDBrowser +target_version = 1 +target_libs = $(DNSSDLibrary) PocoDNSSD PocoNet PocoUtil PocoXML PocoFoundation + +include $(POCO_BASE)/build/rules/exec diff --git a/DNSSD/samples/DNSSDBrowser/bin/Darwin/x86_64/DNSSDBrowser b/DNSSD/samples/DNSSDBrowser/bin/Darwin/x86_64/DNSSDBrowser new file mode 100755 index 000000000..24c52135e Binary files /dev/null and b/DNSSD/samples/DNSSDBrowser/bin/Darwin/x86_64/DNSSDBrowser differ diff --git a/DNSSD/samples/DNSSDBrowser/bin/Darwin/x86_64/DNSSDBrowserd b/DNSSD/samples/DNSSDBrowser/bin/Darwin/x86_64/DNSSDBrowserd new file mode 100755 index 000000000..cfa022728 Binary files /dev/null and b/DNSSD/samples/DNSSDBrowser/bin/Darwin/x86_64/DNSSDBrowserd differ diff --git a/DNSSD/samples/DNSSDBrowser/src/DNSSDBrowser.cpp b/DNSSD/samples/DNSSDBrowser/src/DNSSDBrowser.cpp new file mode 100644 index 000000000..ee2f16f81 --- /dev/null +++ b/DNSSD/samples/DNSSDBrowser/src/DNSSDBrowser.cpp @@ -0,0 +1,436 @@ +// +// DNSSDBrowser.cpp +// +// $Id: //poco/1.7/DNSSD/samples/DNSSDBrowser/src/DNSSDBrowser.cpp#1 $ +// +// This sample demonstrates the DNSSDBrowser and DNSSDResponder classes. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/Util/ServerApplication.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" +#include "Poco/Util/IntValidator.h" +#include "Poco/DNSSD/DNSSDResponder.h" +#include "Poco/DNSSD/DNSSDBrowser.h" +#if POCO_OS == POCO_OS_LINUX && !defined(POCO_DNSSD_USE_BONJOUR) +#include "Poco/DNSSD/Avahi/Avahi.h" +#else +#include "Poco/DNSSD/Bonjour/Bonjour.h" +#endif +#include "Poco/Delegate.h" +#include "Poco/NumberParser.h" +#include "Poco/Thread.h" +#include +#include + + +using Poco::Util::Application; +using Poco::Util::ServerApplication; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::OptionCallback; +using Poco::Util::HelpFormatter; +using Poco::DNSSD::DNSSDResponder; +using Poco::DNSSD::Service; +using Poco::DNSSD::BrowseHandle; +using Poco::DNSSD::ServiceHandle; + + +class DNSSDBrowserApp: public ServerApplication +{ +public: + DNSSDBrowserApp(): + _helpRequested(false), + _autoResolve(false), + _enumerateDomains(false), + _port(0), + _interface(0) + { + Poco::DNSSD::initializeDNSSD(); + } + + ~DNSSDBrowserApp() + { + Poco::DNSSD::uninitializeDNSSD(); + } + +protected: + void initialize(Application& self) + { + loadConfiguration(); // load default configuration files, if present + ServerApplication::initialize(self); + } + + void uninitialize() + { + ServerApplication::uninitialize(); + } + + void defineOptions(OptionSet& options) + { + ServerApplication::defineOptions(options); + + options.addOption( + Option("help", "h", "Display help information on command line arguments.") + .required(false) + .repeatable(false) + .callback(OptionCallback(this, &DNSSDBrowserApp::handleHelp))); + + options.addOption( + Option("browse", "b", + "Browse for services with the type given in the argument (e.g., _ftp._tcp). " + "Can be specified multiple times to browse for different types of services.") + .required(false) + .repeatable(true) + .argument("") + .callback(OptionCallback(this, &DNSSDBrowserApp::handleBrowse))); + + options.addOption( + Option("resolve", "r", + "Automatically resolve all discovered services.") + .required(false) + .repeatable(false) + .callback(OptionCallback(this, &DNSSDBrowserApp::handleResolve))); + + options.addOption( + Option("domain", "d", + "Specify the domain to browse, or register a service in. " + "If not specified, the default domain will be used.") + .required(false) + .repeatable(false) + .argument("") + .callback(OptionCallback(this, &DNSSDBrowserApp::handleDomain))); + + options.addOption( + Option("enumerate-domains", "e", "Enumerate browse- and registration-domains.") + .required(false) + .repeatable(false) + .callback(OptionCallback(this, &DNSSDBrowserApp::handleEnumerate))); + + options.addOption( + Option("register", "R", + "Register a service with the given type (e.g., _ftp._tcp).") + .required(false) + .repeatable(false) + .argument("") + .callback(OptionCallback(this, &DNSSDBrowserApp::handleRegister))); + + options.addOption( + Option("name", "n", + "Specify the service name for the service to be registered. " + "If not specified, the name of the machine will be used.") + .required(false) + .repeatable(false) + .argument("") + .callback(OptionCallback(this, &DNSSDBrowserApp::handleName))); + + options.addOption( + Option("host", "H", + "Specify the host name for the service to be registered. " + "If not specified, the machine's host name will be used.") + .required(false) + .repeatable(false) + .argument("") + .callback(OptionCallback(this, &DNSSDBrowserApp::handleHost))); + + options.addOption( + Option("port", "p", + "Specify the port number for the service to be registered. " + "If not specified, the service will be registered with port 0.") + .required(false) + .repeatable(false) + .argument("") + .validator(new Poco::Util::IntValidator(0, 65535)) + .callback(OptionCallback(this, &DNSSDBrowserApp::handlePort))); + + options.addOption( + Option("txt", "t", + "Specify a key-value pair for a registered service's TXT record. " + "Can be given multiple times.") + .required(false) + .repeatable(true) + .argument("<[=value]>") + .callback(OptionCallback(this, &DNSSDBrowserApp::handleTXT))); + + options.addOption( + Option("interface", "i", + "Specify a specific network interface for browsing and registration, by its " + "interface index. Specify 0 to browse/register on all interfaces (default).") + .required(false) + .repeatable(false) + .argument("") + .validator(new Poco::Util::IntValidator(0, 16)) + .callback(OptionCallback(this, &DNSSDBrowserApp::handleInterface))); + } + + void handleHelp(const std::string& name, const std::string& value) + { + _helpRequested = true; + stopOptionsProcessing(); + } + + void handleBrowse(const std::string& name, const std::string& value) + { + _browseTypes.insert(value); + } + + void handleResolve(const std::string& name, const std::string& value) + { + _autoResolve = true; + } + + void handleDomain(const std::string& name, const std::string& value) + { + _domain = value; + } + + void handleEnumerate(const std::string& name, const std::string& value) + { + _enumerateDomains = true; + } + + void handleRegister(const std::string& name, const std::string& value) + { + _registeredService = value; + } + + void handleName(const std::string& name, const std::string& value) + { + _name = value; + } + + void handleHost(const std::string& name, const std::string& value) + { + _host = value; + } + + void handlePort(const std::string& name, const std::string& value) + { + _port = static_cast(Poco::NumberParser::parseUnsigned(value)); + } + + void handleTXT(const std::string& name, const std::string& value) + { + std::string::size_type pos = value.find('='); + if (pos != std::string::npos) + { + _properties.add(value.substr(0, pos), value.substr(pos + 1)); + } + else + { + _properties.add(value, ""); + } + } + + void handleInterface(const std::string& name, const std::string& value) + { + _interface = Poco::NumberParser::parse(value); + } + + void displayHelp() + { + HelpFormatter helpFormatter(options()); + helpFormatter.setCommand(commandName()); + helpFormatter.setUsage("OPTIONS"); + helpFormatter.setHeader( + "\n" + "A sample application demonstrating the use of the DNSSDBrowser and DNSSDResponder classes. " + "The following command line options are supported:"); + helpFormatter.setFooter( + "For more information, please see the Applied Informatics C++ Libraries " + "and Tools documentation at ." + ); + helpFormatter.setIndent(8); + helpFormatter.format(std::cout); + } + + void onError(const void* sender, const Poco::DNSSD::DNSSDBrowser::ErrorEventArgs& args) + { + std::cout << args.error.message() << " (" << args.error.code() << ")" << std::endl; + } + + void onServiceFound(const void* sender, const Poco::DNSSD::DNSSDBrowser::ServiceEventArgs& args) + { + std::cout << "Service Found: \n" + << " Name: " << args.service.name() << "\n" + << " Domain: " << args.service.domain() << "\n" + << " Type: " << args.service.type() << "\n" + << " Interface: " << args.service.networkInterface() << "\n" << std::endl; + + if (_autoResolve) + { + reinterpret_cast(const_cast(sender))->resolve(args.service); + } + } + + void onServiceRemoved(const void* sender, const Poco::DNSSD::DNSSDBrowser::ServiceEventArgs& args) + { + std::cout << "Service Removed: \n" + << " Name: " << args.service.name() << "\n" + << " Domain: " << args.service.domain() << "\n" + << " Type: " << args.service.type() << "\n" + << " Interface: " << args.service.networkInterface() << "\n" << std::endl; + } + + void onServiceResolved(const void* sender, const Poco::DNSSD::DNSSDBrowser::ServiceEventArgs& args) + { + std::cout << "Service Resolved: \n" + << " Name: " << args.service.name() << "\n" + << " Full Name: " << args.service.fullName() << "\n" + << " Domain: " << args.service.domain() << "\n" + << " Type: " << args.service.type() << "\n" + << " Interface: " << args.service.networkInterface() << "\n" + << " Host: " << args.service.host() << "\n" + << " Port: " << args.service.port() << "\n" + << " Properties: \n"; + + for (Poco::DNSSD::Service::Properties::ConstIterator it = args.service.properties().begin(); it != args.service.properties().end(); ++it) + { + std::cout << " " << it->first << ": " << it->second << "\n"; + } + std::cout << std::endl; + + reinterpret_cast(const_cast(sender))->resolveHost(args.service.host()); + } + + void onHostResolved(const void* sender, const Poco::DNSSD::DNSSDBrowser::ResolveHostEventArgs& args) + { + std::cout << "Host Resolved: \n" + << " Host: " << args.host << "\n" + << " Interface: " << args.networkInterface << "\n" + << " Address: " << args.address.toString() << "\n" + << " TTL: " << args.ttl << "\n" << std::endl; + } + + void onBrowseDomainFound(const void* sender, const Poco::DNSSD::DNSSDBrowser::DomainEventArgs& args) + { + std::cout << "Browse Domain Found:\n" + << " Name: " << args.domain.name() << "\n" + << " Interface: " << args.domain.networkInterface() << "\n" + << " Default: " << args.domain.isDefault() << "\n" << std::endl; + } + + void onBrowseDomainRemoved(const void* sender, const Poco::DNSSD::DNSSDBrowser::DomainEventArgs& args) + { + std::cout << "Browse Domain Removed:\n" + << " Name: " << args.domain.name() << "\n" + << " Interface: " << args.domain.networkInterface() << "\n" + << " Default: " << args.domain.isDefault() << "\n" << std::endl; + } + + void onRegistrationDomainFound(const void* sender, const Poco::DNSSD::DNSSDBrowser::DomainEventArgs& args) + { + std::cout << "Registration Domain Found:\n" + << " Name: " << args.domain.name() << "\n" + << " Interface: " << args.domain.networkInterface() << "\n" + << " Default: " << args.domain.isDefault() << "\n" << std::endl; + } + + void onRegistrationDomainRemoved(const void* sender, const Poco::DNSSD::DNSSDBrowser::DomainEventArgs& args) + { + std::cout << "Registration Domain Removed:\n" + << " Name: " << args.domain.name() << "\n" + << " Interface: " << args.domain.networkInterface() << "\n" + << " Default: " << args.domain.isDefault() << "\n" << std::endl; + } + + int main(const std::vector& args) + { + if (_helpRequested || (_browseTypes.empty() && _registeredService.empty() && !_enumerateDomains)) + { + displayHelp(); + } + else + { + DNSSDResponder dnssdResponder; + + dnssdResponder.browser().browseError += Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().resolveError += Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().serviceFound += Poco::delegate(this, &DNSSDBrowserApp::onServiceFound); + dnssdResponder.browser().serviceRemoved += Poco::delegate(this, &DNSSDBrowserApp::onServiceRemoved); + dnssdResponder.browser().serviceResolved += Poco::delegate(this, &DNSSDBrowserApp::onServiceResolved); + dnssdResponder.browser().browseDomainError += Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().browseDomainFound += Poco::delegate(this, &DNSSDBrowserApp::onBrowseDomainFound); + dnssdResponder.browser().browseDomainRemoved += Poco::delegate(this, &DNSSDBrowserApp::onBrowseDomainRemoved); + dnssdResponder.browser().registrationDomainError += Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().registrationDomainFound += Poco::delegate(this, &DNSSDBrowserApp::onRegistrationDomainFound); + dnssdResponder.browser().registrationDomainRemoved += Poco::delegate(this, &DNSSDBrowserApp::onRegistrationDomainRemoved); + dnssdResponder.browser().hostResolveError += Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().hostResolved += Poco::delegate(this, &DNSSDBrowserApp::onHostResolved); + + std::vector browseHandles; + for (std::set::const_iterator it = _browseTypes.begin(); it != _browseTypes.end(); ++it) + { + browseHandles.push_back(dnssdResponder.browser().browse(*it, _domain, 0, _interface)); + } + + if (_enumerateDomains) + { + browseHandles.push_back(dnssdResponder.browser().enumerateBrowseDomains(_interface)); + browseHandles.push_back(dnssdResponder.browser().enumerateRegistrationDomains(_interface)); + } + + ServiceHandle serviceHandle; + if (!_registeredService.empty()) + { + Service service(_interface, _name, "", _registeredService, _domain, _host, _port, _properties); + serviceHandle = dnssdResponder.registerService(service); + } + + dnssdResponder.start(); + waitForTerminationRequest(); + + if (serviceHandle.isValid()) + { + dnssdResponder.unregisterService(serviceHandle); + Poco::Thread::sleep(2500); // allow time for delivery of remove event + } + + for (std::vector::iterator it = browseHandles.begin(); it != browseHandles.end(); ++it) + { + dnssdResponder.browser().cancel(*it); + } + + dnssdResponder.stop(); + + dnssdResponder.browser().browseError -= Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().resolveError -= Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().serviceFound -= Poco::delegate(this, &DNSSDBrowserApp::onServiceFound); + dnssdResponder.browser().serviceRemoved -= Poco::delegate(this, &DNSSDBrowserApp::onServiceRemoved); + dnssdResponder.browser().serviceResolved -= Poco::delegate(this, &DNSSDBrowserApp::onServiceResolved); + dnssdResponder.browser().browseDomainError -= Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().browseDomainFound -= Poco::delegate(this, &DNSSDBrowserApp::onBrowseDomainFound); + dnssdResponder.browser().browseDomainRemoved -= Poco::delegate(this, &DNSSDBrowserApp::onBrowseDomainRemoved); + dnssdResponder.browser().registrationDomainError -= Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().registrationDomainFound -= Poco::delegate(this, &DNSSDBrowserApp::onRegistrationDomainFound); + dnssdResponder.browser().registrationDomainRemoved -= Poco::delegate(this, &DNSSDBrowserApp::onRegistrationDomainRemoved); + dnssdResponder.browser().hostResolveError -= Poco::delegate(this, &DNSSDBrowserApp::onError); + dnssdResponder.browser().hostResolved -= Poco::delegate(this, &DNSSDBrowserApp::onHostResolved); + } + + return Application::EXIT_OK; + } + +private: + bool _helpRequested; + bool _autoResolve; + bool _enumerateDomains; + std::set _browseTypes; + std::string _domain; + std::string _registeredService; + std::string _name; + std::string _host; + Service::Properties _properties; + Poco::UInt16 _port; + Poco::Int32 _interface; +}; + + +POCO_SERVER_MAIN(DNSSDBrowserApp) diff --git a/DNSSD/samples/HTTPTimeServer/CMakeLists.txt b/DNSSD/samples/HTTPTimeServer/CMakeLists.txt new file mode 100644 index 000000000..b9bd48e27 --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/CMakeLists.txt @@ -0,0 +1,7 @@ +set(SAMPLE_NAME "DNSSDHTTPTimeServer") + +set(LOCAL_SRCS "") +aux_source_directory(src LOCAL_SRCS) + +add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) +target_link_libraries( ${SAMPLE_NAME} Foundation Net Util XML DNSSD ${DNSSD_IMPLEMENTATION_LIBRARY} ) diff --git a/DNSSD/samples/HTTPTimeServer/HTTPTimeServer.progen b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer.progen new file mode 100644 index 000000000..1375cd8e3 --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer.progen @@ -0,0 +1,13 @@ +vc.project.guid = ${vc.project.guidFromName} +vc.project.name = ${vc.project.baseName} +vc.project.target = ${vc.project.name} +vc.project.type = executable +vc.project.pocobase = ..\\..\\.. +vc.project.platforms = Win32, x64, WinCE +vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md +vc.project.prototype = ${vc.project.name}_vs90.vcproj +vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\XML\\include;..\\..\\..\\Util\\include;..\\..\\..\\Net\\include;..\\..\\..\\DNSSD\\include;..\\..\\..\\DNSSD\\Bonjour\\include +vc.project.linker.dependencies = dnssd.lib +vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.x64 = ws2_32.lib iphlpapi.lib +vc.project.linker.dependencies.WinCE = ws2.lib iphlpapi.lib diff --git a/DNSSD/samples/HTTPTimeServer/HTTPTimeServer.properties b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer.properties new file mode 100644 index 000000000..a86940311 --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer.properties @@ -0,0 +1,13 @@ +# This is a sample configuration file for HTTPTimeServer + +logging.loggers.root.channel.class = ConsoleChannel +logging.loggers.app.name = Application +logging.loggers.app.channel = c1 +logging.formatters.f1.class = PatternFormatter +logging.formatters.f1.pattern = [%p] %t +logging.channels.c1.class = ConsoleChannel +logging.channels.c1.formatter = f1 +HTTPTimeServer.format = %W, %e %b %y %H:%M:%S %Z +HTTPTimeServer.port = 9980 +#HTTPTimeServer.maxQueued = 200 +#HTTPTimeServer.maxThreads = 64 diff --git a/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs160.vcxproj b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs160.vcxproj new file mode 100644 index 000000000..f31548726 --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs160.vcxproj @@ -0,0 +1,649 @@ + + + + + debug_shared + Win32 + + + debug_shared + x64 + + + debug_static_md + Win32 + + + debug_static_md + x64 + + + debug_static_mt + Win32 + + + debug_static_mt + x64 + + + release_shared + Win32 + + + release_shared + x64 + + + release_static_md + Win32 + + + release_static_md + x64 + + + release_static_mt + Win32 + + + release_static_mt + x64 + + + + 17.0 + HTTPTimeServer + {18A0143A-444A-38E3-838C-1ACFBE4EE18C} + HTTPTimeServer + Win32Proj + + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + Application + MultiByte + v142 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.34511.75 + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServer + HTTPTimeServer + HTTPTimeServer + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServer + HTTPTimeServer + HTTPTimeServer + + + bin\ + obj\HTTPTimeServer\$(Configuration)\ + true + + + bin\ + obj\HTTPTimeServer\$(Configuration)\ + false + + + bin\static_mt\ + obj\HTTPTimeServer\$(Configuration)\ + true + + + bin\static_mt\ + obj\HTTPTimeServer\$(Configuration)\ + false + + + bin\static_md\ + obj\HTTPTimeServer\$(Configuration)\ + true + + + bin\static_md\ + obj\HTTPTimeServer\$(Configuration)\ + false + + + bin64\ + obj64\HTTPTimeServer\$(Configuration)\ + true + + + bin64\ + obj64\HTTPTimeServer\$(Configuration)\ + false + + + bin64\static_mt\ + obj64\HTTPTimeServer\$(Configuration)\ + true + + + bin64\static_mt\ + obj64\HTTPTimeServer\$(Configuration)\ + false + + + bin64\static_md\ + obj64\HTTPTimeServer\$(Configuration)\ + true + + + bin64\static_md\ + obj64\HTTPTimeServer\$(Configuration)\ + false + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\HTTPTimeServerd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\HTTPTimeServer.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\HTTPTimeServerd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\HTTPTimeServer.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\HTTPTimeServerd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\HTTPTimeServer.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\HTTPTimeServerd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\HTTPTimeServer.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\HTTPTimeServerd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\HTTPTimeServer.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\HTTPTimeServerd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\HTTPTimeServer.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + + + + true + stdcpp17 + stdc11 + + + + + diff --git a/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs160.vcxproj.filters b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs160.vcxproj.filters new file mode 100644 index 000000000..a9e67427b --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs160.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + {05ecd2d8-936d-4c90-9cf1-546f7a313acc} + + + {9f18ac45-b5e5-4f7f-af10-320feb933138} + + + + + Configuration Files + + + + + Source Files + + + \ No newline at end of file diff --git a/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs170.vcxproj b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs170.vcxproj new file mode 100644 index 000000000..f4f7fc258 --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs170.vcxproj @@ -0,0 +1,958 @@ + + + + + debug_shared + ARM64 + + + debug_shared + Win32 + + + debug_shared + x64 + + + debug_static_md + ARM64 + + + debug_static_md + Win32 + + + debug_static_md + x64 + + + debug_static_mt + ARM64 + + + debug_static_mt + Win32 + + + debug_static_mt + x64 + + + release_shared + ARM64 + + + release_shared + Win32 + + + release_shared + x64 + + + release_static_md + ARM64 + + + release_static_md + Win32 + + + release_static_md + x64 + + + release_static_mt + ARM64 + + + release_static_mt + Win32 + + + release_static_mt + x64 + + + + 17.0 + HTTPTimeServer + {18A0143A-444A-38E3-838C-1ACFBE4EE18C} + HTTPTimeServer + Win32Proj + + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.34511.75 + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServer + HTTPTimeServer + HTTPTimeServer + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServer + HTTPTimeServer + HTTPTimeServer + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServerd + HTTPTimeServer + HTTPTimeServer + HTTPTimeServer + + + binA64\ + objA64\HTTPTimeServer\$(Configuration)\ + true + + + binA64\ + objA64\HTTPTimeServer\$(Configuration)\ + false + + + binA64\static_mt\ + objA64\HTTPTimeServer\$(Configuration)\ + true + + + binA64\static_mt\ + objA64\HTTPTimeServer\$(Configuration)\ + false + + + binA64\static_md\ + objA64\HTTPTimeServer\$(Configuration)\ + true + + + binA64\static_md\ + objA64\HTTPTimeServer\$(Configuration)\ + false + + + bin\ + obj\HTTPTimeServer\$(Configuration)\ + true + + + bin\ + obj\HTTPTimeServer\$(Configuration)\ + false + + + bin\static_mt\ + obj\HTTPTimeServer\$(Configuration)\ + true + + + bin\static_mt\ + obj\HTTPTimeServer\$(Configuration)\ + false + + + bin\static_md\ + obj\HTTPTimeServer\$(Configuration)\ + true + + + bin\static_md\ + obj\HTTPTimeServer\$(Configuration)\ + false + + + bin64\ + obj64\HTTPTimeServer\$(Configuration)\ + true + + + bin64\ + obj64\HTTPTimeServer\$(Configuration)\ + false + + + bin64\static_mt\ + obj64\HTTPTimeServer\$(Configuration)\ + true + + + bin64\static_mt\ + obj64\HTTPTimeServer\$(Configuration)\ + false + + + bin64\static_md\ + obj64\HTTPTimeServer\$(Configuration)\ + true + + + bin64\static_md\ + obj64\HTTPTimeServer\$(Configuration)\ + false + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName).exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineARM64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + binA64\HTTPTimeServer.exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineARM64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + binA64\static_mt\HTTPTimeServerd.exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineARM64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + binA64\static_mt\HTTPTimeServer.exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineARM64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + binA64\static_md\HTTPTimeServerd.exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineARM64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName).exe + ..\..\..\libA64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineARM64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\HTTPTimeServerd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\HTTPTimeServer.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\HTTPTimeServerd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_mt\HTTPTimeServer.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\HTTPTimeServerd.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin\static_md\HTTPTimeServer.exe + ..\..\..\lib;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX86 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\HTTPTimeServerd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\HTTPTimeServer.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\HTTPTimeServerd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreaded + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_mt\HTTPTimeServer.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + Disabled + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + true + true + true + true + + Level3 + ProgramDatabase + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\HTTPTimeServerd.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + true + true + $(OutDir)$(TargetName).pdb + Console + MachineX64 + + + + + MaxSpeed + OnlyExplicitInline + true + Speed + true + .\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;..\..\..\DNSSD\include;..\..\..\DNSSD\Bonjour\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + true + true + + Level3 + + Default + $(OutDir)$(TargetName).pdb + true + stdcpp17 + stdc11 + + + iphlpapi.lib;winmm.lib;dnssd.lib;ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + bin64\static_md\HTTPTimeServer.exe + ..\..\..\lib64;%(AdditionalLibraryDirectories) + false + Console + true + true + MachineX64 + + + + + + + + true + stdcpp17 + stdc11 + + + + + diff --git a/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs170.vcxproj.filters b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs170.vcxproj.filters new file mode 100644 index 000000000..6556ec16f --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs170.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + {441c16c9-88da-4016-a905-429b26f51567} + + + {00fba94b-d0c4-47a2-a9e8-cf363dd59707} + + + + + Configuration Files + + + + + Source Files + + + \ No newline at end of file diff --git a/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs90.vcproj b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs90.vcproj new file mode 100644 index 000000000..0fbc2302c --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/HTTPTimeServer_vs90.vcproj @@ -0,0 +1,450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DNSSD/samples/HTTPTimeServer/Makefile b/DNSSD/samples/HTTPTimeServer/Makefile new file mode 100644 index 000000000..d0d3323b4 --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/Makefile @@ -0,0 +1,23 @@ +# +# Makefile +# +# $Id: //poco/1.7/DNSSD/samples/HTTPTimeServer/Makefile#1 $ +# +# Makefile for HTTPTimeServer sample +# + +include $(POCO_BASE)/build/rules/global + +ifeq ($(OSNAME),Linux) +DNSSDLibrary = PocoDNSSDAvahi +else +DNSSDLibrary = PocoDNSSDBonjour +endif + +objects = HTTPTimeServer + +target = HTTPTimeServer +target_version = 1 +target_libs = $(DNSSDLibrary) PocoDNSSD PocoNet PocoUtil PocoXML PocoFoundation + +include $(POCO_BASE)/build/rules/exec diff --git a/DNSSD/samples/HTTPTimeServer/bin/Darwin/x86_64/HTTPTimeServer b/DNSSD/samples/HTTPTimeServer/bin/Darwin/x86_64/HTTPTimeServer new file mode 100755 index 000000000..20da9f60f Binary files /dev/null and b/DNSSD/samples/HTTPTimeServer/bin/Darwin/x86_64/HTTPTimeServer differ diff --git a/DNSSD/samples/HTTPTimeServer/bin/Darwin/x86_64/HTTPTimeServerd b/DNSSD/samples/HTTPTimeServer/bin/Darwin/x86_64/HTTPTimeServerd new file mode 100755 index 000000000..5de70786b Binary files /dev/null and b/DNSSD/samples/HTTPTimeServer/bin/Darwin/x86_64/HTTPTimeServerd differ diff --git a/DNSSD/samples/HTTPTimeServer/src/HTTPTimeServer.cpp b/DNSSD/samples/HTTPTimeServer/src/HTTPTimeServer.cpp new file mode 100644 index 000000000..f0e0b3697 --- /dev/null +++ b/DNSSD/samples/HTTPTimeServer/src/HTTPTimeServer.cpp @@ -0,0 +1,248 @@ +// +// HTTPTimeServer.cpp +// +// $Id: //poco/1.7/DNSSD/samples/HTTPTimeServer/src/HTTPTimeServer.cpp#1 $ +// +// This sample demonstrates how a web server can advertise itself +// on the network using DNS Service Discovery. +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/Net/HTTPServer.h" +#include "Poco/Net/HTTPRequestHandler.h" +#include "Poco/Net/HTTPRequestHandlerFactory.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/HTTPServerRequest.h" +#include "Poco/Net/HTTPServerResponse.h" +#include "Poco/Net/HTTPServerParams.h" +#include "Poco/Net/ServerSocket.h" +#include "Poco/Net/IPAddress.h" +#include "Poco/Net/NetworkInterface.h" +#include "Poco/Net/MulticastSocket.h" +#include "Poco/Util/ServerApplication.h" +#include "Poco/Util/Option.h" +#include "Poco/Util/OptionSet.h" +#include "Poco/Util/HelpFormatter.h" +#include "Poco/DNSSD/DNSSDResponder.h" +#if POCO_OS == POCO_OS_LINUX && !defined(POCO_DNSSD_USE_BONJOUR) +#include "Poco/DNSSD/Avahi/Avahi.h" +#else +#include "Poco/DNSSD/Bonjour/Bonjour.h" +#endif +#include "Poco/DateTimeFormatter.h" +#include "Poco/DateTimeFormat.h" +#include "Poco/StreamCopier.h" +#include "Poco/Exception.h" +#include "Poco/ThreadPool.h" +#include +#include + + +using Poco::Net::ServerSocket; +using Poco::Net::SocketAddress; +using Poco::Net::HTTPRequestHandler; +using Poco::Net::HTTPRequestHandlerFactory; +using Poco::Net::HTTPServer; +using Poco::Net::HTTPServerRequest; +using Poco::Net::HTTPServerResponse; +using Poco::Net::HTTPServerParams; +using Poco::Timestamp; +using Poco::DateTimeFormatter; +using Poco::DateTimeFormat; +using Poco::ThreadPool; +using Poco::Util::ServerApplication; +using Poco::Util::Application; +using Poco::Util::Option; +using Poco::Util::OptionSet; +using Poco::Util::HelpFormatter; + + +class TimeRequestHandler: public HTTPRequestHandler + /// Return a HTML document with the current date and time. +{ +public: + TimeRequestHandler(const std::string& format): + _format(format) + { + } + + void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) + { + Application& app = Application::instance(); + app.logger().information("Request from " + request.clientAddress().toString()); + + Timestamp now; + std::string dt(DateTimeFormatter::format(now, _format)); + + response.setChunkedTransferEncoding(true); + response.setContentType("text/html"); + + std::ostream& ostr = response.send(); + ostr << "HTTPTimeServer powered by POCO C++ Libraries"; + ostr << ""; + ostr << "

"; + ostr << dt; + ostr << "

"; + } + +private: + std::string _format; +}; + + +class TimeRequestHandlerFactory: public HTTPRequestHandlerFactory +{ +public: + TimeRequestHandlerFactory(const std::string& format): + _format(format) + { + } + + HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) + { + if (request.getURI() == "/") + return new TimeRequestHandler(_format); + else + return 0; + } + +private: + std::string _format; +}; + + +class HTTPTimeServer: public Poco::Util::ServerApplication + /// The main application class. + /// + /// This class handles command-line arguments and + /// configuration files. + /// Start the HTTPTimeServer executable with the help + /// option (/help on Windows, --help on Unix) for + /// the available command line options. + /// + /// To use the sample configuration file (HTTPTimeServer.properties), + /// copy the file to the directory where the HTTPTimeServer executable + /// resides. If you start the debug version of the HTTPTimeServer + /// (HTTPTimeServerd[.exe]), you must also create a copy of the configuration + /// file named HTTPTimeServerd.properties. In the configuration file, you + /// can specify the port on which the server is listening (default + /// 9980) and the format of the date/time string sent back to the client. + /// + /// To test the TimeServer you can use any web browser (http://localhost:9980/). +{ +public: + HTTPTimeServer(): _helpRequested(false) + { + Poco::DNSSD::initializeDNSSD(); + } + + ~HTTPTimeServer() + { + Poco::DNSSD::uninitializeDNSSD(); + } + +protected: + void initialize(Application& self) + { + loadConfiguration(); // load default configuration files, if present + ServerApplication::initialize(self); + } + + void uninitialize() + { + ServerApplication::uninitialize(); + } + + void defineOptions(OptionSet& options) + { + ServerApplication::defineOptions(options); + + options.addOption( + Option("help", "h", "Display help information on command line arguments.") + .required(false) + .repeatable(false)); + } + + void handleOption(const std::string& name, const std::string& value) + { + ServerApplication::handleOption(name, value); + + if (name == "help") + _helpRequested = true; + } + + void displayHelp() + { + HelpFormatter helpFormatter(options()); + helpFormatter.setCommand(commandName()); + helpFormatter.setUsage("OPTIONS"); + helpFormatter.setHeader("A web server that serves the current date and time and announces itself via UPnP SSDP."); + helpFormatter.format(std::cout); + } + + int main(const std::vector& args) + { + if (_helpRequested) + { + displayHelp(); + } + else + { + // get parameters from configuration file + unsigned short httpPort = static_cast(config().getInt("http.port", 9980)); + std::string format(config().getString("datetime.format", DateTimeFormat::SORTABLE_FORMAT)); + + Poco::Net::HTTPServerParams::Ptr pHTTPParams = new Poco::Net::HTTPServerParams; + pHTTPParams->setSoftwareVersion(config().getString("http.softwareVersion", "")); + pHTTPParams->setMaxQueued(config().getInt("http.maxQueued", 4)); + pHTTPParams->setMaxThreads(config().getInt("http.maxThreads", 4)); + pHTTPParams->setTimeout(Poco::Timespan(config().getInt("http.timeout", 5), 0)); + pHTTPParams->setKeepAlive(config().getBool("http.keepAlive", false)); + pHTTPParams->setMaxKeepAliveRequests(config().getInt("http.maxKeepAliveRequests", 10)); + pHTTPParams->setKeepAliveTimeout(Poco::Timespan(config().getInt("http.keepAliveTimeout", 10), 0)); + + ThreadPool::defaultPool().addCapacity(pHTTPParams->getMaxThreads()); + + // set-up a server socket + SocketAddress httpSA(Poco::Net::IPAddress(), httpPort); + ServerSocket httpSocket(httpSA); + // set-up a HTTPServer instance + HTTPServer srv(new TimeRequestHandlerFactory(format), httpSocket, pHTTPParams); + // start the HTTPServer + srv.start(); + + // register with DNSSDResponder + Poco::DNSSD::DNSSDResponder dnssdResponder; + dnssdResponder.start(); + + Poco::DNSSD::Service service("_http._tcp", httpPort); + Poco::DNSSD::ServiceHandle serviceHandle = dnssdResponder.registerService(service); + + // wait for CTRL-C or kill + waitForTerminationRequest(); + + // shut down UPnP + dnssdResponder.unregisterService(serviceHandle); + dnssdResponder.stop(); + + // Stop the HTTPServer + srv.stop(); + } + return Application::EXIT_OK; + } + +private: + bool _helpRequested; +}; + + +int main(int argc, char** argv) +{ + HTTPTimeServer app; + return app.run(argc, argv); +} diff --git a/DNSSD/samples/Makefile b/DNSSD/samples/Makefile new file mode 100644 index 000000000..64436a993 --- /dev/null +++ b/DNSSD/samples/Makefile @@ -0,0 +1,13 @@ +# +# Makefile +# +# $Id: //poco/1.7/DNSSD/samples/Makefile#1 $ +# +# Makefile for DNSSD Samples +# + +.PHONY: projects +clean all: projects +projects: + $(MAKE) -C DNSSDBrowser $(MAKECMDGOALS) + $(MAKE) -C HTTPTimeServer $(MAKECMDGOALS) diff --git a/DNSSD/samples/dependencies b/DNSSD/samples/dependencies new file mode 100644 index 000000000..b2586077a --- /dev/null +++ b/DNSSD/samples/dependencies @@ -0,0 +1,6 @@ +Foundation +XML +Util +Net +DNSSD +DNSSD/Default diff --git a/DNSSD/samples/samples.progen b/DNSSD/samples/samples.progen new file mode 100644 index 000000000..5dd93f1ba --- /dev/null +++ b/DNSSD/samples/samples.progen @@ -0,0 +1,6 @@ +vc.project.platforms = Win32, x64, WinCE +vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md +vc.solution.create = true +vc.solution.include = \ + DNSSDBrowser\\DNSSDBrowser; \ + HTTPTimeServer\\HTTPTimeServer diff --git a/DNSSD/samples/samples_vs160.sln b/DNSSD/samples/samples_vs160.sln new file mode 100644 index 000000000..07516a19d --- /dev/null +++ b/DNSSD/samples/samples_vs160.sln @@ -0,0 +1,99 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DNSSDBrowser", "DNSSDBrowser\DNSSDBrowser_vs160.vcxproj", "{36D5972E-D503-3863-AFC5-8740752A3A8F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPTimeServer", "HTTPTimeServer\HTTPTimeServer_vs160.vcxproj", "{18A0143A-444A-38E3-838C-1ACFBE4EE18C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|Win32.Build.0 = release_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|x64.Build.0 = debug_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|x64.ActiveCfg = release_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|x64.Build.0 = release_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|x64.Deploy.0 = release_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|x64.Build.0 = release_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|x64.Deploy.0 = release_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|Win32.Build.0 = release_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|x64.Build.0 = debug_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|x64.ActiveCfg = release_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|x64.Build.0 = release_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|x64.Deploy.0 = release_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|x64.Build.0 = release_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/samples/samples_vs170.sln b/DNSSD/samples/samples_vs170.sln new file mode 100644 index 000000000..3427c3fc9 --- /dev/null +++ b/DNSSD/samples/samples_vs170.sln @@ -0,0 +1,141 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DNSSDBrowser", "DNSSDBrowser\DNSSDBrowser_vs170.vcxproj", "{36D5972E-D503-3863-AFC5-8740752A3A8F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPTimeServer", "HTTPTimeServer\HTTPTimeServer_vs170.vcxproj", "{18A0143A-444A-38E3-838C-1ACFBE4EE18C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|ARM64 = debug_shared|ARM64 + release_shared|ARM64 = release_shared|ARM64 + debug_static_mt|ARM64 = debug_static_mt|ARM64 + release_static_mt|ARM64 = release_static_mt|ARM64 + debug_static_md|ARM64 = debug_static_md|ARM64 + release_static_md|ARM64 = release_static_md|ARM64 + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|ARM64.ActiveCfg = debug_shared|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|ARM64.Build.0 = debug_shared|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|ARM64.Deploy.0 = debug_shared|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|ARM64.ActiveCfg = release_shared|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|ARM64.Build.0 = release_shared|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|ARM64.Deploy.0 = release_shared|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|ARM64.ActiveCfg = debug_static_mt|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|ARM64.Build.0 = debug_static_mt|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|ARM64.Deploy.0 = debug_static_mt|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|ARM64.ActiveCfg = release_static_mt|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|ARM64.Build.0 = release_static_mt|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|ARM64.Deploy.0 = release_static_mt|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|ARM64.ActiveCfg = debug_static_md|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|ARM64.Build.0 = debug_static_md|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|ARM64.Deploy.0 = debug_static_md|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|ARM64.ActiveCfg = release_static_md|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|ARM64.Build.0 = release_static_md|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|ARM64.Deploy.0 = release_static_md|ARM64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|Win32.Build.0 = release_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|x64.Build.0 = debug_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|x64.ActiveCfg = release_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|x64.Build.0 = release_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|x64.Deploy.0 = release_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|x64.Build.0 = release_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|x64.Deploy.0 = release_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|ARM64.ActiveCfg = debug_shared|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|ARM64.Build.0 = debug_shared|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|ARM64.Deploy.0 = debug_shared|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|ARM64.ActiveCfg = release_shared|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|ARM64.Build.0 = release_shared|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|ARM64.Deploy.0 = release_shared|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|ARM64.ActiveCfg = debug_static_mt|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|ARM64.Build.0 = debug_static_mt|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|ARM64.Deploy.0 = debug_static_mt|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|ARM64.ActiveCfg = release_static_mt|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|ARM64.Build.0 = release_static_mt|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|ARM64.Deploy.0 = release_static_mt|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|ARM64.ActiveCfg = debug_static_md|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|ARM64.Build.0 = debug_static_md|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|ARM64.Deploy.0 = debug_static_md|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|ARM64.ActiveCfg = release_static_md|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|ARM64.Build.0 = release_static_md|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|ARM64.Deploy.0 = release_static_md|ARM64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|Win32.Build.0 = release_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|x64.Build.0 = debug_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|x64.ActiveCfg = release_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|x64.Build.0 = release_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|x64.Deploy.0 = release_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|x64.Build.0 = release_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/samples/samples_vs90.sln b/DNSSD/samples/samples_vs90.sln new file mode 100644 index 000000000..ab731ea56 --- /dev/null +++ b/DNSSD/samples/samples_vs90.sln @@ -0,0 +1,57 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DNSSDBrowser", "DNSSDBrowser\DNSSDBrowser_vs90.vcproj", "{36D5972E-D503-3863-AFC5-8740752A3A8F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPTimeServer", "HTTPTimeServer\HTTPTimeServer_vs90.vcproj", "{18A0143A-444A-38E3-838C-1ACFBE4EE18C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|Win32 = debug_shared|Win32 + release_shared|Win32 = release_shared|Win32 + debug_static_mt|Win32 = debug_static_mt|Win32 + release_static_mt|Win32 = release_static_mt|Win32 + debug_static_md|Win32 = debug_static_md|Win32 + release_static_md|Win32 = release_static_md|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|Win32.Build.0 = release_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|Win32.Build.0 = debug_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|Win32.Deploy.0 = debug_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|Win32.ActiveCfg = release_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|Win32.Build.0 = release_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|Win32.Deploy.0 = release_shared|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|Win32.Build.0 = release_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|Win32.Build.0 = debug_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|Win32.ActiveCfg = release_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|Win32.Build.0 = release_static_md|Win32 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|Win32.Deploy.0 = release_static_md|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/samples/samples_x64_vs90.sln b/DNSSD/samples/samples_x64_vs90.sln new file mode 100644 index 000000000..becd97156 --- /dev/null +++ b/DNSSD/samples/samples_x64_vs90.sln @@ -0,0 +1,57 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DNSSDBrowser", "DNSSDBrowser\DNSSDBrowser_x64_vs90.vcproj", "{36D5972E-D503-3863-AFC5-8740752A3A8F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPTimeServer", "HTTPTimeServer\HTTPTimeServer_x64_vs90.vcproj", "{18A0143A-444A-38E3-838C-1ACFBE4EE18C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + debug_shared|x64 = debug_shared|x64 + release_shared|x64 = release_shared|x64 + debug_static_mt|x64 = debug_static_mt|x64 + release_static_mt|x64 = release_static_mt|x64 + debug_static_md|x64 = debug_static_md|x64 + release_static_md|x64 = release_static_md|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|x64.Build.0 = debug_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|x64.ActiveCfg = release_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|x64.Build.0 = release_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_shared|x64.Deploy.0 = release_shared|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|x64.Build.0 = release_static_md|x64 + {36D5972E-D503-3863-AFC5-8740752A3A8F}.release_static_md|x64.Deploy.0 = release_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|x64.ActiveCfg = debug_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|x64.Build.0 = debug_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_shared|x64.Deploy.0 = debug_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|x64.ActiveCfg = release_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|x64.Build.0 = release_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_shared|x64.Deploy.0 = release_shared|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|x64.Build.0 = debug_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|x64.ActiveCfg = release_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|x64.Build.0 = release_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_mt|x64.Deploy.0 = release_static_mt|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|x64.ActiveCfg = debug_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|x64.Build.0 = debug_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.debug_static_md|x64.Deploy.0 = debug_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|x64.ActiveCfg = release_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|x64.Build.0 = release_static_md|x64 + {18A0143A-444A-38E3-838C-1ACFBE4EE18C}.release_static_md|x64.Deploy.0 = release_static_md|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DNSSD/src/DNSSDBrowser.cpp b/DNSSD/src/DNSSDBrowser.cpp new file mode 100644 index 000000000..33d623e4a --- /dev/null +++ b/DNSSD/src/DNSSDBrowser.cpp @@ -0,0 +1,34 @@ +// +// DNSServiceBrowser.cpp +// +// $Id: //poco/1.7/DNSSD/src/DNSSDBrowser.cpp#1 $ +// +// Library: DNSSD +// Package: Core +// Module: DNSServiceBrowser +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/DNSSDBrowser.h" + + +namespace Poco { +namespace DNSSD { + + +DNSSDBrowser::DNSSDBrowser() +{ +} + + +DNSSDBrowser::~DNSSDBrowser() +{ +} + + +} } // namespace Poco::DNSSD diff --git a/DNSSD/src/DNSSDException.cpp b/DNSSD/src/DNSSDException.cpp new file mode 100644 index 000000000..dcd71cfbd --- /dev/null +++ b/DNSSD/src/DNSSDException.cpp @@ -0,0 +1,28 @@ +// +// ZeroconfException.cpp +// +// $Id: //poco/1.7/DNSSD/src/DNSSDException.cpp#1 $ +// +// Library: Zeroconf +// Package: Core +// Module: ZeroconfException +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/DNSSDException.h" +#include + + +namespace Poco { +namespace DNSSD { + + +POCO_IMPLEMENT_EXCEPTION(DNSSDException, Poco::RuntimeException, "DNSSD Exception") + + +} } // namespace Poco::DNSSD diff --git a/DNSSD/src/DNSSDResponder.cpp b/DNSSD/src/DNSSDResponder.cpp new file mode 100644 index 000000000..df0c1741c --- /dev/null +++ b/DNSSD/src/DNSSDResponder.cpp @@ -0,0 +1,109 @@ +// +// DNSSDResponder.cpp +// +// $Id: //poco/1.7/DNSSD/src/DNSSDResponder.cpp#1 $ +// +// Library: DNSSD +// Package: Core +// Module: DNSSDResponder +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/DNSSDResponder.h" +#include "Poco/DNSSD/DNSSDResponderImpl.h" +#include "Poco/Exception.h" + + +namespace Poco { +namespace DNSSD { + + +DNSSDResponderImplFactory* DNSSDResponder::_pImplFactory(0); + + +DNSSDResponder::DNSSDResponder(): + _pImpl(0) +{ + if (_pImplFactory) + { + _pImpl = _pImplFactory->createResponderImpl(*this); + } + else + { + throw Poco::IllegalStateException("No DNSResponderImplFactory available."); + } +} + + +DNSSDResponder::~DNSSDResponder() +{ + delete _pImpl; +} + + +DNSSDBrowser& DNSSDResponder::browser() +{ + return _pImpl->browser(); +} + + +ServiceHandle DNSSDResponder::registerService(const Service& service, int options) +{ + return _pImpl->registerService(service, options); +} + + +void DNSSDResponder::unregisterService(ServiceHandle& serviceHandle) +{ + _pImpl->unregisterService(serviceHandle); +} + + +RecordHandle DNSSDResponder::addRecord(ServiceHandle serviceHandle, const Record& record) +{ + return _pImpl->addRecord(serviceHandle, record); +} + + +void DNSSDResponder::updateRecord(ServiceHandle serviceHandle, RecordHandle recordHandle, const Record& record) +{ + _pImpl->updateRecord(serviceHandle, recordHandle, record); +} + + +void DNSSDResponder::removeRecord(ServiceHandle serviceHandle, RecordHandle& recordHandle) +{ + _pImpl->removeRecord(serviceHandle, recordHandle); +} + + +void DNSSDResponder::start() +{ + _pImpl->start(); +} + + +void DNSSDResponder::stop() +{ + _pImpl->stop(); +} + + +void DNSSDResponder::registerImplFactory(DNSSDResponderImplFactory& factory) +{ + _pImplFactory = &factory; +} + + +void DNSSDResponder::unregisterImplFactory() +{ + _pImplFactory = 0; +} + + +} } // namespace Poco::DNSSD diff --git a/DNSSD/src/DNSSDResponderImpl.cpp b/DNSSD/src/DNSSDResponderImpl.cpp new file mode 100644 index 000000000..26a765c45 --- /dev/null +++ b/DNSSD/src/DNSSDResponderImpl.cpp @@ -0,0 +1,39 @@ +// +// DNSSDResponderImpl.cpp +// +// $Id: //poco/1.7/DNSSD/src/DNSSDResponderImpl.cpp#1 $ +// +// Library: DNSSD +// Package: Core +// Module: DNSSDResponderImpl +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/DNSSDResponderImpl.h" + + +namespace Poco { +namespace DNSSD { + + +DNSSDResponderImpl::DNSSDResponderImpl() +{ +} + + +DNSSDResponderImpl::~DNSSDResponderImpl() +{ +} + + +DNSSDResponderImplFactory::~DNSSDResponderImplFactory() +{ +} + + +} } // namespace Poco::DNSSD diff --git a/DNSSD/src/Domain.cpp b/DNSSD/src/Domain.cpp new file mode 100644 index 000000000..41b530df6 --- /dev/null +++ b/DNSSD/src/Domain.cpp @@ -0,0 +1,44 @@ +// +// Domain.cpp +// +// $Id: //poco/1.7/DNSSD/src/Domain.cpp#1 $ +// +// Library: DNSSD +// Package: Core +// Module: Domain +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/Domain.h" + + +namespace Poco { +namespace DNSSD { + + +Domain::Domain(): + _networkInterface(0), + _isDefault(false) +{ +} + + +Domain::Domain(Poco::Int32 networkInterface, const std::string& name, bool isDefault): + _networkInterface(networkInterface), + _name(name), + _isDefault(isDefault) +{ +} + + +Domain::~Domain() +{ +} + + +} } // namespace Poco::DNSSD diff --git a/DNSSD/src/Error.cpp b/DNSSD/src/Error.cpp new file mode 100644 index 000000000..a56d73b23 --- /dev/null +++ b/DNSSD/src/Error.cpp @@ -0,0 +1,44 @@ +// +// Error.cpp +// +// $Id: //poco/1.7/DNSSD/src/Error.cpp#1 $ +// +// Library: DNSSD +// Package: Core +// Module: Error +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/Error.h" + + +namespace Poco { +namespace DNSSD { + + +Error::Error(): + _networkInterface(0), + _code(0) +{ +} + + +Error::Error(Poco::Int32 networkInterface, Poco::Int32 code, const std::string& message): + _networkInterface(networkInterface), + _code(code), + _message(message) +{ +} + + +Error::~Error() +{ +} + + +} } // namespace Poco::DNSSD diff --git a/DNSSD/src/Record.cpp b/DNSSD/src/Record.cpp new file mode 100644 index 000000000..c09742bb8 --- /dev/null +++ b/DNSSD/src/Record.cpp @@ -0,0 +1,64 @@ +// +// Record.cpp +// +// $Id: //poco/1.7/DNSSD/src/Record.cpp#1 $ +// +// Library: DNSSD +// Package: Core +// Module: Record +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/Record.h" + + +namespace Poco { +namespace DNSSD { + + +Record::Record(): + _networkInterface(0), + _type(0), + _clazz(0), + _length(0), + _data(0), + _ttl(0) +{ +} + + +Record::Record(Poco::Int32 networkInterface, const std::string& name, Poco::UInt16 type, Poco::UInt16 clazz, Poco::UInt16 length, const void* data, Poco::UInt32 ttl): + _networkInterface(networkInterface), + _name(name), + _type(type), + _clazz(clazz), + _length(length), + _data(data), + _ttl(ttl) +{ +} + + +Record::Record(const std::string& name, Poco::UInt16 type, Poco::UInt16 length, const void* data, Poco::UInt32 ttl): + _networkInterface(0), + _name(name), + _type(type), + _clazz(RC_IN), + _length(length), + _data(data), + _ttl(ttl) +{ +} + + +Record::~Record() +{ +} + + +} } // namespace Poco::DNSSD diff --git a/DNSSD/src/Service.cpp b/DNSSD/src/Service.cpp new file mode 100644 index 000000000..5b56655a7 --- /dev/null +++ b/DNSSD/src/Service.cpp @@ -0,0 +1,80 @@ +// +// Service.cpp +// +// $Id: //poco/1.7/DNSSD/src/Service.cpp#1 $ +// +// Library: DNSSD +// Package: Core +// Module: Service +// +// Copyright (c) 2006-2024, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DNSSD/Service.h" + + +namespace Poco { +namespace DNSSD { + + +Service::Service(): + _networkInterface(0), + _port(0) +{ +} + + +Service::Service(Poco::Int32 networkInterface, const std::string& name, const std::string& type, const std::string& domain): + _networkInterface(networkInterface), + _name(name), + _type(type), + _domain(domain), + _port(0) +{ +} + + +Service::Service(const std::string& type, Poco::UInt16 port, const Properties& properties): + _networkInterface(0), + _type(type), + _port(port), + _properties(properties) +{ +} + + +Service::Service(Poco::Int32 networkInterface, const std::string& name, const std::string& fullName, const std::string& type, const std::string& domain, const std::string& host, Poco::UInt16 port): + _networkInterface(networkInterface), + _name(name), + _fullName(fullName), + _type(type), + _domain(domain), + _host(host), + _port(port) +{ +} + + +Service::Service(Poco::Int32 networkInterface, const std::string& name, const std::string& fullName, const std::string& type, const std::string& domain, const std::string& host, Poco::UInt16 port, const Properties& properties): + _networkInterface(networkInterface), + _name(name), + _fullName(fullName), + _type(type), + _domain(domain), + _host(host), + _port(port), + _properties(properties) +{ +} + + +Service::~Service() +{ +} + + +} } // namespace Poco::DNSSD diff --git a/cmake/FindAvahi.cmake b/cmake/FindAvahi.cmake new file mode 100644 index 000000000..09bfa3e46 --- /dev/null +++ b/cmake/FindAvahi.cmake @@ -0,0 +1,20 @@ +# +# - Find Avahi +# Find the native AVAHI includes and library +# +# AVAHI_INCLUDE_DIRS - where to find pcre.h, etc. +# AVAHI_LIBRARIES - List of libraries when using pcre. +# AVAHI_FOUND - True if pcre found. + +find_library(AVAHI_LIBRARY-COMMON NAMES avahi-common) +find_library(AVAHI_LIBRARY-CLIENT NAMES avahi-client) + +find_path(AVAHI_INCLUDE_DIR avahi-client/publish.h) +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(Avahi DEFAULT_MSG AVAHI_LIBRARY-COMMON AVAHI_LIBRARY-CLIENT AVAHI_INCLUDE_DIR) + +if(AVAHI_FOUND) + set(AVAHI_LIBRARIES ${AVAHI_LIBRARY-COMMON} ${AVAHI_LIBRARY-CLIENT}) + set(AVAHI_INCLUDE_DIRS ${AVAHI_INCLUDE_DIR}) +endif() diff --git a/cmake/FindBonjour.cmake b/cmake/FindBonjour.cmake new file mode 100644 index 000000000..8b53ce62d --- /dev/null +++ b/cmake/FindBonjour.cmake @@ -0,0 +1,49 @@ +# - Try to find Bonjour +# (See http://developer.apple.com/networking/bonjour/index.html) +# By default available on MacOS X. +# Check for libdns_sd +# +# BONJOUR_INCLUDE_DIR - where to find dns_sd.h, etc. +# BONJOUR_LIBRARIES - List of libraries when using .... +# BONJOUR_FOUND - True if Bonjour libraries found. + +set(BONJOUR_FOUND FALSE) +set(BONJOUR_LIBRARIES) + +message(STATUS "Checking whether Bonjour is supported") + +# Bonjour is built-in on MacOS X / iOS (i.e. available in libSystem) +if(NOT APPLE) + IF (WIN32) + FIND_PATH(BONJOUR_INCLUDE_DIR dns_sd.h + PATHS $ENV{PROGRAMW6432}/Bonjour\ SDK/Include + ) + FIND_LIBRARY(BONJOUR_LIBRARY + NAMES dnssd + PATHS $ENV{PROGRAMW6432}/Bonjour\ SDK/Lib/x64 + ) + ELSE(WIN32) + find_path(BONJOUR_INCLUDE_DIR dns_sd.h + PATHS /opt/dnssd/include /usr/include /usr/local/include + ) + find_library(BONJOUR_LIBRARY + NAMES dns_sd + PATHS /opt/dnssd/lib /usr/lib /usr/local/lib + ) + ENDIF(WIN32) + if(NOT BONJOUR_INCLUDE_DIR OR NOT BONJOUR_LIBRARY) + return() + else() + set(BONJOUR_LIBRARIES ${BONJOUR_LIBRARY} ) + set(BONJOUR_FOUND TRUE) + endif() +else() + find_library(BONJOUR_LIBRARY CoreServices) + set(BONJOUR_FOUND TRUE) +endif() + + +mark_as_advanced( FORCE + BONJOUR_INCLUDE_DIR + BONJOUR_LIBRARY + ) diff --git a/components b/components index 811018f99..dcf24697d 100644 --- a/components +++ b/components @@ -25,5 +25,8 @@ Redis Prometheus ActiveRecord ActiveRecord/Compiler +DNSSD +DNSSD/Avahi +DNSSD/Bonjour PocoDoc ProGen diff --git a/configure b/configure index 1ceeebeee..466ca3fdc 100755 --- a/configure +++ b/configure @@ -171,8 +171,8 @@ unbundled="" static="" shared="" nosqlparser= -omitMinimal="Crypto NetSSL_OpenSSL Zip Data Data/SQLite Data/ODBC Data/MySQL Data/PostgreSQL MongoDB Redis PDF CppParser PageCompiler" -omitTypical="Data/ODBC Data/MySQL Data/PostgreSQL MongoDB Redis PDF CppParser" +omitMinimal="Crypto NetSSL_OpenSSL Zip Data Data/SQLite Data/ODBC Data/MySQL Data/PostgreSQL MongoDB Redis PDF DNSSD DNSSD/Avahi DNSSD/Bonjour CppParser PageCompiler" +omitTypical="Data/ODBC Data/MySQL Data/PostgreSQL MongoDB Redis PDF DNSSD DNSSD/Avahi DNSSD/Bonjour CppParser" omit=$omitTypical # parse arguments while [ $# -ge 1 ]; do