Skip to content

Commit

Permalink
Merge pull request #737 from bbockelm/xrootd-tpc-renew-v2
Browse files Browse the repository at this point in the history
HTTP TPC v2
  • Loading branch information
ffurano committed Jun 15, 2018
2 parents 9aa9dad + f7fe092 commit 10765d5
Show file tree
Hide file tree
Showing 24 changed files with 2,229 additions and 70 deletions.
15 changes: 15 additions & 0 deletions cmake/XRootDFindLibs.cmake
Expand Up @@ -27,6 +27,9 @@ if( SYSTEMD_FOUND )
add_definitions( -DHAVE_SYSTEMD )
endif()

include (FindPkgConfig)
pkg_check_modules(CURL libcurl)

if( ENABLE_CRYPTO )
find_package( OpenSSL )
if( OPENSSL_FOUND )
Expand Down Expand Up @@ -70,11 +73,23 @@ endif()
if( ENABLE_HTTP )
if( OPENSSL_FOUND AND BUILD_CRYPTO )
set( BUILD_HTTP TRUE )
if( CURL_FOUND )
set( BUILD_TPC TRUE )
else()
set( BUILD_TPC FALSE )
endif()
else()
set( BUILD_HTTP FALSE )
set( BUILD_TPC FALSE )
endif()
endif()

if( BUILD_TPC )
set ( CMAKE_REQUIRED_LIBRARIES ${CURL_LIBRARIES} )
check_function_exists( curl_multi_wait HAVE_CURL_MULTI_WAIT )
compiler_define_if_found( HAVE_CURL_MULTI_WAIT HAVE_CURL_MULTI_WAIT )
endif()

if( ENABLE_CEPH )
find_package( ceph )
if( CEPH_FOUND )
Expand Down
2 changes: 2 additions & 0 deletions cmake/XRootDSummary.cmake
Expand Up @@ -9,6 +9,7 @@ component_status( KRB5 BUILD_KRB5 KERBEROS5_FOUND )
component_status( XRDCL ENABLE_XRDCL TRUE_VAR )
component_status( TESTS BUILD_TESTS CPPUNIT_FOUND )
component_status( HTTP BUILD_HTTP OPENSSL_FOUND )
component_status( TPC BUILD_TPC CURL_FOUND )
component_status( CEPH BUILD_CEPH CEPH_FOUND )
component_status( PYTHON BUILD_PYTHON PYTHON_FOUND )

