Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2208 merge dnssd #4479

Merged
merged 46 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
56e7388
Initial commit
obiltschnig Oct 5, 2016
a30ef28
initial commit
obiltschnig Oct 5, 2016
68b4d76
added README.md
obiltschnig Oct 5, 2016
a38083e
Update README.md
obiltschnig Oct 5, 2016
6754a4b
Add top level CMakeLists like another project in POCO framework. see #1
May 12, 2017
b942a10
Add CMakeLists to Avahi and Bonjour. (see #1)
soroshsabz May 12, 2017
fe1f856
Missing changing in top level CMakeLists correct. (see #1)
soroshsabz May 12, 2017
79ccb8d
Add samples CMakeLists. (see #1)
soroshsabz May 12, 2017
64f415a
Add temporary cmake find module for Avahi and Bonjour in cmake direct…
soroshsabz May 12, 2017
f12ab8f
Add mandatory requirement diff for POCO framework to DNSSD cmake can …
soroshsabz May 12, 2017
1d4e33e
Update README.md
soroshsabz May 12, 2017
a6cdd1c
Update README.md
soroshsabz May 12, 2017
8f78c1c
Update README.md
soroshsabz May 12, 2017
674b83a
Moved files
soroshsabz Jan 27, 2023
682e68d
Add cmake modules
soroshsabz Jan 27, 2023
e660d4e
Add cmake modules
soroshsabz Jan 27, 2023
6344a44
Merge remote-tracking branch 'sub/master' into devel
soroshsabz Jan 27, 2023
a73861b
Remove modules
soroshsabz Jan 27, 2023
4af6687
Correct linux cmake ci.
soroshsabz Jan 27, 2023
95047c2
Exclude DNSSD from macos, windows.
soroshsabz Feb 2, 2023
d4fc7cd
Merge branch 'devel' into devel
soroshsabz Mar 18, 2023
6d04f50
Update CMakeLists.txt
soroshsabz Sep 21, 2023
1e5027a
Remove unused gitignore
soroshsabz Sep 21, 2023
93ff2ed
Merge branch 'devel' of https://github.com/soroshsabz/poco into devel
soroshsabz Sep 21, 2023
fae860b
Merge branch 'devel' into devel
aleks-f Nov 27, 2023
767bad3
Merge branch 'pocoproject:devel' into devel
soroshsabz Dec 5, 2023
9cae4ec
Merge branch 'pocoproject:devel' into devel
soroshsabz Feb 25, 2024
d28ed46
Remove deprecated vs versions
soroshsabz Feb 25, 2024
65bc9e4
Add vs160 and vs170 for DNSSD
soroshsabz Feb 25, 2024
3ea9d6a
Remove deprecated sln
soroshsabz Feb 29, 2024
5d4bd65
Revert bad changes
soroshsabz Feb 29, 2024
dcea7cf
Revert bad changes
soroshsabz Feb 29, 2024
2d83fa7
Merge branch 'pocoproject:devel' into devel
soroshsabz Feb 29, 2024
056deb3
Merge branch 'devel' into 2208-merge-dnssd
aleks-f Mar 28, 2024
51d78f8
chore: remove vs90 sln files
aleks-f Mar 28, 2024
14bbdb6
chore: remove vs90 x64 files
aleks-f Mar 28, 2024
d74bd4b
Revert "chore: remove vs90 sln files"
aleks-f Mar 28, 2024
3beb89c
chore: add DNSSD to components
aleks-f Mar 28, 2024
ff9cb67
chore(DNSSD): disable in CI, update copyright and doc
aleks-f Mar 29, 2024
b80648f
Merge branch 'devel' into 2208-merge-dnssd
aleks-f Mar 29, 2024
6a38b4c
Merge branch 'devel' into 2208-merge-dnssd
aleks-f Mar 29, 2024
49178d4
fix(DNSSD): CMake on Apple platforms: fix finding library providing D…
matejk Apr 2, 2024
31963ed
fix(DNSSD): Handle kDNSServiceFlagsNonBrowsable that was removed in 1…
matejk Apr 2, 2024
c840a28
chore: naming and code modernize review comments
aleks-f Apr 2, 2024
5e7572f
enh(DNSSD): Define DNSSD_*_API for non-MSVC compilers.
matejk Apr 3, 2024
6cff0bb
Merge branch 'devel' into 2208-merge-dnssd
aleks-f Apr 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-buildscript.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ lib/
lib64/
pocomsg.h
**/UpgradeLog*.XML
/out/build/x64-Debug

# Eclipse generated files #
###########################
Expand Down
Empty file removed .gitmodules
Empty file.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
aleks-f marked this conversation as resolved.
Show resolved Hide resolved
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)
Expand Down Expand Up @@ -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")
Expand Down
33 changes: 33 additions & 0 deletions DNSSD/Avahi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_compile_definitions("${LIBNAME}" PUBLIC ${LIB_MODE_DEFINITIONS})

POCO_INSTALL("${LIBNAME}")
POCO_GENERATE_PACKAGE("${LIBNAME}")
21 changes: 21 additions & 0 deletions DNSSD/Avahi/Makefile
Original file line number Diff line number Diff line change
@@ -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

5 changes: 5 additions & 0 deletions DNSSD/Avahi/cmake/PocoDNSSDAvahiConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include(CMakeFindDependencyMacro)
find_dependency(PocoFoundation)
find_dependency(PocoNet)
find_dependency(PocoDNSSD)
include("${CMAKE_CURRENT_LIST_DIR}/PocoDNSSDAvahiTargets.cmake")
3 changes: 3 additions & 0 deletions DNSSD/Avahi/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Foundation
Net
DNSSD
76 changes: 76 additions & 0 deletions DNSSD/Avahi/include/Poco/DNSSD/Avahi/Avahi.h
Original file line number Diff line number Diff line change
@@ -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
86 changes: 86 additions & 0 deletions DNSSD/Avahi/include/Poco/DNSSD/Avahi/AvahiBrowserImpl.h
Original file line number Diff line number Diff line change
@@ -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 <avahi-client/lookup.h>
#include <map>


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<std::string, Poco::Net::IPAddress> AddressMap;

AvahiResponderImpl& _responder;
AddressMap _addressMap;
};


} } } // namespace Poco::DNSSD::Avahi


#endif // DNSSD_Avahi_AvahiBrowserImpl_INCLUDED
Loading
Loading