From c242341fc1a52377b22e4e577b2743d5332b6525 Mon Sep 17 00:00:00 2001 From: Guilherme Amadio <amadio@cern.ch> Date: Mon, 10 Dec 2018 10:58:47 +0100 Subject: [PATCH] Remove deprecated Bonjour support --- cmake/modules/FindBonjour.cmake | 63 --------- cmake/modules/RootBuildOptions.cmake | 6 +- cmake/modules/RootConfiguration.cmake | 5 - cmake/modules/RootNewMacros.cmake | 1 - cmake/modules/SearchInstalledSoftware.cmake | 15 -- config/Makefile.in | 5 - core/macosx/CMakeLists.txt | 8 -- documentation/doxygen/Doxyfile | 1 - graf2d/cocoa/CMakeLists.txt | 9 -- graf2d/quartz/CMakeLists.txt | 9 -- net/CMakeLists.txt | 4 - net/bonjour/CMakeLists.txt | 22 --- net/bonjour/inc/LinkDef.h | 18 --- net/bonjour/inc/TBonjourBrowser.h | 88 ------------ net/bonjour/inc/TBonjourRecord.h | 72 ---------- net/bonjour/inc/TBonjourRegistrar.h | 83 ----------- net/bonjour/inc/TBonjourResolver.h | 85 ----------- net/bonjour/src/TBonjourBrowser.cxx | 149 -------------------- net/bonjour/src/TBonjourRecord.cxx | 56 -------- net/bonjour/src/TBonjourRegistrar.cxx | 146 ------------------- net/bonjour/src/TBonjourResolver.cxx | 139 ------------------ net/doc/v524/index.html | 42 ------ proof/proofd/inc/XrdProofdNetMgr.h | 3 - proof/proofd/src/XrdProofWorker.cxx | 3 +- proof/proofd/src/XrdProofdNetMgr.cxx | 23 +-- tutorials/net/hclientbonj.C | 147 ------------------- tutorials/net/hserv2bonj.C | 113 --------------- 27 files changed, 4 insertions(+), 1311 deletions(-) delete mode 100644 cmake/modules/FindBonjour.cmake delete mode 100644 net/bonjour/CMakeLists.txt delete mode 100644 net/bonjour/inc/LinkDef.h delete mode 100644 net/bonjour/inc/TBonjourBrowser.h delete mode 100644 net/bonjour/inc/TBonjourRecord.h delete mode 100644 net/bonjour/inc/TBonjourRegistrar.h delete mode 100644 net/bonjour/inc/TBonjourResolver.h delete mode 100644 net/bonjour/src/TBonjourBrowser.cxx delete mode 100644 net/bonjour/src/TBonjourRecord.cxx delete mode 100644 net/bonjour/src/TBonjourRegistrar.cxx delete mode 100644 net/bonjour/src/TBonjourResolver.cxx delete mode 100644 tutorials/net/hclientbonj.C delete mode 100644 tutorials/net/hserv2bonj.C diff --git a/cmake/modules/FindBonjour.cmake b/cmake/modules/FindBonjour.cmake deleted file mode 100644 index 1d8ec084d2c..00000000000 --- a/cmake/modules/FindBonjour.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# - Try to find Bonjour -# (See http://developer.apple.com/networking/bonjour/index.html) -# By default available on MacOS X and on Linux via the Avahi package. -# 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/Avahi is supported") - -# Bonjour is built-in on MacOS X / iOS (i.e. available in libSystem) -if(NOT APPLE) - 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 - ) - if(NOT BONJOUR_INCLUDE_DIR OR NOT BONJOUR_LIBRARY) - return() - else() - set(BONJOUR_LIBRARIES ${BONJOUR_LIBRARY} ) - set(BONJOUR_FOUND TRUE) - endif() -else() - set(BONJOUR_FOUND TRUE) -endif() -if (CMAKE_SYSTEM_NAME MATCHES Linux) - # The compatibility layer is needed for the Bonjour record management. - find_path(AVAHI_INCLUDE_DIR avahi-client/client.h - PATHS /opt/include /usr/include /usr/local/include - ) - if(AVAHI_INCLUDE_DIR) - set(BONJOUR_INCLUDE_DIR ${BONJOUR_INCLUDE_DIR} ${AVAHI_INCLUDE_DIR}) - endif() - - # Also, the library is needed, as in Mac OS X. When found the compat - # layer, also the other libraries must be in the same location. - foreach(l client common core) - find_library(AVAHI_${l}_LIBRARY - NAMES avahi-${l}.so - PATHS /opt/lib /usr/lib /usr/local/lib - ) - if(AVAHI_${l}_LIBRARY) - set(BONJOUR_LIBRARIES ${BONJOUR_LIBRARIES} ${AVAHI_${l}_LIBRARY}) - endif() - endforeach() - - if(BONJOUR_INCLUDE_DIR AND BONJOUR_LIBRARIES) - set(BONJOUR_FOUND TRUE) - endif() -endif() - -mark_as_advanced( FORCE - BONJOUR_INCLUDE_DIR - BONJOUR_LIBRARY -) - diff --git a/cmake/modules/RootBuildOptions.cmake b/cmake/modules/RootBuildOptions.cmake index 7f69a799d7c..81086494b9e 100644 --- a/cmake/modules/RootBuildOptions.cmake +++ b/cmake/modules/RootBuildOptions.cmake @@ -76,7 +76,6 @@ ROOT_BUILD_OPTION(alien OFF "Enable support for AliEn (requires libgapiUI from A ROOT_BUILD_OPTION(arrow OFF "Enable support for Apache Arrow") ROOT_BUILD_OPTION(asimage ON "Enable support for image processing via libAfterImage") ROOT_BUILD_OPTION(astiff ON "Enable support for TIFF images via libAfterImage") -ROOT_BUILD_OPTION(bonjour OFF "Enable support for Avahi/Bonjour (requires libdns_sd and/or avahi)") ROOT_BUILD_OPTION(builtin_afterimage ON "Build bundled copy of libAfterImage") ROOT_BUILD_OPTION(builtin_cfitsio OFF "Build CFITSIO internally (requires network)") ROOT_BUILD_OPTION(builtin_clang ON "Build bundled copy of Clang") @@ -237,7 +236,6 @@ endif() #--- The 'all' option swithes ON major options--------------------------------------------------- if(all) set(arrow_defvalue ON) - set(bonjour_defvalue ON) set(dcache_defvalue ON) set(fitsio_defvalue ON) set(fortran_defvalue ON) @@ -326,14 +324,14 @@ endif() ROOT_APPLY_OPTIONS() #---Removed options------------------------------------------------------------ -foreach(opt afs chirp glite ios qt qtgsi ruby sapdb srp table) +foreach(opt afs bonjour chirp glite ios qt qtgsi ruby sapdb srp table) if(${opt}) message(FATAL_ERROR ">>> Option '${opt}' has been removed in ROOT v6.16.") endif() endforeach() #---Deprecated options--------------------------------------------------------- -foreach(opt afdsmgrd bonjour castor geocad globus gviz hdfs krb5 ldap memstat odbc rfio) +foreach(opt afdsmgrd castor geocad globus gviz hdfs krb5 ldap memstat odbc rfio) if(${opt}) message(DEPRECATION ">>> Option '${opt}' is deprecated and will be removed in ROOT v6.18. Please inform rootdev@cern.ch should you still need it.") endif() diff --git a/cmake/modules/RootConfiguration.cmake b/cmake/modules/RootConfiguration.cmake index ebaf8969589..547c4232507 100644 --- a/cmake/modules/RootConfiguration.cmake +++ b/cmake/modules/RootConfiguration.cmake @@ -240,11 +240,6 @@ set(gfalincdir ${GFAL_INCLUDE_DIR}) set(buildmemstat ${value${memstat}}) -set(buildbonjour ${value${bonjour}}) -set(dnssdlibdir ${BONJOUR_LIBRARY_DIR}) -set(dnssdlib ${BONJOUR_LIBRARY}) -set(dnsdincdir ${BONJOUR_INCLUDE_DIR}) - set(buildhdfs ${value${hdfs}}) set(hdfslibdir ${HDFS_LIBRARY_DIR}) set(hdfslib ${HDFS_LIBRARY}) diff --git a/cmake/modules/RootNewMacros.cmake b/cmake/modules/RootNewMacros.cmake index 0d769e1a2e1..47c428fe162 100644 --- a/cmake/modules/RootNewMacros.cmake +++ b/cmake/modules/RootNewMacros.cmake @@ -490,7 +490,6 @@ function (ROOT_CXXMODULES_APPEND_TO_MODULEMAP library library_headers) if (APPLE) # FIXME: Krb5Auth.h triggers "declaration of '__mb_cur_max' has a different language linkage" # problem. - # FIXME: error: declaration of 'NSObject' must be imported from module 'ROOT.libBonjour.so.TBonjourBrowser.h' before it is required if (${library} MATCHES "Krb5Auth" OR ${library} MATCHES "(GCocoa|GQuartz)") return() endif() diff --git a/cmake/modules/SearchInstalledSoftware.cmake b/cmake/modules/SearchInstalledSoftware.cmake index 6c47587f67f..8c8a8bd00c5 100644 --- a/cmake/modules/SearchInstalledSoftware.cmake +++ b/cmake/modules/SearchInstalledSoftware.cmake @@ -518,21 +518,6 @@ if(gviz) endif() endif() -#---Check for Bonjour installation------------------------------------------------------- -if(bonjour) - message(STATUS "Looking for Bonjour") - find_package(Bonjour) - if(NOT BONJOUR_FOUND) - if(fail-on-missing) - message(FATAL_ERROR "Bonjour/Avahi libraries not found and Bonjour component required") - else() - message(STATUS "Bonjour not found. Switching off bonjour option") - set(bonjour OFF CACHE BOOL "Disabled because Bonjour not found (${bonjour_description})" FORCE) - endif() - endif() -endif() - - #---Check for krb5 Support----------------------------------------------------------- if(krb5) message(STATUS "Looking for Kerberos 5") diff --git a/config/Makefile.in b/config/Makefile.in index 8a31eb296d6..06b999dce2f 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -236,11 +236,6 @@ GLIB2INCDIR := $(filter-out /usr/include, @glib2incdir@) BUILDMEMSTAT := @buildmemstat@ -BUILDBONJOUR := @buildbonjour@ -DNSSDLIBDIR := @dnssdlibdir@ -DNSSDLIB := @dnssdlib@ -DNSSDINCDIR := $(filter-out /usr/include, @dnssdincdir@) - BUILDHDFS := @buildhdfs@ HDFSLIBDIR := @hdfslibdir@ HDFSCLILIB := @hdfslib@ diff --git a/core/macosx/CMakeLists.txt b/core/macosx/CMakeLists.txt index daba0d96145..ab2d359af08 100644 --- a/core/macosx/CMakeLists.txt +++ b/core/macosx/CMakeLists.txt @@ -7,14 +7,6 @@ ROOT_GLOB_SOURCES(headers ${CMAKE_CURRENT_SOURCE_DIR}/inc/T*.h) set(Macosx_dict_headers ${headers} PARENT_SCOPE) -if(cxxmodules) - # FIXME: Disable modules for ObjC/ObjC++. - # ROOT top-most module, cannot be built implicitly in ObjC/ObjC++ TU context - # because of issues in TBonjourBrowser (when incluing dns_sd.h) on OSX. - string(REPLACE "${ROOT_CXXMODULES_CXXFLAGS}" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - string(REPLACE "${ROOT_CXXMODULES_CFLAGS}" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) -endif(cxxmodules) - ROOT_OBJECT_LIBRARY(Macosx ${sources}) set_source_files_properties(${sources} COMPILE_FLAGS "-ObjC++ -std=c++11") diff --git a/documentation/doxygen/Doxyfile b/documentation/doxygen/Doxyfile index 10587a52490..56ba9467efc 100644 --- a/documentation/doxygen/Doxyfile +++ b/documentation/doxygen/Doxyfile @@ -847,7 +847,6 @@ INPUT = . \ ../../montecarlo/ \ ../../net/alien/ \ ../../net/auth/ \ - ../../net/bonjour/ \ ../../net/davix/ \ ../../net/http/ \ ../../net/krb5auth/ \ diff --git a/graf2d/cocoa/CMakeLists.txt b/graf2d/cocoa/CMakeLists.txt index c6bd29d7fe7..6e82f8257ff 100644 --- a/graf2d/cocoa/CMakeLists.txt +++ b/graf2d/cocoa/CMakeLists.txt @@ -5,15 +5,6 @@ add_definitions("-ObjC++") -if (cxxmodules) - # FIXME: Disable modules for ObjC/ObjC++. Modules for cocoa and quarts have to - # be treated in a special way. Eg. it seems that they cannot be nested in the - # ROOT top-most module, because an implicit build of this module in ObjC TU - # causes issues in TBonjourBrowser (when incluing dns_sd.h) on OSX. - string(REPLACE "${ROOT_CXXMODULES_CXXFLAGS}" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - string(REPLACE "${ROOT_CXXMODULES_CFLAGS}" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) -endif(cxxmodules) - include_directories(${FREETYPE_INCLUDE_DIRS}) ROOT_STANDARD_LIBRARY_PACKAGE(GCocoa diff --git a/graf2d/quartz/CMakeLists.txt b/graf2d/quartz/CMakeLists.txt index e4680b5370a..352e3483dcd 100644 --- a/graf2d/quartz/CMakeLists.txt +++ b/graf2d/quartz/CMakeLists.txt @@ -5,15 +5,6 @@ add_definitions("-ObjC++") -if(cxxmodules) - # FIXME: Disable modules for ObjC/ObjC++. Modules for cocoa and quarts have to - # be treated in a special way. Eg. it seems that they cannot be nested in the - # ROOT top-most module, because an implicit build of this module in ObjC TU - # causes issues in TBonjourBrowser (when incluing dns_sd.h) on OSX. - string(REPLACE "${ROOT_CXXMODULES_CXXFLAGS}" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - string(REPLACE "${ROOT_CXXMODULES_CFLAGS}" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) -endif(cxxmodules) - ROOT_STANDARD_LIBRARY_PACKAGE(GQuartz NO_HEADERS SOURCES *.mm diff --git a/net/CMakeLists.txt b/net/CMakeLists.txt index 593b78e784d..059ccf167a9 100644 --- a/net/CMakeLists.txt +++ b/net/CMakeLists.txt @@ -1,10 +1,6 @@ add_subdirectory(net) add_subdirectory(auth) -if(bonjour) - add_subdirectory(bonjour) -endif() - if(krb5) add_subdirectory(krb5auth) endif() diff --git a/net/bonjour/CMakeLists.txt b/net/bonjour/CMakeLists.txt deleted file mode 100644 index 3a228614acc..00000000000 --- a/net/bonjour/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################ -# CMakeLists.txt file for building ROOT net/bonjour package -# @author Pere Mato, CERN -############################################################################ - -ROOT_STANDARD_LIBRARY_PACKAGE(Bonjour - HEADERS - TBonjourBrowser.h - TBonjourRecord.h - TBonjourRegistrar.h - TBonjourResolver.h - SOURCES - src/TBonjourBrowser.cxx - src/TBonjourRecord.cxx - src/TBonjourRegistrar.cxx - src/TBonjourResolver.cxx - DEPENDENCIES - Core -) - -target_link_libraries(Bonjour PUBLIC ${BONJOUR_LIBRARIES}) -target_include_directories(Bonjour PUBLIC ${BONJOUR_INCLUDE_DIRS}) diff --git a/net/bonjour/inc/LinkDef.h b/net/bonjour/inc/LinkDef.h deleted file mode 100644 index eecfc42da49..00000000000 --- a/net/bonjour/inc/LinkDef.h +++ /dev/null @@ -1,18 +0,0 @@ -/* @(#)root/bonjour:$Id$ */ - -/************************************************************************* - * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifdef __CINT__ - -#pragma link C++ class TBonjourRecord; -#pragma link C++ class TBonjourRegistrar; -#pragma link C++ class TBonjourBrowser; -#pragma link C++ class TBonjourResolver; - -#endif diff --git a/net/bonjour/inc/TBonjourBrowser.h b/net/bonjour/inc/TBonjourBrowser.h deleted file mode 100644 index 57af6c02e5e..00000000000 --- a/net/bonjour/inc/TBonjourBrowser.h +++ /dev/null @@ -1,88 +0,0 @@ -// @(#)root/bonjour:$Id$ -// Author: Fons Rademakers 29/05/2009 - -/************************************************************************* - * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TBonjourBrowser -#define ROOT_TBonjourBrowser - - -////////////////////////////////////////////////////////////////////////// -// // -// TBonjourBrowser // -// // -// This class consists of one main member function, // -// BrowseForServiceType(), that looks for the service. // -// The rest of the class wraps the various bits of Bonjour service // -// browser. The static callback function is marked with the DNSSD_API // -// macro to make sure that the callback has the correct calling // -// convention on Windows. // -// // -// Bonjour works out-of-the-box on MacOS X. On Linux you have to // -// install the Avahi package and run the avahi-daemon. To compile // -// these classes and run Avahi on Linux you need to install the: // -// avahi // -// avahi-compat-libdns_sd-devel // -// nss-mdns // -// packages. After installation make sure the avahi-daemon is started. // -// // -////////////////////////////////////////////////////////////////////////// - -#include "TObject.h" -#include "TQObject.h" -#include "TString.h" - -#if !defined(__CINT__) -#include <dns_sd.h> -#else -typedef ULong_t DNSServiceRef; -typedef UInt_t DNSServiceFlags; -typedef Int_t DNSServiceErrorType; -#endif - -class TFileHandler; -class TList; - - -class TBonjourBrowser : public TObject, public TQObject { - -private: - DNSServiceRef fDNSRef; - TFileHandler *fBonjourSocketHandler; - TList *fBonjourRecords; - TString fBrowsingType; - - void *GetSender() { return this; } // used to get gTQSender - -#if !defined(__CINT__) - static void DNSSD_API BonjourBrowseReply(DNSServiceRef, - DNSServiceFlags, UInt_t, DNSServiceErrorType, - const char *, const char *, const char *, void *); -#else - static void BonjourBrowseReply(DNSServiceRef, - DNSServiceFlags, Int_t, DNSServiceErrorType, - const char *, const char *, const char *, void *); -#endif - -public: - TBonjourBrowser(); - virtual ~TBonjourBrowser(); - - Int_t BrowseForServiceType(const char *serviceType); - TList *CurrentRecords() const { return fBonjourRecords; } - const char *ServiceType() const { return fBrowsingType; } - - void CurrentBonjourRecordsChanged(TList *bonjourRecords); //*SIGNAL* - - void BonjourSocketReadyRead(); // private slot - - ClassDef(TBonjourBrowser,0) // Browse hosts for specific bonjour service type -}; - -#endif diff --git a/net/bonjour/inc/TBonjourRecord.h b/net/bonjour/inc/TBonjourRecord.h deleted file mode 100644 index 29d472e8fa4..00000000000 --- a/net/bonjour/inc/TBonjourRecord.h +++ /dev/null @@ -1,72 +0,0 @@ -// @(#)root/bonjour:$Id$ -// Author: Fons Rademakers 29/05/2009 - -/************************************************************************* - * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TBonjourRecord -#define ROOT_TBonjourRecord - - -////////////////////////////////////////////////////////////////////////// -// // -// TBonjourRecord // -// // -// Contains all information concerning a Bonjour entry. // -// // -////////////////////////////////////////////////////////////////////////// - -#include "TObject.h" - -#include "TString.h" - - - -class TBonjourRecord : public TObject { - -private: - TString fServiceName; - TString fRegisteredType; - TString fReplyDomain; - TString fTXTRecords; - -public: - TBonjourRecord() { } - TBonjourRecord(const char *name, const char *regType, const char *domain) : - fServiceName(name), fRegisteredType(regType), fReplyDomain(domain), - fTXTRecords("") { } - TBonjourRecord(const char *name, const char *regType, const char *domain, - const char *txt) : - fServiceName(name), fRegisteredType(regType), - fReplyDomain(domain), fTXTRecords(txt) { } - virtual ~TBonjourRecord() { } - - Bool_t operator==(const TBonjourRecord &other) const { - return fServiceName == other.fServiceName && - fRegisteredType == other.fRegisteredType && - fReplyDomain == other.fReplyDomain && - fTXTRecords == other.fTXTRecords; - } - - Bool_t IsEqual(const TObject *obj) const { return *this == *(TBonjourRecord*)obj; } - - const char *GetServiceName() const { return fServiceName; } - const char *GetRegisteredType() const { return fRegisteredType; } - const char *GetReplyDomain() const { return fReplyDomain; } - const char *GetTXTRecords() const { return fTXTRecords; } - Int_t GetTXTRecordsLength() const { return fTXTRecords.Length(); } - - void AddTXTRecord(const char *record); - void AddTXTRecord(const TString &record); - - void Print(Option_t *opt = "") const; - - ClassDef(TBonjourRecord,0) // Bonjour information record -}; - -#endif diff --git a/net/bonjour/inc/TBonjourRegistrar.h b/net/bonjour/inc/TBonjourRegistrar.h deleted file mode 100644 index 23d52b85c17..00000000000 --- a/net/bonjour/inc/TBonjourRegistrar.h +++ /dev/null @@ -1,83 +0,0 @@ -// @(#)root/bonjour:$Id$ -// Author: Fons Rademakers 29/05/2009 - -/************************************************************************* - * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TBonjourRegistrar -#define ROOT_TBonjourRegistrar - - -////////////////////////////////////////////////////////////////////////// -// // -// TBonjourRegistrar // -// // -// This class consists of one main member function, RegisterService(), // -// that registers the service. As long as the object is alive, the // -// service stays registered. The rest of the class wraps the various // -// bits of Bonjour service registration. The static callback function // -// is marked with the DNSSD_API macro to make sure that the callback // -// has the correct calling convention on Windows. // -// // -// Bonjour works out-of-the-box on MacOS X. On Linux you have to // -// install the Avahi package and run the avahi-daemon. To compile // -// these classes and run Avahi on Linux you need to install the: // -// avahi // -// avahi-compat-libdns_sd-devel // -// nss-mdns // -// packages. After installation make sure the avahi-daemon is started. // -// // -////////////////////////////////////////////////////////////////////////// - -#include "TObject.h" -#include "TQObject.h" -#include "TBonjourRecord.h" - -#if !defined(__CINT__) -#include <dns_sd.h> -#else -typedef ULong_t DNSServiceRef; -typedef UInt_t DNSServiceFlags; -typedef Int_t DNSServiceErrorType; -#endif - -class TFileHandler; - - -class TBonjourRegistrar : public TObject, public TQObject { - -private: - DNSServiceRef fDNSRef; - TFileHandler *fBonjourSocketHandler; - TBonjourRecord fFinalRecord; - - void *GetSender() { return this; } // used to get gTQSender - -#if !defined(__CINT__) - static void DNSSD_API BonjourRegisterService(DNSServiceRef, DNSServiceFlags, DNSServiceErrorType, - const char *, const char *, const char *, void *); -#else - static void BonjourRegisterService(DNSServiceRef, DNSServiceFlags, DNSServiceErrorType, - const char *, const char *, const char *, void *); -#endif - -public: - TBonjourRegistrar(); - virtual ~TBonjourRegistrar(); - - Int_t RegisterService(const TBonjourRecord &record, UShort_t servicePort); - TBonjourRecord RegisteredRecord() const { return fFinalRecord; } - - void ServiceRegistered(TBonjourRecord *record); //*SIGNAL* - - void BonjourSocketReadyRead(); // private slot - - ClassDef(TBonjourRegistrar,0) // Register Bonjour service -}; - -#endif diff --git a/net/bonjour/inc/TBonjourResolver.h b/net/bonjour/inc/TBonjourResolver.h deleted file mode 100644 index b8c025755c9..00000000000 --- a/net/bonjour/inc/TBonjourResolver.h +++ /dev/null @@ -1,85 +0,0 @@ -// @(#)root/bonjour:$Id$ -// Author: Fons Rademakers 29/05/2009 - -/************************************************************************* - * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_TBonjourResolver -#define ROOT_TBonjourResolver - - -////////////////////////////////////////////////////////////////////////// -// // -// TBonjourResolver // -// // -// This class consists of one main member function, // -// ResolveBonjourRecord(), that resolves the service to an actual // -// IP address and port number. The rest of the class wraps the various // -// bits of Bonjour service resolver. The static callback function // -// is marked with the DNSSD_API macro to make sure that the callback // -// has the correct calling convention on Windows. // -// // -////////////////////////////////////////////////////////////////////////// - -#include "TObject.h" -#include "TQObject.h" -#include "TInetAddress.h" - -#if !defined(__CINT__) -#include <dns_sd.h> -#else -typedef ULong_t DNSServiceRef; -typedef UInt_t DNSServiceFlags; -typedef Int_t DNSServiceErrorType; -#endif - -class TFileHandler; -class TBonjourRecord; - - -class TBonjourResolver : public TObject, public TQObject { - -private: - DNSServiceRef fDNSRef; - TFileHandler *fBonjourSocketHandler; - TInetAddress fHostAddress; - Int_t fPort; - TString fTXTRecord; - - void *GetSender() { return this; } // used to get gTQSender - -#if !defined(__CINT__) - static void DNSSD_API BonjourResolveReply(DNSServiceRef, DNSServiceFlags, UInt_t, - DNSServiceErrorType, - const char *, const char *, - UShort_t, UShort_t, const char *, void *); -#else - static void BonjourResolveReply(DNSServiceRef, DNSServiceFlags, UInt_t, - DNSServiceErrorType, - const char *, const char *, - UShort_t, UShort_t, const char *, void *); -#endif - -public: - TBonjourResolver(); - virtual ~TBonjourResolver(); - - TInetAddress GetInetAddress() const { return fHostAddress; } - Int_t GetPort() const { return fPort; } - const char * GetTXTRecord() const { return fTXTRecord; } - - Int_t ResolveBonjourRecord(const TBonjourRecord &record); - - void RecordResolved(const TInetAddress *hostInfo, Int_t port); //*SIGNAL* - - void BonjourSocketReadyRead(); // private slot - - ClassDef(TBonjourResolver,0) // Resolve Bonjour to actual IP address and port -}; - -#endif diff --git a/net/bonjour/src/TBonjourBrowser.cxx b/net/bonjour/src/TBonjourBrowser.cxx deleted file mode 100644 index 57411c4b27e..00000000000 --- a/net/bonjour/src/TBonjourBrowser.cxx +++ /dev/null @@ -1,149 +0,0 @@ -// @(#)root/bonjour:$Id$ -// Author: Fons Rademakers 29/05/2009 - -/************************************************************************* - * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -////////////////////////////////////////////////////////////////////////// -// // -// TBonjourBrowser // -// // -// This class consists of one main member function, // -// BrowseForServiceType(), that looks for the service. // -// The rest of the class wraps the various bits of Bonjour service // -// browser. The static callback function is marked with the DNSSD_API // -// macro to make sure that the callback has the correct calling // -// convention on Windows. // -// // -// Bonjour works out-of-the-box on MacOS X. On Linux you have to // -// install the Avahi package and run the avahi-daemon. To compile // -// these classes and run Avahi on Linux you need to install the: // -// avahi // -// avahi-compat-libdns_sd-devel // -// nss-mdns // -// packages. After installation make sure the avahi-daemon is started. // -// // -////////////////////////////////////////////////////////////////////////// - -#include "TBonjourBrowser.h" -#include "TBonjourRecord.h" -#include "TSysEvtHandler.h" -#include "TList.h" -#include "TError.h" -#include "TSystem.h" - - -ClassImp(TBonjourBrowser); - -//////////////////////////////////////////////////////////////////////////////// -/// Default ctor. - -TBonjourBrowser::TBonjourBrowser() : fDNSRef(0), fBonjourSocketHandler(0) -{ - fBonjourRecords = new TList; - fBonjourRecords->SetOwner(); - - // silence Avahi about using Bonjour compat layer - gSystem->Setenv("AVAHI_COMPAT_NOWARN", "1"); -} - -//////////////////////////////////////////////////////////////////////////////// -/// Cleanup. - -TBonjourBrowser::~TBonjourBrowser() -{ - delete fBonjourRecords; - delete fBonjourSocketHandler; - - if (fDNSRef) { - DNSServiceRefDeallocate(fDNSRef); - fDNSRef = 0; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// Tell Bonjour to start browsing for a specific type of service. -/// Returns -1 in case of error, 0 otherwise. - -Int_t TBonjourBrowser::BrowseForServiceType(const char *serviceType) -{ - DNSServiceErrorType err = DNSServiceBrowse(&fDNSRef, 0, - 0, serviceType, 0, - (DNSServiceBrowseReply)BonjourBrowseReply, - this); - if (err != kDNSServiceErr_NoError) { - Error("BrowseForServiceType", "error in DNSServiceBrowse (%d)", err); - return -1; - } - - Int_t sockfd = DNSServiceRefSockFD(fDNSRef); - if (sockfd == -1) { - Error("BrowseForServiceType", "invalid sockfd"); - return -1; - } - - fBonjourSocketHandler = new TFileHandler(sockfd, TFileHandler::kRead); - fBonjourSocketHandler->Connect("Notified()", "TBonjourBrowser", this, "BonjourSocketReadyRead()"); - fBonjourSocketHandler->Add(); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -/// Emit CurrentBonjourRecordsChanged signal. - -void TBonjourBrowser::CurrentBonjourRecordsChanged(TList *bonjourRecords) -{ - Emit("CurrentBonjourRecordsChanged(TList*)", (Long_t)bonjourRecords); -} - -//////////////////////////////////////////////////////////////////////////////// -/// The Bonjour socket is ready for reading. Tell Bonjour to process the -/// information on the socket, this will invoke the BonjourBrowseReply -/// callback. This is a private slot, used in BrowseForServiceType. - -void TBonjourBrowser::BonjourSocketReadyRead() -{ - // in case the browser has already been deleted - if (!fDNSRef) return; - - DNSServiceErrorType err = DNSServiceProcessResult(fDNSRef); - if (err != kDNSServiceErr_NoError) - Error("BonjourSocketReadyRead", "error in DNSServiceProcessResult"); -} - -//////////////////////////////////////////////////////////////////////////////// -/// Static Bonjour browser callback function. - -void TBonjourBrowser::BonjourBrowseReply(DNSServiceRef, - DNSServiceFlags flags, UInt_t, - DNSServiceErrorType errorCode, - const char *serviceName, const char *regType, - const char *replyDomain, void *context) -{ - TBonjourBrowser *browser = static_cast<TBonjourBrowser*>(context); - if (errorCode != kDNSServiceErr_NoError) { - ::Error("TBonjourBrowser::BonjourBrowseReply", "error in BonjourBrowseReply"); - //browser->Error(errorCode); - } else { - TBonjourRecord *record = new TBonjourRecord(serviceName, regType, replyDomain); - if (flags & kDNSServiceFlagsAdd) { - if (!browser->fBonjourRecords->FindObject(record)) - browser->fBonjourRecords->Add(record); - else - delete record; - } else { - TBonjourRecord *r = (TBonjourRecord*)browser->fBonjourRecords->Remove(record); - delete r; - delete record; - } - if (!(flags & kDNSServiceFlagsMoreComing)) { - browser->CurrentBonjourRecordsChanged(browser->fBonjourRecords); - } - } -} diff --git a/net/bonjour/src/TBonjourRecord.cxx b/net/bonjour/src/TBonjourRecord.cxx deleted file mode 100644 index 59de2ccc671..00000000000 --- a/net/bonjour/src/TBonjourRecord.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// @(#)root/bonjour:$Id$ -// Author: Fons Rademakers 29/05/2009 - -/************************************************************************* - * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -////////////////////////////////////////////////////////////////////////// -// // -// TBonjourRecord // -// // -// Contains all information concerning a Bonjour entry. // -// // -////////////////////////////////////////////////////////////////////////// - -#include "TBonjourRecord.h" -#include "Riostream.h" - - -ClassImp(TBonjourRecord); - -//////////////////////////////////////////////////////////////////////////////// - -void TBonjourRecord::AddTXTRecord(const char * record) -{ - TString rec(record); - AddTXTRecord(rec); -} - -//////////////////////////////////////////////////////////////////////////////// -/// This methods adds the length before the data for compliance with the -/// mDNS records standard. - -void TBonjourRecord::AddTXTRecord(const TString &record) -{ - fTXTRecords.Append((char)record.Length()); - fTXTRecords.Append(record); -} - -//////////////////////////////////////////////////////////////////////////////// -/// Print TBonjourRecord. - -void TBonjourRecord::Print(Option_t *) const -{ - std::cout << "TBonjourRecord:" - << "\n\tService name: #" << GetServiceName() << "#" - << "\n\tRegistered type: #" << GetRegisteredType() << "#" - << "\n\tDomain: #" << GetReplyDomain() << "#" - << "\n\tTXT Records (length): #" << GetTXTRecords() - << "# (" << GetTXTRecordsLength() << ")" - << std::endl; -} diff --git a/net/bonjour/src/TBonjourRegistrar.cxx b/net/bonjour/src/TBonjourRegistrar.cxx deleted file mode 100644 index 3a40552745e..00000000000 --- a/net/bonjour/src/TBonjourRegistrar.cxx +++ /dev/null @@ -1,146 +0,0 @@ -// @(#)root/bonjour:$Id$ -// Author: Fons Rademakers 29/05/2009 - -/************************************************************************* - * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -////////////////////////////////////////////////////////////////////////// -// // -// TBonjourRegistrar // -// // -// This class consists of one main member function, RegisterService(), // -// that registers the service. As long as the object is alive, the // -// service stays registered. The rest of the class wraps the various // -// bits of Bonjour service registration. The static callback function // -// is marked with the DNSSD_API macro to make sure that the callback // -// has the correct calling convention on Windows. // -// // -// Bonjour works out-of-the-box on MacOS X. On Linux you have to // -// install the Avahi package and run the avahi-daemon. To compile // -// these classes and run Avahi on Linux you need to install the: // -// avahi // -// avahi-compat-libdns_sd-devel // -// nss-mdns // -// packages. After installation make sure the avahi-daemon is started. // -// // -////////////////////////////////////////////////////////////////////////// - -#include "TBonjourRegistrar.h" -#include "TBonjourBrowser.h" -#include "TSysEvtHandler.h" -#include "TError.h" -#include "TSystem.h" - -#include <arpa/inet.h> - - -ClassImp(TBonjourRegistrar); - -//////////////////////////////////////////////////////////////////////////////// -/// Default ctor. - -TBonjourRegistrar::TBonjourRegistrar() : fDNSRef(0), fBonjourSocketHandler(0) -{ - // silence Avahi about using Bonjour compat layer - gSystem->Setenv("AVAHI_COMPAT_NOWARN", "1"); -} - -//////////////////////////////////////////////////////////////////////////////// -/// Cleanup. - -TBonjourRegistrar::~TBonjourRegistrar() -{ - delete fBonjourSocketHandler; - - if (fDNSRef) { - DNSServiceRefDeallocate(fDNSRef); - fDNSRef = 0; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// Register Bonjour service. -/// Return -1 in case or error, 0 otherwise. - -Int_t TBonjourRegistrar::RegisterService(const TBonjourRecord &record, UShort_t servicePort) -{ - if (fDNSRef) { - Warning("RegisterService", "already registered a service"); - return 0; - } - - UShort_t sport = htons(servicePort); - - // register our service and callback - DNSServiceErrorType err = DNSServiceRegister(&fDNSRef, 0, kDNSServiceInterfaceIndexAny, - !strlen(record.GetServiceName()) ? 0 - : record.GetServiceName(), - record.GetRegisteredType(), - !strlen(record.GetReplyDomain()) ? 0 - : record.GetReplyDomain(), - 0, sport, - record.GetTXTRecordsLength(), - !strlen(record.GetTXTRecords()) ? 0 - : record.GetTXTRecords(), - (DNSServiceRegisterReply)BonjourRegisterService, - this); - if (err != kDNSServiceErr_NoError) { - Error("RegisterService", "error in DNSServiceRegister (%d)", err); - return -1; - } - - Int_t sockfd = DNSServiceRefSockFD(fDNSRef); - if (sockfd == -1) { - Error("RegisterService", "invalid sockfd"); - return -1; - } - - fBonjourSocketHandler = new TFileHandler(sockfd, TFileHandler::kRead); - fBonjourSocketHandler->Connect("Notified()", "TBonjourRegistrar", this, "BonjourSocketReadyRead()"); - fBonjourSocketHandler->Add(); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -/// Emit ServiceRegistered signal. - -void TBonjourRegistrar::ServiceRegistered(TBonjourRecord *record) -{ - Emit("ServiceRegistered(TBonjourRecord*)", (Long_t)record); -} - -//////////////////////////////////////////////////////////////////////////////// -/// The Bonjour socket is ready for reading. Tell Bonjour to process the -/// information on the socket, this will invoke the BonjourRegisterService -/// callback. This is a private slot, used in RegisterService. - -void TBonjourRegistrar::BonjourSocketReadyRead() -{ - DNSServiceErrorType err = DNSServiceProcessResult(fDNSRef); - if (err != kDNSServiceErr_NoError) - Error("BonjourSocketReadyRead", "error in DNSServiceProcessResult"); -} - -//////////////////////////////////////////////////////////////////////////////// -/// Static Bonjour register callback function. - -void TBonjourRegistrar::BonjourRegisterService(DNSServiceRef, DNSServiceFlags, - DNSServiceErrorType errCode, - const char *name, const char *regType, - const char *domain, void *context) -{ - TBonjourRegistrar *registrar = static_cast<TBonjourRegistrar*>(context); - if (errCode != kDNSServiceErr_NoError) { - ::Error("TBonjourRegistrar::BonjourRegisterService", "error in BonjourRegisterService"); - //registrar->Error(errorCode); - } else { - registrar->fFinalRecord = TBonjourRecord(name, regType, domain); - registrar->ServiceRegistered(®istrar->fFinalRecord); - } -} diff --git a/net/bonjour/src/TBonjourResolver.cxx b/net/bonjour/src/TBonjourResolver.cxx deleted file mode 100644 index c77961e6e12..00000000000 --- a/net/bonjour/src/TBonjourResolver.cxx +++ /dev/null @@ -1,139 +0,0 @@ -// @(#)root/bonjour:$Id$ -// Author: Fons Rademakers 29/05/2009 - -/************************************************************************* - * Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -////////////////////////////////////////////////////////////////////////// -// // -// TBonjourResolver // -// // -// This class consists of one main member function, // -// ResolveBonjourRecord(), that resolves the service to an actual // -// IP address and port number. The rest of the class wraps the various // -// bits of Bonjour service resolver. The static callback function // -// is marked with the DNSSD_API macro to make sure that the callback // -// has the correct calling convention on Windows. // -// // -////////////////////////////////////////////////////////////////////////// - -#include "TBonjourResolver.h" -#include "TBonjourBrowser.h" -#include "TBonjourRecord.h" -#include "TSysEvtHandler.h" -#include "TSystem.h" -#include "TError.h" - -#include <arpa/inet.h> - - -ClassImp(TBonjourResolver); - -//////////////////////////////////////////////////////////////////////////////// -/// Default ctor. - -TBonjourResolver::TBonjourResolver() : fDNSRef(0), fBonjourSocketHandler(0), fPort(0) -{ -} - -//////////////////////////////////////////////////////////////////////////////// -/// Cleanup. - -TBonjourResolver::~TBonjourResolver() -{ - delete fBonjourSocketHandler; - - if (fDNSRef) { - DNSServiceRefDeallocate(fDNSRef); - fDNSRef = 0; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// Resolve Bonjour service to IP address and port. -/// Returns -1 in case of error, 0 otherwise. - -Int_t TBonjourResolver::ResolveBonjourRecord(const TBonjourRecord &record) -{ - if (fDNSRef) { - Warning("ResolveBonjourRecord", "resolve already in process"); - return 0; - } - - DNSServiceErrorType err = DNSServiceResolve(&fDNSRef, 0, 0, - record.GetServiceName(), - record.GetRegisteredType(), - record.GetReplyDomain(), - (DNSServiceResolveReply)BonjourResolveReply, - this); - if (err != kDNSServiceErr_NoError) { - Error("ResolveBonjourRecord", "error in DNSServiceResolve (%d)", err); - return -1; - } - - Int_t sockfd = DNSServiceRefSockFD(fDNSRef); - if (sockfd == -1) { - Error("ResolveBonjourRecord", "invalide sockfd"); - return -1; - } - - fBonjourSocketHandler = new TFileHandler(sockfd, TFileHandler::kRead); - fBonjourSocketHandler->Connect("Notified()", "TBonjourResolver", this, "BonjourSocketReadyRead()"); - fBonjourSocketHandler->Add(); - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -/// Emit RecordResolved signal. - -void TBonjourResolver::RecordResolved(const TInetAddress *hostInfo, Int_t port) -{ - Long_t args[2]; - args[0] = (Long_t) hostInfo; - args[1] = port; - - Emit("RecordResolved(TInetAddress*,Int_t)", args); -} - -//////////////////////////////////////////////////////////////////////////////// -/// The Bonjour socket is ready for reading. Tell Bonjour to process the -/// information on the socket, this will invoke the BonjourResolveReply -/// callback. This is a private slot, used in ResolveBonjourRecord. - -void TBonjourResolver::BonjourSocketReadyRead() -{ - // in case the resolver has already been deleted - if (!fDNSRef) return; - - DNSServiceErrorType err = DNSServiceProcessResult(fDNSRef); - if (err != kDNSServiceErr_NoError) - Error("BonjourSocketReadyRead", "error in DNSServiceProcessResult"); -} - -//////////////////////////////////////////////////////////////////////////////// -/// Static Bonjour resolver callback function. - -void TBonjourResolver::BonjourResolveReply(DNSServiceRef, - DNSServiceFlags, UInt_t, - DNSServiceErrorType errorCode, const char *, - const char *hostTarget, UShort_t port, - UShort_t, const char *txtRecord, - void *context) -{ - TBonjourResolver *resolver = static_cast<TBonjourResolver *>(context); - if (errorCode != kDNSServiceErr_NoError) { - ::Error("TBonjourResolver::BonjourResolveReply", "error in BonjourResolveReply"); - //resolver->Error(errorCode); - } else { - resolver->fPort = ntohs(port); - resolver->fHostAddress = gSystem->GetHostByName(hostTarget); - resolver->fTXTRecord = txtRecord; - resolver->RecordResolved(&resolver->fHostAddress, resolver->fPort); - } -} diff --git a/net/doc/v524/index.html b/net/doc/v524/index.html index f75e5875f61..83515242d94 100644 --- a/net/doc/v524/index.html +++ b/net/doc/v524/index.html @@ -18,48 +18,6 @@ The user name and password can be specified in the URL like this: </li> </ul> -<h3>Bonjour Support</h3> -New Zero-Configuration networking classes using Bonjour: -<ul> -<li>TBonjourRecord</li> -<li>TBonjourRegistrar</li> -<li>TBonjourBrowser</li> -<li>TBonjourResolver</li> -</ul> -<p> -Zeroconf is meant to solve the problem of finding services and connecting -to them. Instead of having to know a machine's IP address and port number -for the service, a machine offering a service simply announces that it -offers the service. Clients who want to use a service ask for all the -machines that are offering it and then the user decides which one to -connect to. -</p><p> -Traditionally, you would have to make sure that each machine is configured -correctly and on the network. Zeroconf takes care of all of this for you -for a local area network. Lots of new hardware, such as printers with -networking support or wireless routers, come with their own Zeroconf server -to allow easy network configuration. On Mac OS X, many applications take -advantage of Bonjour to advertise services, such as the ssh server, -iTunes shares, or iChat availability. Zeroconf is a powerful way of -simplifying your applications, and there are implementations available -for most operating systems. -</p><p> -If you have Mac OS X, you already have Bonjour installed; otherwise, you -can download the source code from the Apple website -(http://developer.apple.com/Bonjour) and build and install Bonjour in -relatively short order. Most modern Linux distributions come with Avahi, -an LGPL implementation of Zeroconf with a compatibibility API for Bonjour. -The ROOT Bonjour classes were tested to work with both Apple's Bonjour -implementation and Avahi's Bonjour compatibility layer. -</p><p> -Service discovery consists of three steps: registering a service, browsing -for available services, and resolving the service to an actual address. -A server will register its services with the Bonjour daemon. Clients will -browse for services to get a list to provide to the user. Finally, when it -is time to connect to a service, the client will resolve the selected -service to an actual IP address and port and then connect to the service -provide using TCP/IP. - </p><h3>XROOTD</h3><ul><li>New version 20090610-0430</li></ul><ul><ul><li>Improvements</li><ul><li>Add the possibility of using the xrd command line from batch scripts</li><li>Add support for Adler32 checksum calculation of a local unix file (including stdin) and file on a remote xrootd data diff --git a/proof/proofd/inc/XrdProofdNetMgr.h b/proof/proofd/inc/XrdProofdNetMgr.h index db4fa6fae1f..e906ddb30a8 100644 --- a/proof/proofd/inc/XrdProofdNetMgr.h +++ b/proof/proofd/inc/XrdProofdNetMgr.h @@ -62,13 +62,10 @@ private: int LocateLocalFile(XrdOucString &file); - int DoDirectiveBonjour(char *val, XrdOucStream *cfg, bool); int DoDirectiveAdminReqTO(char *, XrdOucStream *, bool); int DoDirectiveResource(char *, XrdOucStream *, bool); int DoDirectiveWorker(char *, XrdOucStream *, bool); - bool fBonjourEnabled; - public: XrdProofdNetMgr(XrdProofdManager *mgr, XrdProtocol_Config *pi, XrdSysError *e); virtual ~XrdProofdNetMgr(); diff --git a/proof/proofd/src/XrdProofWorker.cxx b/proof/proofd/src/XrdProofWorker.cxx index 26f42851481..e0a1ed76b72 100644 --- a/proof/proofd/src/XrdProofWorker.cxx +++ b/proof/proofd/src/XrdProofWorker.cxx @@ -293,8 +293,7 @@ int XrdProofWorker::GetNActiveSessions() //////////////////////////////////////////////////////////////////////////////// /// Merge session objects from the other worker object in order to merge all -/// the objects in only one. This was added to support hybrid satatically and -/// dinamically Bonjour workers discovery. +/// the objects in only one. void XrdProofWorker::MergeProofServs(const XrdProofWorker &other) { diff --git a/proof/proofd/src/XrdProofdNetMgr.cxx b/proof/proofd/src/XrdProofdNetMgr.cxx index 9e185f65370..1a0df4a3434 100644 --- a/proof/proofd/src/XrdProofdNetMgr.cxx +++ b/proof/proofd/src/XrdProofdNetMgr.cxx @@ -81,7 +81,6 @@ XrdProofdNetMgr::XrdProofdNetMgr(XrdProofdManager *mgr, fNumLocalWrks = XrdProofdAux::GetNumCPUs(); fWorkerUsrCfg = 0; fRequestTO = 30; - fBonjourEnabled = false; // Configuration directives RegisterDirectives(); @@ -95,7 +94,6 @@ void XrdProofdNetMgr::RegisterDirectives() Register("adminreqto", new XrdProofdDirective("adminreqto", this, &DoDirectiveClass)); Register("resource", new XrdProofdDirective("resource", this, &DoDirectiveClass)); Register("worker", new XrdProofdDirective("worker", this, &DoDirectiveClass)); - Register("bonjour", new XrdProofdDirective("bonjour", this, &DoDirectiveClass)); Register("localwrks", new XrdProofdDirective("localwrks", (void *)&fNumLocalWrks, &DoDirectiveInt)); } @@ -181,7 +179,7 @@ int XrdProofdNetMgr::Config(bool rcf) // Use default CreateDefaultPROOFcfg(); } - } else if (fResourceType == kRTNone && fWorkers.size() <= 1 && !fBonjourEnabled) { + } else if (fResourceType == kRTNone && fWorkers.size() <= 1) { // Nothing defined: use default CreateDefaultPROOFcfg(); } @@ -221,8 +219,6 @@ int XrdProofdNetMgr::DoDirective(XrdProofdDirective *d, return DoDirectiveAdminReqTO(val, cfg, rcf); } else if (d->fName == "worker") { return DoDirectiveWorker(val, cfg, rcf); - } else if (d->fName == "bonjour") { - return DoDirectiveBonjour(val, cfg, rcf); } TRACE(XERR, "unknown directive: " << d->fName); @@ -230,23 +226,6 @@ int XrdProofdNetMgr::DoDirective(XrdProofdDirective *d, return -1; } -//////////////////////////////////////////////////////////////////////////////// - -int XrdProofdNetMgr::DoDirectiveBonjour(char *val, XrdOucStream *cfg, bool) -{ - XPDLOC(NMGR, "NetMgr::DoDirectiveBonjour"); - - // Process 'bonjour' directive - TRACE(DBG, "processing Bonjour directive"); - - if (!val || !cfg) - // undefined inputs - return -1; - - TRACE(XERR, "Bonjour support is disabled"); - return -1; -} - //////////////////////////////////////////////////////////////////////////////// /// Indices (this will be used twice). diff --git a/tutorials/net/hclientbonj.C b/tutorials/net/hclientbonj.C deleted file mode 100644 index 47608499823..00000000000 --- a/tutorials/net/hclientbonj.C +++ /dev/null @@ -1,147 +0,0 @@ -/// \file -/// \ingroup tutorial_net -/// Client program which creates and fills a histogram. Every 1000 fills -/// the histogram is send to the server which displays the histogram. -/// -/// To run this demo do the following: -/// - Open three windows -/// - Start ROOT in all three windows -/// - Execute in the first window: .x hserv.C (or hserv2.C) -/// - Execute in the second and third windows: .x hclient.C -/// If you want to run the hserv.C on a different host, just change -/// "localhost" in the TSocket ctor below to the desired hostname. -/// -/// The script argument "evol" can be used when using a modified version -/// of the script where the clients and server are on systems with -/// different versions of ROOT. When evol is set to kTRUE the socket will -/// support automatic schema evolution between the client and the server. -/// -/// \macro_code -/// -/// \author Fons Rademakers - -#include "TBenchmark.h" -#include "TList.h" -#include "TInetAddress.h" -#include "TSocket.h" -#include "TMessage.h" -#include "TH1.h" -#include "TH2.h" -#include "TRandom.h" -#include "TBonjourBrowser.h" -#include "TBonjourResolver.h" -#include "TBonjourRecord.h" - - -static Bool_t gEvo = kFALSE; - -void ConnectToServer(const TInetAddress *hostb, Int_t port) -{ - // Called by the Bonjour resolver with the host and port to which - // we can connect. - - // Connect only once... - TBonjourResolver *resolver = (TBonjourResolver*) gTQSender; - TInetAddress host = *hostb; - delete resolver; - - printf("ConnectToServer: host = %s, port = %d\n", host.GetHostName(), port); - - //--- Here starts original hclient.C code --- - - // Open connection to server - TSocket *sock = new TSocket(host.GetHostName(), port); - - // Wait till we get the start message - char str[32]; - sock->Recv(str, 32); - - // server tells us who we are - int idx = !strcmp(str, "go 0") ? 0 : 1; - - Float_t messlen = 0; - Float_t cmesslen = 0; - if (idx == 1) - sock->SetCompressionLevel(1); - - TH1 *hpx; - if (idx == 0) { - // Create the histogram - hpx = new TH1F("hpx","This is the px distribution",100,-4,4); - hpx->SetFillColor(48); // set nice fill-color - } else { - hpx = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4); - } - - TMessage::EnableSchemaEvolutionForAll(gEvo); - TMessage mess(kMESS_OBJECT); - //TMessage mess(kMESS_OBJECT | kMESS_ACK); - - // Fill histogram randomly - gRandom->SetSeed(); - Float_t px, py; - const int kUPDATE = 1000; - for (int i = 0; i < 25000; i++) { - gRandom->Rannor(px,py); - if (idx == 0) - hpx->Fill(px); - else - hpx->Fill(px,py); - if (i && (i%kUPDATE) == 0) { - mess.Reset(); // re-use TMessage object - mess.WriteObject(hpx); // write object in message buffer - sock->Send(mess); // send message - messlen += mess.Length(); - cmesslen += mess.CompLength(); - } - } - sock->Send("Finished"); // tell server we are finished - - if (cmesslen > 0) - printf("Average compression ratio: %g\n", messlen/cmesslen); - - gBenchmark->Show("hclient"); - - // Close the socket - sock->Close(); -} - -void UpdateBonjourRecords(TList *records) -{ - // Browse for Bonjour record of type "_hserv2._tcp." in domain "local.". - // When found, create Bonjour resolver to get host and port of this record. - - static Bool_t resolved = kFALSE; - - // we can be called multiple times whenever a new server appears - printf("UpdateBonjourRecords (resolved = %s)\n", resolved ? "kTRUE" : "kFALSE"); - - if (resolved) return; - - // Look for _hserv2._tcp. in local. domain and try to resolve it - TBonjourRecord *rec; - TIter next(records); - while ((rec = (TBonjourRecord*) next())) { - if (!strcmp(rec->GetRegisteredType(), "_hserv2._tcp.") && - !strcmp(rec->GetReplyDomain(), "local.")) { - rec->Print(); - TBonjourResolver *resolver = new TBonjourResolver; - resolver->Connect("RecordResolved(TInetAddress*,Int_t)", 0, 0, - "ConnectToServer(TInetAddress*,Int_t)"); - resolver->ResolveBonjourRecord(*rec); - resolved = kTRUE; - } - } -} - -void hclientbonj(Bool_t evol=kFALSE) -{ - gEvo = evol; - - gBenchmark->Start("hclient"); - - TBonjourBrowser *browser = new TBonjourBrowser; - browser->Connect("CurrentBonjourRecordsChanged(TList*)", 0, 0, - "UpdateBonjourRecords(TList*)"); - browser->BrowseForServiceType("_hserv2._tcp"); -} diff --git a/tutorials/net/hserv2bonj.C b/tutorials/net/hserv2bonj.C deleted file mode 100644 index e257d5e36a3..00000000000 --- a/tutorials/net/hserv2bonj.C +++ /dev/null @@ -1,113 +0,0 @@ -/// \file -/// \ingroup tutorial_net -/// This script shows how to make a simple iterative server that -/// can accept connections while handling currently open connections. -/// Compare this script to hserv.C that blocks on accept. -/// In this script a server socket is created and added to a monitor. -/// A monitor object is used to monitor connection requests on -/// the server socket. After accepting the connection -/// the new socket is added to the monitor and immediately ready -/// for use. Once two connections are accepted the server socket -/// is removed from the monitor and closed. The monitor continues -/// monitoring the sockets. -/// -/// To run this demo do the following: -/// - Open three windows -/// - Start ROOT in all three windows -/// - Execute in the first window: .x hserv2.C -/// - Execute in the second and third windows: .x hclient.C -/// -/// \macro_code -/// -/// \author Fons Rademakers - -{ - // Create canvas and pads to display the histograms - TCanvas *c1 = new TCanvas("c1","The Ntuple canvas",200,10,700,780); - TPad *pad1 = new TPad("pad1","This is pad1",0.02,0.52,0.98,0.98,21); - TPad *pad2 = new TPad("pad2","This is pad2",0.02,0.02,0.98,0.48,21); - pad1->Draw(); - pad2->Draw(); - - // Advertise our service using Bonjour - TBonjourRegistrar *reg = new TBonjourRegistrar; - reg->RegisterService(TBonjourRecord(Form("hserv2 on %s", gSystem->HostName()), - "_hserv2._tcp", ""), 9090); - - // Open a server socket looking for connections on a named service or - // on a specified port. - //TServerSocket *ss = new TServerSocket("rootserv", kTRUE); - TServerSocket *ss = new TServerSocket(9090, kTRUE); - - TMonitor *mon = new TMonitor; - - mon->Add(ss); - - TSocket *s0 = 0, *s1 = 0; - - while (1) { - TMessage *mess; - TSocket *s; - - s = mon->Select(); - - if (s->IsA() == TServerSocket::Class()) { - if (!s0) { - s0 = ((TServerSocket *)s)->Accept(); - s0->Send("go 0"); - mon->Add(s0); - } else if (!s1) { - s1 = ((TServerSocket *)s)->Accept(); - s1->Send("go 1"); - mon->Add(s1); - } else - printf("only accept two client connections\n"); - - if (s0 && s1) { - mon->Remove(ss); - ss->Close(); - } - continue; - } - - s->Recv(mess); - - if (mess->What() == kMESS_STRING) { - char str[64]; - mess->ReadString(str, 64); - printf("Client %d: %s\n", s==s0 ? 0 : 1, str); - mon->Remove(s); - if (mon->GetActive() == 0) { - printf("No more active clients... stopping\n"); - break; - } - } else if (mess->What() == kMESS_OBJECT) { - //printf("got object of class: %s\n", mess->GetClass()->GetName()); - TH1 *h = (TH1 *)mess->ReadObject(mess->GetClass()); - if (h) { - if (s == s0) - pad1->cd(); - else - pad2->cd(); - h->Print(); - h->DrawCopy(); //draw a copy of the histogram, not the histo itself - c1->Modified(); - c1->Update(); - delete h; // delete histogram - } - } else { - printf("*** Unexpected message ***\n"); - } - - delete mess; - } - - printf("Client 0: bytes recv = %d, bytes sent = %d\n", s0->GetBytesRecv(), - s0->GetBytesSent()); - printf("Client 1: bytes recv = %d, bytes sent = %d\n", s1->GetBytesRecv(), - s1->GetBytesSent()); - - // Close the socket. - s0->Close(); - s1->Close(); -} -- GitLab