Expand All @@ -26,6 +27,7 @@ message( STATUS "Kerberos5 support: " ${STATUS_KRB5} )
message( STATUS "XrdCl: " ${STATUS_XRDCL} )
message( STATUS "Tests: " ${STATUS_TESTS} )
message( STATUS "HTTP support: " ${STATUS_HTTP} )
message( STATUS "HTTP TPC support: " ${STATUS_TPC} )
message( STATUS "CEPH support: " ${STATUS_CEPH} )
message( STATUS "Python support: " ${STATUS_PYTHON} )
message( STATUS "----------------------------------------" )
2 changes: 1 addition & 1 deletion packaging/debian/control
Expand Up @@ -3,7 +3,7 @@ Maintainer: Jozsef Makai <jozsef.makai@cern.ch>
Section: misc
Priority: optional
Standards-Version: 3.9.3
Build-Depends: debhelper (>= 9), cmake (>=3.3.0), zlib1g-dev, libfuse-dev, python-dev, libssl-dev, libxml2-dev, ncurses-dev, libkrb5-dev, libreadline-dev, libsystemd-dev, selinux-policy-dev, systemd
Build-Depends: debhelper (>= 9), cmake (>=3.3.0), zlib1g-dev, libfuse-dev, python-dev, libssl-dev, libxml2-dev, ncurses-dev, libkrb5-dev, libreadline-dev, libsystemd-dev, selinux-policy-dev, libcurl-dev, systemd
Homepage: https://github.com/xrootd/xrootd
Vcs-Git: https://github.com/xrootd/xrootd.git
Vcs-Browser: https://github.com/xrootd/xrootd
Expand Down
1 change: 1 addition & 0 deletions packaging/debian/xrootd-server-devel.install
Expand Up @@ -6,3 +6,4 @@ usr/include/xrootd/XrdSfs
usr/include/xrootd/XrdXrootd
usr/include/xrootd/XrdHttp
usr/lib/*/libXrdServer.so
usr/lib/*/libXrdHttpUtils.so
2 changes: 2 additions & 0 deletions packaging/debian/xrootd-server-libs.install
Expand Up @@ -4,6 +4,8 @@ usr/lib/*/libXrdXrootd-4.so
usr/lib/*/libXrdFileCache-4.so
usr/lib/*/libXrdBlacklistDecision-4.so
usr/lib/*/libXrdHttp-4.so
usr/lib/*/libXrdHttpTPC-4.so
usr/lib/*/libXrdHttpUtils.so.*
usr/lib/*/libXrdN2No2p-4.so
usr/lib/*/libXrdOssSIgpfsT-4.so
usr/lib/*/libXrdServer.so.*
Expand Down
4 changes: 4 additions & 0 deletions packaging/rhel/xrootd.spec.in
Expand Up @@ -62,6 +62,7 @@ BuildRequires: libxml2-devel
BuildRequires: krb5-devel
BuildRequires: zlib-devel
BuildRequires: ncurses-devel
BuildRequires: libcurl-devel

BuildRequires: python2-devel
%if %{?fedora}%{!?fedora:0} >= 13
Expand Down Expand Up @@ -778,6 +779,8 @@ fi
%{_libdir}/libXrdFileCache-4.so
%{_libdir}/libXrdBlacklistDecision-4.so
%{_libdir}/libXrdHttp-4.so
%{_libdir}/libXrdHttpTPC-4.so
%{_libdir}/libXrdHttpUtils.so.*
%{_libdir}/libXrdN2No2p-4.so
%{_libdir}/libXrdOssSIgpfsT-4.so
%{_libdir}/libXrdServer.so.*
Expand All @@ -797,6 +800,7 @@ fi
%{_includedir}/xrootd/XrdXrootd
%{_includedir}/xrootd/XrdHttp
%{_libdir}/libXrdServer.so
%{_libdir}/libXrdHttpUtils.so

%files private-devel
%defattr(-,root,root,-)
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Expand Up @@ -38,6 +38,7 @@ include( XrdFileCache )

if( BUILD_HTTP )
include( XrdHttp )
include( XrdTpc )
endif()

if( BUILD_CEPH )
Expand Down
35 changes: 29 additions & 6 deletions src/XrdHttp.cmake
Expand Up @@ -3,21 +3,26 @@ include( XRootDCommon )
#-------------------------------------------------------------------------------
# Modules
#-------------------------------------------------------------------------------
set( LIB_XRD_HTTP XrdHttp-${PLUGIN_VERSION} )
set( LIB_XRD_HTTP_UTILS XrdHttpUtils )
set( MOD_XRD_HTTP XrdHttp-${PLUGIN_VERSION} )

#-------------------------------------------------------------------------------
# Shared library version
#-------------------------------------------------------------------------------
set( XRD_HTTP_UTILS_VERSION 1.0.0 )
set( XRD_HTTP_UTILS_SOVERSION 1 )

if( BUILD_HTTP )
#-----------------------------------------------------------------------------
# The XrdHttp library
#-----------------------------------------------------------------------------
include_directories( ${OPENSSL_INCLUDE_DIR} )

# Note this is marked as a shared library as XrdHttp plugins are expected to
# link against this for the XrdHttpExt class implementations.
add_library(
${LIB_XRD_HTTP}
MODULE
${LIB_XRD_HTTP_UTILS}
SHARED
XrdHttp/XrdHttpProtocol.cc XrdHttp/XrdHttpProtocol.hh
XrdHttp/XrdHttpReq.cc XrdHttp/XrdHttpReq.hh
XrdHttp/XrdHttpSecXtractor.hh
Expand All @@ -26,8 +31,13 @@ if( BUILD_HTTP )
XrdHttp/XrdHttpTrace.cc XrdHttp/XrdHttpTrace.hh
XrdHttp/XrdHttpUtils.cc XrdHttp/XrdHttpUtils.hh )

add_library(
${MOD_XRD_HTTP}
MODULE
XrdHttp/XrdHttpModule.cc )

target_link_libraries(
${LIB_XRD_HTTP}
${LIB_XRD_HTTP_UTILS}
XrdServer
XrdUtils
XrdCrypto
Expand All @@ -36,17 +46,30 @@ if( BUILD_HTTP )
${OPENSSL_LIBRARIES}
${OPENSSL_CRYPTO_LIBRARY} )

target_link_libraries(
${MOD_XRD_HTTP}
${LIB_XRD_HTTP_UTILS} )

set_target_properties(
${LIB_XRD_HTTP_UTILS}
PROPERTIES
VERSION ${XRD_HTTP_UTILS_VERSION}
SOVERSION ${XRD_HTTP_UTILS_SOVERSION}
INTERFACE_LINK_LIBRARIES ""
LINK_INTERFACE_LIBRARIES "" )

set_target_properties(
${LIB_XRD_HTTP}
${MOD_XRD_HTTP}
PROPERTIES
INTERFACE_LINK_LIBRARIES ""
SUFFIX ".so"
LINK_INTERFACE_LIBRARIES "" )

#-----------------------------------------------------------------------------
# Install
#-----------------------------------------------------------------------------
install(
TARGETS ${LIB_XRD_HTTP}
TARGETS ${LIB_XRD_HTTP_UTILS} ${MOD_XRD_HTTP}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )

endif()
63 changes: 63 additions & 0 deletions src/XrdHttp/XrdHttpModule.cc
@@ -0,0 +1,63 @@

#include "XrdVersion.hh"

#include "XrdHttpProtocol.hh"

/******************************************************************************/
/* P r o t o c o l L o a d e r */
/* X r d g e t P r o t o c o l */
/******************************************************************************/

// This protocol can live in a module. The interface below is used by
// the protocol driver to obtain a copy of the protocol object that can be used
// to decide whether or not a link is talking a particular protocol.
//
XrdVERSIONINFO(XrdgetProtocol, xrdhttp);

extern "C" {

XrdProtocol *XrdgetProtocol(const char *pname, char *parms,
XrdProtocol_Config *pi) {
XrdProtocol *pp = 0;
const char *txt = "completed.";

// Put up the banner
//
pi->eDest->Say("Copr. 2012 CERN IT, an HTTP implementation for the XROOTD framework.");
pi->eDest->Say("++++++ HTTP protocol initialization started.");

// Return the protocol object to be used if static init succeeds
//
if (XrdHttpProtocol::Configure(parms, pi))
pp = (XrdProtocol *)new XrdHttpProtocol(false);
else txt = "failed.";
pi->eDest->Say("------ HTTP protocol initialization ", txt);
return pp;
}
}


/******************************************************************************/
/* */
/* P r o t o c o l P o r t D e t e r m i n a t i o n */
/* X r d g e t P r o t o c o l P o r t */
/******************************************************************************/

// This function is called early on to determine the port we need to use. The
// default is ostensibly 1094 but can be overidden; which we allow.
//
XrdVERSIONINFO(XrdgetProtocolPort, xrdhttp);

extern "C" {

int XrdgetProtocolPort(const char *pname, char *parms, XrdProtocol_Config *pi) {

// Figure out what port number we should return. In practice only one port
// number is allowed. However, we could potentially have a clustered port
// and several unclustered ports. So, we let this practicality slide.
//
if (pi->Port < 0) return 1094;
return pi->Port;
}
}

66 changes: 3 additions & 63 deletions src/XrdHttp/XrdHttpProtocol.cc
Expand Up @@ -117,65 +117,6 @@ XrdObjectQ<XrdHttpProtocol>
XrdHttpProtocol::ProtStack("ProtStack",
"xrootd protocol anchor");

/******************************************************************************/
/* P r o t o c o l L o a d e r */
/* X r d g e t P r o t o c o l */
/******************************************************************************/

// This protocol can live in a shared library. The interface below is used by
// the protocol driver to obtain a copy of the protocol object that can be used
// to decide whether or not a link is talking a particular protocol.
//
XrdVERSIONINFO(XrdgetProtocol, xrdhttp);

extern "C" {

XrdProtocol *XrdgetProtocol(const char *pname, char *parms,
XrdProtocol_Config *pi) {
XrdProtocol *pp = 0;
const char *txt = "completed.";

// Put up the banner
//
pi->eDest->Say("Copr. 2012 CERN IT, an HTTP implementation for the XROOTD framework.");
pi->eDest->Say("++++++ HTTP protocol initialization started.");

// Return the protocol object to be used if static init succeeds
//
if (XrdHttpProtocol::Configure(parms, pi))
pp = (XrdProtocol *)new XrdHttpProtocol(false);
else txt = "failed.";
pi->eDest->Say("------ HTTP protocol initialization ", txt);
return pp;
}
}

/******************************************************************************/
/* */
/* P r o t o c o l P o r t D e t e r m i n a t i o n */
/* X r d g e t P r o t o c o l P o r t */
/******************************************************************************/

// This function is called early on to determine the port we need to use. The
// default is ostensibly 1094 but can be overidden; which we allow.
//
XrdVERSIONINFO(XrdgetProtocolPort, xrdhttp);

extern "C" {

int XrdgetProtocolPort(const char *pname, char *parms, XrdProtocol_Config *pi) {

// Figure out what port number we should return. In practice only one port
// number is allowed. However, we could potentially have a clustered port
// and several unclustered ports. So, we let this practicality slide.
//
if (pi->Port < 0) return 1094;
return pi->Port;
}
}




/******************************************************************************/
/* U g l y O p e n S S L w o r k a r o u n d s */
Expand Down Expand Up @@ -2717,6 +2658,7 @@ int XrdHttpProtocol::doStat(char *fname) {



static XrdVERSIONINFODEF(compiledVer, XrdHttpProtocolTest, XrdVNUMBER, XrdVERSION);

// Loads the SecXtractor plugin, if available
int XrdHttpProtocol::LoadSecXtractor(XrdSysError *myeDest, const char *libName,
Expand All @@ -2726,8 +2668,7 @@ int XrdHttpProtocol::LoadSecXtractor(XrdSysError *myeDest, const char *libName,
// We don't want to load it more than once
if (secxtractor) return 1;

XrdVersionInfo *myVer = &XrdVERSIONINFOVAR(XrdgetProtocol);
XrdOucPinLoader myLib(myeDest, myVer, "secxtractorlib", libName);
XrdOucPinLoader myLib(myeDest, &compiledVer, "secxtractorlib", libName);
XrdHttpSecXtractor *(*ep)(XrdHttpSecXtractorArgs);

// Get the entry point of the object creator
Expand Down Expand Up @@ -2755,8 +2696,7 @@ int XrdHttpProtocol::LoadExtHandler(XrdSysError *myeDest, const char *libName,
return 1;
}

XrdVersionInfo *myVer = &XrdVERSIONINFOVAR(XrdgetProtocol);
XrdOucPinLoader myLib(myeDest, myVer, "exthandlerlib", libName);
XrdOucPinLoader myLib(myeDest, &compiledVer, "exthandlerlib", libName);
XrdHttpExtHandler *(*ep)(XrdHttpExtHandlerArgs);

// Get the entry point of the object creator
Expand Down
52 changes: 52 additions & 0 deletions src/XrdTpc.cmake
@@ -0,0 +1,52 @@
include( XRootDCommon )

#-------------------------------------------------------------------------------
# Modules
#-------------------------------------------------------------------------------
set( LIB_XRD_TPC XrdHttpTPC-${PLUGIN_VERSION} )

#-------------------------------------------------------------------------------
# Shared library version
#-------------------------------------------------------------------------------

if( BUILD_TPC )
#-----------------------------------------------------------------------------
# The XrdHttp library
#-----------------------------------------------------------------------------
include_directories( ${CURL_INCLUDE_DIRS} )

add_library(
${LIB_XRD_TPC}
MODULE
XrdTpc/XrdTpcConfigure.cc
XrdTpc/XrdTpcMultistream.cc
XrdTpc/XrdTpcCurlMulti.cc XrdTpc/XrdTpcCurlMulti.hh
XrdTpc/XrdTpcState.cc XrdTpc/XrdTpcState.hh
XrdTpc/XrdTpcStream.cc XrdTpc/XrdTpcStream.hh
XrdTpc/XrdTpcTPC.cc XrdTpc/XrdTpcTPC.hh)

target_link_libraries(
${LIB_XRD_TPC}
XrdServer
XrdUtils
XrdHttpUtils
dl
pthread
${CURL_LIBRARIES} )

set_target_properties(
${LIB_XRD_TPC}
PROPERTIES
INTERFACE_LINK_LIBRARIES ""
LINK_INTERFACE_LIBRARIES ""
LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/XrdTpc/export-lib-symbols"
COMPILE_DEFINITIONS "XRD_CHUNK_RESP")

#-----------------------------------------------------------------------------
# Install
#-----------------------------------------------------------------------------
install(
TARGETS ${LIB_XRD_TPC}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )

endif()

0 comments on commit 10765d5

Please sign in to comment.