From 8e93ceb8be4d6d35c5af9fbca343f695dbaaba4d Mon Sep 17 00:00:00 2001 From: Luz Marina Date: Wed, 24 Jul 2024 19:57:49 +0200 Subject: [PATCH] Remove not needed binary files. --- test/binary/usr/bin/xrootd-config | 79 - .../usr/include/xrootd/XProtocol/XProtocol.hh | 1482 ----------------- .../usr/include/xrootd/XProtocol/XPtypes.hh | 101 -- .../usr/include/xrootd/Xrd/XrdBuffer.hh | 118 -- test/binary/usr/include/xrootd/Xrd/XrdJob.hh | 58 - test/binary/usr/include/xrootd/Xrd/XrdLink.hh | 597 ------- .../usr/include/xrootd/Xrd/XrdLinkMatch.hh | 69 - .../usr/include/xrootd/Xrd/XrdProtocol.hh | 221 --- .../usr/include/xrootd/Xrd/XrdScheduler.hh | 137 -- .../usr/include/xrootd/Xrd/XrdTcpMonPin.hh | 96 -- .../usr/include/xrootd/XrdCks/XrdCks.hh | 336 ---- .../usr/include/xrootd/XrdCks/XrdCksAssist.hh | 108 -- .../usr/include/xrootd/XrdCks/XrdCksCalc.hh | 171 -- .../usr/include/xrootd/XrdCks/XrdCksData.hh | 130 -- .../include/xrootd/XrdCks/XrdCksManager.hh | 116 -- .../include/xrootd/XrdCks/XrdCksWrapper.hh | 301 ---- .../usr/include/xrootd/XrdNet/XrdNet.hh | 301 ---- .../usr/include/xrootd/XrdNet/XrdNetAddr.hh | 295 ---- .../include/xrootd/XrdNet/XrdNetAddrInfo.hh | 375 ----- .../include/xrootd/XrdNet/XrdNetCmsNotify.hh | 59 - .../include/xrootd/XrdNet/XrdNetConnect.hh | 59 - .../usr/include/xrootd/XrdNet/XrdNetOpts.hh | 123 -- .../include/xrootd/XrdNet/XrdNetSockAddr.hh | 47 - .../usr/include/xrootd/XrdNet/XrdNetSocket.hh | 159 -- .../usr/include/xrootd/XrdNet/XrdNetUtils.hh | 457 ----- .../usr/include/xrootd/XrdOuc/XrdOucBuffer.hh | 278 ---- .../usr/include/xrootd/XrdOuc/XrdOucCRC.hh | 157 -- .../include/xrootd/XrdOuc/XrdOucCacheCM.hh | 96 -- .../include/xrootd/XrdOuc/XrdOucCacheStats.hh | 144 -- .../include/xrootd/XrdOuc/XrdOucCallBack.hh | 113 -- .../usr/include/xrootd/XrdOuc/XrdOucChain.hh | 94 -- .../include/xrootd/XrdOuc/XrdOucCompiler.hh | 34 - .../usr/include/xrootd/XrdOuc/XrdOucDLlist.hh | 113 -- .../usr/include/xrootd/XrdOuc/XrdOucEnum.hh | 32 - .../usr/include/xrootd/XrdOuc/XrdOucEnv.hh | 119 -- .../include/xrootd/XrdOuc/XrdOucErrInfo.hh | 525 ------ .../usr/include/xrootd/XrdOuc/XrdOucGMap.hh | 175 -- .../usr/include/xrootd/XrdOuc/XrdOucHash.hh | 213 --- .../usr/include/xrootd/XrdOuc/XrdOucHash.icc | 295 ---- .../usr/include/xrootd/XrdOuc/XrdOucIOVec.hh | 67 - .../usr/include/xrootd/XrdOuc/XrdOucLock.hh | 47 - .../include/xrootd/XrdOuc/XrdOucName2Name.hh | 234 --- .../include/xrootd/XrdOuc/XrdOucPinObject.hh | 71 - .../include/xrootd/XrdOuc/XrdOucPinPath.hh | 59 - .../usr/include/xrootd/XrdOuc/XrdOucRash.hh | 185 -- .../usr/include/xrootd/XrdOuc/XrdOucRash.icc | 252 --- .../usr/include/xrootd/XrdOuc/XrdOucSFVec.hh | 51 - .../usr/include/xrootd/XrdOuc/XrdOucStream.hh | 284 ---- .../usr/include/xrootd/XrdOuc/XrdOucString.hh | 388 ----- .../usr/include/xrootd/XrdOuc/XrdOucTList.hh | 121 -- .../usr/include/xrootd/XrdOuc/XrdOucTable.hh | 162 -- .../include/xrootd/XrdOuc/XrdOucTokenizer.hh | 75 - .../usr/include/xrootd/XrdOuc/XrdOucTrace.hh | 56 - .../usr/include/xrootd/XrdOuc/XrdOucUtils.hh | 137 -- .../usr/include/xrootd/XrdOuc/XrdOuca2x.hh | 65 - .../usr/include/xrootd/XrdSec/XrdSecAttr.hh | 91 - .../usr/include/xrootd/XrdSec/XrdSecEntity.hh | 125 -- .../include/xrootd/XrdSec/XrdSecEntityAttr.hh | 179 -- .../include/xrootd/XrdSec/XrdSecEntityPin.hh | 87 - .../include/xrootd/XrdSec/XrdSecInterface.hh | 678 -------- .../include/xrootd/XrdSys/XrdSysAtomics.hh | 100 -- .../usr/include/xrootd/XrdSys/XrdSysError.hh | 179 -- .../usr/include/xrootd/XrdSys/XrdSysFD.hh | 164 -- .../include/xrootd/XrdSys/XrdSysHeaders.hh | 51 - .../usr/include/xrootd/XrdSys/XrdSysLogPI.hh | 94 -- .../usr/include/xrootd/XrdSys/XrdSysLogger.hh | 285 ---- .../include/xrootd/XrdSys/XrdSysPageSize.hh | 40 - .../include/xrootd/XrdSys/XrdSysPlatform.hh | 288 ---- .../usr/include/xrootd/XrdSys/XrdSysPlugin.hh | 250 --- .../include/xrootd/XrdSys/XrdSysPthread.hh | 612 ------- .../include/xrootd/XrdSys/XrdSysSemWait.hh | 124 -- .../usr/include/xrootd/XrdSys/XrdSysTimer.hh | 88 - .../usr/include/xrootd/XrdSys/XrdSysXAttr.hh | 283 ---- .../usr/include/xrootd/XrdSys/XrdSysXSLock.hh | 68 - test/binary/usr/include/xrootd/XrdVersion.hh | 106 -- .../usr/include/xrootd/XrdXml/XrdXmlReader.hh | 170 -- test/binary/usr/lib/erlang/m-no-CInf.beam | Bin 524 -> 0 bytes test/binary/usr/lib/erlang/m.beam | Bin 640 -> 0 bytes test/binary/usr/lib/libfoo-2.so | Bin 15360 -> 0 bytes test/binary/usr/lib/libfoo-2.so.foo | 1 - test/binary/usr/lib/libfoo.so | 1 - test/binary/usr/lib/libfoo.so.1 | Bin 14056 -> 0 bytes test/binary/usr/lib64/libXrdAppUtils.so | 1 - test/binary/usr/lib64/libXrdCrypto.so | 1 - test/binary/usr/lib64/libXrdCryptoLite.so | 1 - test/binary/usr/lib64/libXrdUtils.so | 1 - test/binary/usr/lib64/libXrdXml.so | 1 - .../usr/share/xrootd/cmake/XRootDConfig.cmake | 242 --- 88 files changed, 14948 deletions(-) delete mode 100755 test/binary/usr/bin/xrootd-config delete mode 100644 test/binary/usr/include/xrootd/XProtocol/XProtocol.hh delete mode 100644 test/binary/usr/include/xrootd/XProtocol/XPtypes.hh delete mode 100644 test/binary/usr/include/xrootd/Xrd/XrdBuffer.hh delete mode 100644 test/binary/usr/include/xrootd/Xrd/XrdJob.hh delete mode 100644 test/binary/usr/include/xrootd/Xrd/XrdLink.hh delete mode 100644 test/binary/usr/include/xrootd/Xrd/XrdLinkMatch.hh delete mode 100644 test/binary/usr/include/xrootd/Xrd/XrdProtocol.hh delete mode 100644 test/binary/usr/include/xrootd/Xrd/XrdScheduler.hh delete mode 100644 test/binary/usr/include/xrootd/Xrd/XrdTcpMonPin.hh delete mode 100644 test/binary/usr/include/xrootd/XrdCks/XrdCks.hh delete mode 100644 test/binary/usr/include/xrootd/XrdCks/XrdCksAssist.hh delete mode 100644 test/binary/usr/include/xrootd/XrdCks/XrdCksCalc.hh delete mode 100644 test/binary/usr/include/xrootd/XrdCks/XrdCksData.hh delete mode 100644 test/binary/usr/include/xrootd/XrdCks/XrdCksManager.hh delete mode 100644 test/binary/usr/include/xrootd/XrdCks/XrdCksWrapper.hh delete mode 100644 test/binary/usr/include/xrootd/XrdNet/XrdNet.hh delete mode 100644 test/binary/usr/include/xrootd/XrdNet/XrdNetAddr.hh delete mode 100644 test/binary/usr/include/xrootd/XrdNet/XrdNetAddrInfo.hh delete mode 100644 test/binary/usr/include/xrootd/XrdNet/XrdNetCmsNotify.hh delete mode 100644 test/binary/usr/include/xrootd/XrdNet/XrdNetConnect.hh delete mode 100644 test/binary/usr/include/xrootd/XrdNet/XrdNetOpts.hh delete mode 100644 test/binary/usr/include/xrootd/XrdNet/XrdNetSockAddr.hh delete mode 100644 test/binary/usr/include/xrootd/XrdNet/XrdNetSocket.hh delete mode 100644 test/binary/usr/include/xrootd/XrdNet/XrdNetUtils.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucBuffer.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucCRC.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucCacheCM.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucCacheStats.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucCallBack.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucChain.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucCompiler.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucDLlist.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucEnum.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucEnv.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucErrInfo.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucGMap.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucHash.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucHash.icc delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucIOVec.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucLock.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucName2Name.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucPinObject.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucPinPath.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucRash.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucRash.icc delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucSFVec.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucStream.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucString.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucTList.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucTable.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucTokenizer.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucTrace.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOucUtils.hh delete mode 100644 test/binary/usr/include/xrootd/XrdOuc/XrdOuca2x.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSec/XrdSecAttr.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSec/XrdSecEntity.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSec/XrdSecEntityAttr.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSec/XrdSecEntityPin.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSec/XrdSecInterface.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysAtomics.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysError.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysFD.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysHeaders.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysLogPI.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysLogger.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysPageSize.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysPlatform.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysPlugin.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysPthread.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysSemWait.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysTimer.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysXAttr.hh delete mode 100644 test/binary/usr/include/xrootd/XrdSys/XrdSysXSLock.hh delete mode 100644 test/binary/usr/include/xrootd/XrdVersion.hh delete mode 100644 test/binary/usr/include/xrootd/XrdXml/XrdXmlReader.hh delete mode 100644 test/binary/usr/lib/erlang/m-no-CInf.beam delete mode 100644 test/binary/usr/lib/erlang/m.beam delete mode 100755 test/binary/usr/lib/libfoo-2.so delete mode 100644 test/binary/usr/lib/libfoo-2.so.foo delete mode 120000 test/binary/usr/lib/libfoo.so delete mode 100755 test/binary/usr/lib/libfoo.so.1 delete mode 120000 test/binary/usr/lib64/libXrdAppUtils.so delete mode 120000 test/binary/usr/lib64/libXrdCrypto.so delete mode 120000 test/binary/usr/lib64/libXrdCryptoLite.so delete mode 120000 test/binary/usr/lib64/libXrdUtils.so delete mode 120000 test/binary/usr/lib64/libXrdXml.so delete mode 100644 test/binary/usr/share/xrootd/cmake/XRootDConfig.cmake diff --git a/test/binary/usr/bin/xrootd-config b/test/binary/usr/bin/xrootd-config deleted file mode 100755 index 017ae9ef9..000000000 --- a/test/binary/usr/bin/xrootd-config +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/bash -#------------------------------------------------------------------------------- -# Copyright (c) 2014 by European Organization for Nuclear Research (CERN) -# Author: Lukasz Janyst -#------------------------------------------------------------------------------- -# This file is part of the XRootD software suite. -# -# XRootD is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# XRootD is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with XRootD. If not, see . -# -# In applying this licence, CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. -#------------------------------------------------------------------------------- - -version=v5.5.4 -prefix=/usr -includedir=${prefix}/include/xrootd -plugin_version=5 - -usage() -{ - cat <&2 -fi - -while test $# -gt 0; do - case $1 in - --prefix) - echo $prefix - ;; - --version) - echo $version - ;; - --cflags) - if test "$includedir" != "/usr/include" ; then - echo "-I${includedir}" - fi - ;; - --plugin-version) - echo ${plugin_version} - ;; - --help) - usage 0 - ;; - *) - usage 1 1>&2 - ;; - esac - shift -done diff --git a/test/binary/usr/include/xrootd/XProtocol/XProtocol.hh b/test/binary/usr/include/xrootd/XProtocol/XProtocol.hh deleted file mode 100644 index eb9af2c79..000000000 --- a/test/binary/usr/include/xrootd/XProtocol/XProtocol.hh +++ /dev/null @@ -1,1482 +0,0 @@ -#ifndef __XPROTOCOL_H -#define __XPROTOCOL_H -/******************************************************************************/ -/* */ -/* X P r o t o c o l . h h */ -/* */ -/* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* The XRoot protocol definition, documented in this file, is distributed */ -/* under a modified BSD license and may be freely used to reimplement it. */ -/* Any references to "source" in this license refers to this file or any */ -/* other file that specifically contains the following license. */ -/* */ -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ -/* */ -/* 1. Redistributions of source code must retain the above copyright notice, */ -/* this list of conditions and the following disclaimer. */ -/* */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ -/* */ -/* 3. Neither the name of the copyright holder nor the names of its */ -/* contributors may be used to endorse or promote products derived from */ -/* this software without specific prior written permission. */ -/* */ -/* 4. Derived software may not use the name XRootD or cmsd (regardless of */ -/* capitilization) in association with the derived work if the protocol */ -/* documented in this file is changed in any way. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ -/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ -/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ -/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ -/* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ -/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ -/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ -/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ -/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ -/******************************************************************************/ - -#ifdef __CINT__ -#define __attribute__(x) -#endif - -#include "XProtocol/XPtypes.hh" - -/******************************************************************************/ -/* P r o t o c o l V e r s i o n D e f i n i t i o n s */ -/******************************************************************************/ - -// The following is the binary representation of the protocol version here. -// Protocol version is repesented as three base10 digits x.y.z with x having no -// upper limit (i.e. n.9.9 + 1 -> n+1.0.0). The kXR_PROTSIGNVERSION defines the -// protocol version where request signing became available. -// -#define kXR_PROTOCOLVERSION 0x00000511 -#define kXR_PROTXATTVERSION 0x00000500 -#define kXR_PROTTLSVERSION 0x00000500 -#define kXR_PROTPGRWVERSION 0x00000511 -#define kXR_PROTSIGNVERSION 0x00000310 -#define kXR_PROTOCOLVSTRING "5.1.0" - -/******************************************************************************/ -/* C l i e n t - S e r v e r H a n d s h a k e */ -/******************************************************************************/ - -// The fields to be sent as initial handshake -// -struct ClientInitHandShake { - kXR_int32 first; - kXR_int32 second; - kXR_int32 third; - kXR_int32 fourth; - kXR_int32 fifth; -}; - -// The body received after the first handshake's header -// -struct ServerInitHandShake { - kXR_int32 msglen; - kXR_int32 protover; - kXR_int32 msgval; -}; - -/******************************************************************************/ -/* C l i e n t R e q u e s t s */ -/******************************************************************************/ - -// G.Ganis: All the following structures never need padding bytes: -// no need of packing options like __attribute__((packed)) -// -// All binary data is sent in network byte order. - -// Client request codes -// -enum XRequestTypes { - kXR_1stRequest= 3000, - kXR_auth = 3000, - kXR_query, // 3001 - kXR_chmod, // 3002 - kXR_close, // 3003 - kXR_dirlist, // 3004 - kXR_gpfile, // 3005 was kXR_getfile - kXR_protocol,// 3006 - kXR_login, // 3007 - kXR_mkdir, // 3008 - kXR_mv, // 3009 - kXR_open, // 3010 - kXR_ping, // 3011 - kXR_chkpoint,// 3012 was kXR_putfile - kXR_read, // 3013 - kXR_rm, // 3014 - kXR_rmdir, // 3015 - kXR_sync, // 3016 - kXR_stat, // 3017 - kXR_set, // 3018 - kXR_write, // 3019 - kXR_fattr, // 3020 was kXR_admin - kXR_prepare, // 3021 - kXR_statx, // 3022 - kXR_endsess, // 3023 - kXR_bind, // 3024 - kXR_readv, // 3025 - kXR_pgwrite, // 3026 was kXR_verifyw - kXR_locate, // 3027 - kXR_truncate,// 3028 - kXR_sigver, // 3029 - kXR_pgread, // 3030 was kXR_decrypt - kXR_writev, // 3031 - kXR_REQFENCE // Always last valid request code +1 -}; - -// Virtual client request codes -// -enum XVirtRequestTypes { - kXR_virtReadv = 2000 -}; - -// All client requests use a header with the following format -// -struct ClientRequestHdr { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char body[16]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ a u t h R e q u e s t */ -/******************************************************************************/ - -struct ClientAuthRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char reserved[12]; - kXR_char credtype[4]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ b i n d R e q u e s t */ -/******************************************************************************/ - -struct ClientBindRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char sessid[16]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ c h m o d R e q u e s t */ -/******************************************************************************/ - -struct ClientChmodRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char reserved[14]; - kXR_unt16 mode; // See XOpenRequestMode - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ c h k p o i n t R e q u e s t */ -/******************************************************************************/ - -struct ClientChkPointRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char fhandle[4]; // For Create, Delete, Query, or Restore - kXR_char reserved[11]; - kXR_char opcode; // One of kXR_ckpxxxx actions - kXR_int32 dlen; -}; - -// Actions -// -static const int kXR_ckpBegin = 0; // Begin checkpoint -static const int kXR_ckpCommit = 1; // Commit changes -static const int kXR_ckpQuery = 2; // Query checkpoint limits -static const int kXR_ckpRollback= 3; // Rollback changes -static const int kXR_ckpXeq = 4; // Execute trunc, write, or writev - -// The minimum size of a checkpoint data limit -// -static const int kXR_ckpMinMax = 104857604; // 10 MB - -/******************************************************************************/ -/* k X R _ c l o s e R e q u e s t */ -/******************************************************************************/ - -struct ClientCloseRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char fhandle[4]; - kXR_char reserved[12]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ d i r l i s t R e q u e s t */ -/******************************************************************************/ - -enum XDirlistRequestOption { - kXR_online = 1, - kXR_dstat = 2, - kXR_dcksm = 4 // dcksm implies dstat irrespective of dstat setting -}; - -struct ClientDirlistRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char reserved[15]; - kXR_char options[1]; // See XDirlistRequestOption enum - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ e n d s e s s R e q u e s t */ -/******************************************************************************/ - -struct ClientEndsessRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char sessid[16]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ f a t t r R e q u e s t */ -/******************************************************************************/ - -// kXR_fattr subcodes -// -enum xfaSubCode { - kXR_fattrDel = 0, - kXR_fattrGet = 1, - kXR_fattrList = 2, - kXR_fattrSet = 3, - kXR_fatrrMaxSC = 3 // Highest valid subcode -}; - -// kXR_fattr limits -// -enum xfaLimits { - kXR_faMaxVars = 16, // Maximum variables per request - kXR_faMaxNlen = 248, // Maximum length of variable name - kXR_faMaxVlen = 65536 // Maximum length of variable value -}; - -struct ClientFattrRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char fhandle[4]; - kXR_char subcode; // See xfaSubCode enum - kXR_char numattr; - kXR_char options; // See valid options below - kXR_char reserved[9]; - kXR_int32 dlen; - -// Valid options: -// - static const int isNew = 0x01; // For set, the variable must not exist - static const int aData = 0x10; // For list, return attribute value - -// Add an attribute name to nvec (the buffer has to be sufficiently big) -// - static char* NVecInsert( const char *name, char *buffer ); - -// Add an attribute name to vvec (the buffer has to be sufficiently big) -// - static char* VVecInsert( const char *value, char *buffer ); - -// Read error code from nvec -// - static char* NVecRead( char* buffer, kXR_unt16 &rc ); - -// Read attribute name from nvec, should be deallocated with free() -// - static char* NVecRead( char* buffer, char *&name ); - -// Read value length from vvec -// - static char* VVecRead( char* buffer, kXR_int32 &len ); - -// Read attribute value from vvec, should be deallocated with free() -// - static char* VVecRead( char* buffer, kXR_int32 len, char *&value ); - -}; - -/******************************************************************************/ -/* k X R _ g p f i l e R e q u e s t */ -/******************************************************************************/ - -struct ClientGPfileRequest { // ??? This is all wrong; correct when implemented - kXR_char streamid[2]; - kXR_unt16 requestid; // kXR_gpfile - kXR_int32 options; - kXR_char reserved[8]; - kXR_int32 buffsz; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ l o c a t e R e q u e s t */ -/******************************************************************************/ - -struct ClientLocateRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_unt16 options; // See XOpenRequestOption enum tagged for locate - kXR_char reserved[14]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ l o g i n R e q u e s t */ -/******************************************************************************/ - -// this is a bitmask -enum XLoginAbility { - kXR_nothing = 0, - kXR_fullurl = 1, - kXR_multipr = 3, - kXR_readrdok = 4, - kXR_hasipv64 = 8, - kXR_onlyprv4 = 16, - kXR_onlyprv6 = 32, - kXR_lclfile = 64, - kXR_redirflags = 128 -}; - -// this iss a bitmask -enum XLoginAbility2 { - kXR_empty = 0, - kXR_ecredir = 1 -}; - -// this is a bitmask (note that XLoginVersion resides in lower bits) -enum XLoginCapVer { - kXR_lcvnone = 0, - kXR_vermask = 63, - kXR_asyncap = 128 -}; - -// this is a single number that is or'd into capver as the version -// -enum XLoginVersion { - kXR_ver000 = 0, // Old clients predating history - kXR_ver001 = 1, // Generally implemented 2005 protocol - kXR_ver002 = 2, // Same as 1 but adds asyncresp recognition - kXR_ver003 = 3, // The 2011-2012 rewritten client - kXR_ver004 = 4, // The 2016 sign-capable client - kXR_ver005 = 5 // The 2019 TLS-capable client -}; - -struct ClientLoginRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_int32 pid; - kXR_char username[8]; - kXR_char ability2; // See XLoginAbility2 enum flags - kXR_char ability; // See XLoginAbility enum flags - kXR_char capver[1]; // See XLoginCapVer enum flags - kXR_char reserved2; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ m k d i r R e q u e s t */ -/******************************************************************************/ - -enum XMkdirOptions { - kXR_mknone = 0, - kXR_mkdirpath = 1 -}; - -struct ClientMkdirRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char options[1]; - kXR_char reserved[13]; - kXR_unt16 mode; // See XOpenRequestMode - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ m v R e q u e s t */ -/******************************************************************************/ - -struct ClientMvRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char reserved[14]; - kXR_int16 arg1len; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ o p e n R e q u e s t */ -/******************************************************************************/ - -// OPEN MODE FOR A REMOTE FILE -enum XOpenRequestMode { - kXR_ur = 0x100, - kXR_uw = 0x080, - kXR_ux = 0x040, - kXR_gr = 0x020, - kXR_gw = 0x010, - kXR_gx = 0x008, - kXR_or = 0x004, - kXR_ow = 0x002, - kXR_ox = 0x001 -}; - -enum XOpenRequestOption { - kXR_compress = 0x0001, // 1 // also locate (return unique hosts) - kXR_delete = 0x0002, // 2 - kXR_force = 0x0004, // 4 - kXR_new = 0x0008, // 8 - kXR_open_read= 0x0010, // 16 - kXR_open_updt= 0x0020, // 32 - kXR_async = 0x0040, // 64 - kXR_refresh = 0x0080, // 128 // also locate - kXR_mkpath = 0x0100, // 256 - kXR_prefname = 0x0100, // 256 // only locate - kXR_open_apnd= 0x0200, // 512 - kXR_retstat = 0x0400, // 1024 - kXR_4dirlist = 0x0400, // 1024 // for locate intending a dirlist - kXR_replica = 0x0800, // 2048 - kXR_posc = 0x1000, // 4096 - kXR_nowait = 0x2000, // 8192 // also locate - kXR_seqio = 0x4000, // 16384 - kXR_open_wrto= 0x8000 // 32768 -}; - -enum XOpenRequestOption2 { - kXR_dup = 0x0001, // 1 - kXR_samefs = 0x0002 // 2 -}; - -struct ClientOpenRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_unt16 mode; - kXR_unt16 options; - kXR_char reserved[12]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ p g r e a d R e q u e s t */ -/******************************************************************************/ - -// The page size for pgread and pgwrite and the maximum transmission size -// -namespace XrdProto // Always use this namespace for new additions -{ -static const int kXR_pgPageSZ = 4096; // Length of a page -static const int kXR_pgPageBL = 12; // log2(page length) -static const int kXR_pgUnitSZ = kXR_pgPageSZ + sizeof(kXR_unt32); -static const int kXR_pgMaxEpr = 128; // Max checksum errs per request -static const int kXR_pgMaxEos = 256; // Max checksum errs outstanding - -// kXR_pgread/write options -// -static const kXR_char kXR_AnyPath = 0xff; // In pathid -static const int kXR_pgRetry = 0x01; // In reqflags -} - -struct ClientPgReadRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char fhandle[4]; - kXR_int64 offset; - kXR_int32 rlen; - kXR_int32 dlen; // Request data length must be 0 unless args present -}; - -struct ClientPgReadReqArgs { - kXR_char pathid; // Request data length must be 1 - kXR_char reqflags; // Request data length must be 2 -}; - -namespace -{ -} - -/******************************************************************************/ -/* k X R _ p r w r i t e R e q u e s t */ -/******************************************************************************/ - -struct ClientPgWriteRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char fhandle[4]; - kXR_int64 offset; - kXR_char pathid; - kXR_char reqflags; - kXR_char reserved[2]; - kXR_int32 dlen; -// kXR_char data[dlen]; -}; - -/******************************************************************************/ -/* k X R _ p i n g R e q u e s t */ -/******************************************************************************/ - -struct ClientPingRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char reserved[16]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ p r o t o c o l R e q u e s t */ -/******************************************************************************/ - -struct ClientProtocolRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_int32 clientpv; // 2.9.7 or higher - kXR_char flags; // 3.1.0 or higher - kXR_char expect; // 4.0.0 or higher - kXR_char reserved[10]; - kXR_int32 dlen; - -enum RequestFlags { - kXR_secreqs = 0x01, // Options: Return security requirements - kXR_ableTLS = 0x02, // Options: Client is TLS capable - kXR_wantTLS = 0x04, // Options: Change connection to use TLS - kXR_bifreqs = 0x08 // Options: Return bind interface requirements -}; - -enum ExpectFlags { - kXR_ExpMask = 0x0f, // Isolate the relevant expect enumeration value - kXR_ExpNone = 0x00, - kXR_ExpBind = 0x01, - kXR_ExpGPF = 0x02, - kXR_ExpLogin = 0x03, - kXR_ExpTPC = 0x04, - kXR_ExpGPFA = 0x08 -}; -}; - -/******************************************************************************/ -/* k X R _ p r e p a r e R e q u e s t */ -/******************************************************************************/ - -enum XPrepRequestOption { - kXR_cancel = 1, - kXR_notify = 2, - kXR_noerrs = 4, - kXR_stage = 8, - kXR_wmode = 16, - kXR_coloc = 32, - kXR_fresh = 64, - kXR_usetcp = 128, - - kXR_evict = 0x0001 // optionsX: file no longer useful -}; - -struct ClientPrepareRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char options; - kXR_char prty; - kXR_unt16 port; // 2.9.9 or higher - kXR_unt16 optionX; // Extended options - kXR_char reserved[10]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ q u e r y R e q u e s t */ -/******************************************************************************/ - -enum XQueryType { - kXR_QStats = 1, - kXR_QPrep = 2, - kXR_Qcksum = 3, - kXR_Qxattr = 4, - kXR_Qspace = 5, - kXR_Qckscan= 6, - kXR_Qconfig= 7, - kXR_Qvisa = 8, - kXR_Qopaque=16, - kXR_Qopaquf=32, - kXR_Qopaqug=64 -}; - -struct ClientQueryRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_unt16 infotype; // See XQueryType enum - kXR_char reserved1[2]; - kXR_char fhandle[4]; - kXR_char reserved2[8]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ r e a d R e q u e s t */ -/******************************************************************************/ - -struct ClientReadRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char fhandle[4]; - kXR_int64 offset; - kXR_int32 rlen; - kXR_int32 dlen; -// Optionally followed by read_args -}; - -struct read_args { - kXR_char pathid; - kXR_char reserved[7]; -// This struct may be followed by an array of readahead_list -}; - -struct readahead_list { - kXR_char fhandle[4]; - kXR_int32 rlen; - kXR_int64 offset; -}; - -/******************************************************************************/ -/* k X R _ r e a d v R e q u e s t */ -/******************************************************************************/ - -struct ClientReadVRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char reserved[15]; - kXR_char pathid; - kXR_int32 dlen; -// This struct followed by the read_list -}; - -namespace XrdProto // Always use this namespace for new additions -{ -struct read_list { - kXR_char fhandle[4]; - kXR_int32 rlen; - kXR_int64 offset; -}; -static const int rlItemLen = sizeof(read_list); -static const int maxRvecln = 16384; -static const int maxRvecsz = maxRvecln/rlItemLen; -} - -/******************************************************************************/ -/* k X R _ r m R e q u e s t */ -/******************************************************************************/ - -struct ClientRmRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char reserved[16]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ r m d i r R e q u e s t */ -/******************************************************************************/ - -struct ClientRmdirRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char reserved[16]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ s e t R e q u e s t */ -/******************************************************************************/ - -struct ClientSetRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char reserved[15]; - kXR_char modifier; // For security purposes, should be zero - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ s i g v e r R e q u e s t */ -/******************************************************************************/ - -// Cryptography used for kXR_sigver SigverRequest::crypto -enum XSecCrypto { - kXR_SHA256 = 0x01, // Hash used - kXR_HashMask = 0x0f, // Mak to extract the hash type - kXR_rsaKey = 0x80 // The rsa key was used -}; - -// Flags for kXR_sigver -enum XSecFlags { - kXR_nodata = 1 // Request payload was not hashed -}; - -// Version number -enum XSecVersion { - kXR_Ver_00 = 0 -}; - -struct ClientSigverRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_unt16 expectrid; // Request code of subsequent request - kXR_char version; // Security version being used (see XSecVersion) - kXR_char flags; // One or more flags defined in enum (see XSecFlags) - kXR_unt64 seqno; // Monotonically increasing number (part of hash) - kXR_char crypto; // Cryptography used (see XSecCrypto) - kXR_char rsvd2[3]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ s t a t R e q u e s t */ -/******************************************************************************/ - -enum XStatRequestOption { - kXR_vfs = 1 -}; - -struct ClientStatRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char options; // See XStatRequestOption - kXR_char reserved[11]; - kXR_char fhandle[4]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ s y n c R e q u e s t */ -/******************************************************************************/ - -struct ClientSyncRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char fhandle[4]; - kXR_char reserved[12]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ t r u n c a t e R e q u e s t */ -/******************************************************************************/ - -struct ClientTruncateRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char fhandle[4]; - kXR_int64 offset; - kXR_char reserved[4]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ w r i t e R e q u e s t */ -/******************************************************************************/ - -struct ClientWriteRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char fhandle[4]; - kXR_int64 offset; - kXR_char pathid; - kXR_char reserved[3]; - kXR_int32 dlen; -}; - -/******************************************************************************/ -/* k X R _ w r i t e v R e q u e s t */ -/******************************************************************************/ - -struct ClientWriteVRequest { - kXR_char streamid[2]; - kXR_unt16 requestid; - kXR_char options; // See static const ints below - kXR_char reserved[15]; - kXR_int32 dlen; -// This struct followed by the write_list - - static const kXR_int32 doSync = 0x01; -}; - -namespace XrdProto // Always use this namespace for new additions -{ -struct write_list { - kXR_char fhandle[4]; - kXR_int32 wlen; - kXR_int64 offset; -}; -static const int wlItemLen = sizeof(write_list); -static const int maxWvecln = 16384; -static const int maxWvecsz = maxWvecln/wlItemLen; -} - -/******************************************************************************/ -/* U n i o n o f a l l C l i e n t R e q u e s t s */ -/******************************************************************************/ - -typedef union { - struct ClientRequestHdr header; - struct ClientAuthRequest auth; - struct ClientBindRequest bind; - struct ClientChkPointRequest chkpoint; - struct ClientChmodRequest chmod; - struct ClientCloseRequest close; - struct ClientDirlistRequest dirlist; - struct ClientEndsessRequest endsess; - struct ClientFattrRequest fattr; - struct ClientGPfileRequest gpfile; - struct ClientLocateRequest locate; - struct ClientLoginRequest login; - struct ClientMkdirRequest mkdir; - struct ClientMvRequest mv; - struct ClientOpenRequest open; - struct ClientPgReadRequest pgread; - struct ClientPgWriteRequest pgwrite; - struct ClientPingRequest ping; - struct ClientPrepareRequest prepare; - struct ClientProtocolRequest protocol; - struct ClientQueryRequest query; - struct ClientReadRequest read; - struct ClientReadVRequest readv; - struct ClientRmRequest rm; - struct ClientRmdirRequest rmdir; - struct ClientSetRequest set; - struct ClientSigverRequest sigver; - struct ClientStatRequest stat; - struct ClientSyncRequest sync; - struct ClientTruncateRequest truncate; - struct ClientWriteRequest write; - struct ClientWriteVRequest writev; -} ClientRequest; - -typedef union { - struct ClientRequestHdr header; - struct ClientSigverRequest sigver; -} SecurityRequest; - -/******************************************************************************/ -/* S e r v e r R e s p o n s e s */ -/******************************************************************************/ - -// Nice header for the server response. -// Note that the protocol specifies these values to be in network -// byte order when sent -// -// G.Ganis: The following structures never need padding bytes: -// no need of packing options - -// Server response codes -// -enum XResponseType { - kXR_ok = 0, - kXR_oksofar = 4000, - kXR_attn, // 4001 - kXR_authmore,// 4002 - kXR_error, // 4003 - kXR_redirect,// 4004 - kXR_wait, // 4005 - kXR_waitresp,// 4006 - kXR_status, // 4007 - kXR_noResponsesYet = 10000 -}; - -// All serer responses start with the same header -// -struct ServerResponseHeader { - kXR_char streamid[2]; - kXR_unt16 status; - kXR_int32 dlen; -}; - -// This is a bit of wierdness held over from the very old days, sigh. -// -struct ServerResponseBody_Buffer { - char data[4096]; -}; - -/******************************************************************************/ -/* k X R _ a t t n R e s p o n s e */ -/******************************************************************************/ - -enum XActionCode { - kXR_asyncab = 5000, // No longer supported - kXR_asyncdi, // 5001 No longer supported - kXR_asyncms = 5002, - kXR_asyncrd, // 5003 No longer supported - kXR_asyncwt, // 5004 No longer supported - kXR_asyncav, // 5005 No longer supported - kXR_asynunav, // 5006 No longer supported - kXR_asyncgo, // 5007 No longer supported - kXR_asynresp= 5008 -}; - -struct ServerResponseBody_Attn { - kXR_int32 actnum; // See XActionCode enum - char parms[4096]; // Should be sufficient for every use -}; - -struct ServerResponseBody_Attn_asyncms { - kXR_int32 actnum; // XActionCode::kXR_asyncms - char reserved[4]; - ServerResponseHeader resphdr; - char respdata[4096]; -}; - -struct ServerResponseBody_Attn_asynresp { - kXR_int32 actnum; // XActionCode::kXR_asynresp - char reserved[4]; - ServerResponseHeader resphdr; - char respdata[4096]; -}; - -/******************************************************************************/ -/* k X R _ a u t h m o r e R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_Authmore { - char data[4096]; -}; - -/******************************************************************************/ -/* k X R _ b i n d R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_Bind { - kXR_char substreamid; -}; - -/******************************************************************************/ -/* k X R _ c h k p o i n t R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_ChkPoint { // Only for kXR_ckpQMax - kXR_unt32 maxCkpSize; // Maximum number of bytes including overhead - kXR_unt32 useCkpSize; // The number of bytes already being used -}; - -/******************************************************************************/ -/* k X R _ e r r o r R e s p o n s e */ -/******************************************************************************/ - -enum XErrorCode { - kXR_ArgInvalid = 3000, - kXR_ArgMissing, // 3001 - kXR_ArgTooLong, // 3002 - kXR_FileLocked, // 3003 - kXR_FileNotOpen, // 3004 - kXR_FSError, // 3005 - kXR_InvalidRequest, // 3006 - kXR_IOError, // 3007 - kXR_NoMemory, // 3008 - kXR_NoSpace, // 3009 - kXR_NotAuthorized, // 3010 - kXR_NotFound, // 3011 - kXR_ServerError, // 3012 - kXR_Unsupported, // 3013 - kXR_noserver, // 3014 - kXR_NotFile, // 3015 - kXR_isDirectory, // 3016 - kXR_Cancelled, // 3017 - kXR_ItExists, // 3018 - kXR_ChkSumErr, // 3019 - kXR_inProgress, // 3020 - kXR_overQuota, // 3021 - kXR_SigVerErr, // 3022 - kXR_DecryptErr, // 3023 - kXR_Overloaded, // 3024 - kXR_fsReadOnly, // 3025 - kXR_BadPayload, // 3026 - kXR_AttrNotFound, // 3027 - kXR_TLSRequired, // 3028 - kXR_noReplicas, // 3029 - kXR_AuthFailed, // 3030 - kXR_Impossible, // 3031 - kXR_Conflict, // 3032 - kXR_TooManyErrs, // 3033 - kXR_ReqTimedOut, // 3034 - kXR_ERRFENCE, // Always last valid errcode + 1 - kXR_noErrorYet = 10000 -}; - -struct ServerResponseBody_Error { - kXR_int32 errnum; // See XErrorCode enu - char errmsg[4096]; // Should be sufficient for every use -}; - -/******************************************************************************/ -/* k X R _ l o g i n R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_Login { - kXR_char sessid[16]; - kXR_char sec[4096]; // Should be sufficient for every use -}; - -/******************************************************************************/ -/* k X R _ o p e n R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_Open { - kXR_char fhandle[4]; - kXR_int32 cpsize; // cpsize & cptype returned if kXR_compress *or* - kXR_char cptype[4]; // kXR_retstat is specified -}; // info will follow if kXR_retstat is specified - -/******************************************************************************/ -/* k X R _ p g r e a d R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_pgRead { - kXR_int64 offset; // info[]: File offset of data that follows -// kXR_char data[dlen]; -}; - -/******************************************************************************/ -/* k X R _ p g w r i t e R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_pgWrite { - kXR_int64 offset; // info[]: File offset of data written -}; - - -// The following structure is appended to ServerResponseBody_pgWrite if one or -// more checksum errors occurred and need to be retransmitted. -// -struct ServerResponseBody_pgWrCSE { - kXR_unt32 cseCRC; // crc32c of all following bits - kXR_int16 dlFirst; // Data length at first offset in list - kXR_int16 dlLast; // Data length at last offset in list -// kXR_int64 bof[(dlen-8)/8]; // List of offsets of pages in error -}; - -/******************************************************************************/ -/* k X R _ p r o t o c o l R e s p o n s e */ -/******************************************************************************/ - -// The following information is returned in the response body when kXR_bifreqs -// is set in ClientProtocolRequest::flags. Note that the size of bifInfo is -// is variable. This response will not be returned if there are no bif's. -// Note: This structure is null byte padded to be a multiple of 8 bytes! -// -struct ServerResponseBifs_Protocol { - kXR_char theTag; // Always the character 'B' to identify struct - kXR_char rsvd; // Reserved for the future (always 0 for now) - kXR_unt16 bifILen; // Length of bifInfo including null bytes. -// kXR_char bifInfo[bifILen]; -}; - -// The following information is returned in the response body when kXR_secreqs -// is set in ClientProtocolRequest::flags. Note that the size of secvec is -// defined by secvsz and will not be present when secvsz == 0. -// -struct ServerResponseSVec_Protocol { - kXR_char reqindx; // Request index - kXR_char reqsreq; // Request signing requirement -}; - -struct ServerResponseReqs_Protocol { - kXR_char theTag; // Always the character 'S' to identify struct - kXR_char rsvd; // Reserved for the future (always 0 for now) - kXR_char secver; // Security version - kXR_char secopt; // Security options - kXR_char seclvl; // Security level when secvsz == 0 - kXR_char secvsz; // Number of items in secvec (i.e. its length/2) - ServerResponseSVec_Protocol secvec; -}; - - -namespace XrdProto -{ -typedef struct ServerResponseBifs_Protocol bifReqs; -typedef struct ServerResponseReqs_Protocol secReqs; -} - -// Options reflected in protocol response ServerResponseReqs_Protocol::secopt -// -#define kXR_secOData 0x01 -#define kXR_secOFrce 0x02 - -// Security level definitions (these are predefined but can be over-ridden) -// -#define kXR_secNone 0 -#define kXR_secCompatible 1 -#define kXR_secStandard 2 -#define kXR_secIntense 3 -#define kXR_secPedantic 4 - -// Requirements one of which set in each ServerResponseReqs_Protocol::secvec -// -#define kXR_signIgnore 0 -#define kXR_signLikely 1 -#define kXR_signNeeded 2 - -// Version used for kXR_sigver and is set in SigverRequest::version, -// ServerResponseReqs_Protocol::secver -// -#define kXR_secver_0 0 - -// KINDS of SERVERS (no longer used by new clients) -// -#define kXR_DataServer 1 -#define kXR_LBalServer 0 - -// The below are defined for protocol version 2.9.7 or higher -// These are the flag values in the kXR_protool response -// -#define kXR_isManager 0x00000002 -#define kXR_isServer 0x00000001 -#define kXR_attrMeta 0x00000100 -#define kXR_attrProxy 0x00000200 -#define kXR_attrSuper 0x00000400 -#define kXR_attrVirtRdr 0x00000800 - -// Virtual options set on redirect -// -#define kXR_recoverWrts 0x00001000 -#define kXR_collapseRedir 0x00002000 -#define kXR_ecRedir 0x00004000 - -// Things the server supports -// -#define kXR_anongpf 0x00800000 -#define kXR_supgpf 0x00400000 -#define kXR_suppgrw 0x00200000 -#define kXR_supposc 0x00100000 - -// TLS requirements -// -#define kXR_haveTLS 0x80000000 -#define kXR_gotoTLS 0x40000000 -#define kXR_tlsAny 0x1f000000 -#define kXR_tlsData 0x01000000 -#define kXR_tlsGPF 0x02000000 -#define kXR_tlsLogin 0x04000000 -#define kXR_tlsSess 0x08000000 -#define kXR_tlsTPC 0x10000000 -#define kXR_tlsGPFA 0x20000000 - -// Body for the kXR_protocol response... useful -// -struct ServerResponseBody_Protocol { - kXR_int32 pval; - kXR_int32 flags; - ServerResponseReqs_Protocol secreq; // Only for V3.1.0+ && if requested -}; - -// Handy definition of the size of the protocol response when the security -// information is not present. -// -#define kXR_ShortProtRespLen sizeof(ServerResponseBody_Protocol)-\ - sizeof(ServerResponseReqs_Protocol) - -/******************************************************************************/ -/* k X R _ r e d i r e c t R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_Redirect { - kXR_int32 port; - char host[4096]; // Should be sufficient for every use -}; - -/******************************************************************************/ -/* k X R _ s t a t R e s p o n s e */ -/******************************************************************************/ - -// The following bits are encoded in the "flags" token in the response -// -enum XStatRespFlags { - kXR_file = 0, - kXR_xset = 1, - kXR_isDir = 2, - kXR_other = 4, - kXR_offline = 8, - kXR_readable=16, - kXR_writable=32, - kXR_poscpend=64, - kXR_bkpexist=128 -}; - -/******************************************************************************/ -/* k X R _ s t a t u s R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_Status { // Always preceeded by ServerResponseHeader - kXR_unt32 crc32c; // IETF RFC 7143 standard - kXR_char streamID[2]; // Identical to streamid[2] in ServerResponseHeader - kXR_char requestid; // requestcode - kXR_1stRequest - kXR_char resptype; // See RespType enum below - kXR_char reserved[4]; - kXR_int32 dlen; -// kXR_char info[ServerResponseHeader::dlen-sizeof(ServerResponseBody_Status)]; -// kXR_char data[dlen]; -}; - -namespace XrdProto -{ -enum RespType { - - kXR_FinalResult = 0x00, - kXR_PartialResult = 0x01, - kXR_ProgressInfo = 0x02 -}; - - // This is the minimum size of ServerResponseHeader::dlen for kXR_status - // - static const int kXR_statusBodyLen = sizeof(ServerResponseBody_Status); -} - -struct ServerResponseStatus { - struct ServerResponseHeader hdr; - struct ServerResponseBody_Status bdy; -}; - -/******************************************************************************/ -/* k X R _ w a i t R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_Wait { - kXR_int32 seconds; - char infomsg[4096]; // Should be sufficient for every use -}; - -/******************************************************************************/ -/* k X R _ w a i t r e s p R e s p o n s e */ -/******************************************************************************/ - -struct ServerResponseBody_Waitresp { - kXR_int32 seconds; -}; - -/******************************************************************************/ -/* U n i o n o f a l l S e r v e r R e s p o n s e s */ -/******************************************************************************/ - -struct ServerResponse -{ - ServerResponseHeader hdr; - union - { - ServerResponseBody_Attn attn; - ServerResponseBody_Authmore authmore; - ServerResponseBody_Bind bind; - ServerResponseBody_Buffer buffer; - ServerResponseBody_Error error; - ServerResponseBody_Login login; - ServerResponseBody_Protocol protocol; - ServerResponseBody_Redirect redirect; - ServerResponseBody_Status status; - ServerResponseBody_Wait wait; - ServerResponseBody_Waitresp waitresp; - } body; -}; - -// The pgread and pgwrite do not fit the union above because they are composed -// of three structs not two as all the above. So, we define the exceptions here. -// -struct ServerResponseV2 -{ - ServerResponseStatus status; // status.bdy and status.hdr - union - { - ServerResponseBody_pgRead pgread; - ServerResponseBody_pgWrite pgwrite; - } info; -}; - -struct ALIGN_CHECK {char chkszreq[25-sizeof(ClientRequest)]; - char chkszrsp[ 9-sizeof(ServerResponseHeader)]; -}; - -/******************************************************************************/ -/* X P r o t o c o l U t i l i t i e s */ -/******************************************************************************/ - -#include -#if defined(WIN32) -#if !defined(ENOTBLK) -# define ENOTBLK 15 -#endif -#if !defined(ETXTBSY) -#define ETXTBSY 26 -#endif -#if !defined(ENOBUFS) -#define ENOBUFS 105 -#endif -#if !defined(ENETUNREACH) -#define ENETUNREACH 114 -#endif -#endif - -#ifndef ENOATTR -#define ENOATTR ENODATA -#endif - -#ifndef EBADRQC -#define EBADRQC EBADRPC -#endif - -#ifndef EAUTH -#define EAUTH EBADE -#endif - -struct stat; - -class XProtocol -{ -public: - -// mapError() is the official mapping from errno to xroot protocol error. -// -static int mapError(int rc) - {if (rc < 0) rc = -rc; - switch(rc) - {case ENOENT: return kXR_NotFound; - case EINVAL: return kXR_ArgInvalid; - case EPERM: return kXR_NotAuthorized; - case EACCES: return kXR_NotAuthorized; - case EIO: return kXR_IOError; - case ENOMEM: return kXR_NoMemory; - case ENOBUFS: return kXR_NoMemory; - case ENOSPC: return kXR_NoSpace; - case ENAMETOOLONG: return kXR_ArgTooLong; - case ENETUNREACH: return kXR_noserver; - case ENOTBLK: return kXR_NotFile; - case ENOTSUP: return kXR_Unsupported; - case EISDIR: return kXR_isDirectory; - case EEXIST: return kXR_ItExists; - case EBADRQC: return kXR_InvalidRequest; - case ETXTBSY: return kXR_inProgress; - case ENODEV: return kXR_FSError; - case EFAULT: return kXR_ServerError; - case EDOM: return kXR_ChkSumErr; - case EDQUOT: return kXR_overQuota; - case EILSEQ: return kXR_SigVerErr; - case ERANGE: return kXR_DecryptErr; - case EUSERS: return kXR_Overloaded; - case EROFS: return kXR_fsReadOnly; - case ENOATTR: return kXR_AttrNotFound; - case EPROTOTYPE: return kXR_TLSRequired; - case EADDRNOTAVAIL: return kXR_noReplicas; - case EAUTH: return kXR_AuthFailed; - case EIDRM: return kXR_Impossible; - case ENOTTY: return kXR_Conflict; - case ETOOMANYREFS: return kXR_TooManyErrs; - case ETIMEDOUT: return kXR_ReqTimedOut; - case EBADF: return kXR_FileNotOpen; - case ECANCELED: return kXR_Cancelled; - default: return kXR_FSError; - } - } - -static int toErrno( int xerr ) -{ - switch(xerr) - {case kXR_ArgInvalid: return EINVAL; - case kXR_ArgMissing: return EINVAL; - case kXR_ArgTooLong: return ENAMETOOLONG; - case kXR_FileLocked: return EDEADLK; - case kXR_FileNotOpen: return EBADF; - case kXR_FSError: return ENODEV; - case kXR_InvalidRequest:return EBADRQC; - case kXR_IOError: return EIO; - case kXR_NoMemory: return ENOMEM; - case kXR_NoSpace: return ENOSPC; - case kXR_NotAuthorized: return EACCES; - case kXR_NotFound: return ENOENT; - case kXR_ServerError: return EFAULT; - case kXR_Unsupported: return ENOTSUP; - case kXR_noserver: return EHOSTUNREACH; - case kXR_NotFile: return ENOTBLK; - case kXR_isDirectory: return EISDIR; - case kXR_Cancelled: return ECANCELED; - case kXR_ItExists: return EEXIST; - case kXR_ChkSumErr: return EDOM; - case kXR_inProgress: return EINPROGRESS; - case kXR_overQuota: return EDQUOT; - case kXR_SigVerErr: return EILSEQ; - case kXR_DecryptErr: return ERANGE; - case kXR_Overloaded: return EUSERS; - case kXR_fsReadOnly: return EROFS; - case kXR_BadPayload: return EINVAL; - case kXR_AttrNotFound: return ENOATTR; - case kXR_TLSRequired: return EPROTOTYPE; - case kXR_noReplicas: return EADDRNOTAVAIL; - case kXR_AuthFailed: return EAUTH; - case kXR_Impossible: return EIDRM; - case kXR_Conflict: return ENOTTY; - case kXR_TooManyErrs: return ETOOMANYREFS; - case kXR_ReqTimedOut: return ETIMEDOUT; - default: return ENOMSG; - } -} - -static const char *errName(kXR_int32 errCode); - -static const char *reqName(kXR_unt16 reqCode); - -/******************************************************************************/ -/* O b s o l e t e D e f i n i t i o n s */ -/******************************************************************************/ - -struct ServerResponseBody_Attn_asyncdi { // No longer supported - kXR_int32 actnum; - kXR_int32 wsec; - kXR_int32 msec; -}; - -struct ServerResponseBody_Attn_asyncrd { // No longer supported - kXR_int32 actnum; - kXR_int32 port; - char host[4092]; -}; - -struct ServerResponseBody_Attn_asyncwt { // No longer supported - kXR_int32 actnum; - kXR_int32 wsec; -}; - -// Kind of error inside a XTNetFile's routine (temporary) -// -enum XReqErrorType { - kGENERICERR = 0, // Generic error - kREAD, // Error while reading from stream - kWRITE, // Error while writing to stream - kREDIRCONNECT, // Error redirecting to a given host - kOK, // Everything seems ok - kNOMORESTREAMS // No more available stream IDs for - // async processing -}; - -typedef kXR_int32 ServerResponseType; - -#define kXR_maxReqRetry 10 - -}; // XProtocol -#endif diff --git a/test/binary/usr/include/xrootd/XProtocol/XPtypes.hh b/test/binary/usr/include/xrootd/XProtocol/XPtypes.hh deleted file mode 100644 index b6ce38959..000000000 --- a/test/binary/usr/include/xrootd/XProtocol/XPtypes.hh +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef __XPTYPES_H -#define __XPTYPES_H -/******************************************************************************/ -/* */ -/* X P t y p e s . h h */ -/* */ -/* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* The XRootD protocol definition, documented in this file, is distributed */ -/* under a modified BSD license and may be freely used to reimplement it. */ -/* Any references to "source" in this license refers to this file or any */ -/* other file that specifically contains the following license. */ -/* */ -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ -/* */ -/* 1. Redistributions of source code must retain the above copyright notice, */ -/* this list of conditions and the following disclaimer. */ -/* */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ -/* */ -/* 3. Neither the name of the copyright holder nor the names of its */ -/* contributors may be used to endorse or promote products derived from */ -/* this software without specific prior written permission. */ -/* */ -/* 4. Derived software may not use the name XRootD or cmsd (regardless of */ -/* capitilization) in association with the derived work if the protocol */ -/* documented in this file is changed in any way. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ -/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ -/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ -/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ -/* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ -/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ -/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ -/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ -/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ -/******************************************************************************/ - -// Full range type compatibility work done by Gerardo Ganis, CERN. - -// Typical data types -// -// Only char and short are truly portable types -typedef unsigned char kXR_char; -typedef short kXR_int16; -typedef unsigned short kXR_unt16; - -// Signed integer 4 bytes -// -#ifndef XR__INT16 -# if defined(LP32) || defined(__LP32) || defined(__LP32__) || \ - defined(BORLAND) -# define XR__INT16 -# endif -#endif -#ifndef XR__INT64 -# if defined(ILP64) || defined(__ILP64) || defined(__ILP64__) -# define XR__INT64 -# endif -#endif -#if defined(XR__INT16) -typedef long kXR_int32; -typedef unsigned long kXR_unt32; -#elif defined(XR__INT64) -typedef int32 kXR_int32; -typedef unsigned int32 kXR_unt32; -#else -typedef int kXR_int32; -typedef unsigned int kXR_unt32; -#endif - -// Signed integer 8 bytes -// -//#if defined(_WIN32) -//typedef __int64 kXR_int64; -//#else -typedef long long kXR_int64; -typedef unsigned long long kXR_unt64; -//#endif -#endif diff --git a/test/binary/usr/include/xrootd/Xrd/XrdBuffer.hh b/test/binary/usr/include/xrootd/Xrd/XrdBuffer.hh deleted file mode 100644 index 942699421..000000000 --- a/test/binary/usr/include/xrootd/Xrd/XrdBuffer.hh +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef __XrdBuffer_H__ -#define __XrdBuffer_H__ -/******************************************************************************/ -/* */ -/* X r d B u f f e r . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include -#include -#include "XrdSys/XrdSysPthread.hh" - -/******************************************************************************/ -/* x r d _ B u f f e r */ -/******************************************************************************/ - -class XrdBuffer -{ -public: - -char * buff; // -> buffer -int bsize; // size of this buffer - - XrdBuffer(char *bp, int sz, int ix) - {buff = bp; bsize = sz; bindex = ix; next = 0;} - - ~XrdBuffer() {if (buff) free(buff);} - - friend class XrdBuffManager; - friend class XrdBuffXL; -private: - -int bindex; -XrdBuffer *next; -static int pagesz; -}; - -/******************************************************************************/ -/* x r d _ B u f f M a n a g e r */ -/******************************************************************************/ - -#define XRD_BUCKETS 12 -#define XRD_BUSHIFT 10 - -// There should be only one instance of this class per buffer pool. -// -class XrdBuffManager -{ -public: - -void Init(); - -XrdBuffer *Obtain(int bsz); - -int Recalc(int bsz); - -void Release(XrdBuffer *bp); - -int MaxSize() {return maxsz;} - -void Reshape(); - -void Set(int maxmem=-1, int minw=-1); - -int Stats(char *buff, int blen, int do_sync=0); - - XrdBuffManager(int minrst=20*60); - - ~XrdBuffManager(); // The buffmanager is never deleted - -private: - -const int slots; -const int shift; -const int pagsz; -const int maxsz; - -struct {XrdBuffer *bnext; - int numbuf; - int numreq; - } bucket[XRD_BUCKETS]; // 1K to 1<<(szshift+slots-1)M buffers - -int totreq; -int totbuf; -long long totalo; -long long maxalo; -int minrsw; -int rsinprog; -int totadj; - -XrdSysCondVar Reshaper; -static const char *TraceID; -}; -#endif diff --git a/test/binary/usr/include/xrootd/Xrd/XrdJob.hh b/test/binary/usr/include/xrootd/Xrd/XrdJob.hh deleted file mode 100644 index 80a8e0240..000000000 --- a/test/binary/usr/include/xrootd/Xrd/XrdJob.hh +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef ___XRD_JOB_H___ -#define ___XRD_JOB_H___ -/******************************************************************************/ -/* */ -/* X r d J o b . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include -#include -#include - -// The XrdJob class is a super-class that is inherited by any class that needs -// to schedule work on behalf of itself. The XrdJob class is optimized for -// queue processing since that's where it spends a lot of time. This class -// should not be depedent on any other class. - -class XrdJob -{ -friend class XrdScheduler; -public: -XrdJob *NextJob; // -> Next job in the queue (zero if last) -const char *Comment; // -> Description of work for debugging (static!) - -virtual void DoIt() = 0; - - XrdJob(const char *desc="") - {Comment = desc; NextJob = 0; SchedTime = 0;} -virtual ~XrdJob() {} - -private: -time_t SchedTime; // -> Time job is to be scheduled -}; -#endif diff --git a/test/binary/usr/include/xrootd/Xrd/XrdLink.hh b/test/binary/usr/include/xrootd/Xrd/XrdLink.hh deleted file mode 100644 index 3d11e9d68..000000000 --- a/test/binary/usr/include/xrootd/Xrd/XrdLink.hh +++ /dev/null @@ -1,597 +0,0 @@ -#ifndef __XRD_LINK_H__ -#define __XRD_LINK_H__ -/******************************************************************************/ -/* */ -/* X r d L i n k . h h */ -/* */ -/* (c) 2018 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include - -#include "XrdNet/XrdNetAddr.hh" -#include "XrdOuc/XrdOucSFVec.hh" -#include "XrdSys/XrdSysPthread.hh" - -#include "Xrd/XrdJob.hh" - -/******************************************************************************/ -/* C l a s s D e f i n i t i o n */ -/******************************************************************************/ - -class XrdLinkMatch; -class XrdLinkXeq; -class XrdPollInfo; -class XrdProtocol; -class XrdTlsPeerCerts; -class XrdTlsContext; - -class XrdLink : public XrdJob -{ -public: - -//----------------------------------------------------------------------------- -//! Activate a link by attaching it to a poller object. -//! -//! @return True if activation succeeded and false otherwise. -//----------------------------------------------------------------------------- - -bool Activate(); - -//----------------------------------------------------------------------------- -//! Obtain the address information for this link. -//! -//! @return Pointer to the XrdAddrInfo object. The pointer is valid while the -//! end-point is connected. -//----------------------------------------------------------------------------- - -XrdNetAddrInfo *AddrInfo(); - -//----------------------------------------------------------------------------- -//! Obtain the number of queued async requests. -//! -//! @return The number of async requests queued. -//----------------------------------------------------------------------------- - -int Backlog(); - -//----------------------------------------------------------------------------- -//! Get a copy of the client's name as known by the link. -//! -//! @param buff Pointer to buffer to hold the name. -//! @param blen Length of the buffer. -//! -//! @return !0 The length of the name in gthe buffer. -//! =0 The name could not be returned. -//----------------------------------------------------------------------------- - -int Client(char *buff, int blen); - -//----------------------------------------------------------------------------- -//! Close the link. -//! -//! @param defer If true, the link is made unaccessible but the link -//! object not the file descriptor is released. -//! -//! @return !0 An error occurred, the return value is the errno. -//! =0 Action successfully completed. -//----------------------------------------------------------------------------- - -int Close(bool defer=false); - -//----------------------------------------------------------------------------- -//! Enable the link to field interrupts. -//----------------------------------------------------------------------------- - -void Enable(); - -//----------------------------------------------------------------------------- -//! Get the associated file descriptor. -//! -//! @return The file descriptor number. -//----------------------------------------------------------------------------- - -int FDnum(); - -//----------------------------------------------------------------------------- -//! Find the next link matching certain attributes. -//! -//! @param curr Is an internal tracking value that allows repeated calls. -//! It must be set to a value of 0 or less on the initial call -//! and not touched therafter unless a null pointer is returned. -//! @param who If the object use to check if the link matches the wanted -//! criterea (typically, client name and host name). If the -//! pointer is nil, the next link is always returned. -//! -//! @return !0 Pointer to the link object that matches the criterea. The -//! link's reference counter is increased to prevent it from -//! being reused. A subsequent call will reduce the number. -//! =0 No more links exist with the specified criterea. -//----------------------------------------------------------------------------- - -static XrdLink *Find(int &curr, XrdLinkMatch *who=0); - -//----------------------------------------------------------------------------- -//! Get I/O statistics. -//! -//! @param inbytes The number of bytes read. -//! @param outbytes The number of bytes written. -//! @param numstall The number of times the link was rescheduled due to -//! unavailability. -//! @param numtardy The number of times the link was delayed due to -//! unavailability. -//! -//! @return The link's reference count. The parameters will hold the -//! indicated statistic. -//----------------------------------------------------------------------------- - - int getIOStats(long long &inbytes, long long &outbytes, - int &numstall, int &numtardy); - -//----------------------------------------------------------------------------- -//! Find the next client name matching certain attributes. -//! -//! @param curr Is an internal tracking value that allows repeated calls. -//! It must be set to a value of 0 or less on the initial call -//! and not touched therafter unless zero is returned. -//! @param bname Pointer to a buffer where the name is to be returned. -//! @param blen The length of the buffer. -//! @param who If the object use to check if the link matches the wanted -//! criterea (typically, client name and host name). If the -//! pointer is nil, a match always occurs. -//! -//! @return !0 The length of teh name placed in the buffer. -//! =0 No more links exist with the specified criterea. -//----------------------------------------------------------------------------- - -static int getName(int &curr, char *bname, int blen, XrdLinkMatch *who=0); - -//----------------------------------------------------------------------------- -//! Get the x509 certificate information for this TLS enabled link. -//! -//! @return A pointer to the XrdTlsCerts object holding verified certificates -//! if such certificates exist. Otherwise a nil pointer is returned. -//! -//! @note Used by various protocols, so XrdTlsPeerCerts is a private header. -//----------------------------------------------------------------------------- - -XrdTlsPeerCerts *getPeerCerts(); - -//----------------------------------------------------------------------------- -//! Obtain current protocol object pointer. -//----------------------------------------------------------------------------- - -XrdProtocol *getProtocol(); - -//----------------------------------------------------------------------------- -//! Lock or unlock the mutex used for control operations. -//! -//! @param lk When true, a lock is obtained. Otherwise it is released. -//! The caller is responsible for consistency. -//----------------------------------------------------------------------------- - -void Hold(bool lk); - -//----------------------------------------------------------------------------- -//! Get the fully qualified name of the endpoint. -//! -//! @return Pointer to fully qualified host name. The contents are valid -//! while the endpoint is connected. -//----------------------------------------------------------------------------- - -const char *Host() const {return (const char *)HostName;} - -//----------------------------------------------------------------------------- -//! Pointer to the client's link identity. -//----------------------------------------------------------------------------- - -char *ID; // This is referenced a lot (should have been const). - -//----------------------------------------------------------------------------- -//! Obtain the link's instance number. -//! -//! @return The link's instance number. -//----------------------------------------------------------------------------- - -unsigned int Inst() const {return Instance;} - -//----------------------------------------------------------------------------- -//! Indicate whether or not the link has an outstanding error. -//! -//! @return True the link has an outstanding error. -//! the link has no outstanding error. -//----------------------------------------------------------------------------- - -bool isFlawed() const; - -//----------------------------------------------------------------------------- -//! Indicate whether or not this link is of a particular instance. -//! only be used for display and not for security purposes. -//! -//! @param inst the expected instance number. -//! -//! @return true the link matches the instance number. -//! false the link differs the instance number. -//----------------------------------------------------------------------------- - -bool isInstance(unsigned int inst) const; - -//----------------------------------------------------------------------------- -//! Obtain the domain trimmed name of the end-point. The returned value should -//! only be used for display and not for security purposes. -//! -//! @return Pointer to the name that remains valid during the link's lifetime. -//----------------------------------------------------------------------------- - -const char *Name() const; - -//----------------------------------------------------------------------------- -//! Obtain the network address object for this link. The returned value is -//! valid as long as the end-point is connected. Otherwise, it may change. -//! -//! @return Pointer to the object and remains valid during the link's lifetime. -//----------------------------------------------------------------------------- -const -XrdNetAddr *NetAddr() const; - -//----------------------------------------------------------------------------- -//! Issue a socket peek() and return result (do not use for TLS connections). -//! -//! @param buff pointer to buffer to hold data. -//! @param blen length of buffer. -//! @param timeout milliseconds to wait for data. A negative value waits -//! forever. -//! -//! @return >=0 buffer holds data equal to the returned value. -//! < 0 an error or timeout occurred. -//----------------------------------------------------------------------------- - -int Peek(char *buff, int blen, int timeout=-1); - -//----------------------------------------------------------------------------- -//! Read data from a link. Note that this call blocks until some data is -//! available. Use Recv() with a timeout to avoid blocking. -//! -//! @param buff pointer to buffer to hold data. -//! @param blen length of buffer (implies the maximum bytes wanted). -//! -//! @return >=0 buffer holds data equal to the returned value. -//! < 0 an error occurred. -//----------------------------------------------------------------------------- - -int Recv(char *buff, int blen); - -//----------------------------------------------------------------------------- -//! Read data from a link. Note that this call either reads all the data wanted -//! or no data if the passed timeout occurs before any data is present. -//! -//! @param buff pointer to buffer to hold data. -//! @param blen length of buffer (implies the actual bytes wanted). -//! @param timeout milliseconds to wait for data. A negative value waits -//! forever. -//! -//! @return >=0 buffer holds data equal to the returned value. -//! < 0 an error occurred. Note that a special error -ENOMSG -//! is returned if poll() indicated data was present but -//! no bytes were actually read. -//----------------------------------------------------------------------------- - -int Recv(char *buff, int blen, int timeout); - -//----------------------------------------------------------------------------- -//! Read data on a link. Note that this call either reads all the data wanted -//! or no data if the passed timeout occurs before any data is present. -//! -//! @param iov pointer to the message vector. -//! @param iocnt number of iov elements in the vector. -//! @param timeout milliseconds to wait for data. A negative value waits -//! forever. -//! -//! @return >=0 number of bytes read. -//! < 0 an error occurred or when -ETIMEDOUT is returned, no data -//! arrived within the timeout period. -ENOMSG is returned -//! when poll indicated data was present but 0 bytes were read. -//----------------------------------------------------------------------------- - -int Recv(const struct iovec *iov, int iocnt, int timeout); - -//----------------------------------------------------------------------------- -//! Read data from a link. Note that this call reads as much data as it can -//! or until the passed timeout has occurred. -//! -//! @param buff pointer to buffer to hold data. -//! @param blen length of buffer (implies the maximum bytes wanted). -//! @param timeout milliseconds to wait for data. A negative value waits -//! forever. -//! -//! @return >=0 buffer holds data equal to the returned value. -//! < 0 an error occurred or when -ETIMEDOUT is returned, no data -//! arrived within the timeout period. -ENOMSG is returned -//! when poll indicated data was present but 0 bytes were read. -//----------------------------------------------------------------------------- - -int RecvAll(char *buff, int blen, int timeout=-1); - -//------------------------------------------------------------------------------ -//! Register a host name with this IP address. This is not MT-safe! -//! -//! @param hName pointer to a true host name which should be fully qualified. -//! One of the IP addresses registered to this name must -//! match the IP address associated with this object. -//! -//! @return True: Specified name is now associated with this link. -//! False: Nothing changed, registration could not be verified. -//------------------------------------------------------------------------------ - -bool Register(const char *hName); - -//----------------------------------------------------------------------------- -//! Send data on a link. This calls may block unless the socket was marked -//! nonblocking. If a block would occur, the data is copied for later sending. -//! -//! @param buff pointer to buffer to send. -//! @param blen length of buffer. -//! -//! @return >=0 number of bytes sent. -//! < 0 an error or occurred. -//----------------------------------------------------------------------------- - -int Send(const char *buff, int blen); - -//----------------------------------------------------------------------------- -//! Send data on a link. This calls may block unless the socket was marked -//! nonblocking. If a block would occur, the data is copied for later sending. -//! -//! @param iov pointer to the message vector. -//! @param iocnt number of iov elements in the vector. -//! @param bytes the sum of the sizes in the vector. -//! -//! @return >=0 number of bytes sent. -//! < 0 an error occurred. -//----------------------------------------------------------------------------- - -int Send(const struct iovec *iov, int iocnt, int bytes=0); - -//----------------------------------------------------------------------------- -//! Send data on a link using sendfile(). This call always blocks until all -//! data is sent. It should only be called if sfOK is true (see below). -//! -//! @param sdP pointer to the sendfile vector. -//! @param sdn number of elements in the vector. -//! -//! @return >=0 number of bytes sent. -//! < 0 an error occurred. -//----------------------------------------------------------------------------- - -static bool sfOK; // True if Send(sfVec) enabled - -typedef XrdOucSFVec sfVec; - -int Send(const sfVec *sdP, int sdn); // Iff sfOK is true - -//----------------------------------------------------------------------------- -//! Wait for all outstanding requests to be completed on the link. -//----------------------------------------------------------------------------- - -void Serialize(); - -//----------------------------------------------------------------------------- -//! Set an error indication on he link. -//! -//! @param text a message describing the error. -//! -//! @return =0 message set, the link is considered in error. -//! -1 the message pointer was nil. -//----------------------------------------------------------------------------- - -int setEtext(const char *text); - -//----------------------------------------------------------------------------- -//! Set the client's link identity. -//! -//! @param userid pointer to the client's username. -//! @param procid the client's process id (i.e. pid). -//----------------------------------------------------------------------------- - -void setID(const char *userid, int procid); - -//----------------------------------------------------------------------------- -//! Set the client's location. -//! -//! @param loc reference to the location information. -//----------------------------------------------------------------------------- - -void setLocation(XrdNetAddrInfo::LocInfo &loc); - -//----------------------------------------------------------------------------- -//! Set the link to be non-blocking. -//! -//! @return true mode has been set. -//! @return false mode is not supported for this operating system. -//----------------------------------------------------------------------------- - -bool setNB(); - -//----------------------------------------------------------------------------- -//! Set the link's protocol. -//! -//! @param pp pointer to the protocol object. -//! @param runit if true, starts running the protocol. -//! @param push if true, pushes current protocol to be the alternate one. -//! -//! @return pointer to the previous protocol (may be nil). -//----------------------------------------------------------------------------- - -XrdProtocol *setProtocol(XrdProtocol *pp, bool runit=false, bool push=false); - -//----------------------------------------------------------------------------- -//! Set the link's protocol name. -//! -//! @param name name of he protocol being used. The storage must be -//! valid for the duration of the program. -//----------------------------------------------------------------------------- - -void setProtName(const char *name); - -//----------------------------------------------------------------------------- -//! Set the link's parallel usage count. -//! -//! @param cnt should be 1 to increased the count and -1 to decrease it. -//----------------------------------------------------------------------------- - -void setRef(int cnt); - -//----------------------------------------------------------------------------- -//! Enable or disable TLS on the link. -// -//! @param enable if true, TLS is enabled if not already enabled. Otherwise, -//! TLS is disabled and the TLS logical connection torn down. -//! statistics may be contradictory as they are collected async. -//! @param ctx The context to use when enabling TLS. When nil, the default -//! context is used. -//! -//! @return True if successful, false otherwise. -//----------------------------------------------------------------------------- - -bool setTLS(bool enable, XrdTlsContext *ctx=0); - -//----------------------------------------------------------------------------- -//! Shutdown the link but otherwise keep it intact. -//! -//! @param getLock if true, the operation is performed under a lock. -//----------------------------------------------------------------------------- - -void Shutdown(bool getLock); - -//----------------------------------------------------------------------------- -//! Obtain link statistics. -//! -//! @param buff pointer to the buffer for the xml statistics. -//! @param blen length of the buffer. -//! @param do_sync if true, the statistics self-consistent. Otherwise, the -//! statistics may be contradictory as they are collected async. -//! -//! @return number of bytes placed in the buffer excluding the null byte. -//----------------------------------------------------------------------------- - -static int Stats(char *buff, int blen, bool do_sync=0); - -//----------------------------------------------------------------------------- -//! Add all local statistics to the global counters. -//! -//! @param ctime if not nil, return the total connect time in seconds. -//----------------------------------------------------------------------------- - -void syncStats(int *ctime=0); - -//----------------------------------------------------------------------------- -//! Terminate a connection. -//! -//! @param owner pointer to the link ID representing a client who made -//! the connection to be terminated. If nil then this is a -//! request for the link to terminate another link, if possible. -//! @param fdnum the file descriptor number of the link to be terminated. -//! @param inst the link's instance number. -//! -//! @return >0 caller should wait this number of seconds and try again. -//! @return =0 link terminated. -//! @return <0 link could not be terminated: -//! -EACCES the links was not created by the passed owner. -//! -EPIPE link already being terminated. -//! -ESRCH fdnum does not refer to a link. -//! -ETIME unsuccessful, too many tries. -//----------------------------------------------------------------------------- - -int Terminate(const char *owner, int fdnum, unsigned int inst); - -//----------------------------------------------------------------------------- -//! Return the time the link was made active (i.e. time of connection). -//----------------------------------------------------------------------------- - -time_t timeCon() const; - -//----------------------------------------------------------------------------- -//! Return link's reference count. -//----------------------------------------------------------------------------- - -int UseCnt() const; - -//----------------------------------------------------------------------------- -//! Mark this link as an in-memory communications bridge (internal use only). -//----------------------------------------------------------------------------- - -void armBridge(); - -//----------------------------------------------------------------------------- -//! Determine if this link is a bridge. -//! -//! @return true this link is a bridge. -//! @return false this link is a plain old link. -//----------------------------------------------------------------------------- - -bool hasBridge() const {return isBridged;} - -//----------------------------------------------------------------------------- -//! Determine if this link is using TLS. -//! -//! @return true this link is using TLS. -//! @return false this link not using TLS. -//----------------------------------------------------------------------------- - -bool hasTLS() const {return isTLS;} - -//----------------------------------------------------------------------------- -//! Return TLS protocol version being used. -//! -//! @return The TLS protocol version number. If the link is not using TLS, -//! a null string is returned; -//----------------------------------------------------------------------------- - -const char *verTLS(); - -//----------------------------------------------------------------------------- -//! Constructor -//! -//! @param lxq Reference to the implementation. -//----------------------------------------------------------------------------- - - XrdLink(XrdLinkXeq &lxq); - -protected: - ~XrdLink() {} // Is never deleted! - -void DoIt(); // This is an override of XrdJob::DoIt. -void ResetLink(); -int Wait4Data(int timeout); - -void *rsvd1[3]; // Reserved for future use -XrdLinkXeq &linkXQ; // The implementation -char *HostName; // Pointer to the hostname -unsigned int Instance; // Instance number of this object -bool isBridged; // If true, this link is an in-memory bridge -bool isTLS; // If true, this link uses TLS for all I/O -char rsvd2[2]; -}; -#endif diff --git a/test/binary/usr/include/xrootd/Xrd/XrdLinkMatch.hh b/test/binary/usr/include/xrootd/Xrd/XrdLinkMatch.hh deleted file mode 100644 index 1bd36e5ad..000000000 --- a/test/binary/usr/include/xrootd/Xrd/XrdLinkMatch.hh +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __LINK_MATCH__ -#define __LINK_MATCH__ -/******************************************************************************/ -/* */ -/* X r d L i n k M a t c h . h h */ -/* */ -/* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -class XrdLinkMatch -{ -public: - - -int Match(const char *uname, int unlen, - const char *hname, int hnlen); -inline int Match(const char *uname, int unlen, - const char *hname) - {return Match(uname, unlen, hname, strlen(hname));} - -// Target: [][*][@[][*][]] -// - void Set(const char *target); - - XrdLinkMatch(const char *target=0) - {Uname = HnameL = HnameR = 0; - Unamelen = Hnamelen = 0; - if (target) Set(target); - } - - ~XrdLinkMatch() {} - -private: - -char Buff[256]; -int Unamelen; -char *Uname; -int HnamelenL; -char *HnameL; -int HnamelenR; -char *HnameR; -int Hnamelen; -}; -#endif diff --git a/test/binary/usr/include/xrootd/Xrd/XrdProtocol.hh b/test/binary/usr/include/xrootd/Xrd/XrdProtocol.hh deleted file mode 100644 index 297cd29b2..000000000 --- a/test/binary/usr/include/xrootd/Xrd/XrdProtocol.hh +++ /dev/null @@ -1,221 +0,0 @@ -#ifndef __XrdProtocol_H__ -#define __XrdProtocol_H__ -/******************************************************************************/ -/* */ -/* X r d P r o t o c o l . h h */ -/* */ -/*(c) 2004-18 By the Board of Trustees of the Leland Stanford, Jr., University*/ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "Xrd/XrdJob.hh" - -/******************************************************************************/ -/* X r d P r o t o c o l _ C o n f i g */ -/******************************************************************************/ - -// The following class is passed to the XrdgetProtocol() and XrdgetProtocolPort() -// functions to properly configure the protocol. This object is not stable and -// the protocol must copy out any values it desires to keep. It may copy the -// whole object using the supplied copy constructor. - -class XrdSysError; -union XrdNetSockAddr; -class XrdOucEnv; -class XrdOucString; -class XrdBuffManager; -class XrdInet; -class XrdScheduler; -class XrdStats; -class XrdTlsContext; - -struct sockaddr; - -class XrdProtocol_Config -{ -public: - -// The following pointers may be copied; they are stable. -// -XrdSysError *eDest; // Stable -> Error Message/Logging Handler -XrdInet *NetTCP; // Stable -> Network Object (@ XrdgetProtocol) -XrdBuffManager *BPool; // Stable -> Buffer Pool Manager -XrdScheduler *Sched; // Stable -> System Scheduler -XrdStats *Stats; // Stable -> System Statistics (@ XrdgetProtocol) -XrdOucEnv *theEnv; // Stable -> Additional environmental information -void *rsvd0; - -// The following information must be duplicated; it is unstable. -// -char *ConfigFN; // -> Configuration file -int Format; // Binary format of this server -int Port; // Port number -int WSize; // Window size for Port -int rsvd1; -const char *AdmPath; // Admin path -int AdmMode; // Admin path mode -int xrdFlags; -static const int admPSet = 0x00000001; // The adminppath was set via cli - -const char *myInst; // Instance name -const char *myName; // Host name -const char *myProg; // Program name -union { -const -XrdNetSockAddr *urAddr; // Host Address (the actual structure/union) -const -struct sockaddr *myAddr; // Host address - }; -int ConnMax; // Max connections -int readWait; // Max milliseconds to wait for data -int idleWait; // Max milliseconds connection may be idle -int argc; // Number of arguments -char **argv; // Argument array (prescreened) -char DebugON; // True if started with -d option -char rsvd3[7]; -int hailWait; // Max milliseconds to wait for data after accept -int tlsPort; // Default TLS port (0 if not specified) -XrdTlsContext *tlsCtx; // Stable -> TLS Context (0 if not initialized) -XrdOucString *totalCF; // Stable -> total config after full init - - XrdProtocol_Config(XrdProtocol_Config &rhs) =delete; - XrdProtocol_Config() : rsvd0(0), rsvd1(0) - {memset(rsvd3, 0, sizeof(rsvd3));} - ~XrdProtocol_Config() {} -}; - -/******************************************************************************/ -/* X r d P r o t o c o l */ -/******************************************************************************/ - -// This class is used by the Link object to process the input stream on a link. -// At least one protocol object exists per Link object. Specific protocols are -// derived from this pure abstract class since a link can use one of several -// protocols. Indeed, startup and shutdown are handled by specialized protocols. - -// System configuration obtains an instance of a protocol by calling -// XrdgetProtocol(), which must exist in the shared library. -// This instance is used as the base pointer for Alloc(), Configure(), and -// Match(). Unfortuantely, they cannot be static given the silly C++ rules. - -class XrdLink; - -class XrdProtocol : public XrdJob -{ -public: - -// Match() is invoked when a new link is created and we are trying -// to determine if this protocol can handle the link. It must -// return a protocol object if it can and NULL (0), otherwise. -// -virtual XrdProtocol *Match(XrdLink *lp) = 0; - -// Process() is invoked when a link has data waiting to be read -// -virtual int Process(XrdLink *lp) = 0; - -// Recycle() is invoked when this object is no longer needed. The method is -// passed the number of seconds the protocol was connected to the -// link and the reason for the disconnection, if any. -// -virtual void Recycle(XrdLink *lp=0,int consec=0,const char *reason=0)=0; - -// Stats() is invoked when we need statistics about all instances of the -// protocol. If a buffer is supplied, it must return a null -// terminated string in the supplied buffer and the return value -// is the number of bytes placed in the buffer defined by C99 for -// snprintf(). If no buffer is supplied, the method should return -// the maximum number of characters that could have been returned. -// Regardless of the buffer value, if do_sync is true, the method -// should include any local statistics in the global data (if any) -// prior to performing any action. -// -virtual int Stats(char *buff, int blen, int do_sync=0) = 0; - - XrdProtocol(const char *jname): XrdJob(jname) {} -virtual ~XrdProtocol() {} -}; - -/******************************************************************************/ -/* X r d g e t P r o t o c o l */ -/******************************************************************************/ - -/* This extern "C" function must be defined in the shared library plug-in - implementing your protocol. It is called to obtain an instance of your - protocol. This allows protocols to live outside of the protocol driver - (i.e., to be loaded at run-time). The call is made after the call to - XrdgetProtocolPort() to determine the port to be used (see below) which - allows e network object (NetTCP) to be proerly defined and it's pointer - is passed in the XrdProtocol_Config object for your use. - - Required return values: - Success: Pointer to XrdProtocol object. - Failure: Null pointer (i.e. 0) which causes the program to exit. - -extern "C" // This is in a comment! -{ - XrdProtocol *XrdgetProtocol(const char *protocol_name, char *parms, - XrdProtocol_Config *pi) {....} -} -*/ - -/******************************************************************************/ -/* X r d g e t P r o t o c o l P o r t */ -/******************************************************************************/ - -/* This extern "C" function must be defined for statically linked protocols - but is optional for protocols defined as a shared library plug-in if the - rules determining which port number to use is sufficient for your protocol. - The function is called to obtain the actual port number to be used by the - the protocol. The default port number is noted in XrdProtocol_Config Port. - Initially, it has one of the fllowing values: - <0 -> No port was specified. - =0 -> An erbitrary port will be assigned. - >0 -> This port number was specified. - - XrdgetProtoclPort() must return: - <0 -> Failure is indicated and we terminate - =0 -> Use an arbitrary port (even if this equals Port) - >0 -> The returned port number must be used (even if it equals Port) - - When we finally call XrdgetProtocol(), the actual port number is indicated - in Port and the network object is defined in NetTCP and bound to the port. - - Final Caveats: 1. The network object (NetTCP) is not defined until - XrdgetProtocol() is called. - - 2. The statistics object (Stats) is not defined until - XrdgetProtocol() is called. - - 3. When the protocol is loaded from a shared library, you need - need not define XrdgetProtocolPort() if the standard port - determination scheme is sufficient. - -extern "C" // This is in a comment! -{ - int XrdgetProtocolPort(const char *protocol_name, char *parms, - XrdProtocol_Config *pi) {....} -} -*/ -#endif diff --git a/test/binary/usr/include/xrootd/Xrd/XrdScheduler.hh b/test/binary/usr/include/xrootd/Xrd/XrdScheduler.hh deleted file mode 100644 index 5986a26ca..000000000 --- a/test/binary/usr/include/xrootd/Xrd/XrdScheduler.hh +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef ___XRD_SCHED_H___ -#define ___XRD_SCHED_H___ -/******************************************************************************/ -/* */ -/* X r d S c h e d u l e r . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -#include "XrdSys/XrdSysPthread.hh" -#include "Xrd/XrdJob.hh" - -class XrdOucTrace; -class XrdSchedulerPID; -class XrdSysError; -class XrdSysTrace; - -#define MAX_SCHED_PROCS 30000 - -class XrdScheduler : public XrdJob -{ -public: - -int Active() {return num_Workers - idl_Workers + num_JobsinQ;} - -void Cancel(XrdJob *jp); - -inline int canStick() {return num_Workers < stk_Workers - || (num_Workers-idl_Workers) < stk_Workers;} - -void DoIt(); - -pid_t Fork(const char *id); - -void *Reaper(); - -void Run(); - -void Schedule(XrdJob *jp); -void Schedule(int num, XrdJob *jfirst, XrdJob *jlast); -void Schedule(XrdJob *jp, time_t atime); - -void setParms(int minw, int maxw, int avlt, int maxi, int once=0); - -void Start(); - -int Stats(char *buff, int blen, int do_sync=0); - -void TimeSched(); - -// Statistical information -// -int num_TCreate; // Number of threads created -int num_TDestroy;// Number of threads destroyed -int num_Jobs; // Number of jobs scheduled -int max_QLength; // Longest queue length we had -int num_Limited; // Number of times max was reached - -// This is the preferred constructor -// - XrdScheduler(XrdSysError *eP, XrdSysTrace *tP, - int minw=8, int maxw=8192, int maxi=780); - -// This constructor is only maintained for ABI compatibility and will be -// removed in a future major release. While syntactically compatible the -// sematics now are slightly different and tracing might not occur. -// - XrdScheduler(XrdSysError *eP, XrdOucTrace *tP, - int minw=8, int maxw=8192, int maxi=780); - -// This constructor is used for a stand-alone scheduler. -// - XrdScheduler(int minw=3, int maxw=128, int maxi=12); - - ~XrdScheduler(); - -private: -XrdSysError *XrdLog; -XrdSysTrace *XrdTrace; -XrdOucTrace *XrdTraceOld; // This is only used for ABI compatibility - -XrdSysMutex DispatchMutex; // Disp: Protects above area -int idl_Workers; // Disp: Number of idle workers - -int min_Workers; // Sched: Min threads we need to have -int max_Workers; // Sched: Max threads we can start -int max_Workidl; // Sched: Max idle time for threads above min_Workers -int num_Workers; // Sched: Number of threads we have -int stk_Workers; // Sched: Number of sticky workers we can have -int num_JobsinQ; // Sched: Number of outstanding jobs in the queue -int num_Layoffs; // Sched: Number of threads to terminate - -XrdJob *WorkFirst; // Pending work -XrdJob *WorkLast; -XrdSysSemaphore WorkAvail; -XrdSysMutex SchedMutex; // Protects private area - -XrdJob *TimerQueue; // Pending work -XrdSysCondVar TimerRings; -XrdSysMutex TimerMutex; // Protects scheduler area - -XrdSchedulerPID *firstPID; -XrdSysMutex ReaperMutex; - -void Boot(XrdSysError *eP, XrdSysTrace *tP, int minw, int maxw, int maxi); -void hireWorker(int dotrace=1); -void Init(int minw, int maxw, int maxi); -void Monitor(); -void traceExit(pid_t pid, int status); -static const char *TraceID; -}; -#endif diff --git a/test/binary/usr/include/xrootd/Xrd/XrdTcpMonPin.hh b/test/binary/usr/include/xrootd/Xrd/XrdTcpMonPin.hh deleted file mode 100644 index bdaa83b1c..000000000 --- a/test/binary/usr/include/xrootd/Xrd/XrdTcpMonPin.hh +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __XRDTCPMONPIN_H__ -#define __XRDTCPMONPIN_H__ -/******************************************************************************/ -/* */ -/* X r d T c p M o n P i n . h h */ -/* */ -/* (c) 2020 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -/*! This class defines the XrdLink TCP post monitoring plugin. This plugin is - used to generate additional moinitoring information, as needed, when the - connection is about to be closed. The plugin should use the g-stream object - recorded in the passed environment. If not found, the getInstance() method - should return failure as this plugin should not be loaded unless such an - object exists in the environment. You get the g-stream object specific - to this plugin by executing the following (assume envR is the environment): - - @code {.cpp} - XrdXrootdGStream *gS = (XrdXrootdGStream *)envR.GetPtr("TcpMon.gStream*"); - @endcode -*/ - -class XrdTcpMonPin -{ -public: - -//------------------------------------------------------------------------------ -//! Produce monitoring information upon connection termination. -//! -//! @param netInfo Reference to the network object associated with link. -//! @param lnkInfo Reference to link-specific information. -//! @param liLen Byte length of lnkInfo being passed. -//------------------------------------------------------------------------------ - -struct LinkInfo - {const char *tident; //!< Pointer to the client's trace identifier - int fd; //!< Socket file descriptor - int consec; //!< Seconds connected - long long bytesIn; //!< Bytes read from the socket - long long bytesOut; //!< Bytes written to the socket - }; - -virtual void Monitor(XrdNetAddrInfo &netInfo, LinkInfo &lnkInfo, int liLen) = 0; - - XrdTcpMonPin() {} -virtual ~XrdTcpMonPin() {} -}; - -/*! An instance of the plugin is obtained by the plugin manager using the - XrdOucPinObject class. The most straightforward way to implement this - is to inherit the XrdOucPinObject class by a class of your choosing - that defines a file level object named TcpMonPin, as follows: - - class myPinObject : public XrdOucPinObject - {public: - - XrdTcpMonPin *getInstance(...) {provide concrete implementation} - - } TcpMonPin; - - see XrdOucPinObject.hh for additional details and the definition of the - getInstance() method. There are many other ways to accomplish this - including inheriting this class along with the XrdTcpMonPin class by - the implementation class. - - You should also specify the compilation version. That is, the XRootD - version you used to compile your plug-in. Declare it as: - - #include "XrdVersion.hh" - XrdVERSIONINFO(TcpMonPin,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ -#endif diff --git a/test/binary/usr/include/xrootd/XrdCks/XrdCks.hh b/test/binary/usr/include/xrootd/XrdCks/XrdCks.hh deleted file mode 100644 index 88ba82af8..000000000 --- a/test/binary/usr/include/xrootd/XrdCks/XrdCks.hh +++ /dev/null @@ -1,336 +0,0 @@ -#ifndef __XRDCKS_HH__ -#define __XRDCKS_HH__ -/******************************************************************************/ -/* */ -/* X r d C k s . h h */ -/* */ -/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "XrdCks/XrdCksData.hh" - -class XrdCks; -class XrdCksCalc; -class XrdOucStream; -class XrdSysError; -class XrdSysPlugin; - -/*! This class defines the checksum management interface. It should be used as - the base class for a plugin. When used that way, the shared library holding - the plugin must define a "C" entry point named XrdCksInit() as described at - the end of this include file. Note that you can also base you plugin on the - native implementation, XrdCks, and replace only selected methods. -*/ - -/******************************************************************************/ -/* X r d C k s P C B */ -/******************************************************************************/ -/*! The XrdCksPCB object defines a callback hat allows he caller to monitor the - progress of a checksum calculation (calc or verify). -*/ - -class XrdCksPCB -{ -public: - -//------------------------------------------------------------------------------ -//! Report checksum progress. -//! @param fsize The file size in bytes. -//! @param csbytes Bytes checksummed so far. -//------------------------------------------------------------------------------ - -virtual void Info(long long fsize, long long csbytes); - -long long rsvd; - - XrdCksPCB() : rsvd(0) {} -virtual ~XrdCksPCB() {} -}; - -/******************************************************************************/ -/* X r d C k s */ -/******************************************************************************/ -//------------------------------------------------------------------------------ -//! @note Filenames passed to any of the manager's methods may be either logical -//! (lfn) or physical (pfn). By default, these are always physical file names. -//! However, it is possible to configure the default manager to use the Oss -//! plugin for all I/O related functions. In this case, a logical filename may -//! be passed if this is required by the Oss plugin as it will translate the -//! logical name to the physical one. See the "ofs.osslib" directive for -//! details. Additionally, when using the default Oss or Pss plugins as the I/O -//! provider, logical file names are always provided to the manager. Note that -//! default manager is automatically configured to accept the correct type of -//! file name. There is no mechanism to do this for a specialized manager. So, -//! it's possible to create a configuration file that requires logical name to -//! be supplied when the manager override only accepts physical ones. -//------------------------------------------------------------------------------ - -class XrdCks -{ -public: - -//------------------------------------------------------------------------------ -//! Calculate a new checksum for a physical file using the checksum algorithm -//! named in the Cks parameter. -//! -//! @param Xfn The logical or physical name of the file to be checksumed. -//! @param Cks For input, it specifies the checksum algorithm to be used. -//! For output, the checksum value is returned upon success. -//! @param doSet When true, the new value must replace any existing value -//! in the Xfn's extended file attributes. -//! @param pcbP In the second form, the pointer to the callback object. -//! A nil pointer does not invoke any callback. -//! -//! @return Success: zero with Cks structure holding the checksum value. -//! Failure: -errno (see significant error numbers below). -//------------------------------------------------------------------------------ -virtual -int Calc( const char *Xfn, XrdCksData &Cks, int doSet=1) = 0; - -virtual -int Calc( const char *Xfn, XrdCksData &Cks, XrdCksPCB *pcbP, int doSet=1) - {(void)pcbP; return Calc(Xfn, Cks, doSet);} - -//------------------------------------------------------------------------------ -//! Delete the checksum from the Xfn's xattrs. -//! -//! @param Xfn The logical or physical name of the file to be checksumed. -//! @param Cks Specifies the checksum type to delete. -//! -//! @return Success: 0 -//! Failure: -errno (see significant error numbers below). -//------------------------------------------------------------------------------ -virtual -int Del( const char *Xfn, XrdCksData &Cks) = 0; - -//------------------------------------------------------------------------------ -//! Retreive the checksum from the Xfn's xattrs and return it and indicate -//! whether or not it is stale (i.e. the file modification has changed or the -//! name and length are not the expected values). -//! -//! @param Xfn The logical or physical name of the file to be checksumed. -//! @param Cks For input, it specifies the checksum type to return. -//! For output, the checksum value is returned upon success. -//! -//! @return Success: The length of the binary checksum in the Cks structure. -//! Failure: -errno (see significant error numbers below). -//------------------------------------------------------------------------------ -virtual -int Get( const char *Xfn, XrdCksData &Cks) = 0; - -//------------------------------------------------------------------------------ -//! Parse a configuration directives specific to the checksum manager. -//! -//! @param Token Points to the directive that triggered the call. -//! @param Line All the characters after the directive. -//! -//! @return Success: 1 -//! Failure: 0 -//------------------------------------------------------------------------------ -virtual -int Config(const char *Token, char *Line) = 0; - -//------------------------------------------------------------------------------ -//! Fully initialize the manager which includes loading any plugins. -//! -//! @param ConfigFN Points to the configuration file path. -//! @param DfltCalc Is the default checksum and should be defaulted if NULL. -//! The default implementation defaults this to adler32. A -//! default is only needed should the checksum name in the -//! XrdCksData object be omitted. -//! -//!@return Success: 1 -//! Failure: 0 -//------------------------------------------------------------------------------ -virtual -int Init(const char *ConfigFN, const char *DfltCalc=0) = 0; - -//------------------------------------------------------------------------------ -//! List names of the checksums associated with a Xfn or all supported ones. -//! -//! @param Xfn The logical or physical file name whose checksum names are -//! to be returned. When Xfn is null, return all supported -//! checksum algorithm names. -//! @param Buff Points to a buffer, at least 64 bytes in length, to hold -//! a "Sep" separated list of checksum names. -//! @param Blen The length of the buffer. -//! @param Sep The separation character to be used between adjacent names. -//! -//! @return Success: Pointer to Buff holding at least one checksum name. -//! Failure: A nil pointer is returned. -//------------------------------------------------------------------------------ -virtual -char *List(const char *Xfn, char *Buff, int Blen, char Sep=' ') = 0; - -//------------------------------------------------------------------------------ -//! Get the name of the checksums associated with a sequence number. Note that -//! Name() may be called prior to final config to see if there are any chksums -//! to configure and avoid unintended errors. -//! -//! @param seqNum The sequence number. Zero signifies the default name. -//! Higher numbers are alternates. -//! @return Success: Pointer to the name. -//! Failure: A nil pointer is returned (no more alternates exist). -//------------------------------------------------------------------------------ -virtual const -char *Name(int seqNum=0) = 0; - -//------------------------------------------------------------------------------ -//! Get a new XrdCksCalc object that can calculate the checksum corresponding to -//! the specified name or the default object if name is a null pointer. The -//! object can be used to compute checksums on the fly. The object's Recycle() -//! method must be used to delete it. -//! -//! @param name The name of the checksum algorithm. If null, use the -//! default one. -//! -//! @return Success: A pointer to the object is returned. -//! Failure: Zero if no corresponding object exists. -//------------------------------------------------------------------------------ -virtual -XrdCksCalc *Object(const char *name) -{ - (void)name; - return 0; -} - -//------------------------------------------------------------------------------ -//! Get the binary length of the checksum with the corresponding name. -//! -//! @param Name The checksum algorithm name. If null, use the default name. -//! -//! @return Success: checksum length. -//! Failure: Zero if the checksum name does not exist. -//------------------------------------------------------------------------------ -virtual -int Size( const char *Name=0) = 0; - -//------------------------------------------------------------------------------ -//! Set a file's checksum in the extended attributes along with the file's mtime -//! and the time of setting. -//! -//! @param Xfn The logical or physical name of the file to be set. -//! @param Cks Specifies the checksum name and value. -//! @param myTime When true then the fmTime and gmTime in the Cks structure -//! are to be used; as opposed to the current time. -//! -//! @return Success: zero is returned. -//! Failure: -errno (see significant error numbers below). -//------------------------------------------------------------------------------ -virtual -int Set( const char *Xfn, XrdCksData &Cks, int myTime=0) = 0; - -//------------------------------------------------------------------------------ -//! Retreive the checksum from the Xfn's xattrs and compare it to the supplied -//! checksum. If the checksum is not available or is stale, a new checksum is -//! calculated and written to the extended attributes. -//! -//! @param Xfn The logical or physical name of the file to be verified. -//! @param Cks Specifies the checksum name and value. -//! @param pcbP In the second form, the pointer to the callback object. -//! A nil pointer does not invoke any callback. -//! -//! @return Success: True -//! Failure: False (the checksums do not match) or -errno indicating -//! that verification could not be performed (see significant -//! error numbers below). -//------------------------------------------------------------------------------ -virtual -int Ver( const char *Xfn, XrdCksData &Cks) = 0; - -virtual -int Ver( const char *Xfn, XrdCksData &Cks, XrdCksPCB *pcbP) - {(void)pcbP; return Ver(Xfn, Cks);} - -//------------------------------------------------------------------------------ -//! Constructor -//------------------------------------------------------------------------------ - - XrdCks(XrdSysError *erP) : eDest(erP) {} - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ -virtual ~XrdCks() {} - -/*! Significant errno values: - - -EDOM The supplied checksum length is invalid for the checksum name. - -ENOTSUP The supplied or default checksum name is not supported. - -ESRCH Checksum does not exist for file. - -ESTALE The file's checksum is no longer valid. -*/ - -protected: - -XrdSysError *eDest; -}; - -/******************************************************************************/ -/* X r d C k s I n i t */ -/******************************************************************************/ - -#define XRDCKSINITPARMS XrdSysError *, const char *, const char * - -//------------------------------------------------------------------------------ -//! Obtain an instance of the checksum manager. -//! -//! XrdCksInit() is an extern "C" function that is called to obtain an instance -//! of a checksum manager object that will be used for all subsequent checksums. -//! This is useful when checksums come from an alternate source (e.g. database). -//! The proxy server uses this mechanism to obtain checksums from the underlying -//! data server. You can also defined plugins for specific checksum calculations -//! (see XrdCksCalc.hh). The function must be defined in the plug-in shared -//! library. All the following extern symbols must be defined at file level! -//! -//! @param eDest-> The XrdSysError object for messages. -//! @param cfn -> The name of the configuration file -//! @param parm -> Parameters specified on the ckslib directive. If none it is -//! zero. -//! -//! @return Success: A pointer to the checksum manager object. -//! Failure: Null pointer which causes initialization to fail. -//------------------------------------------------------------------------------ - -/*! extern "C" XrdCks *XrdCksInit(XrdSysError *eDest, - const char *cFN, - const char *Parms - ); -*/ -//------------------------------------------------------------------------------ -//! Declare the compilation version number. -//! -//! Additionally, you *should* declare the xrootd version you used to compile -//! your plug-in. While not currently required, it is highly recommended to -//! avoid execution issues should the class definition change. Declare it as: -//------------------------------------------------------------------------------ - -/*! #include "XrdVersion.hh" - XrdVERSIONINFO(XrdCksInit,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ -#endif diff --git a/test/binary/usr/include/xrootd/XrdCks/XrdCksAssist.hh b/test/binary/usr/include/xrootd/XrdCks/XrdCksAssist.hh deleted file mode 100644 index ccd9d21a9..000000000 --- a/test/binary/usr/include/xrootd/XrdCks/XrdCksAssist.hh +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef __XRDCKSASSIST_HH__ -#define __XRDCKSASSIST_HH__ -/******************************************************************************/ -/* */ -/* X r d C k s A s s i s t . h h */ -/* */ -/* (c) 2017 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -//------------------------------------------------------------------------------ -//! This header file defines linkages to various XRootD checksum assistants. -//! The functions described here are located in libXrdUtils.so. -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -//! Generate the extended attribute data for a particular checksum that can -//! be used to set the corresponding checksum attribute variable. -//! -//! @param cstype A null terminated string holding the checksum type -//! (e.g. "adler32", "md5", "sha2", etc). -//! @param csval A null terminated string holding the corresonding -//! checksum value. This must be an ASCII hex representation -//! of the value and must be of appropriate length. -//! @param mtime The subject file's modification time. -//! -//! @return A vector of bytes that should be usedto set the attribute variable. -//! If the size of the vector is zero, then the supplied parameters -//! were incorrect and valid data cannot be generated; errno is: -//! EINVAL - csval length is incorrect for checksum type or -//! contains a non-hex digit. -//! ENAMETOOLONG - checksum type is too long. -//! EOVERFLOW - csval could not be represented in the data. -//------------------------------------------------------------------------------ - -extern std::vector XrdCksAttrData(const char *cstype, - const char *csval, time_t mtime); - -//------------------------------------------------------------------------------ -//! Generate the extended attribute variable name for a particular checksum. -//! -//! @param cstype A null terminated string holding the checksum type -//! (e.g. "adler32", "md5", "sha2", etc). -//! @param nspfx Is the namespace prefix to add to the variable name. -//! By default no prefix os used. Certain platforms and/or -//! filesystems require that user attributes start with a -//! particular prefix (e.g. Linux requires 'user.') others -//! do not. If your are going to use the variable name to get -//! or set an attribute you should specify any required -//! prefix. If specified and it does not end with a dot, a -//! dot is automatically added to the nspfx. -//! -//! @return A string holding the variable name that should be used to get or -//! set the extended attribute holding the correspnding checksum. If -//! a null string is returned, the variable could not be generated; -//! errno is set to: -//! ENAMETOOLONG - checksum type is too long. -//------------------------------------------------------------------------------ - -extern std::string XrdCksAttrName(const char *cstype, const char *nspfx=""); - -//------------------------------------------------------------------------------ -//! Extract th checksum value from checksum extended attribute data. -//! -//! @param cstype A null terminated string holding the checksum type -//! (e.g. "adler32", "md5", "sha2", etc). -//! @param csbuff A pointer to a buffer hlding the checksum data. -//! @param csblen The length of the checksum data (i.e. the length of the -//! retrieved extended attribute). -//! -//! @return A string holding the ASCII hexstring correspoding to the checksum -//! value. If a null string is returned then the checksum data was -//! invalid or did not correspond to the specified checksum type, the -//! errno is set to: -//! EINVAL - the checksum length in csbuff is incorrect. -//! EMSGSIZE - csblen was not the expected value. -//! ENOENT - the specified cstype did not match the one in csbuff. -//! EOVERFLOW - checksum value could not be generated from csbuff. -//------------------------------------------------------------------------------ - -extern std::string XrdCksAttrValue(const char *cstype, - const char *csbuff, int csblen); -#endif diff --git a/test/binary/usr/include/xrootd/XrdCks/XrdCksCalc.hh b/test/binary/usr/include/xrootd/XrdCks/XrdCksCalc.hh deleted file mode 100644 index a73f105dc..000000000 --- a/test/binary/usr/include/xrootd/XrdCks/XrdCksCalc.hh +++ /dev/null @@ -1,171 +0,0 @@ -#ifndef __XRDCKSCALC_HH__ -#define __XRDCKSCALC_HH__ -/******************************************************************************/ -/* */ -/* X r d C k s C a l c . h h */ -/* */ -/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -/*! This class defines the interface to a checksum computation. When this class - is used to define a plugin computation, the initial XrdCksCalc computation - object is created by the XrdCksCalcInit() function defined at the end of - this file. -*/ - -class XrdCksCalc -{ -public: - -//------------------------------------------------------------------------------ -//! Calculate a one-time checksum. The obvious default implementation is -//! provided and assumes that Init() may be called more than once. -//! -//! @param Buff -> Data to be checksummed. -//! @param BLen -> Length of the data in Buff. -//! -//! @return the checksum value in binary format. The pointer to the value -//! becomes invalid once the associated object is deleted. -//------------------------------------------------------------------------------ - -virtual char *Calc(const char *Buff, int BLen) - {Init(); Update(Buff, BLen); return Final();} - -//------------------------------------------------------------------------------ -//! Get the current binary checksum value (defaults to final). However, the -//! final checksum result is not affected. -//! -//! @return the checksum value in binary format. The pointer to the value -//! becomes invalid once the associated object is deleted. -//------------------------------------------------------------------------------ - -virtual char *Current() {return Final();} - -//------------------------------------------------------------------------------ -//! Get the actual checksum in binary format. -//! -//! @return the checksum value in binary format. The pointer to the value -//! becomes invalid once the associated object is deleted. -//------------------------------------------------------------------------------ - -virtual char *Final() = 0; - -//------------------------------------------------------------------------------ -//! Initializes data structures (must be called by constructor). This is always -//! called to reuse the object for a new checksum. -//------------------------------------------------------------------------------ - -virtual void Init() = 0; - -//------------------------------------------------------------------------------ -//! Get a new instance of the underlying checksum calculation object. -//! -//! @return the checksum calculation object. -//------------------------------------------------------------------------------ -virtual -XrdCksCalc *New() = 0; - -//------------------------------------------------------------------------------ -//! Recycle the checksum object as it is no longer needed. A default is given. -//------------------------------------------------------------------------------ - -virtual void Recycle() {delete this;} - -//------------------------------------------------------------------------------ -//! Get the checksum object algorithm name and the number bytes (i.e. size) -//! required for the checksum value. -//! -//! @param csSize -> Parameter to hold the size of the checksum value. -//! -//! @return the checksum algorithm's name. The name persists event after the -//! checksum object is deleted. -//------------------------------------------------------------------------------ - -virtual const char *Type(int &csSize) = 0; - -//------------------------------------------------------------------------------ -//! Compute a running checksum. This method may be called repeatedly for data -//! segments; with Final() returning the full checksum. -//! -//! @param Buff -> Data to be checksummed. -//! @param BLen -> Length of the data in Buff. -//------------------------------------------------------------------------------ - -virtual void Update(const char *Buff, int BLen) = 0; - -//------------------------------------------------------------------------------ -//! Constructor -//------------------------------------------------------------------------------ - - XrdCksCalc() {} - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - -virtual ~XrdCksCalc() {} -}; - -/******************************************************************************/ -/* C h e c k s u m O b j e c t C r e a t o r */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! Obtain an instance of the checksum calculation object. -//! -//! XrdCksCalcInit() is an extern "C" function that is called to obtain an -//! initial instance of a checksum calculation object. You may create custom -//! checksum calculation and use them as plug-ins to the checksum manager -//! (see XrdCks.hh). The function must be defined in the plug-in shared library. -//! All the following extern symbols must be defined at file level! -//! -//! @param eDest -> The XrdSysError object for messages. -//! @param csName -> The name of the checksum algorithm. -//! @param cFN -> The name of the configuration file -//! @param Parms -> Parameters specified on the ckslib directive. If none it is -//! zero. -//------------------------------------------------------------------------------ - -/*! extern "C" XrdCksCalc *XrdCksCalcInit(XrdSysError *eDest, - const char *csName, - const char *cFN, - const char *Parms); -*/ - -//------------------------------------------------------------------------------ -//! Declare the compilation version number. -//! -//! Additionally, you *should* declare the xrootd version you used to compile -//! your plug-in. While not currently required, it is highly recommended to -//! avoid execution issues should the class definition change. Declare it as: -//------------------------------------------------------------------------------ - -/*! #include "XrdVersion.hh" - XrdVERSIONINFO(XrdCksCalcInit,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ -#endif diff --git a/test/binary/usr/include/xrootd/XrdCks/XrdCksData.hh b/test/binary/usr/include/xrootd/XrdCks/XrdCksData.hh deleted file mode 100644 index 6ba8f27f1..000000000 --- a/test/binary/usr/include/xrootd/XrdCks/XrdCksData.hh +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef __XRDCKSDATA_HH__ -#define __XRDCKSDATA_HH__ -/******************************************************************************/ -/* */ -/* X r d C k s D a t a . h h */ -/* */ -/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include - -class XrdOucEnv; - -class XrdCksData -{ -public: - -static const int NameSize = 16; // Max name length is NameSize - 1 -static const int ValuSize = 64; // Max value length is 512 bits - -char Name[NameSize]; // Checksum algorithm name -union { -long long fmTime; // Out: File's mtime when checksum was computed. -XrdOucEnv*envP; // In: Set for get & calc, only! - }; -int csTime; // Delta from fmTime when checksum was computed. -short Rsvd1; // Reserved field -char Rsvd2; // Reserved field -char Length; // Length, in bytes, of the checksum value -char Value[ValuSize]; // The binary checksum value - -inline -int operator==(const XrdCksData &oth) - {return (!strncmp(Name, oth.Name, NameSize) - && Length == oth.Length - && !memcmp(Value, oth.Value, Length)); - } - -inline -int operator!=(const XrdCksData &oth) - {return (strncmp(Name, oth.Name, NameSize) - || Length != oth.Length - || memcmp(Value, oth.Value, Length)); - } - -int Get(char *Buff, int Blen) - {const char *hv = "0123456789abcdef"; - int i, j = 0; - if (Blen < Length*2+1) return 0; - for (i = 0; i < Length; i++) - {Buff[j++] = hv[(Value[i] >> 4) & 0x0f]; - Buff[j++] = hv[ Value[i] & 0x0f]; - } - Buff[j] = '\0'; - return Length*2; - } - -int Set(const char *csName) - {size_t len = strlen(csName); - if (len >= sizeof(Name)) return 0; - memcpy(Name, csName, len); - Name[len]=0; - return 1; - } - -int Set(const void *csVal, int csLen) - {if (csLen > ValuSize || csLen < 1) return 0; - memcpy(Value, csVal, csLen); - Length = csLen; - return 1; - } - -int Set(const char *csVal, int csLen) - {int n, i = 0, Odd = 0; - if (csLen > (int)sizeof(Value)*2 || (csLen & 1)) return 0; - Length = csLen/2; - while(csLen--) - { if (*csVal >= '0' && *csVal <= '9') n = *csVal-48; - else if (*csVal >= 'a' && *csVal <= 'f') n = *csVal-87; - else if (*csVal >= 'A' && *csVal <= 'F') n = *csVal-55; - else return 0; - if (Odd) Value[i++] |= n; - else Value[i ] = n << 4; - csVal++; Odd = ~Odd; - } - return 1; - } - - void Reset() - {memset(Name, 0, sizeof(Name)); - memset(Value,0, sizeof(Value)); - fmTime = 0; - csTime = 0; - Rsvd1 = 0; - Rsvd2 = 0; - Length = 0; - } - - XrdCksData() - {Reset();} - -bool HasValue() - { - return *Value; - } -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdCks/XrdCksManager.hh b/test/binary/usr/include/xrootd/XrdCks/XrdCksManager.hh deleted file mode 100644 index 0c03b210c..000000000 --- a/test/binary/usr/include/xrootd/XrdCks/XrdCksManager.hh +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef __XRDCKSMANAGER_HH__ -#define __XRDCKSMANAGER_HH__ -/******************************************************************************/ -/* */ -/* X r d C k s M a n a g e r . h h */ -/* */ -/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "sys/types.h" - -#include "XrdCks/XrdCks.hh" -#include "XrdCks/XrdCksData.hh" - -/* This class defines the checksum management interface. It may also be used - as the base class for a plugin. This allows you to replace selected methods - which may be needed for handling certain filesystems (see protected ones). -*/ - -class XrdCksCalc; -class XrdCksLoader; -class XrdSysError; -struct XrdVersionInfo; - -class XrdCksManager : public XrdCks -{ -public: -virtual int Calc( const char *Pfn, XrdCksData &Cks, int doSet=1); - -virtual int Config(const char *Token, char *Line); - -virtual int Del( const char *Pfn, XrdCksData &Cks); - -virtual int Get( const char *Pfn, XrdCksData &Cks); - -virtual int Init(const char *ConfigFN, const char *AddCalc=0); - -virtual char *List(const char *Pfn, char *Buff, int Blen, char Sep=' '); - -virtual const char *Name(int seqNum=0); - -virtual XrdCksCalc *Object(const char *name); - -virtual int Size( const char *Name=0); - -virtual int Set( const char *Pfn, XrdCksData &Cks, int myTime=0); - -virtual int Ver( const char *Pfn, XrdCksData &Cks); - - XrdCksManager(XrdSysError *erP, int iosz, - XrdVersionInfo &vInfo, bool autoload=false); -virtual ~XrdCksManager(); - -protected: - -/* Calc() returns 0 if the checksum was successfully calculated using the - supplied CksObj and places the file's modification time in MTime. - Otherwise, it returns -errno. The default implementation uses - open(), fstat(), mmap(), and unmap() to calculate the results. -*/ -virtual int Calc(const char *Pfn, time_t &MTime, XrdCksCalc *CksObj); - -/* ModTime() returns 0 and places file's modification time in MTime. Otherwise, - it return -errno. The default implementation uses stat(). -*/ -virtual int ModTime(const char *Pfn, time_t &MTime); - -private: - -struct csInfo - {char Name[XrdCksData::NameSize]; - XrdCksCalc *Obj; - char *Path; - char *Parms; - XrdSysPlugin *Plugin; - int Len; - bool doDel; - csInfo() : Obj(0), Path(0), Parms(0), Plugin(0), Len(0), - doDel(true) - {memset(Name, 0, sizeof(Name));} - }; - -int Config(const char *cFN, csInfo &Info); -csInfo *Find(const char *Name); - -static const int csMax = 8; -csInfo csTab[csMax]; -int csLast; -int segSize; -XrdCksLoader *cksLoader; -XrdVersionInfo &myVersion; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdCks/XrdCksWrapper.hh b/test/binary/usr/include/xrootd/XrdCks/XrdCksWrapper.hh deleted file mode 100644 index dc87f552c..000000000 --- a/test/binary/usr/include/xrootd/XrdCks/XrdCksWrapper.hh +++ /dev/null @@ -1,301 +0,0 @@ -#ifndef __XRDCKSWRAPPER_HH__ -#define __XRDCKSWRAPPER_HH__ -/******************************************************************************/ -/* */ -/* X r d C k s W r a p p e r . h h */ -/* */ -/* (c) 2021 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "XrdCks/XrdCks.hh" - -class XrdCksCalc; -class XrdCksData; -class XrdOucEnv; -class XrdOucStream; -class XrdSysError; - -/*! This class defines the wrapper for the checksum management interface. - It should be used as the base class for a stacked plugin. When used that - way, the shared library holding the plugin must define a "C" entry point - named XrdCksAdd2() as described at the end of this include file. Note - you pass a reference to the previous plugin-in in the plug-in chain as a - constructor argument as supplied to the XrdCksAdd2() function. - Override the methods you wish to wrap. Methods that are not overridden - are forwarded to the previous plug-in. -*/ - -class XrdCksWrapper : public XrdCks -{ -public: - -//------------------------------------------------------------------------------ -//! Calculate a new checksum for a physical file using the checksum algorithm -//! named in the Cks parameter. -//! -//! @param Xfn The logical or physical name of the file to be checksumed. -//! @param Cks For input, it specifies the checksum algorithm to be used. -//! For output, the checksum value is returned upon success. -//! @param doSet When true, the new value must replace any existing value -//! in the Xfn's extended file attributes. -//! @param pcbP In the second form, the pointer to the callback object. -//! A nil pointer does not invoke any callback. -//! -//! @return Success: zero with Cks structure holding the checksum value. -//! Failure: -errno (see significant error numbers below). -//------------------------------------------------------------------------------ -virtual -int Calc( const char *Xfn, XrdCksData &Cks, int doSet=1) - {return cksPI.Calc(Xfn, Cks, doSet);} - -virtual -int Calc( const char *Xfn, XrdCksData &Cks, XrdCksPCB *pcbP, int doSet=1) - {(void)pcbP; return Calc(Xfn, Cks, doSet);} - -//------------------------------------------------------------------------------ -//! Delete the checksum from the Xfn's xattrs. -//! -//! @param Xfn The logical or physical name of the file to be checksumed. -//! @param Cks Specifies the checksum type to delete. -//! -//! @return Success: 0 -//! Failure: -errno (see significant error numbers below). -//------------------------------------------------------------------------------ -virtual -int Del( const char *Xfn, XrdCksData &Cks) - {return cksPI.Del(Xfn, Cks);} - -//------------------------------------------------------------------------------ -//! Retreive the checksum from the Xfn's xattrs and return it and indicate -//! whether or not it is stale (i.e. the file modification has changed or the -//! name and length are not the expected values). -//! -//! @param Xfn The logical or physical name of the file to be checksumed. -//! @param Cks For input, it specifies the checksum type to return. -//! For output, the checksum value is returned upon success. -//! -//! @return Success: The length of the binary checksum in the Cks structure. -//! Failure: -errno (see significant error numbers below). -//------------------------------------------------------------------------------ -virtual -int Get( const char *Xfn, XrdCksData &Cks) - {return cksPI.Get(Xfn, Cks);} - -//------------------------------------------------------------------------------ -//! Parse a configuration directives specific to the checksum manager. -//! -//! @param Token Points to the directive that triggered the call. -//! @param Line All the characters after the directive. -//! -//! @return Success: 1 -//! Failure: 0 -//------------------------------------------------------------------------------ -virtual -int Config(const char *Token, char *Line) - {return cksPI.Config(Token, Line);} - -//------------------------------------------------------------------------------ -//! Fully initialize the manager which includes loading any plugins. -//! -//! @param ConfigFN Points to the configuration file path. -//! @param DfltCalc Is the default checksum and should be defaulted if NULL. -//! The default implementation defaults this to adler32. A -//! default is only needed should the checksum name in the -//! XrdCksData object be omitted. -//! -//!@return Success: 1 -//! Failure: 0 -//------------------------------------------------------------------------------ -virtual -int Init(const char *ConfigFN, const char *DfltCalc=0) - {return cksPI.Init(ConfigFN, DfltCalc);} - -//------------------------------------------------------------------------------ -//! List names of the checksums associated with a Xfn or all supported ones. -//! -//! @param Xfn The logical or physical file name whose checksum names are -//! to be returned. When Xfn is null, return all supported -//! checksum algorithm names. -//! @param Buff Points to a buffer, at least 64 bytes in length, to hold -//! a "Sep" separated list of checksum names. -//! @param Blen The length of the buffer. -//! @param Sep The separation character to be used between adjacent names. -//! -//! @return Success: Pointer to Buff holding at least one checksum name. -//! Failure: A nil pointer is returned. -//------------------------------------------------------------------------------ -virtual -char *List(const char *Xfn, char *Buff, int Blen, char Sep=' ') - {return cksPI.List(Xfn, Buff, Blen, Sep);} - -//------------------------------------------------------------------------------ -//! Get the name of the checksums associated with a sequence number. Note that -//! Name() may be called prior to final config to see if there are any chksums -//! to configure and avoid unintended errors. -//! -//! @param seqNum The sequence number. Zero signifies the default name. -//! Higher numbers are alternates. -//! @return Success: Pointer to the name. -//! Failure: A nil pointer is returned (no more alternates exist). -//------------------------------------------------------------------------------ -virtual const -char *Name(int seqNum=0) {return cksPI.Name(seqNum);} - -//------------------------------------------------------------------------------ -//! Get a new XrdCksCalc object that can calculate the checksum corresponding to -//! the specified name or the default object if name is a null pointer. The -//! object can be used to compute checksums on the fly. The object's Recycle() -//! method must be used to delete it. -//! -//! @param name The name of the checksum algorithm. If null, use the -//! default one. -//! -//! @return Success: A pointer to the object is returned. -//! Failure: Zero if no corresponding object exists. -//------------------------------------------------------------------------------ -virtual -XrdCksCalc *Object(const char *name) {return cksPI.Object(name);} - -//------------------------------------------------------------------------------ -//! Get the binary length of the checksum with the corresponding name. -//! -//! @param Name The checksum algorithm name. If null, use the default name. -//! -//! @return Success: checksum length. -//! Failure: Zero if the checksum name does not exist. -//------------------------------------------------------------------------------ -virtual -int Size( const char *Name=0) {return cksPI.Size(Name);} - -//------------------------------------------------------------------------------ -//! Set a file's checksum in the extended attributes along with the file's mtime -//! and the time of setting. -//! -//! @param Xfn The logical or physical name of the file to be set. -//! @param Cks Specifies the checksum name and value. -//! @param myTime When true then the fmTime and gmTime in the Cks structure -//! are to be used; as opposed to the current time. -//! -//! @return Success: zero is returned. -//! Failure: -errno (see significant error numbers below). -//------------------------------------------------------------------------------ -virtual -int Set( const char *Xfn, XrdCksData &Cks, int myTime=0) - {return cksPI.Set(Xfn, Cks, myTime);} - -//------------------------------------------------------------------------------ -//! Retreive the checksum from the Xfn's xattrs and compare it to the supplied -//! checksum. If the checksum is not available or is stale, a new checksum is -//! calculated and written to the extended attributes. -//! -//! @param Xfn The logical or physical name of the file to be verified. -//! @param Cks Specifies the checksum name and value. -//! @param pcbP In the second form, the pointer to the callback object. -//! A nil pointer does not invoke any callback. -//! -//! @return Success: True -//! Failure: False (the checksums do not match) or -errno indicating -//! that verification could not be performed (see significant -//! error numbers below). -//------------------------------------------------------------------------------ -virtual -int Ver( const char *Xfn, XrdCksData &Cks) - {return cksPI.Ver(Xfn, Cks);} - -virtual -int Ver( const char *Xfn, XrdCksData &Cks, XrdCksPCB *pcbP) - {(void)pcbP; return Ver(Xfn, Cks);} - -//------------------------------------------------------------------------------ -//! Constructor -//! -//! @param prevPI Reference to the antecedent plugin. -//! @param errP Pointer to error message object -//------------------------------------------------------------------------------ - - XrdCksWrapper(XrdCks &prevPI, XrdSysError *errP) - : XrdCks(errP), cksPI(prevPI) {} - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - -virtual ~XrdCksWrapper() {} - -protected: - -XrdCks &cksPI; -}; - -/******************************************************************************/ -/* X r d C k s A d d 2 */ -/******************************************************************************/ - -#define XRDCKSADD2PARMS XrdCks &, XrdSysError *, const char *, \ - const char *, XrdOucEnv * - -//------------------------------------------------------------------------------ -//! Obtain an instance of a stacked checksum manager. -//! -//! XrdCksAdd2() is an extern "C" function that is called to obtain an -//! instance of a stacked checksum manager object that will be used for all -//! subsequent checksums. This function is passed a refernce to the previous -//! checksum manager. Overridden methods should, if appropriate, invoke the -//! previous plug-ins corresponding method to complete the required task. -//! All the following extern symbols must be defined at file level! -//! -//! @param pPI -> Reference to the previous checksum manager plug-in. -//! @param eDest-> The XrdSysError object for messages. -//! @param cFN -> The name of the configuration file -//! @param Parm -> Parameters specified on the ckslib directive. If none it is -//! zero. -//! @param pEnv -> Pointer to environmental information or nil. -//! -//! @return Success: A pointer to the checksum manager object. -//! Failure: Null pointer which causes initialization to fail. -//------------------------------------------------------------------------------ - -/*! extern "C" XrdCks *XrdCksAdd2(XrdCks &pPI, - XrdSysError *eDest, - const char *cFN, - const char *Parm, - XrdOucEnv *envP - ); -*/ -//------------------------------------------------------------------------------ -//! Declare the compilation version number. -//! -//! Additionally, you *should* declare the xrootd version you used to compile -//! your plug-in. While not currently required, it is highly recommended to -//! avoid execution issues should the class definition change. Declare it as: -//------------------------------------------------------------------------------ - -/*! #include "XrdVersion.hh" - XrdVERSIONINFO(XrdCksAdd2,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ -#endif diff --git a/test/binary/usr/include/xrootd/XrdNet/XrdNet.hh b/test/binary/usr/include/xrootd/XrdNet/XrdNet.hh deleted file mode 100644 index 95223aac6..000000000 --- a/test/binary/usr/include/xrootd/XrdNet/XrdNet.hh +++ /dev/null @@ -1,301 +0,0 @@ -#ifndef __XRDNET_H__ -#define __XRDNET_H__ -/******************************************************************************/ -/* */ -/* X r d N e t . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include -#ifndef WIN32 -#include -#include -#include -#include -#else -#include -#endif - -#include "XrdNet/XrdNetOpts.hh" - -class XrdNetAddr; -class XrdNetBufferQ; -class XrdNetPeer; -class XrdNetSecurity; -class XrdSysError; - -class XrdNet -{ -public: - -//------------------------------------------------------------------------------ -//! Accept incoming TCP connection. This is the preferred method for TCP. -//! -//! @param myAddr the address object to contain connection information. -//! @param opts processing options: -//! XRDNET_DELAY - do not set nodelay on socket. -//! XRDNET_KEEPALIVE - use TCP keep alive on socket. -//! XRDNET_NOCLOSEX - do not allow socket to close on exec() -//! XRDNET_NOEMSG - supress printing error messages -//! XRDNET_NOLINGER - Do not linger when closing socket. -//! @param timeout maximum seconds to wait for a conection. When negative, -//! the default, no time limit applies. -//! @return !0 Successful connection occurred, myAddr holds information. -//! @return =0 Failure, a timeout or permanent error occurred. -//------------------------------------------------------------------------------ - -int Accept(XrdNetAddr &myAddr, - int opts=0, - int timeout=-1); - -//------------------------------------------------------------------------------ -//! Accept incoming TCP or UDP connection. This method should only be used for -//! UDP-style networks. The previous method is preferred for TCP-style networks. -//! -//! @param myPeer the peer object to contain connection information. -//! @param opts processing options: -//! XRDNET_DELAY - TCP: do not set nodelay on socket. -//! XRDNET_KEEPALIVE - TCP: use TCP keep alive on socket. -//! XRDNET_NEWFD - UDP: obtain new file descriptor -//! XRDNET_NOCLOSEX - ALL: keep socket across exec() calls -//! XRDNET_NODNTRIM - ALL: don't trim domain name in myPeer -//! XRDNET_NOEMSG - ALL: supress printing error messages -//! XRDNET_NORLKUP - ALL: avoid doing reverse DNS look-up -//! XRDNET_USETLS - ALL: enable TLS upon connection -//! @param timeout maximum seconds to wait for a conection. When negative, -//! the default, no time limit applies. -//! @return !0 Successful connection occurred, myPeer holds information. -//! @return =0 Failure, a timeout or permanent error occurred. -//------------------------------------------------------------------------------ - -int Accept(XrdNetPeer &myPeer, - int opts=0, - int timeout=-1); - -//------------------------------------------------------------------------------ -//! Bind a network object to a TCP or UDP port number. -//! -//! @param port the port number to bind to. Use 0 for arbitrary port. -//! @param contype Either "tcp" for TCP networks or "udp" for UDP networks. -//! -//! @return 0 Successfully bound the port. -//! @return !0 Failure, return value is -errno describing the error. -//------------------------------------------------------------------------------ - -int Bind( int port, // Port number - const char *contype="tcp" // "tcp" or "udp" - ); - -//------------------------------------------------------------------------------ -//! Bind a network object to a Unix named socket. -//! -//! @param path the file system path to a named socket to bind with. -//! @param contype Either "stream" to use TCP-tyle streaming protocol or -//! "datagram" to use UDP-style messaging. -//! -//! @return 0 Successfully bound the port. -//! @return !0 Failure, return value is -errno describing the error. -//------------------------------------------------------------------------------ - -int Bind( char *path, // Unix path < |109| - const char *contype="stream" // stream | datagram - ); - -//------------------------------------------------------------------------------ -//! Create a TCP socket and connect it to the given host and port. This is the -//! preferred method for making TCP based connections. -//! -//! @param myAddr address object where connection information is returned. -//! @param dest destination hostname or IP address. -//! @param port the port number to connect to. If < 0 then the dest param -//! must contain the port number preceeded by a colon. -//! @param opts processing options: -//! XRDNET_NOCLOSEX - do not allow socket to close on exec() -//! XRDNET_NOEMSG - supress printing error messages -//! XRDNET_NORLKUP - avoid doing reverse DNS look-up -//! @param timeout the maximum number of seconds to wait for the connection to -//! complete. A negative value waits forever. Values greater -//! than 255 seconds are set to 255. -//! -//! @return true Connection completed, myAddr holds connection information. -//! @return false Connection failed. -//------------------------------------------------------------------------------ - -int Connect(XrdNetAddr &myAddr, - const char *dest, // Destination host or ip address - int port=-1, // Port number - int opts=0, // Options - int timeout=-1 // Second timeout - ); - -//------------------------------------------------------------------------------ -//! Create a TCP or UDP socket and connect it to the given host and port. The -//! previous method is preferred for creating TCP sockets. -//! -//! @param myPeer peer object where connection information is returned. -//! @param dest destination hostname or IP address. -//! @param port the port number to connect to. If < 0 then the dest param -//! must contain the port number preceeded by a colon. -//! @param opts processing options: -//! XRDNET_NOCLOSEX - do not allow socket to close on exec() -//! XRDNET_NODNTRIM - do not trim domain name in myPeer. -//! XRDNET_NOEMSG - supress printing error messages -//! XRDNET_NORLKUP - avoid doing reverse DNS look-up -//! XRDNET_UDPSOCKET - create a UDP socket (o/w use TCP). -//! @param timeout the maximum number of seconds to wait for the connection to -//! complete. A negative value waits forever. Values greater -//! than 255 seconds are set to 255. -//! -//! @return true Connection completed, myPeer holds connection information. -//! @return false Connection failed. -//------------------------------------------------------------------------------ - -int Connect(XrdNetPeer &myPeer, - const char *dest, // Destination host or ip address - int port=-1, // Port number - int opts=0, // Options - int timeout=-1 // Second timeout - ); - -//------------------------------------------------------------------------------ -//! Get the port number, if any, bound to this network. -//! -//! @return >0 The bound port number. -//! @return <=0 The network is not bound to a port. -//------------------------------------------------------------------------------ - -int Port() {return Portnum;} - -// Relay() creates a UDP socket and optionally decomposes a destination -// of the form host:port. Upon success it fills in the Peer object -// and return true (1). Upon failure, it returns false (0). -// -int Relay(XrdNetPeer &Peer, // Peer object to be initialized - const char *dest, // Optional destination - int opts=0 // Optional options as above - ); - -int Relay(const char *dest); // Optional destination - -//------------------------------------------------------------------------------ -//! Add a NetSecurity object to the existing accept() security constraints. -//! -//! @param secp Pointer to the network security object. This object must -//! not be deleted nor directly used after the call as this -//! object assumes its ownership and may delete it at any time. -//------------------------------------------------------------------------------ - -virtual void Secure(XrdNetSecurity *secp); - -//------------------------------------------------------------------------------ -//! Set network defaults. -//! -//! @param options The options to be added to Accept(), Bind() and Connect() -//! calls. These options cannot be turned off, so be careful. -//! @param buffsz The UDP buffer size (the initial default is 32K) or the TCP -//! window size (initial default is OS dependent). -//------------------------------------------------------------------------------ - -void setDefaults(int options, int buffsz=0) - {netOpts = options; Windowsz = buffsz;} - -//------------------------------------------------------------------------------ -//! Set network domain name. -//! -//! @param dname The domain name which indicates to Trim() what part of the -//! host name is so common that it can be trimmed. -//------------------------------------------------------------------------------ - -void setDomain(const char *dname) - {if (Domain) free(Domain); - Domain = strdup(dname); - Domlen = strlen(dname); - } - -//------------------------------------------------------------------------------ -//! Trims off the domain name in a host name. -//! -//! @param hname The host name to be trimmed (it is modified). -//------------------------------------------------------------------------------ - -void Trim(char *hname); - -//------------------------------------------------------------------------------ -//! Unbind the network from any bound resouces. -//------------------------------------------------------------------------------ - -void unBind(); - -//------------------------------------------------------------------------------ -//! Get the current TCP RCVBUF window size. -//! -//! @return >0 The current window size. -//! @return <=0 Either the network is not bound to a port or an error has -//! occurred. Window size is unavailable. -//------------------------------------------------------------------------------ - -int WSize(); - -//------------------------------------------------------------------------------ -//! Constructor -//! -//! @param erp The error object for printing error messages. It must be -//! supplied. -//! @param secp The initial NetSecurity object. This secp object must not -//! be deleted nor directly used after the call as this -//! object assumes its ownership and may delete it at any time. -//------------------------------------------------------------------------------ - - XrdNet(XrdSysError *erp, XrdNetSecurity *secp=0); - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - -virtual ~XrdNet(); - -protected: - -XrdSysError *eDest; -XrdNetSecurity *Police; -char *Domain; -int Domlen; -int iofd; -int Portnum; -int PortType; -int Windowsz; -int netOpts; -int BuffSize; -XrdNetBufferQ *BuffQ; - -private: - -int do_Accept_TCP(XrdNetAddr &myAddr, int opts); -int do_Accept_TCP(XrdNetPeer &myPeer, int opts); -int do_Accept_UDP(XrdNetPeer &myPeer, int opts); -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdNet/XrdNetAddr.hh b/test/binary/usr/include/xrootd/XrdNet/XrdNetAddr.hh deleted file mode 100644 index c8e7150cc..000000000 --- a/test/binary/usr/include/xrootd/XrdNet/XrdNetAddr.hh +++ /dev/null @@ -1,295 +0,0 @@ -#ifndef __XRDNETADDR_HH__ -#define __XRDNETADDR_HH__ -/******************************************************************************/ -/* */ -/* X r d N e t A d d r . h h */ -/* */ -/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "XrdNet/XrdNetAddrInfo.hh" - -//------------------------------------------------------------------------------ -//! The XrdNetAddr class implements the manipulators for XrdNetAddrInfo. -//------------------------------------------------------------------------------ - -struct addrinfo; - -class XrdNetAddr : public XrdNetAddrInfo -{ -public: - -//------------------------------------------------------------------------------ -//! Determine if dynamic DNS has been set. -//! -//! @return True Dynamic DNS has been set. -//! False Dynamic DNS has not been set. -//------------------------------------------------------------------------------ - -static bool DynDNS() {return dynDNS;} - -//------------------------------------------------------------------------------ -//! Determine if IPV4 mode has been set. -//! -//! @return True IPV4 mode has been set. -//! False IPV4 mode has not been set. -//------------------------------------------------------------------------------ - -static bool IPV4Set() {return useIPV4;} - -//------------------------------------------------------------------------------ -//! Optionally set and also returns the port number for our address. -//! -//! @param pNum when negative it only returns the current port. Otherwise, -//! it is taken as the value to be set. -//! -//! @return Success: The port number, which may be 0 if not set. -//! Failure: -1 address is not an internet address or port is invalid. -//------------------------------------------------------------------------------ - -int Port(int pNum=-1); - -//------------------------------------------------------------------------------ -//! Register a host name with this IP address. This is not MT-safe! -//! -//! @param hName -> to a true host name which should be fully qualified. -//! One of the IP addresses registered to this name must -//! match the IP address associated with this object. -//! -//! @return True: Specified name is now associated with this address. -//! False: Nothing changed, registration could not be verified. -//------------------------------------------------------------------------------ - -bool Register(const char *hName); - -//------------------------------------------------------------------------------ -//! Set the IP address and possibly the port number. -//! -//! @param hSpec 0 -> address is set to in6addr_any for binding via bind() -//! (INADDR_ANY in IPV4 mode). -//! !0 -> convert specification to an address. Valid formats: -//! IPv4: nnn.nnn.nnn.nnn[:] -//! IPv6: [ipv6_addr][:] **addr brackets required** -//! IPvx: name[:port] x is determined by getaddrinfo() -//! Unix: / -//! @param pNum >= 0 uses the value as the port number regardless of what -//! is in hSpec, should it be supplied. However, if is -//! present, it must be a valid port number or name. -//! < 0 uses the positive value as the port number if the -//! port number has not been specified in hSpec. -//! **** When set to PortInSpec(the default, see below) the -//! port number/name must be specified in hSpec. If it is -//! not, an error is returned. -//! -//! @return Success: 0. -//! Failure: Error message text describing the error. The message is in -//! persistent storage and cannot be modified. -//------------------------------------------------------------------------------ - -static const int PortInSpec = (int)0x80000000; - -const char *Set(const char *hSpec, int pNum=PortInSpec); - -//------------------------------------------------------------------------------ -//! Return multiple addresses. This form can only be used on the first element -//! of this object that has been allocated as an array. This method is useful -//! for getting all of the aliases assigned to a dns entry. -//! The file descriptor association is set to a negative value. -//! -//! @param hSpec 0 -> address is set to in6addr_any for binding via bind() -//! !0 -> convert specification to an address. Valid formats: -//! IP.v4: nnn.nnn.nnn.nnn[:] -//! IP.v6: [ipv6_addr][:] -//! IP.xx: name[:port] xx is determined by getaddrinfo() -//! @param maxIP number of elements in the array. -//! @param numIP the number of IP addresses actually set (returned value). -//! @param pNum >= 0 uses the value as the port number regardless of what -//! is in hSpec, should it be supplied. However, if is -//! present, it must be a valid port number or name. -//! < 0 uses the positive value as the port number if the -//! port number has not been specified in hSpec. -//! **** When set to PortInSpec(the default, see below) the -//! port number/name must be specified in hSpec. If it is -//! not, an error is returned. -//! @param forUDP when true addresses are usable for UDP connections. -//! Otherwise, they are for TCP connections. -//! -//! @return Success: 0 with numIP set to the number of elements set. -//! Failure: the error message text describing the error and -//! numIP is set to zero. The message is in persistent -//! storage and cannot be modified. -//------------------------------------------------------------------------------ - -const char *Set(const char *hSpec, int &numIP, int maxIP, - int pNum=PortInSpec, bool forUDP=false); - -//------------------------------------------------------------------------------ -//! Set our address via a sockaddr structure. -//! -//! @param sockP a pointer to an initialized and valid sockaddr structure. -//! @param sockFD the associated file descriptor and can be used to record -//! the file descriptor returned by accept(). -//! -//! @return Success: Returns 0. -//! Failure: Returns the error message text describing the error. The -//! message is in persistent storage and cannot be modified. -//------------------------------------------------------------------------------ - -const char *Set(const struct sockaddr *sockP, int sockFD=-1); - -//------------------------------------------------------------------------------ -//! Set our address from the supplied socket file descriptor. -//! -//! @param sockFD a connected socket file descriptor. The value is also -//! recorded as the associated file descriptor. -//! @param peer When true the address is set from getpeername() -//! When false the address is set from getsockname() -//! -//! @return Success: Returns 0. -//! Failure: Returns the error message text describing the error. The -//! message is in persistent storage and cannot be modified. -//------------------------------------------------------------------------------ - -const char *Set(int sockFD, bool peer=true); - -//------------------------------------------------------------------------------ -//! Set our address via and addrinfo structure and initialize the port. -//! -//! @param rP pointer to an addrinfo structure. -//! @param port the port number to set. -//! @param mapit when true maps IPv4 addresses to IPv6. Otherwise, does not. -//! -//! @return Success: Returns 0. -//! Failure: Returns the error message text describing the error. The -//! message is in persistent storage and cannot be modified. -//------------------------------------------------------------------------------ - -const char *Set(struct addrinfo *rP, int port, bool mapit=false); - -//------------------------------------------------------------------------------ -//! Set the cache time for address to name resolutions. This method should only -//! be called during initialization time. The default is to not use the cache. -//------------------------------------------------------------------------------ - -static void SetCache(int keeptime); - -//------------------------------------------------------------------------------ -//! Set the dialect being spoken on this network link. -//! -//! @param dP Pointer to the dialect name. It must be permanently stable. -//------------------------------------------------------------------------------ - - void SetDialect(const char *dP) {protName = dP;} - -//------------------------------------------------------------------------------ -//! Indicate whether or not dynamic DNS is being used. This method should only -//! be called during initialization time. The default is fixed DNS. -//! -//! @param onoff True if dynamic DNS is being used, false otherwise. -//------------------------------------------------------------------------------ - -static void SetDynDNS(bool onoff); - -//------------------------------------------------------------------------------ -//! Force this object to work in IPV4 mode only. This method permanently sets -//! IPV4 mode which cannot be undone without a restart. It is meant to bypass -//! broken IPV6 stacks on those unfortunate hosts that have one. It should be -//! called before any other calls to this object (e.g. initialization time). -//------------------------------------------------------------------------------ - -static void SetIPV4(); - -//------------------------------------------------------------------------------ -//! Force this object to work in IPV6 mode using IPV6 or mapped IPV4 addresses. -//! This method permanently sets IPV6 mode which cannot be undone without a -//! restart. It is meant to disable the default mode which determines which -//! address to use based on which address types are configured on the host -//! (i.e. getaddrinfo() with hints AI_ADDRCONFIG|AI_V4MAPPED). -//------------------------------------------------------------------------------ - -static void SetIPV6(); - -//------------------------------------------------------------------------------ -//! Set the location for this address -//! -//! @param loc pointer to the structure that describes the location. See -//! XrdnetAddrInfo for the definition of the stucture. -//------------------------------------------------------------------------------ - -void SetLocation(XrdNetAddrInfo::LocInfo &loc); - -//------------------------------------------------------------------------------ -//! Set the location's TLS state. -//! -//! @param val True if TLS is being used, false otherwise. -//------------------------------------------------------------------------------ - -void SetTLS(bool val); - -//------------------------------------------------------------------------------ -//! Assignment operator and copy constructor are inherited, no need to define -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -//! Constructor -//! -//! @param addr A pointer to an initialized and valid sockaddr or sockaddr -//! compatible structure used to initialize the address. -//! @param port Uses the address of the current host and the speoified -//! port number to initilize the address. -//------------------------------------------------------------------------------ - - XrdNetAddr() : XrdNetAddrInfo() {} - - XrdNetAddr(const XrdNetAddr *addr) : XrdNetAddrInfo(addr) {} - - XrdNetAddr(const sockaddr *addr) : XrdNetAddrInfo() - {Set(addr);} - - XrdNetAddr(const sockaddr_in *addr) : XrdNetAddrInfo() - {Set((sockaddr *)addr);} - - XrdNetAddr(const sockaddr_in6 *addr) : XrdNetAddrInfo() - {Set((sockaddr *)addr);} - - XrdNetAddr(int port); - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - - ~XrdNetAddr() {} -private: -static struct addrinfo *Hints(int htype, int stype); -bool Map64(); - -static struct addrinfo *hostHints; -static struct addrinfo *huntHintsTCP; -static struct addrinfo *huntHintsUDP; -static bool useIPV4; -static bool dynDNS; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdNet/XrdNetAddrInfo.hh b/test/binary/usr/include/xrootd/XrdNet/XrdNetAddrInfo.hh deleted file mode 100644 index a012845c4..000000000 --- a/test/binary/usr/include/xrootd/XrdNet/XrdNetAddrInfo.hh +++ /dev/null @@ -1,375 +0,0 @@ -#ifndef __XRDNETADDRINFO_HH__ -#define __XRDNETADDRINFO_HH__ -/******************************************************************************/ -/* */ -/* X r d N e t A d d r I n f o . h h */ -/* */ -/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include "XrdNet/XrdNetSockAddr.hh" -#include "XrdSys/XrdSysPlatform.hh" - -//------------------------------------------------------------------------------ -//! The XrdNetAddrInfo class is meant to provide read/only access to members -//! that only class XrdNetAddr can manipulate. This allows the generic use of -//! the XrdNetAddr class but provides a means of exporting that information to -//! other objects without allowing those objects to modify the information. -//------------------------------------------------------------------------------ - -struct addrinfo; -class XrdNetCache; - -class XrdNetAddrInfo -{ -public: - -//------------------------------------------------------------------------------ -//! Provide the protocol languag being spoken (e.g. xroot, http, etc). -//! -//! @return Pointer to the protocol language being used. If unknown, nil ia -//! returned. Use the isUsingTLS() method to see if a secure version of -//! the protocol is being used. -//------------------------------------------------------------------------------ - -const char *Dialect() {return protName;} - -//------------------------------------------------------------------------------ -//! Provide our address family. -//! -//! @return Success: Returns AF_INET, AF_INET6, or AF_UNIX. -//! Failure: Returns 0, address is not valid. -//------------------------------------------------------------------------------ - -int Family() const {return static_cast(IP.Addr.sa_family);} - -//------------------------------------------------------------------------------ -//! Format our address into a supplied buffer with one of the following layouts -//! (the ':' or ':/path' can be omitted if desired, see fmtOpts param): -//! IP.xx: host_name: -//! IP.v4: a.b.c.d: -//! IP.4to6: [::ffff:a.b.c.d]: | [::a.b.c.d]: -//! IP.v6: [a:b:c:d:e:f:g:h]: -//! IP.Unix: localhost:/ -//! -//! @param bAddr address of buffer for result -//! @param bLen length of buffer -//! @param fmtType specifies the type of format desired via fmtUse enum. -//! @param fmtOpts additional formatting options (can be or'd): -//! noPort - do not append the port number to the address. -//! noPortRaw - no port and no brackets for IPv6. -//! old6Map4 - use deprecated IPV6 mapped format '[::x.x.x.x]' -//! -//! @return Success: The number of characters (less null) in Buff. -//! @return Failure: 0 (buffer is too small or not a valid address). However, -//! if bLen > 0 the buffer will contain a null terminated -//! string of up to 8 question marks. -//------------------------------------------------------------------------------ - -enum fmtUse {fmtAuto=0, //!< Hostname if already resolved o/w use fmtAddr - fmtName, //!< Hostname if it is resolvable o/w use fmtAddr - fmtAddr, //!< Address using suitable ipv4 or ipv6 format - fmtAdv6}; //!< Address only in ipv6 format - -static const int noPort = 0x0000001; //!< Do not add port number -static const int noPortRaw = 0x0000002; //!< Use raw address format (no port) -static const int old6Map4 = 0x0000004; //!< Use deprecated IPV6 mapped format -static const int prefipv4 = 0x0000008; //!< Use if mapped IPV4 actual format - -int Format(char *bAddr, int bLen, fmtUse fmtType=fmtAuto, int fmtOpts=0); - -//------------------------------------------------------------------------------ -//! Indicate whether or not our address is the loopback address. Use this -//! method to gaurd against UDP packet spoofing. -//! -//! @return True: This is the loopback address. -//! @return False: This is not the loopback address. -//------------------------------------------------------------------------------ - -bool isLoopback(); - -//------------------------------------------------------------------------------ -//! Indicate whether or not a string is a possible hostname and not IP address. -//! The return value does not aimply any kind of validity. For instance, a -//! false return indicates this is not a valid hostname does not mean it is -//! a valid IP address. -//! -//! @param name The string to check. -//! -//! @return True: This is a possible hostname (i.e. not IP address). -//! @return False: This is not a possible hostname. -//------------------------------------------------------------------------------ - -static bool isHostName(const char *name); - -//------------------------------------------------------------------------------ -//! Indicate whether or not our address is if the desired type. -//! -//! @param ipType The IP address version to test (see enum below). -//! -//! @return True: This is the address version of ipType. -//! @return False: This is not the address version of ipType. -//------------------------------------------------------------------------------ - -enum IPType {IPv4 = AF_INET, IPv6 = AF_INET6, IPuX = AF_UNIX}; - -bool isIPType(IPType ipType) const {return IP.Addr.sa_family == ipType;} - -//------------------------------------------------------------------------------ -//! Indicate whether or not our address is an IPv4 mapped to IPv6 address. -//! -//! @return True: The address is a mapped IPv4 address. -//! False: The address is not a mapped IPv4 address. -//------------------------------------------------------------------------------ - -bool isMapped() const {return IP.Addr.sa_family == AF_INET6 - && IN6_IS_ADDR_V4MAPPED(&IP.v6.sin6_addr); - } - -//------------------------------------------------------------------------------ -//! Indicate whether or not our address is private. -//! -//! @return True: This address is private. -//! False: This address is not private. -//------------------------------------------------------------------------------ - -bool isPrivate(); - -//------------------------------------------------------------------------------ -//! Indicate whether or not our address is registered in the DNS. -//! -//! @return True: This address is registered. -//! False: This address is not registered. -//------------------------------------------------------------------------------ - -bool isRegistered(); - -//------------------------------------------------------------------------------ -//! Indicate whether or not the endpoint is using TLS for communications. -//! -//! @return True: This address is using TLS. -//! False: This address is not using TLS. -//------------------------------------------------------------------------------ - -bool isUsingTLS(); - -//------------------------------------------------------------------------------ -//! Obtain the location of this address. -//! -//! @return !0 pointer to the unverified location information. Not all -//! fields may be set. -//! @return =0 location information is not available. -//------------------------------------------------------------------------------ - -struct LocInfo - {unsigned char Country[2]; //!< Two letter TLD country code - unsigned char Region; //!< Region (may combine adjacent countries) - unsigned char Locale; //!< Locale (may combine adjacent regions) - char TimeZone; //!< +/- hours from GMT (-128 if not set) - char Flags; //!< Flags - short Speed; //!< I/F speed (Gb*1024/100)(not supported) - int Latitude; //!< Degrees +/- xx.xxxxxx (not supported) - int Longtitude; //!< Degrees +/- xx.xxxxxx (not supported) - - LocInfo() : Region(0), Locale(0), TimeZone(-128), Flags(0), - Speed(0), Latitude(0), Longtitude(0) {*Country = 0;} - - }; - -const struct -LocInfo *Location() {return (addrLoc.Country[0] ? &addrLoc : 0);} - -//------------------------------------------------------------------------------ -//! Convert our IP address to the corresponding [host] name. -//! -//! @param eName value to return when the name cannot be determined. -//! @param eText when not null, the reason for a failure is returned. -//! -//! @return Success: Pointer to the name or ip address with eText, if supplied, -//! set to zero. The memory is owned by the object and is -//! deleted when the object is deleted or Set() is called. -//! Failure: eName param and if eText is not zero, returns a pointer -//! to a message describing the reason for the failure. The -//! message is in persistent storage and cannot be modified. -//------------------------------------------------------------------------------ - -const char *Name(const char *eName=0, const char **eText=0); - -//------------------------------------------------------------------------------ -//! Provide a pointer to our socket address suitable for use in calls to methods -//! that require our internal format of sock addr. A value is only returned for -//! IPV6/4 addresses and is nill otherwise. The pointer refers to memory -//! allocated by this object and becomes invalid should the object be deleted. -//! Use SockSize() to get its logical length. -//------------------------------------------------------------------------------ - -const -XrdNetSockAddr *NetAddr() {return (sockAddr == (void *)&IP ? &IP : 0);} - -//------------------------------------------------------------------------------ -//! Return the port number for our address. -//! -//! @return Success: The port number, which may be 0 if not set. -//! Failure: -1 address is not an internet address or port is invalid. -//------------------------------------------------------------------------------ - -int Port(); - -//------------------------------------------------------------------------------ -//! Provide our protocol family. -//! -//! @return Success: Returns PF_INET, PF_INET6, or PF_UNIX. -//! Failure: Returns 0, address is not valid. -//------------------------------------------------------------------------------ - -int Protocol() {return static_cast(protType);} - -//------------------------------------------------------------------------------ -//! Check if the IP address in this object is the same as the one passed. -//! -//! @param ipAddr points to the network address object to compare. -//! @param plusPort when true, port values must also match. In any case, both -//! addresses must be of the same address family. -//! -//! @return Success: True (addresses are the same). -//! Failure: False (addresses are not the same). -//! -//! Note: implemented in terms of const version -//------------------------------------------------------------------------------ - -int Same(const XrdNetAddrInfo *ipAddr, bool plusPort=false); - -//------------------------------------------------------------------------------ -//! Provide a pointer to our socket address suitable for use in calls to -//! functions that require one (e.g. bind() etc). The pointer refers to memory -//! allocated by this object and becomes invalid should the object be deleted -//! or when Set() is called. Use SockSize() to get its length. -//------------------------------------------------------------------------------ - -const -sockaddr *SockAddr() {return sockAddr;} - -//------------------------------------------------------------------------------ -//! Provide the length of our socket adress. Useful for system calls needing it. -//! -//! @return Success: Returns the length of the address returned by SockAddr(). -//! Failure: Returns 0, address is not valid. -//------------------------------------------------------------------------------ - -SOCKLEN_t SockSize() {return static_cast(addrSize);} - -//------------------------------------------------------------------------------ -//! Get the associated file descriptor. -//! -//! @return The associated file descriptor. If negative, no association exists. -//------------------------------------------------------------------------------ - -int SockFD() {return (sockNum ? sockNum : -1);} - -//------------------------------------------------------------------------------ -//! Assignment operator -//------------------------------------------------------------------------------ - -XrdNetAddrInfo &operator=(XrdNetAddrInfo const &rhs) - {if (&rhs != this) - {memmove(&IP, &rhs.IP, sizeof(IP)); - addrSize = rhs.addrSize; sockNum = rhs.sockNum; - protType = rhs.protType; - protFlgs = rhs.protFlgs; - protName = rhs.protName; - if (hostName) free(hostName); - hostName = (rhs.hostName ? strdup(rhs.hostName):0); - addrLoc = rhs.addrLoc; - if (rhs.sockAddr != &rhs.IP.Addr) - {if (!unixPipe || sockAddr == &IP.Addr) - unixPipe = new sockaddr_un; - memcpy(unixPipe, rhs.unixPipe, sizeof(sockaddr_un)); - } else sockAddr = &IP.Addr; - } - return *this; - } - -//------------------------------------------------------------------------------ -//! Copy constructor -//------------------------------------------------------------------------------ - - XrdNetAddrInfo(XrdNetAddrInfo const &oP) - {hostName = 0; - unixPipe = 0; - *this = oP; - } - -//------------------------------------------------------------------------------ -//! Constructor -//------------------------------------------------------------------------------ - - XrdNetAddrInfo() : hostName(0), addrSize(0), protType(0), - protFlgs(0), sockNum(0), protName(0) - {IP.Addr.sa_family = 0; - sockAddr = &IP.Addr; - } - - XrdNetAddrInfo(const XrdNetAddrInfo *addr) : hostName(0) {*this = *addr;} - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - - ~XrdNetAddrInfo() {if (hostName) free(hostName); - if (sockAddr != &IP.Addr) delete unixPipe; - } - -protected: - char *LowCase(char *str); - int QFill(char *bAddr, int bLen); - int Resolve(); - -static XrdNetCache *dnsCache; - -XrdNetSockAddr IP; -union {struct sockaddr *sockAddr; - struct sockaddr_un *unixPipe; - }; -char *hostName; -LocInfo addrLoc; -unsigned short addrSize; -unsigned char protType; -unsigned char protFlgs; -int sockNum; -const char *protName; - -// Flag settings in protFlgs -// -static const char isTLS = 0x01; //!< Location using TLS -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdNet/XrdNetCmsNotify.hh b/test/binary/usr/include/xrootd/XrdNet/XrdNetCmsNotify.hh deleted file mode 100644 index 9c4f60b8a..000000000 --- a/test/binary/usr/include/xrootd/XrdNet/XrdNetCmsNotify.hh +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __NETCMSNOTIFY_HH -#define __NETCMSNOTIFY_HH -/******************************************************************************/ -/* */ -/* X r d N e t C m s N o t i f y . h h */ -/* */ -/* (c) 2010 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -class XrdNetMsg; -class XrdSysError; - -class XrdNetCmsNotify -{ -public: - -int Gone(const char *Path, int isPfn=1); - -int Have(const char *Path, int isPfn=1); - -static const int isServ = 0x0001; -static const int noPace = 0x0002; - - XrdNetCmsNotify(XrdSysError *erp, const char *aPath, - const char *iName, int Opts=0); - ~XrdNetCmsNotify(); - -private: -int Send(const char *Buff, int Blen); - -XrdSysError *eDest; -XrdNetMsg *xMsg; -char *destPath; -int Pace; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdNet/XrdNetConnect.hh b/test/binary/usr/include/xrootd/XrdNet/XrdNetConnect.hh deleted file mode 100644 index f0543b503..000000000 --- a/test/binary/usr/include/xrootd/XrdNet/XrdNetConnect.hh +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __XRDNETCONNECT__ -#define __XRDNETCONNECT__ -/******************************************************************************/ -/* */ -/* X r d N e t C o n n e c t . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#ifndef WIN32 -#include -#else -#include -#endif - -class XrdNetConnect -{ -public: - -// Connect() performs the same function as sycall connect() however, it -// can optionally apply a thread-safe timeout of tsec seconds. -// It returns 0 upon success or errno upon failure. -// -static int Connect( int fd, // Open socket descriptor - const struct sockaddr *name, // Address to connect to - int namelen, // Size of address - int tsec=-1);// Optional timeout - -private: - // Only this class is allowed to create and delete this object - // - XrdNetConnect() {} - ~XrdNetConnect() {} -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdNet/XrdNetOpts.hh b/test/binary/usr/include/xrootd/XrdNet/XrdNetOpts.hh deleted file mode 100644 index 05b5a5888..000000000 --- a/test/binary/usr/include/xrootd/XrdNet/XrdNetOpts.hh +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef __XRDNETOPTS_H__ -#define __XRDNETOPTS_H__ -/******************************************************************************/ -/* */ -/* X r d N e t O p t s . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -/******************************************************************************/ -/* X r d N e t W o r k O p t i o n s */ -/******************************************************************************/ - -// Force a new file descriptor when setting up UDP communications -// -#define XRDNET_NEWFD 0x00000100 - -// This side of the socket will never receive any data -// -#define XRDNET_SENDONLY 0x00000200 - -// Multiple threads may attempts a read (very unusual) -// -#define XRDNET_MULTREAD 0x000000400 - -// Do not trim off fomain in the host name. -// -#define XRDNET_NODNTRIM 0x000000800 - -/******************************************************************************/ -/* X r d N e t W o r k & X r d N e t S o c k e t O p t i o n s */ -/******************************************************************************/ - -// Turn off TCP_NODELAY -// -#define XRDNET_DELAY 0x00010000 - -// Enable SO_KEEPALIVE -// -#define XRDNET_KEEPALIVE 0x00020000 - -// Do not close the socket in child processes hwne they exec -// -#define XRDNET_NOCLOSEX 0x00040000 - -// Do not print common error messages (spotty right now) -// -#define XRDNET_NOEMSG 0x00080000 - -// Do not linger on a close -// -#define XRDNET_NOLINGER 0x00100000 - -// Define a UDP socket -// -#define XRDNET_UDPSOCKET 0x00200000 - -// Define a FIFO (currently only for NetSocket) -// -#define XRDNET_FIFO 0x00400000 - -// Avoid DNS reverse lookups -// -#define XRDNET_NORLKUP 0x00800000 - -// Enable TLS upon connection -// -#define XRDNET_USETLS 0x01000000 - -/******************************************************************************/ -/* X r d N e t S o c k e t O p t i o n s */ -/******************************************************************************/ - -// This socket will be used for server activities (only for XrdNetS -// -#define XRDNET_SERVER 0x10000000 - -// Maximum backlog for incoming connections. The backlog value goes in low -// order byte and is used only when XRDNET_SERVER is specified. -// -#define XRDNET_BKLG 0x000000FF - -// Maximum wait time for outgoing connect. The timeout value goes in low -// order byte and is used only when XRDNET_SERVER is *NOT* specified. -// The value is in seconds (maximum timeout is 255 seconds). -// -#define XRDNET_TOUT 0x000000FF - -// The default UDP socket buffer size -// -#define XRDNET_UDPBUFFSZ 32768 - -// Maximum backlog value for listen() -// -#define XRDNETSOCKET_MAXBKLG 255 - -// Desired linger value for close -// -#define XRDNETSOCKET_LINGER 3 -#endif diff --git a/test/binary/usr/include/xrootd/XrdNet/XrdNetSockAddr.hh b/test/binary/usr/include/xrootd/XrdNet/XrdNetSockAddr.hh deleted file mode 100644 index d258886b0..000000000 --- a/test/binary/usr/include/xrootd/XrdNet/XrdNetSockAddr.hh +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __XRDNETSOCKADDR_HH__ -#define __XRDNETSOCKADDR_HH__ -/******************************************************************************/ -/* */ -/* X r d N e t S o c k A d d r . h h */ -/* */ -/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -//------------------------------------------------------------------------------ -//! Define the smallest structure needed to hold ipv6 and ipv4 addresses. Note -//! we do not want to use sockadddr_storage for this case because it is sized -//! to handle all possible network addresses and winds up being outlandishly -//! bigger than we really need (e.g. 256 bytes in Solaris and 128 in Linux). -//------------------------------------------------------------------------------ - -union XrdNetSockAddr {struct sockaddr_in6 v6; - struct sockaddr_in v4; - struct sockaddr Addr; - }; -#endif diff --git a/test/binary/usr/include/xrootd/XrdNet/XrdNetSocket.hh b/test/binary/usr/include/xrootd/XrdNet/XrdNetSocket.hh deleted file mode 100644 index c84b7e12a..000000000 --- a/test/binary/usr/include/xrootd/XrdNet/XrdNetSocket.hh +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef __NETSOCKET__ -#define __NETSOCKET__ -/******************************************************************************/ -/* */ -/* X r d N e t S o c k e t . h h */ -/* */ -/* (C) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Deprtment of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#ifndef WIN32 -#include -#else -#include -#endif - -#include "XrdNet/XrdNetAddr.hh" - -/******************************************************************************/ -/* C l a s s D e f i n i t i o n */ -/******************************************************************************/ - -class XrdSysError; - -class XrdNetSocket -{ -public: - -// When creating a socket object, you may pass an optional error routing object. -// If you do so, error messages will be writen via the error object. Otherwise, -// errors will be returned quietly. Addionally, you can attach a file descriptor -// to the socket object. This is useful when creating an object for accepted -// connections, e.g., ClientSock = new XrdNetSocket("", ServSock.Accept()). -// - XrdNetSocket(XrdSysError *erobj=0, int SockFileDesc=-1); - - ~XrdNetSocket() {Close();} - -// Create a named socket. Returns a NetSocket object that can be used for the -// given path. A udp or tcp socket can be created on the path with the given -// file name. The access permission mode must also be supplied. Upon failure, -// a null pointer is returned. -// -static XrdNetSocket *Create(XrdSysError *Say, const char *path, - const char *fn, mode_t mode, int isudp=0); - -// Open a socket. Returns socket number upon success otherwise a -1. Use -// LastError() to find out the reason for failure. Only one socket at a time -// may be created. Use Close() to close the socket of Detach() to remove -// the socket association before creating a new one. - -// |<-------- C l i e n t -------->| |<-------- S e r v e r -------->| -// Unix Socket Internet Socket Unix Socket Internet Socket -// path = Filname hostname. filename 0 or "" -// port = -1 port number -1 port number -// flags = ~XRDNET_SERVER ~XRDNET_SERVER XRDNET_SERVER XRDNET_SERVER - -// If the client path does not start with a slash and the port number is -1 -// then hostname must be of the form hostname:port. Open() will always set -// the REUSEADDR option when binding to a port number. -// - int Open(const char *path, int port=-1, int flags=0, int sockbuffsz=0); - -// Issue accept on the created socket. Upon success return socket FD, upon -// failure return -1. Use LastError() to obtain reason for failure. Note that -// Accept() is valid only for Server Sockets. An optional millisecond -// timeout may be specified. If no new connection is attempted within the -// millisecond time limit, a return is made with -1 and an error code of 0. -// Accept() always sets the "close on exec" flag for the new fd. -// - int Accept(int ms=-1); - -// Close a socket. -// - void Close(); - -// Detach the socket filedescriptor without closing it. Useful when you -// will be attaching the descriptor to a stream. Returns the descriptor so -// you can do something like Stream.Attach(Socket.Detach()). -// - int Detach(); - -// Return last errno. -// -inline int LastError() {return ErrCode;} - -// Obtain the name of the host on the other side of a socket. Upon success, -// a pointer to the hostname is returned. Otherwise null is returned. An -// optional address for holding the vided to obtain the hostname for it. -// The string is strdup'd and is deleted when the socket object is deleted. -// -const char *Peername(const struct sockaddr **InetAddr=0, int *InetSize=0); - -// Set socket options (see definitions in XrdNetOpts.hh). The defaults -// defaults are such that each option must be set to override the default -// behaviour. The method is static so it can be used in any context. -// An optional error routing object may be specified if error messages are -// wanted. Only when all option settings succeed is 0 is returned. -// -static int setOpts(int fd, int options, XrdSysError *eDest=0); - -// Set socket recv/send buffer sizes. The method is static so it can be used in -// any context. An optional error routing object may be specified if error -// messages are wanted. Only when all option settings succeed is 0 is returned. -// -static int setWindow(int fd, int Windowsz, XrdSysError *eDest=0); - -static int getWindow(int fd, int &Windowsz, XrdSysError *eDest=0); - -// Return the name of the socket into the provided buffer. Returns 0 -// upon success or errno upon failure. -// -int SockName(char *buff, int blen); - -// Return socket file descriptor number (useful when attaching to a stream). -// -inline int SockNum() {return SockFD;} - -// Create a path to a named socket returning the actual name of the socket. -// This method does not actually create the socket, only the path to the -// socket. If the full path exists then it must be a named socket. Upon -// success, it returns a pointer to the buffer holding the name (supplied by -// the caller). Otherwise, it returns a null pointer. -// -static char *socketPath(XrdSysError *Say, char *inbuff, - const char *path, const char *fn, - mode_t mode); - -/******************************************************************************/ - -private: -XrdNetAddr SockInfo; -XrdSysError *eroute; -int SockFD; -int ErrCode; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdNet/XrdNetUtils.hh b/test/binary/usr/include/xrootd/XrdNet/XrdNetUtils.hh deleted file mode 100644 index 6a3d4ba40..000000000 --- a/test/binary/usr/include/xrootd/XrdNet/XrdNetUtils.hh +++ /dev/null @@ -1,457 +0,0 @@ -#ifndef __XRDNETUTILS_HH__ -#define __XRDNETUTILS_HH__ -/******************************************************************************/ -/* */ -/* X r d N e t U t i l s . h h */ -/* */ -/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -#include "XrdOuc/XrdOucEnum.hh" - -class XrdOucTList; -class XrdNetAddr; -union XrdNetSockAddr; - -namespace XrdNetSpace {struct hpSpec;} - -class XrdNetUtils -{ -public: - -//------------------------------------------------------------------------------ -//! Decode an "encoded" ipv6/4 address and place it "sockaddr" type structure. -//! -//! @param sadr address of the union that will hold the results. -//! @param buff address of buffer that holds the encoding. -//! @param blen length of the string (it need not be null terminated). -//! -//! @return > 0 the port number in host byte order. -//! = 0 the port number was not set. -//! < 0 the encoding was not correct. -//------------------------------------------------------------------------------ - -static int Decode(XrdNetSockAddr *sadr, const char *buff, int blen); - -//------------------------------------------------------------------------------ -//! Encode the address and return it in a supplied buffer. -//! -//! @param sadr address of the union that holds the IPV4/6 address. -//! @param buff address of buffer to hold the null terminated encoding. -//! @param blen length of the buffer. It6 should be at least 40 bytes. -//! @param port optional port value to use as opposed to the one present -//! in sockaddr sadr. The port must be in host order. -//! -//! @return > 0 the length of the encoding less the null byte. -//! = 0 current address format not supported for encoding. -//! < 0 buffer is too small; abs(retval) bytes needed. -//------------------------------------------------------------------------------ - -static int Encode(const XrdNetSockAddr *sadr, char *buff, int blen, int port=-1); - - -//------------------------------------------------------------------------------ -//! Version 1: Return multiple addresses associated with a host or IP address. -//! -//! @param hSpec -> convert specification to addresses. Valid formats: -//! IP.v4: nnn.nnn.nnn.nnn[:] -//! IP.v6: [ipv6_addr][:] -//! IP.xx: name[:port] xx is determined by getaddrinfo() -//! @param aListP place where the pointer to the returned array of XrdNetAddr -//! objects is to be placed. Set to zero if none returned. The -//! caller must delete this array when no longer needed. -//! @param aListN place where the number of elements in aListP are to be -//! returned. -//! @param opts Options on what to return. Choose one of: -//! allIPMap - all IPv6 and mapped IPv4 addrs (default) -//! allIPv64 - all IPv6 and unmapped IPv4 addrs -//! allV4Map - all mapped IPV4 addrs. -//! onlyIPv6 - only IPv6 addrs -//! onlyIPv4 - only unmapped IPv4 addrs -//! prefIPv6 - only IPv6 addrs; if none, mapped IPv4 addrs -//! prefAuto - Returns addresses based on configured non-local -//! interfaces. The returned addresses will be -//! normally useable on this host and may be IPv4, -//! IPv6, mapped IPv4, or a mixture. -//! The above may be or'd with one or more of the following: -//! onlyUDP - only addrs valid for UDP connections else TCP -//! order46 - List IPv4 addresses (mapped or native) first. -//! order64 - List IPv6 addresses first. -//! @param pNum >= 0 uses the value as the port number regardless of what -//! is in hSpec, should it be supplied. However, if is -//! present, it must be a valid port number. -//! < 0 uses the positive value as the port number if the -//! port number has not been specified in hSpec. -//! **** When set to PortInSpec(the default, see below) the -//! port number/name must be specified in hSpec. If it is -//! not, an error is returned. -//! **** When set to NoPortRaw then hSpec does not contain a -//! port number and is a host name, IPv4 address, or an -//! IPv6 address *without* surrounding brackets. -//! -//! @return Success: 0 with aListN set to the number of elements in aListP. -//! Failure: the error message text describing the error and aListP -//! and aListN is set to zero. -//------------------------------------------------------------------------------ - -enum AddrOpts {allIPMap= 0, allIPv64= 1, allV4Map= 2, - onlyIPv6= 3, onlyIPv4= 4, prefIPv6= 8, - prefAuto= 16, order46 = 32, order64 = 64, - onlyUDP =128 - }; - -static const int PortInSpec = (int)0x80000000; -static const int NoPortRaw = (int)0xC0000000; - -static -const char *GetAddrs(const char *hSpec, XrdNetAddr *aListP[], int &aListN, - AddrOpts opts=allIPMap, int pNum=PortInSpec); - -//------------------------------------------------------------------------------ -//! Version 2: Return multiple addresses associated with a host or IP address. -//! -//! @param hSpec Reference to address specification (see version 1). -//! @param aVec Reference to the vector to contain addresses. -//! @param ordn Pointer to where the partition ordinal is to be stored. -//! @param opts Options on what to return (see version 1). -//! @param pNum Port number argument (see version 1). -//! -//! @return Success: 0 is returned. When ordn is not nil, the number of IPv4 -//! entries (for order46) or IPv6 (for order64) entries that -//! appear in the front of the vector. If ordering is not -//! specified, the value is set to the size of the vector. -//! Failure: the error message text describing the error and aVec is -//! cleared (i.e. has no elements). -//------------------------------------------------------------------------------ - -static -const char *GetAddrs(const std::string &hSpec, std::vector &aVec, - int *ordn=0, AddrOpts opts=allIPMap, int pNum=PortInSpec); - -//------------------------------------------------------------------------------ -//! Version 3: Return multiple addresses associated with a list of host or -//! IP addresses. -//! -//! @param hSVec vector of address specification (see version 1). Note that -//! this version requires hSVec entries to have a port number. -//! @param aVec Reference to the vector to contain addresses. -//! @param ordn Pointer to where the partition ordinal is to be stored. -//! @param opts Options on what to return (see version 1). -//! @param rotNum The rotation factor to order addresses in the result. -//! @param force When true resolution errors are ignored. -//! -//! @return Success: 0 is returned. When ordn is not nil, the number of IPv4 -//! entries (for order46) or IPv6 (for order64) entries that -//! appear in the front of the vector. If ordering is not -//! specified, the value is set to the size of the vector. -//! Failure: the error message text describing the error and aVec is -//! cleared (i.e. has no elements). -//------------------------------------------------------------------------------ - -static -const char *GetAddrs(std::vector &hSVec, - std::vector &aVec, - int *ordn=0, AddrOpts opts=allIPMap, - unsigned int rotNum=0, bool force=false); - -//------------------------------------------------------------------------------ -//! Obtain connection information from a socket. -//! -//! @param fd The file descriptor of the socket whose address is to be -//! converted. The sign of the fd indicates which address: -//! fd > 0 the peer address is used (i.e. getpeername) -//! fd < 0 the local address is used (i.e. getsockname) -//! @param theAddr pointer to a buffer of theAlen bytes where the text -//! version of the IP address is to be returned. The text -//! uses the actual native address format. If theAddr is -//! nil or theAlen is not positive, only the port and -//! address type are returned. -//! @param theALen length of the theAddr buffer. -//! @param theType either the character 4 (IPv4) or 6 (IPv6) is returned. -//! corrresponding to the address family. Note that should -//! be AF_INET6 but the address is mapped, '4' is returned. -//! -//! @return Success: >= 0 corresponding to the port number. -//! @return Failure: < 0 corresponding to -errno. -//------------------------------------------------------------------------------ - -static -int GetSokInfo(int fd, char *theAddr, int theALen, char &theType); - -//------------------------------------------------------------------------------ -//! Obtain an easily digestable list of hosts. This is the list of up to eight -//! unique aliases (i.e. with different addresses) assigned to a base hostname. -//! -//! @param hSpec the host specification suitable for XrdNetAddr.Set(). -//! @param hPort When >= 0 specified the port to use regardless of hSpec. -//! When < 0 the port must be present in hSpec. -//! @param hWant Maximum number of list entries wanted. If hWant is greater -//! that eight it is set eigth. -//! @param sPort If not nil, the *sPort will be set to hPort if and only if -//! the IP address in one of the entries matches the host -//! address. Otherwise, the value is unchanged. -//! @param eText When not nil, is where to place error message text. -//! -//! @return Success: Pointer to a list of XrdOucTList objects where -//! p->val is the port number -//! p->text is the host name. -//! The list of objects belongs to the caller. -//! Failure: A nil pointer is returned. If eText is supplied, the error -//! message, in persistent storage, is returned. -//------------------------------------------------------------------------------ - -static -XrdOucTList *Hosts(const char *hSpec, int hPort=-1, int hWant=8, int *sPort=0, - const char **eText=0); - -//------------------------------------------------------------------------------ -//! Convert an IP address/port (V4 or V6) into the standard V6 RFC ASCII -//! representation: "[address]:port". -//! -//! @param sAddr Address to convert. This is either sockaddr_in or -//! sockaddr_in6 cast to struct sockaddr. -//! @param bP points to a buffer large enough to hold the result. -//! A buffer 64 characters long will always be big enough. -//! @param bL the actual size of the buffer. -//! @param opts Formating options: -//! noPort - does not suffix the port number with ":port". -//! oldFmt - use the deprecated format for an IPV4 mapped -//! address: [::d.d.d.d] vs [::ffff:d.d.d.d]. -//! -//! @return Success: The length of the formatted address is returned. -//! @return Failure: Zero is returned and the buffer state is undefined. -//! Failure occurs when the buffer is too small or the address family -//! (sAddr->sa_family) is neither AF_INET nor AF_INET6. -//------------------------------------------------------------------------------ - -static const int noPort = 1; -static const int oldFmt = 2; - -static int IPFormat(const struct sockaddr *sAddr, char *bP, int bL, int opts=0); - -//------------------------------------------------------------------------------ -//! Convert an IP socket address/port (V4 or V6) into the standard V6 RFC ASCII -//! representation: "[address]:port". -//! -//! @param fd The file descriptor of the socket whose address is to be -//! converted. The sign of the fd indicates which address: -//! fd > 0 the peer address is used (i.e. getpeername) -//! fd < 0 the local address is used (i.e. getsockname) -//! @param bP points to a buffer large enough to hold the result. -//! A buffer 64 characters long will always be big enough. -//! @param bL the actual size of the buffer. -//! @param opts Formating options: -//! noPort - does not suffix the port number with ":port". -//! oldFmt - use the deprecated format for an IPV4 mapped -//! address: [::d.d.d.d] vs [::ffff:d.d.d.d]. -//! -//! @return Success: The length of the formatted address is returned. -//! @return Failure: Zero is returned and the buffer state is undefined. -//! Failure occurs when the buffer is too small or the file -//! descriptor does not refer to an open socket. -//------------------------------------------------------------------------------ - -static int IPFormat(int fd, char *bP, int bL, int opts=0); - -//------------------------------------------------------------------------------ -//! Determine if a hostname matches a pattern. -//! -//! @param hName the name of the host. -//! @param pattern the pattern to match against. The pattern may contain one -//! If the pattern contains a single asterisk, then the prefix -//! of hName is compared with the characters before the '*' and -//! the suffix of hName is compared with the character after. -//! If the pattern ends with a plus, the all then pattern is -//! taken as a hostname (less '+') and expanded to all possible -//! hostnames and each one is compared with hName. If the -//! pattern contains both, the asterisk rule is used first. -//! If it contains neither then strict equality is used. -//! -//! @return Success: True, the pattern matches. -//! Failure: False, no match found. -//------------------------------------------------------------------------------ - -static bool Match(const char *hName, const char *pattern); - -//------------------------------------------------------------------------------ -//! Get the fully qualified name of the current host. -//! -//! @param eName The name to be returned when the host name or its true -//! address could not be returned. The pointer may be nil. -//! @param eText When supplied will hold 0 if no errors occurred or error -//! message text, in persistent storage, describing why the -//! error-triggered alternate name was returned. -//! If it contains neither then strict equality is used. -//! -//! @return An strdup() copy of the host name, address , or eName; unless eName -//! is nil, in which case a nil pointer is returned. The caller is -//! responsible for freeing any returned string using free(). -//------------------------------------------------------------------------------ - -static char *MyHostName(const char *eName="*unknown*", const char **eText=0); - -//------------------------------------------------------------------------------ -//! Get the supported network protocols. -//! -//! @param netqry An NetType enum specifying the protocol to inspect. -//! @param eText When not nil, is where to place error message text. -//! -//! @return One the the NetProt enums (see below). When hasNone is returned -//! and eText is not nill it will point to a static string that gives -//! the reason. If the reason is a null string, the query was successful -//! but returned no matching protocols. -//------------------------------------------------------------------------------ - -enum NetProt {hasNone = 0, //!< Unable to determine available protocols - hasIPv4 = 1, //]:", ":", or ":". -//! @param hName place where the starting address of the host is placed. -//! @param hNend place where the ending address+1 is placed. This will -//! point to either ']', ':', or a null byte. -//! @param hPort place where the starting address of the port is placed. -//! If no ":port" was found, this will contain *hNend. -//! @param hPend place where the ending address+1 is placed. If no port -//! If no ":port" was found, this will contain *hNend. -//! -//! @return Success: True. -//! Failure: False, hSpec is not valid. Some output parameters may have -//! been set but shlould be ignored. -//------------------------------------------------------------------------------ - -static bool Parse(const char *hSpec, const char **hName, const char **hNend, - const char **hPort, const char **hPend); - -//------------------------------------------------------------------------------ -//! Obtain the numeric port associated with a file descriptor. -//! -//! @param fd the file descriptor number. -//! @param eText when not null, the reason for a failure is returned. -//! -//! @return Success: The positive port number. -//! Failure: 0 is returned and if eText is not null, the error message. -//------------------------------------------------------------------------------ - -static int Port(int fd, const char **eText=0); - -//------------------------------------------------------------------------------ -//! Obtain the protocol identifier. -//! -//! @param pName the name of the protocol (e.g. "tcp"). -//! -//! @return The protocol identifier. -//------------------------------------------------------------------------------ - -static int ProtoID(const char *pName); - -//------------------------------------------------------------------------------ -//! Obtain the numeric port corresponding to a symbolic name. -//! -//! @param sName the name of the service or a numeric port number. -//! @param isUDP if true, returns the UDP service port o/w the TCP service -//! @param eText when not null, the reason for a failure is returned. -//! -//! @return Success: The positive port number. -//! Failure: 0 is returned and if eText is not null, the error message. -//------------------------------------------------------------------------------ - -static int ServPort(const char *sName, bool isUDP=false, const char **eText=0); - -//------------------------------------------------------------------------------ -//! Set the family and hints to be used in GetAddrs() with prefAuto. This is -//! used within this class and by XrdNetAddr when the IP mode changes. It is -//! meant for internal use only. -//! -//! @param aOpts Is one of the following from the AddrOpts enum: -//! allIPMap - Use IPv6 and mapped IPv4 addrs (default) -//! onlyIPv4 - Use only IPv4 addresses. -//! prefAuto - Determine proper options based on configuration. -//! -//! @return The getaddrinfo() hints value that should be used. -//------------------------------------------------------------------------------ - -static int SetAuto(AddrOpts aOpts=allIPMap); - -//------------------------------------------------------------------------------ -//! Check if whether or not a host name represents more than one unique host. -//! -//! @param hSpec the host specification suitable for XrdNetAddr.Set(). -//! @param eText When not nil, is where to place error message text. -//! -//! @return True is this is a simple single host. False if the name represensts -//! more than one single host. -//------------------------------------------------------------------------------ - -static bool Singleton(const char *hSpec, const char **eText=0); - -//------------------------------------------------------------------------------ -//! Constructor -//------------------------------------------------------------------------------ - - XrdNetUtils() {} - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - - ~XrdNetUtils() {} -private: - -static void FillAddr(XrdNetSpace::hpSpec &aBuff, XrdNetAddr *aVec, - int *ordn=0, unsigned int rotNum=0); -static -const char *GetAInfo(XrdNetSpace::hpSpec &aBuff); -static void GetHints(XrdNetSpace::hpSpec &aBuff, AddrOpts opts); -static -const char *GetHostPort(XrdNetSpace::hpSpec &aBuff, const char *hSpec, int pNum); -static -const char *getMyFQN(const char *&myDom); -static int setET(const char **errtxt, int rc); -static int autoFamily; -static int autoHints; -}; - -XRDOUC_ENUM_OPERATORS(XrdNetUtils::AddrOpts) - -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucBuffer.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucBuffer.hh deleted file mode 100644 index ace08ab1d..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucBuffer.hh +++ /dev/null @@ -1,278 +0,0 @@ -#ifndef __OUC_BUFF__ -#define __OUC_BUFF__ -/******************************************************************************/ -/* */ -/* X r d O u c B u f f e r . h h */ -/* */ -/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include - -#include "XrdOuc/XrdOucChain.hh" -#include "XrdSys/XrdSysPthread.hh" - -/******************************************************************************/ -/* X r d O u c B u f f P o o l */ -/******************************************************************************/ - -class XrdOucBuffer; - -//----------------------------------------------------------------------------- -//! These classes allow for buffer management to minimize data copying. They -//! are typically used in conjunction with the XrdOucErrInfo class. The -//! XrdOucBuffPool class defines a pool of buffers and one such object must -//! exist for each buffer pool (there can be many such pools). This object -//! manufactures XrdOucBuffer objects. You can also create XrdOucBuffers -//! without using a buffer pool (i.e. one time buffers). See the XrdOucBuffer -//! constructor for details on how to do this and the associated caveats. -//----------------------------------------------------------------------------- - -class XrdOucBuffPool -{ -friend class XrdOucBuffer; -public: - -//----------------------------------------------------------------------------- -//! Allocate a buffer object. -//! -//! @param sz - the desired size. It os rounded up to be a multiple of -//! incBsz but cannot exceed maxBsz. -//! -//! @return !0 - pointer to usable buffer object of suitable size. -//! @return =0 - insufficient memort ro allocate a buffer. -//----------------------------------------------------------------------------- - - XrdOucBuffer *Alloc(int sz); - -//----------------------------------------------------------------------------- -//! Obtain the maximum size a buffer can have. -//! -//! @return The maximum size a buffer can be. -//----------------------------------------------------------------------------- - -inline int MaxSize() const {return maxBsz;} - -//----------------------------------------------------------------------------- -//! Constructor -//! -//! @param minsz - the minimum size a buffer can have. If it is smaller than -//! 1024 it is set to 1024. The minsz is also adjusted to be -//! equal to the closest smaller value of 1024*(2**n) (i.e. 1K, -//! 2k, 4K, etc). If it's greater than 16MB, it is set to 16MB. -//! @param maxsz - the maximum size a buffer can have and must be >= minsz. -//! If it's >minsz it is rounded up to the next minsz increment. -//! Buffer sizes are always allocated in minsz increments. -//! @param minh - the minimum number of buffers that should be held in -//! reserve when a buffer is recycled. -//! @param maxh - the maximum number of buffers that should be held in -//! reserve when a buffer is recycled. The value applies to the -//! smallest buffer size and is progessively reduced as the -//! buffer size increases. If maxh < minh it is set to minh. -//! @param rate - specifies how quickly the hold vale is to be reduced as -//! buffer sizes increase. A rate of 0 specifies a purely linear -//! decrease. Higher values logrithmically decrease the hold. -//----------------------------------------------------------------------------- - - XrdOucBuffPool(int minsz=4096, int maxsz=65536, - int minh=1, int maxh=16, - int rate=1); - -//----------------------------------------------------------------------------- -//! Destructor - You must not destroy this object prior to recycling all -//! oustanding buffers allocated out of this pool. -//----------------------------------------------------------------------------- - - ~XrdOucBuffPool() {delete [] bSlot;} - -private: -static int alignit; - -struct BuffSlot - {XrdSysMutex SlotMutex; - XrdOucBuffer *buffFree; - int size; - short numbuff; - short maxbuff; - - void Recycle(XrdOucBuffer *bP); - - BuffSlot() : buffFree(0), size(0), - numbuff(0), maxbuff(0) {} - ~BuffSlot(); - }; - -BuffSlot *bSlot; -int incBsz; -int shfBsz; -int rndBsz; -int maxBsz; -int slots; -}; - -/******************************************************************************/ -/* X r d O u c B u f f e r */ -/******************************************************************************/ - -class XrdOucBuffer -{ -friend class XrdOucBuffPool; - -public: - -//----------------------------------------------------------------------------- -//! Get the pointer to the buffer. -//! -//! @return pointer to the buffer. -//----------------------------------------------------------------------------- - -inline char *Buffer() const {return data;} - -//----------------------------------------------------------------------------- -//! Get the size of the buffer. -//! -//! @return size of the buffer. -//----------------------------------------------------------------------------- - -inline int BuffSize() const {return size;} - -//----------------------------------------------------------------------------- -//! Produce a clone of this buffer. -//! -//! @param trim - when true the memory buffer is trimmed to be of -//! sufficient size to hold the actual data. Otherwise, the -//! cloned memory buffer is of the same length. -//! -//! @return !0 - pointer to the cloned buffer. -//! =0 - insufficient memory to clone the buffer. -//----------------------------------------------------------------------------- - - XrdOucBuffer *Clone(bool trim=true); - -//----------------------------------------------------------------------------- -//! Get a pointer to the data in the buffer. -//! -//! @return pointer to the data. -//----------------------------------------------------------------------------- - -inline char *Data() const {return data+doff;} - -//----------------------------------------------------------------------------- -//! Get a pointer to the data in the buffer and the length of the data. -//! -//! @param dataL - place where the length is to be stored. -//! -//! @return pointer to the data with dataL holding its length. -//----------------------------------------------------------------------------- - -inline char *Data(int &dataL) const {dataL = dlen; return data+doff;} - -//----------------------------------------------------------------------------- -//! Get the data length. -//! -//! @return The data length. -//----------------------------------------------------------------------------- - -inline int DataLen() {return dlen;} - -//----------------------------------------------------------------------------- -//! Highjack the buffer contents and reinitialize the original buffer. -//! -//! @param bPsz - the desired size to be given to the highjacked buffer. If -//! zero, the current size is used. Same size resictions apply -//! as for buffer pool Alloc(), above. -//! -//! @return !0 - pointer to a usable buffer object which is identical to the -//! original buffer. The original buffer was reallocated with -//! the specified size. -//! @return =0 - insufficient memory to allocate a buffer. -//----------------------------------------------------------------------------- - - XrdOucBuffer *Highjack(int bPsz=0); - -//----------------------------------------------------------------------------- -//! Recycle the buffer. The buffer may be reused in the future. -//----------------------------------------------------------------------------- - -inline void Recycle() {buffPool->bSlot[slot].Recycle(this);} - -//----------------------------------------------------------------------------- -//! Resize the buffer. -//! -//! @param newsz - the size that the buffer is to have. The same restrictions -//! apply as for buffer pool Alloc(), above. -//! -//! @return true - buffer has been reallocated. -//! @return false - insufficient memoy to reallocated the buffer. -//----------------------------------------------------------------------------- - - bool Resize(int newsz); - -//----------------------------------------------------------------------------- -//! Set the data length of offset. -//! -//! @param dataL - the length of the data. -//! @param dataO - the offset of the data in the buffer. -//----------------------------------------------------------------------------- - -inline void SetLen(int dataL, int dataO=0) {dlen = dataL; doff = dataO;} - -//----------------------------------------------------------------------------- -//! Public constructor. You can create one-time buffers not associated with a -//! buffer pool via new to associated your own storage area that will be -//! freed when the buffer is recycled. This may be handy to pass along such a -//! buffer to XrdOucErrInfo in a pinch. A one-time buffer is restricted and -//! the Clone(), Highjack() and Resize() methods will always fail. However, -//! all the other methods will work in the expected way. -//! -//! @param buff - pointer to a storage area obtained via posix_memalign() -//! and it will be released via free(). -//! @param blen - the size of the buffer as well as the data length. -//! Use SetLen() to set a new data length if it differs. -//----------------------------------------------------------------------------- - - XrdOucBuffer(char *buff, int blen); - -private: - XrdOucBuffer(XrdOucBuffPool *pP, int snum) - : data(0), dlen(0), doff(0), size(pP->bSlot[snum].size), - slot(snum), buffPool(pP) {} - - XrdOucBuffer() - : data(0), dlen(0), doff(0), size(0), slot(0), buffPool(0) {} - - ~XrdOucBuffer() {if (data) free(data);} - - char *data; - int dlen; - int doff; - int size; - int slot; -union{XrdOucBuffer *buffNext; - XrdOucBuffPool *buffPool; - }; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCRC.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucCRC.hh deleted file mode 100644 index a59651d8f..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCRC.hh +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef __XRDOUCCRC_HH__ -#define __XRDOUCCRC_HH__ -/******************************************************************************/ -/* */ -/* X r d O u c C R C . h h */ -/* */ -/* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -#include "XrdSys/XrdSysPageSize.hh" - -class XrdOucCRC -{ -public: - -//------------------------------------------------------------------------------ -//! Compute a CRC32 checksum. -//! -//! @note This is a historical method as it uses the very slow CRC32 algoritm. -// It is now better to use the CRC32C hardware assisted methods. -//! -//! @param data Pointer to the data whose checksum it to be computed. -//! @param count The number of bytes pointed to by data. -//! -//! @return The CRC32 checksum. -//------------------------------------------------------------------------------ - -static uint32_t CRC32(const unsigned char *data, int count); - -//------------------------------------------------------------------------------ -//! Compute a CRC32C checksum using hardware assist if available. -//! -//! @param data Pointer to the data whose checksum it to be computed. -//! @param count The number of bytes pointed to by data. -//! @param prevcs The previous checksum value. The initial checksum of -//! checksum sequence should be zero, the default. -//! -//! @return The CRC32C checksum. -//------------------------------------------------------------------------------ - -static uint32_t Calc32C(const void* data, size_t count, uint32_t prevcs=0); - -//------------------------------------------------------------------------------ -//! Compute a CRC32C page checksums using hardware assist if available. -//! -//! @param data Pointer to the data whose checksum it to be computed. -//! @param count The number of bytes pointed to by data. -//! @param csval Pointer to a vector to hold individual page checksums. The -//! vector must be sized: -//! (count/XrdSys::PageSize + (count%XrdSys::PageSize != 0)). -//! On return, each element of csval holds the checksum for -//! the associated page. -//------------------------------------------------------------------------------ - -static void Calc32C(const void* data, size_t count, uint32_t* csval); - -//------------------------------------------------------------------------------ -//! Verify a CRC32C checksum using hardware assist if available. -//! -//! @param data Pointer to the data whose checksum it to be verified. -//! @param count The number of bytes pointed to by data. -//! @param csval The expected checksum. -//! @param csbad If csbad is not nil, the computed checksum is returned. -//! -//! @return True if the expected checksum equals the actual checksum; -//! otherwise, false is returned. -//------------------------------------------------------------------------------ - -static bool Ver32C(const void* data, size_t count, - const uint32_t csval, uint32_t* csbad=0); - -//------------------------------------------------------------------------------ -//! Verify a CRC32C page checksums using hardware assist if available. -//! -//! @param data Pointer to the data whose checksum it to be verified. -//! @param count The number of bytes pointed to by data. -//! @param csval Pointer to a vector of expected page checksums. The -//! vector must be sized: -//! (count/XrdSys::PageSize + (count%XrdSys::PageSize != 0)). -//! @param valcs Where the computed checksum is returned for the page -//! whose verification failed; otherwise it is untouched. -//! -//! @return -1 if all the checksums match. Otherwise, the non-negative index -//! into csval whose checksum does not match. -//------------------------------------------------------------------------------ - -static int Ver32C(const void* data, size_t count, - const uint32_t* csval, uint32_t& valcs); - -//------------------------------------------------------------------------------ -//! Verify a CRC32C page checksums using hardware assist if available. -//! -//! @param data Pointer to the data whose checksum it to be verified. -//! @param count The number of bytes pointed to by data. -//! @param csval Pointer to a vector of expected page checksums. The -//! vector must be sized (count/PageSize+(count%PageSize != 0)). -//! @param valok Pointer to a vector of the same size as csval to hold -//! the results of the comparison (true matches, o/w false). -//! -//! @return True if all the checksums match with each element of valok set to -//! true. Otherwise, false is returned and false is set in valok for -//! each page that did not match the expected checksum. -//------------------------------------------------------------------------------ - -static bool Ver32C(const void* data, size_t count, - const uint32_t* csval, bool* valok); - -//------------------------------------------------------------------------------ -//! Verify a CRC32C page checksums using hardware assist if available. -//! -//! @param data Pointer to the data whose checksum it to be verified. -//! @param count The number of bytes pointed to by data. -//! @param csval Pointer to a vector of expected page checksums. The -//! vector must be sized (count/PageSize+(count%PageSize != 0)). -//! @param valcs Pointer to a vector of the same size as csval to hold -//! the computed checksum. -//! -//! @return True if all the checksums match; false otherwise. -//------------------------------------------------------------------------------ - -static bool Ver32C(const void* data, size_t count, - const uint32_t* csval, uint32_t* valcs); - - XrdOucCRC() {} - ~XrdOucCRC() {} - -private: - -static unsigned int crctable[256]; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCacheCM.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucCacheCM.hh deleted file mode 100644 index c9fbfcb0b..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCacheCM.hh +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __XRDPUCCACHECM_HH__ -#define __XRDPUCCACHECM_HH__ -/******************************************************************************/ -/* */ -/* X r d O u c C a c h e C M . h h */ -/* */ -/* (c) 2018 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -/* The class defined here is used to implement a cache context management - plugin. It is loaded as run time can interact with the cache, as needed. - The pss.ccmlib directive is used to load the plugin. However, it is only - loaded if a cache has been enabled for use. - - Your plug-in must exist in a shared library and have the following extern C - function defined: -*/ - -//------------------------------------------------------------------------------ -//! Initialize a cache context management plugin. -//! -//! @param Cache Reference to the object that interacts with the cache. -//! @param Logger -> The message routing object to be used in conjunction -//! with an XrdSysError object for error messages. When -//! nil, you should use cerr. -//! @param Config -> The name of the config file. When nil there was no -//! configuration file. -//! @param Parms -> Any parameters specified after the path on the -//! pss.ccmlib directive. If there are no parameters, the -//! pointer may be zero. -//! @param envP -> Environmental information.; nil if none. -//! -//! @return True Upon success. -//! False Upon failure. -//! -//! The function must be declared as an extern "C" function in a loadable -//! shared library as follows: -//------------------------------------------------------------------------------ - -class XrdOucEnv; -class XrdPosixCache; -class XrdSysLogger; - -typedef bool (*XrdOucCacheCMInit_t)(XrdPosixCache &Cache, - XrdSysLogger *Logger, - const char *Config, - const char *Parms, - XrdOucEnv *envP); -/*! - extern "C" - { - bool XrdOucCacheCMInit(XrdPosixCache &Cache, // Cache interface - XrdSysLogger *Logger, // Where messages go - const char *Config, // Config file used - const char *Parms, // Optional parm string - XrdOucEnv *envP); // Environmental information - } -*/ - -//------------------------------------------------------------------------------ -//! Declare compilation version. -//! -//! Additionally, you *should* declare the xrootd version you used to compile -//! your plug-in. While not currently required, it is highly recommended to -//! avoid execution issues should the class definition change. Declare it as: -//------------------------------------------------------------------------------ - -/*! #include "XrdVersion.hh" - XrdVERSIONINFO(XrdOucCacheCMInit,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCacheStats.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucCacheStats.hh deleted file mode 100644 index 4e24c0da5..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCacheStats.hh +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef __XRDOUCCACHESTATS_HH__ -#define __XRDOUCCACHESTATS_HH__ -/******************************************************************************/ -/* */ -/* X r d O u c C a c h e S t a t s . h h */ -/* */ -/* (c) 2018 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -#include "XrdSys/XrdSysAtomics.hh" -#include "XrdSys/XrdSysPthread.hh" - -/* The XrdOucCacheStats object holds statistics on cache usage. It is available - in each Cache object that records the summary information for that cache. -*/ - -class XrdOucCacheStats -{ -public: - -struct CacheStats -{ -// General read/write information -// -long long BytesPead; // Bytes read via preread (not included in BytesRead) -long long BytesRead; // Total number of bytes read into the cache -long long BytesGet; // Number of bytes delivered from the cache -long long BytesPass; // Number of bytes read but not cached -long long BytesWrite; // Total number of bytes written from the cache -long long BytesPut; // Number of bytes updated in the cache -long long BytesSaved; // Number of bytes written from memory to disk -long long BytesPurged; // Number of bytes purged from the cache -long long Hits; // Number of times wanted data was in the cache -long long Miss; // Number of times wanted data was *not* in the cache -long long Pass; // Number of times wanted data was read but not cached -long long HitsPR; // Number of pages of wanted data was just preread -long long MissPR; // Number of pages of unwanted data was just preread - -// Local file information -// -long long FilesOpened; // Number of cache files opened -long long FilesClosed; // Number of cache files closed -long long FilesCreated;// Number of cache files created -long long FilesPurged; // Number of cache files purged (i.e. deleted) -long long FilesInCache;// Number of files currently in the cache -long long FilesAreFull;// Number of full files currently in the cache - -// Permanent storage information (all state information) -// -long long DiskSize; // Size of disk cache in bytes -long long DiskUsed; // Size of disk cache in use (bytes) -long long DiskMin; // Minimum bytes that were in use -long long DiskMax; // Maximum bytes that were in use - -// Memory information (all state information) -// -long long MemSize; // Maximum bytes that can be in memory -long long MemUsed; // Actual bytes that are allocated in memory -long long MemWriteQ; // Actual bytes that are in write queue - -// File information (supplied by the POSIX layer) -// -long long OpenDefers; // Number of opens that were deferred -long long DeferOpens; // Number of defers that were actually opened -long long ClosDefers; // Number of closes that were deferred -long long ClosedLost; // Number of closed file objects that were lost -} X; // This must be a POD type - -inline void Get(XrdOucCacheStats &D) - {sMutex.Lock(); - memcpy(&D.X, &X, sizeof(CacheStats)); - sMutex.UnLock(); - } - -inline void Add(XrdOucCacheStats &S) - {sMutex.Lock(); - X.BytesPead += S.X.BytesPead; X.BytesRead += S.X.BytesRead; - X.BytesGet += S.X.BytesGet; X.BytesPass += S.X.BytesPass; - X.BytesSaved += S.X.BytesSaved; X.BytesPurged+= S.X.BytesPurged; -/* R/W Cache */ X.BytesWrite += S.X.BytesWrite; X.BytesPut += S.X.BytesPut; - X.Hits += S.X.Hits; X.Miss += S.X.Miss; - X.Pass += S.X.Pass; - X.HitsPR += S.X.HitsPR; X.MissPR += S.X.MissPR; - sMutex.UnLock(); - } - -inline void Set(XrdOucCacheStats &S) - {sMutex.Lock(); - X.FilesOpened = S.X.FilesOpened; X.FilesClosed = S.X.FilesClosed; - X.FilesCreated = S.X.FilesCreated;X.FilesPurged = S.X.FilesPurged; - X.FilesInCache = S.X.FilesInCache;X.FilesAreFull= S.X.FilesAreFull; - - X.DiskSize = S.X.DiskSize; X.DiskUsed = S.X.DiskUsed; - X.DiskMin = S.X.DiskMin; X.DiskMax = S.X.DiskMax; - - X.MemSize = S.X.MemSize; X.MemUsed = S.X.MemUsed; - X.MemWriteQ = S.X.MemWriteQ; - sMutex.UnLock(); - } - -inline void Add(long long &Dest, long long Val) - {sMutex.Lock(); Dest += Val; sMutex.UnLock();} - -inline void Count(long long &Dest) - {AtomicBeg(sMutex); AtomicInc(Dest); AtomicEnd(sMutex);} - -inline void Set(long long &Dest, long long Val) - {sMutex.Lock(); Dest = Val; sMutex.UnLock();} - -inline void Lock() {sMutex.Lock();} -inline void UnLock() {sMutex.UnLock();} - - XrdOucCacheStats() {memset(&X, 0, sizeof(CacheStats));} - ~XrdOucCacheStats() {} -private: -XrdSysMutex sMutex; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCallBack.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucCallBack.hh deleted file mode 100644 index ffc5727c8..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCallBack.hh +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef __XRDOUCCALLBACK__HH_ -#define __XRDOUCCALLBACK__HH_ -/******************************************************************************/ -/* */ -/* X r d O u c C a l l B a c k . h h */ -/* */ -/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "XrdOuc/XrdOucErrInfo.hh" -#include "XrdSys/XrdSysPthread.hh" - -/* The XrdOucCallBack object encapsulates the vagaries of handling callbacks - in the xrootd framework; where callbacks are allowed. Once a callback is - successfully established using Init() this object should not be deleted - until Reply() of Cancel() is called. The destructor automatically calls - Cancel() is a callback is outstanding. The object may be reused after - Cancel() or Reply is called. See warnings on Init() and Cancel(). - - This object is not MT-safe and must be used in a serial fashion. -*/ - -class XrdOucCallBack : public XrdOucEICB -{ -public: - -/* Allowed() tell you whether or not am XrdOucErrInfo object has been setup to - allow callbacks. You should test this before assuming you can use - the object to effect a callback. - - Returns: True - if a callback is allowed. - False - otherwise. -*/ -static int Allowed(XrdOucErrInfo *eInfo) {return eInfo->getErrCB() != 0;} - -/* Cancel() cancels the callback. If no callback is oustanding, it does - nothing. Otherwise, the associated endpoint is told to retry - whatever operation caused the callback to be setup. Warning, - calling Cancel() or deleting this object after calling Init() - but not effecting a callback response will cause the calling - thread to hang! -*/ - void Cancel(); - -/* Init() sets up a call back using the provided XrdOucErrInfo object. - You must successfully call Init() before calling Reply()! - Warning, once you cann Init() you *must* effect a callback - response; otherwise, it is likely a subsequent thread using - this object will hang! - - Returns: True - if a callback was set up. - False - otherwise (i.e., object does not allow callbacks). -*/ - int Init(XrdOucErrInfo *eInfo); - -/* Reply() sends the specified results to the endpoint associated with the - callback esablished by Init(). The parameters are: - retVal - The value you would have synchrnously returned. - eValue - The numeric value that would have been returned in the - original XrdOucErrInfo object. - eText - The character string that would have been returned in the - original XrdOucErrInfo object. - Path - Optional path related to the reply. It is passed to the - callback effector and is used for tracing & monitoring. - - Returns: True - if a callback was initiated. - False - callback failed; likely Init() was not successfully called. -*/ - int Reply(int retVal, int eValue, const char *eText, - const char *Path=0); - - XrdOucCallBack() : Next(0), cbSync(0), cbArg(0), cbObj(0) {} - ~XrdOucCallBack() {if (cbObj) Cancel();} - -// The following is a handy pointer to allow for linking these objects together -// -XrdOucCallBack *Next; - -private: -void Done(int &Result,XrdOucErrInfo *eInfo,const char *Path=0) -{ (void)Result; (void)eInfo; (void)Path; cbSync.Post();} -int Same(unsigned long long arg1, unsigned long long arg2) -{ (void)arg1; (void)arg2; return 0;} - -XrdSysSemaphore cbSync; -unsigned long long cbArg; -XrdOucEICB *cbObj; -char UserID[64]; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucChain.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucChain.hh deleted file mode 100644 index 8bb482113..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucChain.hh +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef __OUC_CHAIN__ -#define __OUC_CHAIN__ -/******************************************************************************/ -/* */ -/* X r d O u c C h a i n . h h */ -/* */ -/* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -template -class XrdOucQSItem -{ -public: -XrdOucQSItem *nextelem; -T *dataitem; - XrdOucQSItem(T *item) {dataitem = item; nextelem = 0;} - ~XrdOucQSItem() {} -}; - -template -class XrdOucStack -{ -public: - -int isEmpty() {return anchor == 0;} - -T *Pop() {XrdOucQSItem *cp; - if (!(cp = anchor)) return (T *)0; - anchor = anchor->nextelem; - cp->nextelem = 0; - return cp->dataitem; - } - -void Push(XrdOucQSItem *item) {item->nextelem = anchor; anchor = item;} - - XrdOucStack() {anchor = 0;} - ~XrdOucStack() {} - -private: -XrdOucQSItem *anchor; -}; - -template -class XrdOucQueue -{ -public: - -void Add(XrdOucQSItem *item) - {item->nextelem = 0; - if (lastelem) {lastelem->nextelem = item; - lastelem = item; - } - else anchor = lastelem = item; - } - -int isEmpty() {return anchor == 0;} - -T *Remove() {XrdOucQSItem *qp; - if (!(qp = anchor)) return (T *)0; - if (!(anchor = anchor->nextelem)) lastelem = 0; - return qp->dataitem; - } - - XrdOucQueue() {anchor = lastelem = 0;} - ~XrdOucQueue() {} - -private: -XrdOucQSItem *anchor; -XrdOucQSItem *lastelem; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCompiler.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucCompiler.hh deleted file mode 100644 index fdd85cd6f..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucCompiler.hh +++ /dev/null @@ -1,34 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2015 by European Organization for Nuclear Research (CERN) -// Author: Lukasz Janyst -//------------------------------------------------------------------------------ -// This file is part of the XRootD software suite. -// -// XRootD is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// XRootD is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with XRootD. If not, see . -// -// In applying this licence, CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. -//------------------------------------------------------------------------------ - -#ifndef __XRD_OUC_COMPILER_HH__ -#define __XRD_OUC_COMPILER_HH__ - -#if defined(__GNUC__) || defined(__clang__) -#define XRD_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#else -#define XRD_WARN_UNUSED_RESULT -#endif - -#endif // __XRD_OUC_COMPILER_HH__ diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucDLlist.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucDLlist.hh deleted file mode 100644 index 6d080d8e8..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucDLlist.hh +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef __OUC_DLIST__ -#define __OUC_DLIST__ -/******************************************************************************/ -/* */ -/* X r d O u c D L l i s t . h h */ -/* */ -/*(c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/*Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Deprtment of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - - -template -class XrdOucDLlist -{ -public: - - XrdOucDLlist(T *itemval=0) {prev=this; next=this; item=itemval;} - ~XrdOucDLlist() {if (prev != next) Remove();} - -// Apply() applies the specified function to every item in the list. Apply() -// is pointer-safe in that the current node pointers may be changed -// without affecting the traversal of the list. An argument may be -// passed to the function. A null pointer is returned if the list -// was completely traversed. Otherwise, the pointer to the node on -// which the applied function returned a non-zero value is returned. -// An optional starting point may be passed. -// -T *Apply(int (*func)(T *, void *), void *Arg, XrdOucDLlist *Start=0) - {XrdOucDLlist *nextnode, *node; - if (Start) node = Start; // Set correct starting point - else node = this; - - // Iterate through the list until we hit ourselves again. We do the - // loop once on the current node to allow for anchorless lists. - // - do {nextnode = node->next; - if (node->item && (*func)(node->item, Arg)) return node->item; - node = nextnode; - } while (node != this); - - // All done, indicate we went through the whole list - // - return (T *)0; - } - -// Insert() inserts the specified node immediately off itself. If an item value -// is not given, it is not changed. -// -void Insert(XrdOucDLlist *Node, T *Item=0) - {Node->next = next; // Chain in the item; - next->prev = Node; - next = Node; - Node->prev = this; - if (Item) Node->item = Item; - } - -// Item() supplies the item value associated with itself (used with Next()). -// -T *Item() {return item;} - -// Remove() removes itself from whatever list it happens to be in. -// -void Remove() - {prev->next = next; // Unchain the item - next->prev = prev; - next = this; - prev = this; - } - -// Next() supplies the next list node. -// -XrdOucDLlist *Next() {return next;} - -// Prev() supplies the prev list node. -// -XrdOucDLlist *Prev() {return prev;} - -// Set the item pointer -// -void setItem(T *ival) {item = ival;} - -// Singleton() indicates whether or not the node points to something -// -int Singleton() {return next == this;} - -private: -XrdOucDLlist *next; -XrdOucDLlist *prev; -T *item; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucEnum.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucEnum.hh deleted file mode 100644 index 84d0f116d..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucEnum.hh +++ /dev/null @@ -1,32 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2013 by European Organization for Nuclear Research (CERN) -// Author: Lukasz Janyst -//------------------------------------------------------------------------------ -// XRootD is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// XRootD is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with XRootD. If not, see . -//------------------------------------------------------------------------------ - -#ifndef __XRD_OUC_ENUM_HH__ -#define __XRD_OUC_ENUM_HH__ - -#define XRDOUC_ENUM_OPERATORS( T ) \ - inline T operator | (const T a, const T b) { return T(int(a) | int(b)); } \ - inline T &operator |= ( T &a, const T b) { return a = a | b; } \ - inline T operator & (const T a, const T b) { return T(int(a) & int(b)); } \ - inline T &operator &= ( T &a, const T b) { return a = a & b; } \ - inline T operator ^ (const T a, const T b) { return T(int(a) ^ int(b)); } \ - inline T &operator ^= ( T &a, const T b) { return a = a ^ b; } \ - inline T operator ~ (const T a) { return T(~int(a)); } - - -#endif // __XRD_OUC_ENUM_HH__ diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucEnv.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucEnv.hh deleted file mode 100644 index 13dbba88d..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucEnv.hh +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef __OUC_ENV__ -#define __OUC_ENV__ -/******************************************************************************/ -/* */ -/* X r d O u c E n v . h h */ -/* */ -/* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#ifndef WIN32 -#include -#endif -#include "XrdOuc/XrdOucHash.hh" - -class XrdSecEntity; - -class XrdOucEnv -{ -public: - -// Env() returns the full environment string and length passed to the -// constructor. -// -inline char *Env(int &envlen) {envlen = global_len; return global_env;} - -// Export() sets an external environmental variable to the desired value -// using dynamically allocated fixed storage. -// -static int Export(const char *Var, const char *Val); -static int Export(const char *Var, int Val); - -// Import() gets a variable from the extended environment and stores -// it in this object -static bool Import( const char *var, char *&val ); -static bool Import( const char *var, long &val ); - -// Get() returns the address of the string associated with the variable -// name. If no association exists, zero is returned. -// - char *Get(const char *varname) {return env_Hash.Find(varname);} - -// GetInt() returns a long integer value. If the variable varname is not found -// in the hash table, return -999999999. -// - long GetInt(const char *varname); - -// GetPtr() returns a pointer as a (void *) value. If the varname is not found -// a nil pointer is returned (i.e. 0). -// - void *GetPtr(const char *varname); - -// Put() associates a string value with the a variable name. If one already -// exists, it is replaced. The passed value and variable strings are -// duplicated (value here, variable by env_Hash). -// - void Put(const char *varname, const char *value) - {env_Hash.Rep((char *)varname, strdup(value), 0, Hash_dofree);} - -// PutInt() puts a long integer value into the hash. Internally, the value gets -// converted into a char* -// - void PutInt(const char *varname, long value); - -// PutPtr() puts a pointer value into the hash. The pointer is accepted as a -// (void *) value. By convention, the variable name should end with -// an asterisk and typically corresponds to it's class name. -// - void PutPtr(const char *varname, void *value); - -// Delimit() search for the first occurrence of comma (',') in value and -// replaces it with a null byte. It then returns the address of the -// remaining string. If no comma was found, it returns zero. -// - char *Delimit(char *value); - -// secEnv() returns the security environment; which may be a null pointer. -// -inline const XrdSecEntity *secEnv() const {return secEntity;} - -// Use the constructor to define the initial variable settings. The passed -// string is duplicated and the copy can be retrieved using Env(). -// - XrdOucEnv(const char *vardata=0, int vardlen=0, - const XrdSecEntity *secent=0); - - ~XrdOucEnv() {if (global_env) free((void *)global_env);} - -private: - -XrdOucHash env_Hash; -const XrdSecEntity *secEntity; -char *global_env; -int global_len; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucErrInfo.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucErrInfo.hh deleted file mode 100644 index 491ba9a11..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucErrInfo.hh +++ /dev/null @@ -1,525 +0,0 @@ -#ifndef __OUC_ERRINFO_H__ -#define __OUC_ERRINFO_H__ -/******************************************************************************/ -/* */ -/* X r d O u c E r r I n f o . h h */ -/* */ -/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/* */ -/******************************************************************************/ - -#include // For strlcpy() -#include - -#include "XrdOuc/XrdOucBuffer.hh" -#include "XrdSys/XrdSysPlatform.hh" - -/******************************************************************************/ -/* X r d O u c E I */ -/******************************************************************************/ - -//----------------------------------------------------------------------------- -//! The XrdOucEI struct encapsulates error information. It uses a fixed buffer -//! for message text and tracing information. It also allows extended -//! information to be recorded in an appendage. It cannot be directly used. -//----------------------------------------------------------------------------- - -struct XrdOucEI // Err information structure -{ - static const size_t Max_Error_Len = 2048; - static const int Path_Offset = 1024; - -const char *user; - int ucap; - int code; - char message[Max_Error_Len]; - -static const int uVMask = 0x0000ffff; //! ucap: Extract protocol version -static const int uAsync = 0x80000000; //! ucap: Supports async responses -static const int uUrlOK = 0x40000000; //! ucap: Supports url redirects -static const int uMProt = 0x20000000; //! ucap: Supports multiple protocols -static const int uReadR = 0x10000000; //! ucap: Supports read redirects -static const int uIPv4 = 0x08000000; //! ucap: Supports only IPv4 info -static const int uIPv64 = 0x04000000; //! ucap: Supports IPv6|IPv4 info and - //! uIPv4 says IPv4 is prefered -static const int uPrip = 0x02000000; //! ucap: Client is on a private net -static const int uLclF = 0x01000000; //! ucap: Client supports "file://" -static const int uRedirFlgs = 0x00800000; //! ucap: Client supports redirect flags -static const int uEcRedir = 0x00400000; //! ucap: Client support EC redirects - -inline void clear(const char *usr=0, int uc=0) - {code=0; ucap = uc; message[0]='\0'; - user = (usr ? usr : "?"); - } - - XrdOucEI &operator =(const XrdOucEI &rhs) - {code = rhs.code; - user = rhs.user; - ucap = rhs.ucap; - strcpy(message, rhs.message); - return *this; - } - XrdOucEI(const char *usr, int uc=0) {clear(usr, uc);} -}; - -/******************************************************************************/ -/* X r d O u c E r r I n f o */ -/******************************************************************************/ - -class XrdOucEICB; -class XrdOucEnv; -class XrdSysSemaphore; - -//----------------------------------------------------------------------------- -//! The XrdOucErrInfo class is used to communicate data, error, and callback -//! information between plug-ins. -//----------------------------------------------------------------------------- - -class XrdOucErrInfo -{ -public: - -//----------------------------------------------------------------------------- -//! Reset data and error information to null. Any appenadges are released. -//----------------------------------------------------------------------------- - - void clear() {Reset(); ErrInfo.clear();} - -//----------------------------------------------------------------------------- -//! Set callback argument. -//! -//! @param cbarg - An opaque 8-byte call-back argument. -//----------------------------------------------------------------------------- - -inline void setErrArg(unsigned long long cbarg=0) {ErrCBarg = cbarg;} - -//----------------------------------------------------------------------------- -//! Set callback information. -//! -//! @param cb - Pointer to the object describing the callback. -//! @param cbarg - An opaque 8-byte call-back argument. -//----------------------------------------------------------------------------- - -inline void setErrCB(XrdOucEICB *cb, unsigned long long cbarg=0) - {ErrCB = cb; ErrCBarg = cbarg;} - -//----------------------------------------------------------------------------- -//! Set error code. Any existing error text remains intact. -//! -//! @param code - The error number describing the error. -//! -//! @return code - The error number. -//----------------------------------------------------------------------------- - -inline int setErrCode(int code) {return ErrInfo.code = code;} - -//----------------------------------------------------------------------------- -//! Set error code and error text. -//! -//! @param code - The error number describing the error. -//! @param emsg - The error message text. -//! -//! @return code - The error number. -//----------------------------------------------------------------------------- - -inline int setErrInfo(int code, const char *emsg) - {strlcpy(ErrInfo.message, emsg, sizeof(ErrInfo.message)); - if (dataBuff) {dataBuff->Recycle(); dataBuff = 0;} - return ErrInfo.code = code; - } - -//----------------------------------------------------------------------------- -//! Set error code and error text. -//! -//! @param code - The error number describing the error. -//! @param txtlist - A vector of error message text segments. -//! @param n - The number of valid elements in txtlist. -//! -//! @return code - The error number. -//----------------------------------------------------------------------------- - -inline int setErrInfo(int code, const char *txtlist[], int n) - {int i, j = 0, k = sizeof(ErrInfo.message), l; - for (i = 0; i < n && k > 1; i++) - {l = strlcpy(&ErrInfo.message[j], txtlist[i], k); - j += l; k -= l; - } - if (dataBuff) {dataBuff->Recycle(); dataBuff = 0;} - return ErrInfo.code = code; - } - -//----------------------------------------------------------------------------- -//! Set error code and error text. -//! -//! @param code - The error number describing the error. -//! @param buffP - Pointer to the data buffer holding the error text, This -//! object takes ownership of the buffer and recycles it. -//! -//! @return code - The error number. -//----------------------------------------------------------------------------- - -inline int setErrInfo(int code, XrdOucBuffer *buffP) - {if (dataBuff) dataBuff->Recycle(); - dataBuff = buffP; - return ErrInfo.code = code; - } - -//----------------------------------------------------------------------------- -//! Set user pointer. -//! -//! @param user - Pointer to a stable storage area containing the username. -//----------------------------------------------------------------------------- - -inline void setErrUser(const char *user) {ErrInfo.user = (user ? user : "?");} - -//----------------------------------------------------------------------------- -//! Obtain the callback argument. -//! -//! @return The argument value currently in effect. -//----------------------------------------------------------------------------- - -inline unsigned long long getErrArg() {return ErrCBarg;} - -//----------------------------------------------------------------------------- -//! Get the pointer to the internal message buffer along with its size. -//! -//! @param mblen - Reference to where the size it to be returned. -//! -//! @return Pointer to the internal message buffer. -//----------------------------------------------------------------------------- - -inline char *getMsgBuff(int &mblen) - {mblen = sizeof(ErrInfo.message); - return ErrInfo.message; - } - -//----------------------------------------------------------------------------- -//! Get the callback object. -//! -//! @return Pointer to the callback object. -//----------------------------------------------------------------------------- - -inline XrdOucEICB *getErrCB() {return ErrCB;} - -//----------------------------------------------------------------------------- -//! Get the callback object and its argument. -//! -//! @param ap - Reference to where the callback argument is returned. -//! -//! @return Pointer to the callback object, ap holds the argument. -//----------------------------------------------------------------------------- - -inline XrdOucEICB *getErrCB(unsigned long long &ap) - {ap = ErrCBarg; return ErrCB;} - -//----------------------------------------------------------------------------- -//! Get the error code. -//! -//! @return The error code that was previously set. -//----------------------------------------------------------------------------- - -inline int getErrInfo() {return ErrInfo.code;} - -/* -//----------------------------------------------------------------------------- -//! Get a copy of the error information. -//! -//! @param errParm - Reference to where error information is to be copied. -//! -//! @return The error code that was previously set. -//----------------------------------------------------------------------------- -inline int getErrInfo(XrdOucEI &errParm) - {errParm = ErrInfo; return ErrInfo.code;} -*/ -//----------------------------------------------------------------------------- -//! Get a pointer to the error text. -//! -//! @return The pointer to the internal error text. -//----------------------------------------------------------------------------- - -inline const char *getErrText() - {if (dataBuff) return dataBuff->Data(); - return (const char *)ErrInfo.message; - } - -//----------------------------------------------------------------------------- -//! Get a pointer to the error text and the error code. -//! -//! @param ecode - Reference to where the error code is to be returned. -//! @return The pointer to the internal error text. -//----------------------------------------------------------------------------- - -inline const char *getErrText(int &ecode) - {ecode = ErrInfo.code; - if (dataBuff) return dataBuff->Data(); - return (const char *)ErrInfo.message; - } - -//----------------------------------------------------------------------------- -//! Get the error text length (optimized for external buffers). -//! -//! @return The mesage length. -//----------------------------------------------------------------------------- - -inline int getErrTextLen() - {if (dataBuff) return dataBuff->DataLen(); - return strlen(ErrInfo.message); - } - -//----------------------------------------------------------------------------- -//! Get a pointer to user information. -//! -//! @return The pointer to the user string. -//----------------------------------------------------------------------------- - -inline const char *getErrUser() {return ErrInfo.user;} - -//----------------------------------------------------------------------------- -//! Get a pointer to the error environment that was previously set. -//! -//! @return =0 - A callback is in effect which is mutually exclusive of -//! conaining an error environment (i.e. no environment). -//! @return !0 - Pointer to the error environment. -//----------------------------------------------------------------------------- - -inline XrdOucEnv *getEnv() {return (ErrCB ? 0 : ErrEnv);} - -//----------------------------------------------------------------------------- -//! Set the error environment and return the previous environment. This call -//! destroys any callback information that may have existed. -//! -//! @param newEnv - Pointer to the new error environment. -//! -//! @return =0 - No previous envuironment existed. -//! @return !0 - Pointer to the previous error environment. -//----------------------------------------------------------------------------- - -inline XrdOucEnv *setEnv(XrdOucEnv *newEnv) - {XrdOucEnv *oldEnv = (ErrCB ? 0 : ErrEnv); - ErrEnv = newEnv; - ErrCB = 0; - return oldEnv; - } - -//----------------------------------------------------------------------------- -//! Get the error tracing data. -//! -//! @return =0 - No tracing data has been set. -//! @return !0 - Pointer to error tracing data. -//----------------------------------------------------------------------------- - -inline const char *getErrData() {return (dOff < 0 ? 0 : ErrInfo.message+dOff);} - -//----------------------------------------------------------------------------- -//! Set the error tracing data (this is always placed in the internal buffer) -//! -//! @param Data - Pointer to the error tracing data. -//! @param Offs - Ofset into the message buffer where the data is to be set. -//----------------------------------------------------------------------------- - -inline void setErrData(const char *Data, int Offs=0) - {if (!Data) dOff = -1; - else {strlcpy(ErrInfo.message+Offs, Data, - sizeof(ErrInfo.message)-Offs); - dOff = Offs; - } - } - -//----------------------------------------------------------------------------- -//! Get the monitoring identifier. -//! -//! @return The monitoring identifier. -//----------------------------------------------------------------------------- - -inline int getErrMid() {return mID;} - -//----------------------------------------------------------------------------- -//! Set the monitoring identifier. -//----------------------------------------------------------------------------- - -inline void setErrMid(int mid) {mID = mid;} - -//----------------------------------------------------------------------------- -//! Check if this object will return extended data (can optimize Reset() calls). -//! -//! @return true - there is extended data. -//! false - there is no extended data. -//----------------------------------------------------------------------------- - -inline bool extData() {return (dataBuff != 0);} - -//----------------------------------------------------------------------------- -//! Reset object to no message state. Call this method to release appendages. -//----------------------------------------------------------------------------- - -inline void Reset() - {if (dataBuff) {dataBuff->Recycle(); dataBuff = 0;} - *ErrInfo.message = 0; - ErrInfo.code = 0; - } - -//----------------------------------------------------------------------------- -//! Get user capabilties. -//! -//! @return the user capabilities. -//----------------------------------------------------------------------------- - -inline int getUCap() {return ErrInfo.ucap;} - -//----------------------------------------------------------------------------- -//! Set user capabilties. -//----------------------------------------------------------------------------- - -inline void setUCap(int ucval) {ErrInfo.ucap = ucval;} - -//----------------------------------------------------------------------------- -//! Assignment operator -//----------------------------------------------------------------------------- - - XrdOucErrInfo &operator =(const XrdOucErrInfo &rhs) - {ErrInfo = rhs.ErrInfo; - ErrCB = rhs.ErrCB; - ErrCBarg= rhs.ErrCBarg; - mID = rhs.mID; - dOff = -1; - if (rhs.dataBuff) dataBuff = rhs.dataBuff->Clone(); - else dataBuff = 0; - return *this; - } - -//----------------------------------------------------------------------------- -//! Constructor -//! -//! @param user - Pointer to he user string in stable storage. -//! @param cb - Pointer to the callback object (zero if none). -//! @param ca - The callback argument. -//! @param mid - The monitoring identifier. -//! @param uc - The user capabilities. -//----------------------------------------------------------------------------- - - XrdOucErrInfo(const char *user=0,XrdOucEICB *cb=0, - unsigned long long ca=0, int mid=0, int uc=0) - : ErrInfo(user, uc), ErrCB(cb), ErrCBarg(ca), mID(mid), - dOff(-1), reserved(0), dataBuff(0) {} - -//----------------------------------------------------------------------------- -//! Constructor -//! -//! @param user - Pointer to he user string in stable storage. -//! @param envp - Pointer to the error environment. -//! @param uc - The user capabilities. -//----------------------------------------------------------------------------- - - XrdOucErrInfo(const char *user, XrdOucEnv *envp, int uc=0) - : ErrInfo(user, uc), ErrCB(0), ErrEnv(envp), mID(0), - dOff(-1), reserved(0), dataBuff(0) {} - -//----------------------------------------------------------------------------- -//! Constructor -//! -//! @param user - Pointer to he user string in stable storage. -//! @param MonID - The monitoring identifier. -//! @param uc - The user capabilities. -//----------------------------------------------------------------------------- - - XrdOucErrInfo(const char *user, int MonID, int uc=0) - : ErrInfo(user, uc), ErrCB(0), ErrCBarg(0), mID(MonID), - dOff(-1), reserved(0), dataBuff(0) {} - -//----------------------------------------------------------------------------- -//! Destructor -//----------------------------------------------------------------------------- - -virtual ~XrdOucErrInfo() {Reset();} - -protected: - -XrdOucEI ErrInfo; -XrdOucEICB *ErrCB; -union { -unsigned long long ErrCBarg; -XrdOucEnv *ErrEnv; - }; -int mID; -short dOff; -short reserved; -XrdOucBuffer *dataBuff; -}; - -/******************************************************************************/ -/* X r d O u c E I C B */ -/******************************************************************************/ - -//----------------------------------------------------------------------------- -//! The XrdOucEICB is the object that instantiates a callback. This abstract -//! class is used to define the callback interface. It is normally handled by -//! classes that know how to deal with this object in a user friendly way -//! (e.g. XrdOucCallBack). -//----------------------------------------------------------------------------- - -class XrdOucEICB -{ -public: - -//----------------------------------------------------------------------------- -//! Invoke a callback after an operation completes. -//! -//! @param Result - the original function's result (may be changed). -//! @param eInfo - Associated error information. The eInfo object may not be -//! modified until it's own callback Done() method is called, if -//! supplied. If the callback function in eInfo is zero, then -//! the eInfo object is deleted by the invoked callback. -//! Otherwise, that method must be invoked by this callback -//! function after the actual callback message is sent. This -//! allows the callback requestor to do post-processing and be -//! asynchronous being assured that the callback completed. -//! @param Path - Optionally, the path related to thid request. It is used -//! for tracing and detailed monitoring purposes. -//----------------------------------------------------------------------------- - -virtual void Done(int &Result, //I/O: Function result - XrdOucErrInfo *eInfo, // In: Error Info - const char *Path=0)=0;// In: Relevant path - -//----------------------------------------------------------------------------- -//! Determine if two callback arguments refer to the same client. -//! -//! @param arg1 - The first callback argument. -//! @param arg2 - The second callback argument. -//! -//! @return !0 - The arguments refer to the same client. -//! @return =0 - The arguments refer to the different clients. -//----------------------------------------------------------------------------- - -virtual int Same(unsigned long long arg1, unsigned long long arg2)=0; - -//----------------------------------------------------------------------------- -//! Constructor and destructor -//----------------------------------------------------------------------------- - - XrdOucEICB() {} -virtual ~XrdOucEICB() {} -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucGMap.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucGMap.hh deleted file mode 100644 index a3532f32c..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucGMap.hh +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef __XRDOUCGMAP_H__ -#define __XRDOUCGMAP_H__ -/******************************************************************************/ -/* */ -/* X r d O u c G M a p . h h */ -/* */ -/* (c) 2006 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "XrdOuc/XrdOucHash.hh" -#include "XrdOuc/XrdOucString.hh" -#include "XrdSys/XrdSysXSLock.hh" - -class XrdOucTrace; -class XrdSysError; -class XrdSecGMapEntry_t -{ -public: - XrdSecGMapEntry_t(const char *v, const char *u, int t) : val(v), user(u), type(t) { } - XrdOucString val; - XrdOucString user; - int type; -}; - -class XrdOucGMap -{ -public: - -//------------------------------------------------------------------------------ -//! Map a distinguished name (dn) to a user name. -//! -//! @param dn -> Distinguished name. -//! @param user -> Buffer where the user name is to be placed. -//! It must end with a null byte. -//! @param ulen -> The length of the 'user' buffer. -//! @param now -> Current time (result of time(0)) or 0 if not available. -//! -//! @return Success: Zero. -//! Failure: An errno number describing the failure; typically -//! -EFAULT - No valid matching found. -//! -errno - If problems reloading the file -//------------------------------------------------------------------------------ - -virtual int dn2user(const char *dn, char *user, int ulen, time_t now = 0); - - -//------------------------------------------------------------------------------ -//! Constructor -//! -//! @param eDest -> The error object that must be used to print any errors or -//! other messages (see XrdSysError.hh). -//! @param mapfn -> Path to the grid map file to be used. This pointer -//! may be null; the default path will be tested then. -//! @param parms -> Argument string specified on the gridmap directive. It may -//! be null or point to a null string if no parms exist. -//! Curently supported parms: -//! dbg to enable debug printouts -//! to=timeout to set a timeout in secs on the validity -//! of the information loaded from the file -//! Default is 600 (10'); the reload is -//! triggered by the first mapping request -//! after the timeout is expired; the file is -//! reloaded only if changed. -//! -//------------------------------------------------------------------------------ -#define XrdOucGMapArgs XrdSysError *eDest, \ - const char *mapfn, \ - const char *parms - XrdOucGMap(XrdOucGMapArgs); - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - -virtual ~XrdOucGMap() {} - -//------------------------------------------------------------------------------ -//! Validity checker -//------------------------------------------------------------------------------ - -bool isValid() const { return valid; } - -private: -//------------------------------------------------------------------------------ -//! Internal members -//------------------------------------------------------------------------------ - -bool valid; -XrdOucHash mappings; -XrdOucString mf_name; -time_t mf_mtime; -time_t notafter; -long timeout; - -XrdSysError *elogger; -XrdOucTrace *tracer; -bool dbg; - -XrdSysXSLock xsl; - -//------------------------------------------------------------------------------ -//! Internal methods -//------------------------------------------------------------------------------ - -int load(const char *mf, bool force = 0); -}; - -/******************************************************************************/ -/* X r d O u c g e t G M a p */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! Obtain an instance of the XrdOucGMap object. -//! -//! This extern "C" function is called when a shared library plug-in containing -//! implementation of this class is loaded. It must exist in the shared library -//! and must be thread-safe. -//! -//! @param eDest -> The error object that must be used to print any errors or -//! other messages (see XrdSysError.hh). -//! @param mapfn -> Path to the grid map file to be used. This pointer -//! may be null; the default path will be tested then. -//! @param parms -> Argument string specified on the gridmap directive. It may -//! be null or point to a null string if no parms exist. -//! -//! @return Success: A pointer to an instance of the XrdOucGMap object. -//! Failure: A null pointer which causes initialization to fail. -//! -//! The GMap object is used frequently in the course of creating new physical -//! connections. -//! The algorithms used by this object *must* be efficient and speedy; -//! otherwise system performance will be severely degraded. -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -//! Declare compilation version. -//! -//! Additionally, you *should* declare the xrootd version you used to compile -//! your plug-in. While not currently required, it is highly recommended to -//! avoid execution issues should the class definition change. Declare it as: -//------------------------------------------------------------------------------ - -/*! - #include "XrdVersion.hh" - XrdVERSIONINFO(XrdOucgetGMap,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ - -extern "C" XrdOucGMap *XrdOucgetGMap(XrdOucGMapArgs); - -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucHash.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucHash.hh deleted file mode 100644 index eaf599877..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucHash.hh +++ /dev/null @@ -1,213 +0,0 @@ -#ifndef __OOUC_HASH__ -#define __OOUC_HASH__ -/******************************************************************************/ -/* */ -/* X r d O u c H a s h . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include -#include -#include - -/* -Hash_data_is_key - The key and data are the same so when an item is added - the data pointer is set to the key address. -Hash_replace - When adding an item, any existing item is replaced. -Hash_count - The number of deletion requests must equal the number of - additions before the item is actually deleted. -Hash_keep - When the item is added, the key is not duplicated and - when the item is deleted, the key *and* data are not deleted. -Hash_dofree - When an item is deleted the data is released using free() - instead of delete(). -Hash_keepdata - Works like Hash_keep but only applies to the data object. - When adding the entry, the key is strdup'd and when deleting - an entry, the key is freed. -*/ -enum XrdOucHash_Options {Hash_default = 0x0000, - Hash_data_is_key = 0x0001, - Hash_replace = 0x0002, - Hash_count = 0x0004, - Hash_keep = 0x0008, - Hash_dofree = 0x0010, - Hash_keepdata = 0x0020 - }; - -template -class XrdOucHash_Item -{ -public: -int Count() {return keycount;} - -T *Data() {return keydata;} - - unsigned long Hash() {return keyhash;} - -const char *Key() {return keyval;} - -XrdOucHash_Item *Next() {return next;} - -time_t Time() {return keytime;} - -void Update(int newcount, time_t newtime) - {keycount = newcount; - if (newtime) keytime = newtime; - } - -int Same(const unsigned long KeyHash, const char *KeyVal) - {return keyhash == KeyHash && !strcmp(keyval, KeyVal);} - -void SetNext(XrdOucHash_Item *item) {next = item;} - - XrdOucHash_Item(unsigned long KeyHash, - const char *KeyVal, - T *KeyData, - time_t KeyTime, - XrdOucHash_Item *KeyNext, - XrdOucHash_Options KeyOpts) - {keyhash = KeyHash; - if (KeyOpts & Hash_keep) keyval = KeyVal; - else keyval = strdup(KeyVal); - if (KeyOpts & Hash_data_is_key) keydata = (T *)keyval; - else keydata = KeyData; - keytime = KeyTime; - entopts = KeyOpts; - next = KeyNext; - keycount= 0; - } - - ~XrdOucHash_Item() - {if (!(entopts & Hash_keep)) - {if (keydata && keydata != (T *)keyval - && !(entopts & Hash_keepdata)) - {if (entopts & Hash_dofree) free(keydata); - else delete keydata; - } - if (keyval) free((void *)keyval); - } - keydata = 0; keyval = 0; keycount = 0; - } - -private: - -XrdOucHash_Item *next; -const char *keyval; -unsigned long keyhash; -T *keydata; -time_t keytime; -int keycount; -XrdOucHash_Options entopts; -}; - -template -class XrdOucHash -{ -public: - -// Add() adds a new item to the hash. If it exists and repl = 0 then the old -// entry is returned and the new data is not added. Otherwise the current -// entry is replaced (see Rep()) and 0 is returned. If we have no memory -// to add the new entry, an ENOMEM exception is thrown. The -// LifeTime value is the number of seconds this entry is to be considered -// valid. When the time has passed, the entry may be deleted. A value -// of zero, keeps the entry until explicitly deleted. A special feature -// allows the data to be associated with the key to be the actual key -// using the Hash_data_is_key option. In this case, KeyData is ignored. -// The Hash_count option keeps track of duplicate key entries for Del. -// -T *Add(const char *KeyVal, T *KeyData, const int LifeTime=0, - XrdOucHash_Options opt=Hash_default); - -// Del() deletes the item from the hash. If it doesn't exist, it returns -// -ENOENT. Otherwise 0 is returned. If the Hash_count option is specified -// tyhen the entry is only deleted when the entry count is below 0. -// -int Del(const char *KeyVal, XrdOucHash_Options opt = Hash_default); - -// Find() simply looks up an entry in the cache. It can optionally return the -// lifetime associated with the entry. If the -// -T *Find(const char *KeyVal, time_t *KeyTime=0); - -// Num() returns the number of items in the hash table -// -int Num() {return hashnum;} - -// Purge() simply deletes all of the appendages to the table. -// -void Purge(); - -// Rep() is simply Add() that allows replacement. -// -T *Rep(const char *KeyVal, T *KeyData, const int LifeTime=0, - XrdOucHash_Options opt=Hash_default) - {return Add(KeyVal, KeyData, LifeTime, - (XrdOucHash_Options)(opt | Hash_replace));} - -// Apply() applies the specified function to every item in the hash. The -// first argument is the key value, the second is the associated data, -// the third argument is whatever is the passed in void *variable, The -// following actions occur for values returned by the applied function: -// <0 - The hash table item is deleted. -// =0 - The next hash table item is processed. -// >0 - Processing stops and the hash table item is returned. -// -T *Apply(int (*func)(const char *, T *, void *), void *Arg); - -// When allocateing a new hash, specify the required starting size. Make -// sure that the previous number is the correct Fibonocci antecedent. The -// series is simply n[j] = n[j-1] + n[j-2]. -// - XrdOucHash(int psize = 89, int size=144, int load=80); - ~XrdOucHash() {if (hashtable) {Purge(); free(hashtable); hashtable = 0;}} - -private: -void Remove(int kent, XrdOucHash_Item *hip, XrdOucHash_Item *phip); - -XrdOucHash_Item *Search(XrdOucHash_Item *hip, - const unsigned long khash, - const char *kval, - XrdOucHash_Item **phip=0); - -unsigned long HashVal(const char *KeyVal); - -void Expand(); - -XrdOucHash_Item **hashtable; -int prevtablesize; -int hashtablesize; -int hashnum; -int hashmax; -int hashload; -}; - -/******************************************************************************/ -/* A c t u a l I m p l e m e n t a t i o n */ -/******************************************************************************/ - -#include "XrdOuc/XrdOucHash.icc" -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucHash.icc b/test/binary/usr/include/xrootd/XrdOuc/XrdOucHash.icc deleted file mode 100644 index 88b3e821d..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucHash.icc +++ /dev/null @@ -1,295 +0,0 @@ -/******************************************************************************/ -/* */ -/* X r d O u c H a s h . i c c */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -/******************************************************************************/ -/* E x t e r n a l H a s h F u n c t i o n */ -/******************************************************************************/ - -extern unsigned long XrdOucHashVal(const char *KeyVal); - -/******************************************************************************/ -/* C o n s t r u c t o r */ -/******************************************************************************/ - -template -XrdOucHash::XrdOucHash(int psize, int csize, int load) -{ - prevtablesize = psize; - hashtablesize = csize; - hashload = load; - hashmax = (csize * load) / 100; - hashnum = 0; - hashtable = (XrdOucHash_Item **) - malloc( (size_t)(csize*sizeof(XrdOucHash_Item *)) ); - memset((void *)hashtable, 0, (size_t)(csize*sizeof(XrdOucHash_Item *))); -} - -/******************************************************************************/ -/* A d d */ -/******************************************************************************/ - -template -T *XrdOucHash::Add(const char *KeyVal, T *KeyData, const int LifeTime, - XrdOucHash_Options opt) -{ - unsigned long khash = XrdOucHashVal(KeyVal); - int hent; - time_t lifetime, KeyTime=0; - XrdOucHash_Item *hip, *newhip, *prevhip; - - // Compute the hash index and look up the entry. If found, either - // return an error or delete it because caller wanted it replaced or - // it has expired. - // - hent = khash % hashtablesize; - if ((hip = hashtable[hent]) && (hip = Search(hip, khash, KeyVal, &prevhip))) - {if (opt & Hash_count) - {hip->Update(hip->Count()+1, - (LifeTime || hip->Time() ? LifeTime + time(0) : 0) );} - if (!(opt & Hash_replace) - && ((lifetime=hip->Time())==0||lifetime>=time(0))) return hip->Data(); - Remove(hent, hip, prevhip); - } else { - // Check if we should expand the table - // - if (hashnum >= hashmax) {Expand(); hent = khash % hashtablesize;} - } - - // Add the entry - // - if (LifeTime) KeyTime = LifeTime + time(0); - if ( !(newhip = new XrdOucHash_Item(khash, KeyVal, KeyData, KeyTime, - hashtable[hent], opt)) ) throw ENOMEM; - hashtable[hent] = newhip; - hashnum++; - return (T *)0; -} - -/******************************************************************************/ -/* A p p l y */ -/******************************************************************************/ - -template -T *XrdOucHash::Apply(int (*func)(const char *, T *, void *), void *Arg) -{ - int i, rc; - time_t lifetime; - XrdOucHash_Item *hip, *prevhip, *nexthip; - - //Run through all the entries, applying the function to each. Expire - // dead entries by pretending that the function asked for a deletion. - // - for (i = 0; i < hashtablesize; i++) - {hip = hashtable[i]; prevhip = 0; - while(hip) - {nexthip = hip->Next(); - if ((lifetime = hip->Time()) && lifetime < time(0)) rc = -1; - else if ( (rc = (*func)(hip->Key(), hip->Data(), Arg)) > 0 ) - return hip->Data(); - if (rc < 0) - {delete hip; - if (prevhip) prevhip->SetNext(nexthip); - else hashtable[i] = nexthip; - hashnum--; - } - else prevhip = hip; - hip = nexthip; - } - } - return (T *)0; -} - -/******************************************************************************/ -/* D e l */ -/******************************************************************************/ - -template -int XrdOucHash::Del(const char *KeyVal, XrdOucHash_Options) -{ - unsigned long khash = XrdOucHashVal(KeyVal); - int hent, cnt; - XrdOucHash_Item *hip, *phip, *thip; - - // Compute the hash index and look up the entry. If found, return it. - // - hent = khash % hashtablesize; - if (!(thip = hashtable[hent])) return -ENOENT; - if (!( hip = Search(thip, khash, KeyVal, &phip) ) ) return -ENOENT; - - // Delete the item and return - // - if ((cnt = hip->Count()) <= 0) Remove(hent, hip, phip); - else hip->Update(cnt-1, 0); - return 0; -} - -/******************************************************************************/ -/* F i n d */ -/******************************************************************************/ - -template -T *XrdOucHash::Find(const char *KeyVal, time_t *KeyTime) -{ - unsigned long khash = XrdOucHashVal(KeyVal); - int kent; - time_t lifetime = 0; - XrdOucHash_Item *phip, *hip; - -// Compute position of the hash table entry -// - kent = khash%hashtablesize; - -// Find the entry (remove it if expired and return nothing) -// - if ((hip = hashtable[kent])) - if ((hip = Search(hip, khash, KeyVal, &phip))) - if ( (lifetime = hip->Time()) && lifetime < time(0) ) - {Remove(kent, hip, phip); - if (KeyTime) *KeyTime = (time_t)0; - return (T *)0; - } - -// Return actual information -// - if (KeyTime) *KeyTime = lifetime; - if (hip) return hip->Data(); - return (T *)0; -} - -/******************************************************************************/ -/* P u r g e */ -/******************************************************************************/ - -template -void XrdOucHash::Purge() -{ - int i; - XrdOucHash_Item *hip, *nexthip; - - //Run through all the entries, deleting each one - // - for (i = 0; i < hashtablesize; i++) - {hip = hashtable[i]; hashtable[i] = 0; - while(hip) - {nexthip = hip->Next(); - delete hip; - hip = nexthip; - } - } - hashnum = 0; -} - -/******************************************************************************/ -/* P r i v a t e M e t h o d s */ -/******************************************************************************/ - -/******************************************************************************/ -/* E x p a n d */ -/******************************************************************************/ - -template -void XrdOucHash::Expand() -{ - int newsize, newent, i; - size_t memlen; - XrdOucHash_Item **newtab, *hip, *nexthip; - - // Compute new size for table using a fibonacci series - // - newsize = prevtablesize +hashtablesize; - - // Allocate the new table - // - memlen = (size_t)(newsize*sizeof(XrdOucHash_Item *)); - if (!(newtab = (XrdOucHash_Item **) malloc(memlen))) throw ENOMEM; - memset((void *)newtab, 0, memlen); - - // Redistribute all of the current items - // - for (i = 0; i < hashtablesize; i++) - {hip = hashtable[i]; - while(hip) - {nexthip = hip->Next(); - newent = (hip->Hash()) % newsize; - hip->SetNext(newtab[newent]); - newtab[newent] = hip; - hip = nexthip; - } - } - - // Free the old table and plug in the new table - // - free((void *)hashtable); - hashtable = newtab; - prevtablesize = hashtablesize; - hashtablesize = newsize; - - // Compute new expansion threshold - // - hashmax = static_cast((static_cast(newsize)*hashload)/100); -} - -/******************************************************************************/ -/* R e m o v e */ -/******************************************************************************/ - -template -void XrdOucHash::Remove(int kent, XrdOucHash_Item *hip, - XrdOucHash_Item *phip) -{ - if (phip) phip->SetNext(hip->Next()); - else hashtable[kent] = hip->Next(); - delete hip; - hashnum--; -} - -/******************************************************************************/ -/* S e a r c h */ -/******************************************************************************/ - -template -XrdOucHash_Item *XrdOucHash::Search(XrdOucHash_Item *hip, - const unsigned long khash, - const char *kval, - XrdOucHash_Item **pitem) -{ - XrdOucHash_Item *prevp = 0; - - // Scan through the chain looking for a match - // - while(hip && !hip->Same(khash, kval)) - {prevp = hip; - hip = hip->Next(); - } - if (pitem) *pitem = prevp; - return hip; -} diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucIOVec.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucIOVec.hh deleted file mode 100644 index e355b44d5..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucIOVec.hh +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef __OUC_IOVEC_H__ -#define __OUC_IOVEC_H__ -/******************************************************************************/ -/* */ -/* X r d O u c I O V e c . h h */ -/* */ -/* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -//----------------------------------------------------------------------------- -//! XrdOucIOVec -//! -//! The struct defined here is a generic data structure that is used whenever -//! we need to pass a vector of file offsets, lengths, and the corresponding -//! target buffer pointers. It is used by the sfs, ofs, and oss components. -//----------------------------------------------------------------------------- - -struct XrdOucIOVec -{ - long long offset; // Offset into the file. - int size; // Size of I/O to perform. - int info; // Available for arbitrary use - char *data; // Location to read into. -}; - -// Add backward compatible constructor to XrdOucIOVec -// -struct XrdOucIOVec2 : public XrdOucIOVec -{ - XrdOucIOVec2(char *buff, long long offs, int sz, int inf=0) - {XrdOucIOVec::offset = offs; - XrdOucIOVec::size = sz; - XrdOucIOVec::info = inf; - XrdOucIOVec::data = buff; - } -}; - -// The following correct an error as 'struct iov' was meant to be 'XrdOucIOVec' -// but was never defined. However, method signatures remain and we can't change -// them. So, the 'struct iov' is defined here in a more useable way. It wase -// layout is identical. -// -struct iov : public XrdOucIOVec { }; - -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucLock.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucLock.hh deleted file mode 100644 index a7ca22eab..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucLock.hh +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __OUC_LOCK_HH__ -#define __OUC_LOCK_HH__ -/******************************************************************************/ -/* */ -/* X r d O u c L o c k . h h */ -/* */ -/* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "XrdSys/XrdSysPthread.hh" - -class XrdOucLock -{ -public: - XrdOucLock(XrdSysMutex *mp) - {Mutex = mp; Mutex->Lock(); isLocked = 1;} - ~XrdOucLock() {if (isLocked) Mutex->UnLock();} - -private: - -XrdSysMutex *Mutex; -int isLocked; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucName2Name.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucName2Name.hh deleted file mode 100644 index 49088a53c..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucName2Name.hh +++ /dev/null @@ -1,234 +0,0 @@ -#ifndef __XRDOUCNAME2NAME_H__ -#define __XRDOUCNAME2NAME_H__ -/******************************************************************************/ -/* */ -/* X r d O u c n a m e 2 n a m e . h h */ -/* */ -/* (c) 2006 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -/******************************************************************************/ -/* X r d O u c N a m e 2 N a m e */ -/******************************************************************************/ - -//! Class XrdoucName2Name must be used for creating a name translation plug-in. -//! This plug-in is specified by the 'oss.namelib' directive and when present -//! makes the default oss plug-in load the plug-in shared library, locate the -//! XrdOucgetName2Name function within and use it to obtain an instance of the -//! XrdOucName2Name object to perform name translation prior to all subsequent -//! storage system calls. The companion object, XrdOucName2NameVec, should -//! also be defined in the same shared library (see the class definition below). - -class XrdOucName2Name -{ -public: - -//------------------------------------------------------------------------------ -//! Map a logical file name to a physical file name. -//! -//! @param lfn -> Logical file name. -//! @param buff -> Buffer where the physical file name of an existing file is -//! to be placed. It must end with a null byte. -//! @param blen The length of the buffer. -//! -//! @return Success: Zero. -//! Failure: An errno number describing the failure; typically -//! EINVAL - The supplied lfn is invalid. -//! ENAMETOOLONG - The buffer is too small for the pfn. -//------------------------------------------------------------------------------ - -virtual int lfn2pfn(const char *lfn, char *buff, int blen) = 0; - -//------------------------------------------------------------------------------ -//! Map a logical file name to the name the file would have in a remote storage -//! system (e.g. Mass Storage System at a remote location). -//! -//! @param lfn -> Logical file name. -//! @param buff -> Buffer where the remote file name is to be placed. It need -//! not actually exist in that location but could be created -//! there with that name. It must end with a null byte. -//! @param blen The length of the buffer. -//! -//! @return Success: Zero. -//! Failure: An errno number describing the failure; typically -//! EINVAL - The supplied lfn is invalid. -//! ENAMETOOLONG - The buffer is too small for the pfn. -//------------------------------------------------------------------------------ - -virtual int lfn2rfn(const char *lfn, char *buff, int blen) = 0; - -//------------------------------------------------------------------------------ -//! Map a physical file name to it's logical file name. -//! -//! @param pfn -> Physical file name. This is always a valid name of either -//! an existing file or a file that could been created. -//! @param buff -> Buffer where the logical file name is to be placed. It need -//! not actually exist but could be created with that name. -//! It must end with a null byte. -//! @param blen The length of the buffer. -//! -//! @return Success: Zero. -//! Failure: An errno number describing the failure; typically -//! EINVAL - The supplied lfn is invalid. -//! ENAMETOOLONG - The buffer is too small for the pfn. -//------------------------------------------------------------------------------ - -virtual int pfn2lfn(const char *pfn, char *buff, int blen) = 0; - -//------------------------------------------------------------------------------ -//! Constructor -//------------------------------------------------------------------------------ - - XrdOucName2Name() {} - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - -virtual ~XrdOucName2Name() {} -}; - -/******************************************************************************/ -/* X r d O u c N a m e 2 N a m e V e c */ -/******************************************************************************/ - -//! Class XrdOucName2NameVec must be used to define a companion name translation -//! mechanism. It is optional but highly recommended and may in fact be required -//! by certain statlib plug-ins specific by the 'oss.statlib' directive. Refer -//! to plug-in documentation to see if it requires this form of name2name -//! translator. This translator should return all possible translations of a -//! given logical file name. After an instance of the XrdOucName2Name -//! translator is obtained (which implies it's full initilization) the default -//! oss plug-in check if the symbol 'Name2NameVec' is present in the shared -//! library. If it does, it obtains the contents of the symbol which should be -//! a pointer to an object derived from the following class. That object is -//! used to obtain a list of possible name translations. Initialization is -//! is simplified if your implementation inherits XrdOucName2Name as well as -//! XrdOucName2Namevec. The symbol that contains the pointer must be defined -//! at file level as follows: - -//! XrdOucName2NameVec *Name2NameVec; - -//! It should be set during XrdOucName2Name initialization to point to an -//! instance of the object. The methods defined for this class must be -//! thread-safe. The default XrdOucName2Name translator also includes the -//! XrdOucName2NameVec translator. - -class XrdOucName2NameVec -{ -public: - -//------------------------------------------------------------------------------ -//! Map a logical file name to all of its possible physical file names. -//! -//! @param lfn -> Logical file name. -//! -//! @return Success: Pointer to a vector of strings of physical file names. -//! Failure: A nil pointer indicating that no translation exists. -//------------------------------------------------------------------------------ - -virtual std::vector *n2nVec(const char *lfn)=0; - -//------------------------------------------------------------------------------ -//! Release all storage occupied by the vector returned by n2nVec(). -//! -//! @param nvP -> Vector returned by n2nVec(). -//------------------------------------------------------------------------------ - -virtual void Recycle(std::vector *nvP) - {if (nvP) - {for (unsigned int i = 0; i < nvP->size(); i++) - {delete (*nvP)[i];} - delete nvP; - } - } - -//------------------------------------------------------------------------------ -//! Constructor and Destructor -//------------------------------------------------------------------------------ - - XrdOucName2NameVec() {} -virtual ~XrdOucName2NameVec() {} -}; - -/******************************************************************************/ -/* X r d O u c g e t N a m e 2 N a m e */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! Obtain an instance of the XrdOucName2Name object. -//! -//! This extern "C" function is called when a shared library plug-in containing -//! implementation of this class is loaded. It must exist in the shared library -//! and must be thread-safe. -//! -//! @param eDest -> The error object that must be used to print any errors or -//! other messages (see XrdSysError.hh). -//! @param confg -> Name of the configuration file that was used. This pointer -//! may be null though that would be impossible. -//! @param parms -> Argument string specified on the namelib directive. It may -//! be null or point to a null string if no parms exist. -//! @param lroot -> The path specified by the localroot directive. It is a -//! null pointer if the directive was not specified. -//! @param rroot -> The path specified by the remoteroot directive. It is a -//! null pointer if the directive was not specified. -//! -//! @return Success: A pointer to an instance of the XrdOucName2Name object. -//! Failure: A null pointer which causes initialization to fail. -//! -//! The Name2Name object is used frequently in the course of opening files -//! as well as other meta-file operations (e.g., stat(), rename(), etc.). -//! The algorithms used by this object *must* be efficient and speedy; -//! otherwise system performance will be severely degraded. -//------------------------------------------------------------------------------ - -class XrdSysError; - -#define XrdOucgetName2NameArgs XrdSysError *eDest, \ - const char *confg, \ - const char *parms, \ - const char *lroot, \ - const char *rroot - -extern "C" XrdOucName2Name *XrdOucgetName2Name(XrdOucgetName2NameArgs); - -//------------------------------------------------------------------------------ -//! Declare compilation version. -//! -//! Additionally, you *should* declare the xrootd version you used to compile -//! your plug-in. While not currently required, it is highly recommended to -//! avoid execution issues should the class definition change. Declare it as: -//------------------------------------------------------------------------------ - -/*! #include "XrdVersion.hh" - XrdVERSIONINFO(XrdOucgetName2Name,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucPinObject.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucPinObject.hh deleted file mode 100644 index e92eafc67..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucPinObject.hh +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef __XRDOUCPINOBJECT_HH__ -#define __XRDOUCPINOBJECT_HH__ -/******************************************************************************/ -/* */ -/* X r d O u c P i n O b j e c t . h h */ -/* */ -/* (c) 2020 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -/*! The XrdOucPinObject defines a generic interface to obtain an instance of a - plugin. Post R5 plugins must have an instance of this class in the shared - library that implements the plugin named in the template parameter. The - plugin handler calls getInstance() to obtain an actual instance of it. -*/ - -class XrdOucEnv; -class XrdOucLogger; - -template -class XrdOucPinObject -{ -public: - -//------------------------------------------------------------------------------ -//! Get the an instance of a plugin. -//! -//! @param parms Pointer to any parameters, may be nil or the null string. -//! @param envR Reference to the environment. If the server was started with -//! a configuration file then key "configFN" holds its path. -//! @param logR Pointer to logging object that should be assocaited with -//! and XrdSysError object to relay messages. -//! @param prevP Pointer to the previous instance if stacked, else nil. -//------------------------------------------------------------------------------ - -virtual -T *getInstance(const char *parms, - XrdOucEnv &envR, - XrdSysLogger &logR, - T *prevP) = 0; - -//------------------------------------------------------------------------------ -//! Constructor & Destructor -//------------------------------------------------------------------------------ - - XrdOucPinObject() {} - -virtual ~XrdOucPinObject() {} -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucPinPath.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucPinPath.hh deleted file mode 100644 index 96f18c694..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucPinPath.hh +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __OOUC_PINPATH_HH__ -#define __OOUC_PINPATH_HH__ -/******************************************************************************/ -/* */ -/* X r d O u c P i n P a t h . h h */ -/* */ -/* (c) 2014 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -//----------------------------------------------------------------------------- -//! XrdOucPinPath -//! -//! This function performs name versioning for shared library plug-ins. It is -//! a public header and may be used by third parties to adhere to the plugin -//! naming conventions. -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -//! Obtain the primary path to be used to load a plugin. -//! -//! @param piPath Pointer to the original (i.e. specified) plugin path. -//! @param noAltP Upon return it is set to true or false. -//! TRUE: only the returned primary path may be used to load -//! the plugin (i.e. no alternate path allowed). -//! FALSE: the plugin should first be loaded using the returned -//! primary path and if that fails, the original path -//! (i.e. piPath) should be used to load the plugin. -//! @param buff Pointer to a buffer that will hold the primary path. -//! @param blen The size of the buffer. -//! -//! @return success The length of the primary path in buff. -//! @return failure Zero (buffer is too small) but eqName is still set. -//----------------------------------------------------------------------------- - -extern int XrdOucPinPath(const char *piPath, bool &noAltP, char *buff, int blen); - -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucRash.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucRash.hh deleted file mode 100644 index 38ccaefac..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucRash.hh +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef __OUC_RASH__ -#define __OUC_RASH__ -/******************************************************************************/ -/* */ -/* X r d O u c R a s h . h h */ -/* */ -/* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -// This templated class implements a radix tree to remap binary quantities using -// a hash-like interface. Define the object as: - -// XrdOucRash myobject; - -// Where: key_type is the binary type of the key (short, int, long, long long) -// value_type is the binary type of the value (one of the types above). - -// The binary types may be signed or unsigned. Use the methods defined in -// class XrdOucRash to Add(), Del(), Find(), and Rep() items in the table. -// Use Apply() to scan through all of the items in the table and Purge() to -// remove all items in the table (indices are not removed). Several options -// exist to manage the items (see individual methods and XrdOucRash_Options). - -// Warning! This class is not MT-safe and should be protected by an external -// mutex when used in a multi-threaded environment. - -#include -#include - -enum XrdOucRash_Options {Rash_default = 0x0000, - Rash_replace = 0x0002, - Rash_count = 0x0004 - }; - -template -class XrdOucRash_Item -{ -public: -int Count() {return keycount;} - -V *Data() {return &keydata;} - -K Key() {return keyval;} - -time_t Time() {return keytime;} - -void Update(int newcount, time_t newtime) - {keycount = newcount; - if (newtime) keytime = newtime; - } - -void Set(V &keyData, time_t newtime) - {keydata = keyData; - keytime = newtime; - } - - XrdOucRash_Item(K &KeyVal, - V &KeyData, - time_t KeyTime) - {keyval = KeyVal; - keydata = KeyData; - keytime = KeyTime; - keycount= 0; - } - - ~XrdOucRash_Item() {} - -private: - -K keyval; -V keydata; -time_t keytime; -int keycount; -}; - -template -class XrdOucRash_Tent -{ -public: -XrdOucRash_Tent *Table; -XrdOucRash_Item *Item; - - XrdOucRash_Tent() {Table = 0; Item = 0;} - ~XrdOucRash_Tent() {if (Table) delete[] Table; - if (Item) delete(Item); - } -}; - -template -class XrdOucRash -{ -public: - -// Add() adds a new item to the table. If it exists and repl = 0 then the old -// entry is returned and the new data is not added. Otherwise the current -// entry is replaced (see Rep()) and 0 is returned. If we have no memory -// to add the new entry, an ENOMEM exception is thrown. The -// LifeTime value is the number of seconds this entry is to be considered -// valid. When the time has passed, the entry may be deleted. A value -// of zero, keeps the entry until explicitly deleted. The Hash_count -// option keeps track of duplicate key entries for Del. Thus the key must -// be deleted as many times as it is added before it is physically deleted. -// -V *Add(K KeyVal, V &KeyData, time_t LifeTime=0, - XrdOucRash_Options opt=Rash_default); - -// Del() deletes the item from the table. If it doesn't exist, it returns -// -ENOENT. If it was deleted it returns 0. If it was created with -// Rash_Count then the count is decremented and count+1 is returned. -// -int Del(K KeyVal); - -// Find() simply looks up an entry in the cache. It can optionally return the -// lifetime associated with the entry. If the -// -V *Find(K KeyVal, time_t *KeyTime=0); - -// Num() returns the number of items in the table -// -int Num() {return rashnum;} - -// Purge() simply deletes all of the appendages to the table. -// -void Purge(); - -// Rep() is simply Add() that allows replacement. -// -V *Rep(K KeyVal, V &KeyData, const int LifeTime=0, - XrdOucRash_Options opt=Rash_default) - {return Add(KeyVal, KeyData, LifeTime, - (XrdOucRash_Options)(opt | Rash_replace));} - -// Apply() applies the specified function to every item in the table. The -// first argument is the key value, the second is the associated data, -// the third argument is whatever is the passed in void *variable, The -// following actions occur for values returned by the applied function: -// <0 - The table item is deleted. -// =0 - The next table item is processed. -// >0 - Processing stops and the address of item is returned. -// -V *Apply(int (*func)(K, V, void *), void *Arg) - {return Apply(rashTable, func, Arg);} - - XrdOucRash() {rashnum = 0;} - ~XrdOucRash() {Purge();} - -private: -V *Apply(XrdOucRash_Tent *tab, - int (*func)(K, V, void *), void *Arg); -XrdOucRash_Item *Lookup(K theKey, XrdOucRash_Tent **tloc); -void Insert(K theKey, XrdOucRash_Item *theItem); -unsigned long long key2ull(K theKey); - -XrdOucRash_Tent rashTable[16]; -int rashnum; -}; - -/******************************************************************************/ -/* A c t u a l I m p l e m e n t a t i o n */ -/******************************************************************************/ - -#include "XrdOuc/XrdOucRash.icc" -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucRash.icc b/test/binary/usr/include/xrootd/XrdOuc/XrdOucRash.icc deleted file mode 100644 index 382da3ec8..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucRash.icc +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************/ -/* */ -/* X r d O u c R a s h . i c c */ -/* */ -/* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include - -#include "XrdSys/XrdSysPlatform.hh" - -/******************************************************************************/ -/* A d d */ -/******************************************************************************/ - -template -V *XrdOucRash::Add(K KeyVal, V &KeyData, time_t LifeTime, - XrdOucRash_Options opt) -{ - time_t lifetime, KeyTime=0; - XrdOucRash_Item *hip; - XrdOucRash_Tent *hiploc; - -// Look up the entry. If found, either return an error or delete it -// because caller wanted it replaced or it has expired. -// - if ((hip = Lookup(KeyVal, &hiploc))) - {if (opt & Rash_count) - {hip->Update(hip->Count()+1, - (LifeTime || hip->Time() ? LifeTime + time(0) : 0) );} - if (!(opt & Rash_replace) - && ((lifetime=hip->Time())==0||lifetime>=time(0))) return hip->Data(); - hip->Set(KeyData, KeyTime); - return (V *)0; - } - -// Create a new item -// - if (LifeTime) KeyTime = LifeTime + time(0); - if ( !(hip = new XrdOucRash_Item(KeyVal, KeyData, KeyTime)) ) - throw ENOMEM; - -// Add this item to the table -// - Insert(KeyVal, hip); - return (V *)0; -} - -/******************************************************************************/ -/* D e l */ -/******************************************************************************/ - -template -int XrdOucRash::Del(K KeyVal) -{ - XrdOucRash_Item *hip; - XrdOucRash_Tent *hiploc; - int cnt; - -// Look up the entry. If not found, indicate so. -// - if (!(hip = Lookup(KeyVal, &hiploc))) return -ENOENT; - -// Delete the item and return -// - if ((cnt = hip->Count())) {hip->Update(cnt-1, 0); return cnt;} - delete hip; - hiploc->Item = (XrdOucRash_Item *)0; - rashnum--; - return 0; - -} - -/******************************************************************************/ -/* F i n d */ -/******************************************************************************/ - -template -V *XrdOucRash::Find(K KeyVal, time_t *KeyTime) -{ - XrdOucRash_Item *hip; - XrdOucRash_Tent *hiploc; - time_t lifetime = 0; - -// Find the entry (remove it if expired and return nothing) -// - if (!(hip = Lookup(KeyVal, &hiploc))) return (V *)0; - if ( (lifetime = hip->Time()) && lifetime < time(0) ) - {delete hip; - hiploc->Item = (XrdOucRash_Item *)0; - rashnum--; - if (KeyTime) *KeyTime = (time_t)0; - return (V *)0; - } - -// Return actual information -// - if (KeyTime) *KeyTime = lifetime; - return hip->Data(); -} - -/******************************************************************************/ -/* P u r g e */ -/******************************************************************************/ - -template -void XrdOucRash::Purge() -{ - int i; - -// Run through the major table and delete each item in the main table -// the deletion automatically propagates. -// - for (i = 0; i < 16; i++) - {if (rashTable[i].Item) - {delete rashTable[i].Item; rashTable[i].Item = 0;} - if (rashTable[i].Table) - {delete []rashTable[i].Table; rashTable[i].Table = 0;} - } - rashnum = 0; -} - -/******************************************************************************/ -/* P r i v a t e M e t h o d s */ -/******************************************************************************/ -/******************************************************************************/ -/* A p p l y */ -/******************************************************************************/ - -template -V *XrdOucRash::Apply(XrdOucRash_Tent *tab, - int (*func)(K, V, void *), void *Arg) -{ - int i, rc; - time_t lifetime; - XrdOucRash_Item *hip; - V *theVal; - - //Run through all the entries, applying the function to each. Expire - // dead entries by pretending that the function asked for a deletion. - // - for (i = 0; i < 16; i++) - {if ((hip = tab[i].Item)) - {if ((lifetime = hip->Time()) && lifetime < time(0)) rc = -1; - else if ( (rc = (*func)(hip->Key(), *hip->Data(), Arg)) > 0 ) - return hip->Data(); - if (rc < 0) {delete hip; - tab[i].Item = (XrdOucRash_Item *)0; - rashnum--; - } - } - if (tab[i].Table && (theVal = Apply(tab[i].Table, func, Arg))) - return theVal; - } - return (V *)0; -} - -/******************************************************************************/ -/* L o o k u p */ -/******************************************************************************/ - -template -XrdOucRash_Item *XrdOucRash::Lookup(K theKey, - XrdOucRash_Tent **tloc) -{ - unsigned long long kVal = key2ull(theKey); - XrdOucRash_Tent *tab = rashTable; - int j; - -// Traverse the binary tree and find the entry -// - do {j = kVal & 0x0f; - kVal = kVal >> 4; - } while(kVal && (tab = tab[j].Table)); - -// Return result -// - if (tab) - {*tloc = &tab[j]; - return tab[j].Item; - } else { - *tloc = 0; - return 0; - } -} - -/******************************************************************************/ -/* I n s e r t */ -/******************************************************************************/ - -template -void XrdOucRash::Insert(K theKey, XrdOucRash_Item *theItem) -{ - unsigned long long kVal = key2ull(theKey); - XrdOucRash_Tent *tab = rashTable; - int j; - -// Traverse the binary tree and find the entry -// - do {j = kVal & 0x0f; - if ((kVal = kVal >> 4)) - {if (tab[j].Table) tab = tab[j].Table; - else tab = tab[j].Table = new XrdOucRash_Tent[16](); - } - } while(kVal); - -// Insert the entry -// - tab[j].Item = theItem; - rashnum++; -} - -/******************************************************************************/ -/* k e y 2 u l l */ -/******************************************************************************/ - -template -unsigned long long XrdOucRash::key2ull(K theKey) -{ -#ifdef Xrd_Big_Endian - union {unsigned long long us; K kv[8/sizeof(K)];} Val; - Val.us = 0; - Val.kv[8/sizeof(K)-1] = theKey; -#else - union {unsigned long long us; K kv;} Val; - Val.us = 0; - Val.kv = theKey; -#endif - return Val.us; -} diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucSFVec.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucSFVec.hh deleted file mode 100644 index edd7e296c..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucSFVec.hh +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __OUC_SFVEC_H__ -#define __OUC_SFVEC_H__ -/******************************************************************************/ -/* */ -/* X r d O u c S F V e c . h h */ -/* */ -/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include - -//----------------------------------------------------------------------------- -//! XrdOucSFVec -//! -//! The struct defined here is a generic data structure that is used whenever -//! we need to pass a vector of file offsets, lengths, and the corresponding -//! target buffer pointers to effect a sendfile() call. It is used by the -//! xrd, sfs, ofs., and oss components. -//----------------------------------------------------------------------------- - -struct XrdOucSFVec {union {char *buffer; //!< ->Data if fdnum < 0 - off_t offset; //!< File offset of data otherwise - }; - int sendsz; //!< Length of data at offset - int fdnum; //!< File descriptor for data - - enum {sfMax = 16}; //!< Maximum number of elements - }; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucStream.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucStream.hh deleted file mode 100644 index 2f3415732..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucStream.hh +++ /dev/null @@ -1,284 +0,0 @@ -#ifndef __OOUC_STREAM__ -#define __OOUC_STREAM__ -/******************************************************************************/ -/* */ -/* X r d O u c S t r e a m . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Deprtment of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include -#include -#ifdef WIN32 -#include "XrdSys/XrdWin32.hh" -#endif - -#include "XrdSys/XrdSysError.hh" - -struct StreamInfo; -class XrdOucEnv; -class XrdOucString; -class XrdOucTList; - -class XrdOucStream -{ -public: - -// When creating a stream object, you may pass an optional error routing object. -// If you do so, error messages will be writen via the error object. Otherwise, -// errors will be returned quietly. -// - XrdOucStream(XrdSysError *erobj=0, const char *ifname=0, - XrdOucEnv *anEnv=0, const char *Pfx=0); - - ~XrdOucStream() {Close(); if (myInst) free(myInst); - if (varVal) delete [] varVal; - if (llBuff) free(llBuff); - } - -// Attach a file descriptor to an existing stream. Any curently associated -// stream is closed and detached. An optional buffer size can be specified. -// Zero is returned upon success, otherwise a -1 (use LastError to get rc). -// -int Attach(int FileDescriptor, int bsz=2047); -int AttachIO(int infd, int outfd, int bsz=2047); - -// Close the current stream and release the associated buffer. -// -void Close(int hold=0); - -// Detach a file descriptor from a stream. This should be called prior to -// close/delete when you are managing your own descriptors. Return the FD num. -// -int Detach() {int oldFD = FD; FD = FE = -1; return oldFD;} - -// Wait for an Exec() to finish and return the ending status. Use this -// function only when you need to find out the ending status of the command. -// -int Drain(); - -// Display last valid line if variable substitution enabled. Fully formed -// input lines are displayed if 'set -v' was encountered (only when using -// the GetxxxWord() methods), -// -void Echo(); -void Echo(bool capture); - -// Execute a command on a stream. Returns 0 upon success or -1 otherwise. -// Use LastError() to get the actual error code. Subsequent Get() calls -// will return the standard output of the executed command. If inrd=1 then -// standardin is redirected so that subqseuent Put() calls write to the -// process via standard in. When inrd=-1 then the current attached FD's are -// used to redirect STDIN and STDOUT of the child process. Standard error -// is handled as determined by the efd argument: -// efd < 0 -> How to handle the current stderr file decriptor: -// -1 The current stderr file decriptor is unchanged. -// Output of only stdout is to be captured by this stream. -// -2 Output of only stderr is to be captured by this stream. -// -3 Output of stdout and stderr is to be captured by this stream. -// efd = 0 -> The stderr file descriptor is set to the original logging FD -// efd > 0 -> The stderr file descriptor is set to the value of efd. -// -int Exec(const char *, int inrd=0, int efd=0); -int Exec( char **, int inrd=0, int efd=0); - -// Get the file descriptor number associated with a stream -// -int FDNum() {return FD;} -int FENum() {return FE;} - -// Flush any remaining output queued on an output stream. -// -void Flush() {fsync(FD); if (FE != FD) fsync(FE);} - -// Get the next record from a stream. Return null upon eof or error. Use -// LastError() to determine which condition occurred (an error code of 0 -// indicates that end of file has been reached). Upon success, a pointer -// to the next record is returned. The record is terminated by a null char. -// -char *GetLine(); - -// Get the next blank-delimited token in the record returned by Getline(). A -// null pointer is returned if no more tokens remain. Each token is terminated -// a null byte. Note that the record buffer is modified during processing. The -// first form returns simply a token pointer. The second form returns a token -// pointer and a pointer to the remainder of the line with no leading blanks. -// The lowcase argument, if 1, converts all letters to lower case in the token. -// RetToken() simply backups the token scanner one token. None of these -// methods perform variable substitution (see GetxxxWord() below). -// -char *GetToken(int lowcase=0); -char *GetToken(char **rest, int lowcase=0); -void RetToken(); - -// Get the next word, ignoring any blank lines and comment lines (lines whose -// first non-blank is a pound sign). Words are returned until logical end of -// line is encountered at which time, a null is returned. A subsequent call -// will return the next word on the next logical line. A physical line may be -// continued by placing a back slash at it's end (i.e., last non-blank char). -// GetFirstWord() always makes sure that the first word of a logical line is -// returned (useful for start afresh after a mid-sentence error). GetRest() -// places the remining tokens in the supplied buffer; returning 0 if the -// buffer was too small. All of these methods perform variable substitution -// should an XrdOucEnv object be passed to the constructor. -// -char *GetFirstWord(int lowcase=0); -char *GetMyFirstWord(int lowcase=0); -int GetRest(char *theBuf, int Blen, int lowcase=0); -char *GetWord(int lowcase=0); - -// Indicate wether there is an active program attached to the stream -// -#ifndef WIN32 -inline int isAlive() {return (child ? kill(child,0) == 0 : 0);} -#else -inline int isAlive() {return (child ? 1 : 0);} -#endif - -// Return last error code encountered. -// -inline int LastError() {int n = ecode; ecode = 0; return n;} - -// Return the last input line -// -char *LastLine() {return recp;} - -// Suppress echoing the previous line when the next line is fetched. -// -int noEcho() {llBok = 0; return 0;} - -// Write a record to a stream, if a length is not given, then the buffer must -// be null terminated and this defines the length (the null is not written). -// -int Put(const char *data, const int dlen); -inline int Put(const char *data) {return Put(data, strlen(data));} - -// Write record fragments to a stream. The list of fragment/length pairs ends -// when a null pointer is encountered. -// -int Put(const char *data[], const int dlen[]); - -// Insert a line into the stream buffer. This replaces anything that was there. -// -int PutLine(const char *data, int dlen=0); - -// Set the Env (returning the old Env). This is useful for suppressing -// substitutions for a while. -// -XrdOucEnv *SetEnv(XrdOucEnv *newEnv) - {XrdOucEnv *oldEnv = myEnv; myEnv = newEnv; return oldEnv;} - -// Set error routing -// -void SetEroute(XrdSysError *eroute) {Eroute = eroute;} - -// A 0 indicates that tabs in the stream should be converted to spaces. -// A 1 inducates that tabs should be left alone (the default). -// -void Tabs(int x=1) {notabs = !x;} - -// Wait for inbound data to arrive. The argument is the max number of millisec -// to wait (-1 means wait forever). Returns 0 if data is present. Otherwise, -// -1 indicates that the connection timed out, a positive value indicates an -// error and the value is the errno describing the error. -// -int Wait4Data(int msMax=-1); - -/******************************************************************************/ - -// The following methods are norally used only during initial configuration -// to capture the actual configuration being used by each component. - -// Capture a message (typically informational before the start of file -// processing); which is added as a comment. Pass a vector of string whose -// last element is 0. -// -static void Capture(const char** cVec=0, bool linefeed=true); - -// Set the capture string object. A value of nil turns off capturing. The -// current capture string pointer is returned. -// -static -XrdOucString *Capture(XrdOucString *cfObj); - -// Return the current capture string object. -// -static -XrdOucString *Capture(); - -/******************************************************************************/ - -private: - void add2CFG(const char *data, bool isCMT=false); - char *add2llB(char *tok, int reset=0); - bool docont(); - bool docont( const char *path, XrdOucTList *tlP); - bool docontD(const char *path, XrdOucTList *tlP); - bool docontF(const char *path, bool noentok=false); - char *doelse(); - char *doif(); - bool Echo(int ec, const char *t1, const char *t2=0, const char *t3=0); - int getValue(const char *path, char *vbuff, int vbsz); - int isSet(char *var); - char *vSubs(char *Var); - int xMsg(const char *txt1, const char *txt2=0, const char *txt3=0); - -static const int maxVLen = 512; -static const int llBsz = 1024; - - int FD; - int FE; - int bsize; - int bleft; - char *buff; - char *bnext; - char *recp; - char *token; - int flags; - pid_t child; - int ecode; - int notabs; - int xcont; - int xline; - char *myInst; - StreamInfo *myInfo; // ABI compatible change! - char *myRsv1; - char *myRsv2; - XrdSysError *Eroute; - XrdOucEnv *myEnv; - char *varVal; - const char *llPrefix; - char *llBuff; - char *llBcur; - int llBleft; - char Verbose; - char sawif; - char skpel; - char llBok; -static -XrdOucString *theCFG; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucString.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucString.hh deleted file mode 100644 index e2dbe2073..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucString.hh +++ /dev/null @@ -1,388 +0,0 @@ -#ifndef __OUC_STRING_H__ -#define __OUC_STRING_H__ -/******************************************************************************/ -/* */ -/* X r d O u c S t r i n g . h h */ -/* */ -/* (c) 2005 F. Furano (INFN Padova), G. Ganis (CERN) */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/* All Rights Reserved. See XrdInfo.cc for complete License Terms */ -/******************************************************************************/ - -/******************************************************************************/ -/* */ -/* Light string manipulation class */ -/* */ -/* This class has three private members: a buffer (char *) and two integers, */ -/* indicating the effective length of the null-terminated string (len), and */ -/* the buffer capacity (siz), i.e. the allocated size. The capacity is set */ -/* at construction either at the value needed by the initializing string or */ -/* to the value requested by the user; by default the capacity is never */ -/* decreased during manipulations (it is increased if required by the */ -/* operation). The capacity can be changed at any time by calling resize(). */ -/* The user can choose a granularity other than 1 to increase the capacity */ -/* by calling XrdOucString::setblksize(nbs) with nbs > 1: this will make */ -/* new allocations to happen in blocks multiple of nbs bytes. */ -/* */ -/* 1. Constructors */ -/* */ -/* XrdOucString(int lmx = 0) */ -/* - create an empty string; set capacity to lmx+1 if lmx > 0 */ -/* XrdOucString(const char *s, int lmx = 0) */ -/* - create a string containing s; capacity is set to strlen(s)+1 or */ -/* to lmx+1 if lmx > 0; in the latter case truncation may occur. */ -/* XrdOucString(const char c, int lmx = 0) */ -/* - create a string char c; capacity is set to 2 or to lmx+1 if lmx > 0.*/ -/* XrdOucString(const XrdOucString &s) */ -/* - create string copying from XrdOucString s . */ -/* XrdOucString(const XrdOucString &s, int j, int k = -1, int lmx = 0) */ -/* - create string copying a portion of XrdOucString s; portion is */ -/* defined by j to k inclusive; if k == -1 the portion copied will be */ -/* from j to end-of-string; if j or k are inconsistent they are taken */ -/* as 0 or len-1, respectively; capacity is set to k-j bytes or to */ -/* to lmx+1 if lmx > 0; in the latter case truncation of the portion */ -/* may occur. */ -/* */ -/* 2. Access to information */ -/* */ -/* const char *c_str() const */ -/* - return pointer to stored string */ -/* int length() const */ -/* - return length stored string */ -/* int capacity() const */ -/* - return capacity of the allocated buffer */ -/* */ -/* char &operator[](int j) */ -/* - array-like operator returning char at position j; abort is invoked */ -/* if j is not in the correct range */ -/* */ -/* int find(const char c, int start = 0, bool forward = 1); */ -/* - find first occurence of char c starting from position start in */ -/* forward (forward == 1, default) or backward (forward == 0) */ -/* direction; returns STR_NPOS if nothing is found */ -/* int find(const char *s, int start = 0) */ -/* - find first occurence of string s starting from position start in */ -/* forward direction; returns STR_NPOS if nothing is found */ -/* int find(XrdOucString s, int start = 0) */ -/* - find first occurence of XrdOucString s starting from position start */ -/* in forward direction; returns STR_NPOS if nothing is found */ -/* */ -/* int rfind(const char c, int start = STR_NPOS) */ -/* - find first occurence of char c starting from position start in */ -/* backward direction; returns STR_NPOS if nothing is found. */ -/* int rfind(const char *s, int start = STR_NPOS) */ -/* - find first occurence of string s starting from position start in */ -/* backward direction; returns STR_NPOS if nothing is found; */ -/* if start == STR_NPOS search starts from position len-strlen(s) */ -/* int rfind(XrdOucString s, int start = STR_NPOS) */ -/* - find first occurence of XrdOucString s starting from position start */ -/* in backward direction; returns STR_NPOS if nothing is found; */ -/* if start == STR_NPOS search starts from position len-s.lenght() */ -/* */ -/* bool beginswith(char c) */ -/* - returns 1 if the stored string starts with char c */ -/* bool beginswith(const char *s) */ -/* - returns 1 if the stored string starts with string s */ -/* bool beginswith(XrdOucString s) */ -/* - returns 1 if the stored string starts with XrdOucString s */ -/* */ -/* bool endswith(char c) */ -/* - returns 1 if the stored string ends with char c */ -/* bool endswith(const char *s) */ -/* - returns 1 if the stored string ends with string s */ -/* bool endswith(XrdOucString s) */ -/* - returns 1 if the stored string ends with XrdOucString s */ -/* */ -/* int matches(const char *s, char wch = '*') */ -/* - check if stored string is compatible with s allowing for wild char */ -/* wch (default: '*'); return the number of matching characters. */ -/* */ -/* 3. Modifiers */ -/* */ -/* void resize(int lmx = 0) */ -/* - resize buffer capacity to lmx+1 bytes; if lmx <= 0, free the buffer.*/ -/* */ -/* void append(const int i) */ -/* - append to stored string the string representation of integer i, */ -/* e.g. if string is initially "x*", after append(5) it will be "x*5". */ -/* void append(const char c) */ -/* - append char c to stored string, e.g. if string is initially "pop", */ -/* after append('_') it will be "pop_". */ -/* void append(const char *s) */ -/* - append string s to stored string, e.g. if string is initially "pop",*/ -/* after append("star") it will be "popstar". */ -/* void append(const XrdOucString s) */ -/* - append s.c_str() to stored string, e.g. if string is initially */ -/* "anti", after append("star") it will be "antistar". */ -/* */ -/* void assign(const char *s, int j, int k = -1) */ -/* - copy to allocated buffer a portion of string s; portion is defined */ -/* by j to k inclusive; if k == -1 the portion copied will be from j */ -/* to end-of-string; if j or k are inconsistent they are taken as 0 or */ -/* len-1, respectively; if necessary, capacity is increased to k-j */ -/* bytes. */ -/* void assign(const XrdOucString s, int j, int k = -1) */ -/* - copy to allocated buffer a portion of s.c_str(); portion is defined */ -/* by j to k inclusive; if k == -1 the portion copied will be from j */ -/* to end-of-string; if j or k are inconsistent they are taken as 0 or */ -/* len-1, respectively; if necessary, capacity is increased to k-j */ -/* bytes. */ -/* */ -/* int keep(int start = 0, int size = 0) */ -/* - drop chars outside the range of size bytes starting at start */ -/* */ -/* void insert(const int i, int start = -1) */ -/* - insert the string representation of integer i at position start of */ -/* the stored string, e.g. if string is initially "*x", after */ -/* insert(5,0) it will be "5*x"; default action is append. */ -/* void insert(const char c, int start = -1) */ -/* - insert the char c at position start of the stored string, e.g. */ -/* if string is initially "pok", after insert('_',0) it will be "_poc";*/ -/* default action is append. */ -/* void insert(const char *s, int start = -1, int lmx = 0) */ -/* - insert string s at position start of the stored string, e.g. */ -/* if string is initially "forth", after insert("backand",0) it will be*/ -/* "backandforth"; default action is append. */ -/* void insert(const XrdOucString s, int start = -1) */ -/* - insert string s.c_str() at position start of the stored string. */ -/* */ -/* int replace(const char *s1, const char *s2, */ -/* int from = 0, int to = -1); */ -/* - replace all occurrencies of string s1 with string s2 in the region */ -/* from position 'from' to position 'to' inclusive; the method is */ -/* optimized to minimize the memory movements; with s2 == 0 or "" */ -/* removes all instances of s1 in the specified region. */ -/* int replace(const XrdOucString s1, const char *s2, */ -/* int from = 0, int to = -1); */ -/* int replace(const char *s1, const XrdOucString s2, */ -/* int from = 0, int to = -1); */ -/* int replace(const XrdOucString s1, const XrdOucString s2, */ -/* int from = 0, int to = -1); */ -/* - interfaces to replace(const char *, const char *, int, int) */ -/* */ -/* int erase(int start = 0, int size = 0) */ -/* - erase size bytes starting at start */ -/* int erase(const char *s, int from = 0, int to = -1) */ -/* - erase occurences of string s within position 'from' and position */ -/* 'to' (inclusive), e.g if stored string is "aabbccefccddgg", then */ -/* erase("cc",0,9) will result in string "aabbefccddgg". */ -/* int erase(XrdOucString s, int from = 0, int to = -1) */ -/* - erase occurences of s.c_str() within position 'from' and position */ -/* 'to' (inclusive). */ -/* int erasefromstart(int sz = 0) */ -/* - erase sz bytes from the start. */ -/* int erasefromend(int sz = 0) */ -/* - erase sz bytes from the end. */ -/* */ -/* void lower(int pos, int size = 0) */ -/* - set to lower case size bytes from position start. */ -/* void upper(int pos, int size = 0) */ -/* - set to upper case size bytes from position start. */ -/* */ -/* void hardreset() */ -/* - memset to 0 the len meaningful bytes of the buffer. */ -/* */ -/* int tokenize(XrdOucString &tok, int from, char del) */ -/* - search for tokens delimited by 'del' (def ':') in string s; search */ -/* starts from 'from' and the token is returned in 'tok'. */ -/* */ -/* 4. Assignement operators */ -/* XrdOucString &operator=(const int i) */ -/* XrdOucString &operator=(const char c) */ -/* XrdOucString &operator=(const char *s) */ -/* XrdOucString &operator=(const XrdOucString s) */ -/* */ -/* 5. Addition operators */ -/* XrdOucString &operator+(const int i) */ -/* XrdOucString &operator+(const char c) */ -/* XrdOucString &operator+(const char *s) */ -/* XrdOucString &operator+(const XrdOucString s) */ -/* XrdOucString &operator+=(const int i) */ -/* XrdOucString &operator+=(const char c) */ -/* XrdOucString &operator+=(const char *s) */ -/* XrdOucString &operator+=(const XrdOucString s) */ -/* XrdOucString const operator+(const char *s1, const XrdOucString s2) */ -/* XrdOucString const operator+(const char c, const XrdOucString s) */ -/* XrdOucString const operator+(const int i, const XrdOucString s) */ -/* */ -/* 6. Equality operators */ -/* int operator==(const int i) */ -/* int operator==(const char c) */ -/* int operator==(const char *s) */ -/* int operator==(const XrdOucString s) */ -/* */ -/* 7. Inequality operators */ -/* int operator!=(const int i) */ -/* int operator!=(const char c) */ -/* int operator!=(const char *s) */ -/* int operator!=(const XrdOucString s) */ -/* */ -/* 8. Static methods to change / monitor the blksize */ -/* static int getblksize(); */ -/* static void setblksize(const int bs); */ -/* */ -/******************************************************************************/ -#include "XrdSys/XrdSysHeaders.hh" - -#include -#include -#include - -using namespace std; - -#define STR_NPOS -1 - -class XrdOucString { - -private: - char *str; - int len; - int siz; - - // Mininal block size to be used in (re-)allocations - // Option switched off by default; use XrdOucString::setblksize() - // and XrdOucString::getblksize() to change / monitor - static int blksize; - - // Private methods - int adjust(int ls, int &j, int &k, int nmx = 0); - char *bufalloc(int nsz); - inline void init() { str = 0; len = 0; siz = 0; } - -public: - XrdOucString(int lmx = 0) { init(); if (lmx > 0) str = bufalloc(lmx+1); } - XrdOucString(const char *s, int lmx = 0); - XrdOucString(const char c, int lmx = 0); - XrdOucString(const XrdOucString &s); - XrdOucString(const XrdOucString &s, int j, int k = -1, int lmx = 0); - virtual ~XrdOucString(); - - // Info access - const char *c_str() const { return (const char *)str; } - int length() const { return len; } - int capacity() const { return siz; } - char &operator[](int j); - int find(const char c, int start = 0, bool forward = 1); - int find(const char *s, int start = 0); - int find(XrdOucString s, int start = 0); - int rfind(const char c, int start = STR_NPOS) - { return find(c, start, 0); } - int rfind(const char *s, int start = STR_NPOS); - int rfind(XrdOucString s, int start = STR_NPOS); - bool beginswith(char c) { return (find(c) == 0); } - bool beginswith(const char *s) { return (find(s) == 0); } - bool beginswith(XrdOucString s) { return (find(s) == 0); } - bool endswith(char c); - bool endswith(const char *s); - bool endswith(XrdOucString s) { return (endswith(s.c_str())); } - int matches(const char *s, char wch = '*'); - - // Tokenizer - int tokenize(XrdOucString &tok, int from, char del = ':'); - - // Modifiers - void resize(int lmx = 0) { int ns = (lmx > 0) ? lmx + 1 : 0; - str = bufalloc(ns); } - void append(const int i); - void append(const char c); - void append(const char *s); - void append(const XrdOucString s); - void assign(const char *s, int j, int k = -1); - void assign(const XrdOucString s, int j, int k = -1); -#if !defined(WINDOWS) - int form(const char *fmt, ...); -#endif - int keep(int start = 0, int size = 0); - void insert(const int i, int start = -1); - void insert(const char c, int start = -1); - void insert(const char *s, int start = -1, int lmx = 0); - void insert(const XrdOucString s, int start = -1); - int replace(const char *s1, const char *s2, - int from = 0, int to = -1); - int replace(const XrdOucString s1, const XrdOucString s2, - int from = 0, int to = -1); - int replace(const XrdOucString s1, const char *s2, - int from = 0, int to = -1); - int replace(const char *s1, const XrdOucString s2, - int from = 0, int to = -1); - int erase(int start = 0, int size = 0); - int erase(const char *s, int from = 0, int to = -1); - int erase(XrdOucString s, int from = 0, int to = -1); - int erasefromstart(int sz = 0) { return erase(0,sz); } - int erasefromend(int sz = 0) { return erase(len-sz,sz); } - void lower(int pos, int size = 0); - void upper(int pos, int size = 0); - void reset(const char c, int j = 0, int k = -1); - void hardreset(); - void setbuffer(char *buf); - - // Assignement operators - XrdOucString &operator=(const int i); - XrdOucString &operator=(const char c); - XrdOucString &operator=(const char *s); - XrdOucString &operator=(const XrdOucString s); - - // Add operators - friend XrdOucString operator+(const XrdOucString &s1, const int i); - friend XrdOucString operator+(const XrdOucString &s1, const char c); - friend XrdOucString operator+(const XrdOucString &s1, const char *s); - friend XrdOucString operator+(const XrdOucString &s1, const XrdOucString &s); - XrdOucString &operator+=(const int i); - XrdOucString &operator+=(const char c); - XrdOucString &operator+=(const char *s); - XrdOucString &operator+=(const XrdOucString s); - - // Equality operators - int operator==(const int i); - int operator==(const char c); - int operator==(const char *s); - int operator==(const XrdOucString s); - - // Inequality operators - int operator!=(const int i) { return !(*this == i); } - int operator!=(const char c) { return !(*this == c); } - int operator!=(const char *s) { return !(*this == s); } - int operator!=(const XrdOucString s) { return !(*this == s); } - - // Miscellanea - bool isdigit(int from = 0, int to = -1); - long atoi(int from = 0, int to = -1); - - // Static methods to change / monitor the default blksize - static int getblksize(); - static void setblksize(const int bs); - -#if !defined(WINDOWS) - // format a string - static int form(XrdOucString &str, const char *fmt, ...); -#endif -}; - -// Operator << is useful to print a string into a stream -ostream &operator<< (ostream &, const XrdOucString s); - -XrdOucString const operator+(const char *s1, const XrdOucString s2); -XrdOucString const operator+(const char c, const XrdOucString s); -XrdOucString const operator+(const int i, const XrdOucString s); - -#endif - diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucTList.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucTList.hh deleted file mode 100644 index 98029ab6a..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucTList.hh +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef __OUC_TLIST__ -#define __OUC_TLIST__ -/******************************************************************************/ -/* */ -/* X r d O u c T L i s t . h h */ -/* */ -/* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include -#include - -/******************************************************************************/ -/* C l a s s X r d O u c T L i s t */ -/******************************************************************************/ - -class XrdOucTList -{ -public: - -XrdOucTList *next; -char *text; -union -{ -long long dval; -int ival[2]; -short sval[4]; -char cval[8]; -int val; -}; - - XrdOucTList(const char *tval, long long *dv,XrdOucTList *np=0) - {next=np; text = (tval ? strdup(tval) : 0); dval=*dv;} - - XrdOucTList(const char *tval=0, int num=0, XrdOucTList *np=0) - {next=np; text = (tval ? strdup(tval) : 0); val=num;} - - XrdOucTList(const char *tval, int iv[2], XrdOucTList *np=0) - {next=np; text = (tval ? strdup(tval) : 0); - memcpy(ival, iv, sizeof(ival));} - - XrdOucTList(const char *tval, short sv[4], XrdOucTList *np=0) - {next=np; text = (tval ? strdup(tval) : 0); - memcpy(sval, sv, sizeof(sval));} - - XrdOucTList(const char *tval, char cv[8], XrdOucTList *np=0) - {text = (tval ? strdup(tval) : 0); next=np; - memcpy(cval, cv, sizeof(cval));} - - ~XrdOucTList() {if (text) free(text);} -}; - -/******************************************************************************/ -/* C l a s s X r d O u c T L i s t H e l p e r */ -/******************************************************************************/ - -class XrdOucTListHelper -{ -public: - -XrdOucTList **Anchor; - - XrdOucTListHelper(XrdOucTList **p) : Anchor(p) {} - ~XrdOucTListHelper() {XrdOucTList *tp; - while((tp = *Anchor)) - {*Anchor = tp->next; delete tp;} - } -}; - -/******************************************************************************/ -/* C l a s s X r d O u c T L i s t F I F O */ -/******************************************************************************/ - -class XrdOucTListFIFO -{ -public: - -XrdOucTList *first; -XrdOucTList *last; - -inline void Add(XrdOucTList *tP) - {if (last) last->next = tP; - else first = tP; - last = tP; - } - -inline void Clear() {XrdOucTList *tP; - while((tP = first)) {first = tP->next; delete tP;} - first = last = 0; - } - -XrdOucTList *Pop() {XrdOucTList *tP = first; first = last = 0; return tP;} - - XrdOucTListFIFO() : first(0), last(0) {} - ~XrdOucTListFIFO() {Clear();} -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucTable.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucTable.hh deleted file mode 100644 index 2805a259c..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucTable.hh +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef __OUC_TABLE__ -#define __OUC_TABLE__ -/******************************************************************************/ -/* */ -/* X r d O u c T a b l e . h h */ -/* */ -/* (c) 2006 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -template -class XrdOucTable -{ -public: - - XrdOucTable(int maxe) - {int i; - Table = new OucTable[(unsigned int)maxe]; - maxnum = maxe; curnum = 0; avlnum = 0; - for (i = 1; i < maxe; i++) Table[i-1].Fnum = i; - Table[maxe-1].Fnum = -1; - } - - ~XrdOucTable() {delete [] Table;} - -// Alloc() returns the next free slot number in the table. A negative value -// indicates that no free slots are left. -// -int Alloc() {int i = avlnum; - if (i >= 0) {avlnum = Table[i].Fnum; - if (i >= curnum) curnum = i+1; - } - return i; - } - -// Apply() applies the specified function to every item in the list. -// An argument may be passed to the function. A null pointer is -// returned if the list was completely traversed. Otherwise, the -// pointer to the node on which the applied function returned a -// non-zero value is returned. An optional starting point may be passed. -// -T *Apply(int (*func)(T *, void *), void *Arg, int Start=0) - {int i; - for (i = Start; i < curnum; i++) - if (Table[i].Item && (*func)(Table[i].Item, Arg)) - return Table[i].Item; - return (T *)0; - } - -// Delete() entry at Tnum and destroy it. The key is destroyed and the slot -// is placed on the free list. The second variation of Remove, deletes by key. -// -void Delete(int Tnum) - {T *temp; - if ((temp = Remove(Tnum))) delete temp; - } - -void Delete(const char *key) - {T *temp; - if ((temp = Remove(key))) delete temp; - } - -// Find() finds a table entry matching the specified key. It returns the -// Item associated with the key or zero if it is not found. If the -// address of an integer is passed, the associated entry number is -// also returned (it is unchanged if a null is returned). -// -T *Find(const char *key, int *Tnum=0) - {int i; - for (i = 0; i < curnum; i++) - if (Table[i].Item && Table[i].Key && !strcmp(Table[i].Key, key)) - {if (Tnum) *Tnum = i; return Table[i].Item;} - return 0; - } - -// Insert() inserts the specified node at entry Tnum. If Tnum is negative, a free -// slot is allocated and the item is inserted there. The slot number is -// returned. A negative slot number indicates the table is full. -// -int Insert(T *Item, const char *key=0, int Tnum=-1) - {if ((Tnum < 0 && ((Tnum = Alloc()) < 0)) || Tnum >= maxnum) return -1; - Table[Tnum].Item = Item; Table[Tnum].Key = strdup(key); - return Tnum; - } - -// Item() supplies the item value associated with entry Tnum; If the address -// if ikey is not zero, the associated key value is returned. -// -T *Item(int Tnum, char **ikey=0) - {if (Tnum < 0 || Tnum >= curnum || !Table[Tnum].Item) return (T *)0; - if (ikey) *ikey = Table[Tnum].Key; - return Table[Tnum].Item; - } - -// Next() iterates through the table using a cursor. This function is -// useful for unlocked scanning of the table. -// -int Next(int &Tnum) {int i; - for (i = Tnum; i < curnum; i++) - if (Table[i].Item) {Tnum = i+1; return i;} - return -1; - } - -// Remove() entry at Tnum and returns it. The key is destroyed and the slot -// is placed on the free list. The second variation of Remove, removes by key. -// -T *Remove(int Tnum) - {T *temp; - if (Tnum < 0 || Tnum >= curnum || !Table[Tnum].Item) return (T *)0; - if (Table[Tnum].Key) free(Table[Tnum].Key); - temp = Table[Tnum].Item; Table[Tnum].Item = 0; - Table[Tnum].Fnum = avlnum; - avlnum = Tnum; - if (Tnum == (curnum-1)) - while(curnum && Table[curnum].Item == 0) curnum--; - return temp; - } - -T *Remove(const char *key) {int i; - if (Find(key, &i)) return Remove(i); - return (T *)0; - } - -private: -struct OucTable {T *Item; - union {char *Key; - int Fnum;}; - OucTable() {Item = 0; Key = 0;} - ~OucTable() {if (Item) {delete Item; if (Key) free(Key);}} - }; - -OucTable *Table; -int avlnum; -int maxnum; -int curnum; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucTokenizer.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucTokenizer.hh deleted file mode 100644 index c38da6742..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucTokenizer.hh +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef __OOUC_TOKENIZER__ -#define __OOUC_TOKENIZER__ -/******************************************************************************/ -/* */ -/* X r d O u c T o k e n i z e r . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Deprtment of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -class XrdOucTokenizer -{ -public: - - XrdOucTokenizer(char *bp) {Attach(bp);} - - ~XrdOucTokenizer() {} - -// Attach a new buffer to the tokenizer. -// -void Attach(char *bp); - -// Get the next record from a buffer. Return null upon eof or error. -// -char *GetLine(); - -// Get the next blank-delimited token in the record returned by Getline(). A -// null pointer is returned if no more tokens remain. Each token is terminated -// a null byte. Note that the record buffer is modified during processing. The -// routine may optionally return a pointer to the remainder of the line with -// no leading blanks. The lowcase argument, if 1, converts all letters to lower -// case in the token. -// -char *GetToken(char **rest=0, int lowcase=0); - -// RetToken() simply backups the token scanner the last tken returned. Only -// one backup is allowed. -// -void RetToken(); - -// A 0 indicates that tabs in the stream should be converted to spaces. -// A 1 inducates that tabs should be left alone (the default). -// -void Tabs(int x=1) {notabs = !x;} - -/******************************************************************************/ - -private: - char *buff; - char *token; - char *tnext; - int notabs; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucTrace.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucTrace.hh deleted file mode 100644 index 75c2a89ff..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucTrace.hh +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef _OOUC_TRACE_H -#define _OOUC_TRACE_H -/******************************************************************************/ -/* */ -/* X r d O u c T r a c e . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Deprtment of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "XrdSys/XrdSysHeaders.hh" -#include "XrdSys/XrdSysError.hh" - -class XrdOucTrace -{ -public: - -inline void Beg(const char *tid=0, const char *usr=0, const char *sid=0) - {eDest->TBeg(usr, tid, sid);} - -inline void End() {eDest->TEnd();} - -inline int Tracing(int mask) {return mask & What;} - - int What; - - XrdOucTrace(XrdSysError *erp) {eDest = erp; What = 0;} - ~XrdOucTrace() {} - -static char *bin2hex(char *data, int dlen, char *buff=0); - -private: - XrdSysError *eDest; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOucUtils.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOucUtils.hh deleted file mode 100644 index dcba8caf5..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOucUtils.hh +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef __XRDOUCUTILS_HH__ -#define __XRDOUCUTILS_HH__ -/******************************************************************************/ -/* */ -/* X r d O u c U t i l s . h h */ -/* */ -/* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include -#include - -class XrdSysError; -class XrdOucString; -class XrdOucStream; - -class XrdOucUtils -{ -public: - -static const mode_t pathMode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; - -static int argList(char *args, char **argV, int argC); - -static char *bin2hex(char *inbuff, int dlen, char *buff, int blen, bool sep=true); - -static bool endsWith(const char *text, const char *ending, int endlen); - -static char *eText(int rc, char *eBuff, int eBlen); - -static int doIf(XrdSysError *eDest, XrdOucStream &Config, - const char *what, const char *hname, - const char *nname, const char *pname); - -static bool findPgm(const char *pgm, XrdOucString& path); - -static int fmtBytes(long long val, char *buff, int bsz); - -static char *genPath(const char *path, const char *inst, const char *psfx=0); - -static int genPath(char *buff, int blen, const char *path, const char *psfx=0); - -static char *getFile(const char *path, int &rc, int maxsz=10240, - bool notempty=true); - -static bool getGID(const char *gName, gid_t &gID); - -static bool getUID(const char *uName, uid_t &uID, gid_t *gID=0); - -static int GidName(gid_t gID, char *gName, int gNsz, time_t keepT=0); - -static int GroupName(gid_t gID, char *gName, int gNsz); - -static const char *i2bstr(char *buff, int blen, int val, bool pad=false); - -static char *Ident(long long &mySID, char *iBuff, int iBlen, - const char *iHost, const char *iProg, const char *iName, - int Port); - -static const char *InstName(int TranOpt=0); - -static const char *InstName(const char *name, int Fillit=1); - -static int is1of(char *val, const char **clist); - -static int isFWD(const char *path, int *port=0, char *hBuff=0, int hBLen=0, - bool pTrim=false); - -static int Log2(unsigned long long n); - -static int Log10(unsigned long long n); - -static void makeHome(XrdSysError &eDest, const char *inst); - -static bool makeHome(XrdSysError &eDest, const char *inst, - const char *path, mode_t mode); - -static int makePath(char *path, mode_t mode, bool reset=false); - -static bool parseLib(XrdSysError &eDest, XrdOucStream &Config, - const char *libName, char *&path, char **libparm); - -static char *parseHome(XrdSysError &eDest, XrdOucStream &Config, int &mode); - -static int ReLink(const char *path, const char *target, mode_t mode=0); - -static void Sanitize(char *instr, char subc='_'); - -static char *subLogfn(XrdSysError &eDest, const char *inst, char *logfn); - -static void toLower(char *str); - -static int Token(const char **str, char delim, char *buff, int bsz); - -static void Undercover(XrdSysError &eDest, int noLog, int *pipeFD = 0); - -static int UidName(uid_t uID, char *uName, int uNsz, time_t keepT=0); - -static int UserName(uid_t uID, char *uName, int uNsz); - -static -const char *ValPath(const char *path, mode_t allow, bool isdir); - -static bool PidFile(XrdSysError &eDest, const char *path); - -static int getModificationTime(const char * path, time_t & modificationTime); - -static void trim(std::string & str); - - XrdOucUtils() {} - ~XrdOucUtils() {} -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdOuc/XrdOuca2x.hh b/test/binary/usr/include/xrootd/XrdOuc/XrdOuca2x.hh deleted file mode 100644 index 9db366c80..000000000 --- a/test/binary/usr/include/xrootd/XrdOuc/XrdOuca2x.hh +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef __OOUC_A2X__ -#define __OOUC_A2X__ -/******************************************************************************/ -/* */ -/* X r d O u c a 2 x . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include "XrdSys/XrdSysError.hh" - -// This class is a holding area for various conversion utility routines -// - -class XrdOuca2x -{ -public: -static int a2i( XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1); -static int a2ll(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1); -static int a2fm(XrdSysError &, const char *emsg, const char *item, int *val, int minv); -static int a2fm(XrdSysError &, const char *emsg, const char *item, int *val, int minv, int maxv); -static int a2p(XrdSysError &, const char *ptype, const char *val, bool anyOK=true); -static int a2sn(XrdSysError &, const char *emsg, const char *item, - int *val, int nScale, int minv=-1, int maxv=-1); -static int a2sp(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1); -static int a2sz(XrdSysError &, const char *emsg, const char *item, long long *val, long long minv=-1, long long maxv=-1); -static int a2tm(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1); -static int a2vp(XrdSysError &, const char *emsg, const char *item, int *val, int minv=-1, int maxv=-1); - -static int b2x(const unsigned char* src, int slen, char* dst, int dlen); -static int x2b(const char* src, int slen, unsigned char* dst, int dlen, - bool radj=false); - -private: -static int Emsg(XrdSysError &, const char *etxt1, const char *item, - const char *etxt2, double val); -static int Emsg(XrdSysError &, const char *etxt1, const char *item, - const char *etxt2, int val); -static int Emsg(XrdSysError &, const char *etxt1, const char *item, - const char *etxt2, long long val); -}; - -#endif diff --git a/test/binary/usr/include/xrootd/XrdSec/XrdSecAttr.hh b/test/binary/usr/include/xrootd/XrdSec/XrdSecAttr.hh deleted file mode 100644 index ceba3fd2c..000000000 --- a/test/binary/usr/include/xrootd/XrdSec/XrdSecAttr.hh +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __SEC_ATTR_H__ -#define __SEC_ATTR_H__ -/******************************************************************************/ -/* */ -/* X r d S e c A t t r . h h */ -/* */ -/* (c) 2019 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -/*! The XrdSecAttr object is used as the base class to add arbitrary - extensions to the XrdSecEntity object. A derived class definition should - have a unique signature which is used by XrdSecEntity::Add() to - differentiate extentions. The easiest way to do this is to use a unique - memory address specific to all instances of the derived class. For instance, - - class myAttr :: public XrdSecAttr - { .... - static const mySig; - - myAttr(...) : XrdSecAttr((const void *)&mySig), ... - .... - }; - - You use this signature to retrieve an instance of the extension added to - a specific XrdSecEntity object. Since signatures are unique the derived - class is well known and you can safely use a static cast to downcast the - returned pointer to the proper class (see the XrdSecEntity::Get() method). - To successfully downcast using static_cast your derived class must be - fully defined and in the scope of the static_cast. Otherwise, you must - use the more expensive dynamic_cast. - - Attribute objects are deleted when the associated XrdSecEntity instance - is deleted. This happens when the client's server connection is closed. -*/ - -class XrdSecEntity; - -class XrdSecAttr -{ -public: -friend class XrdSecEntityAttr; - -//------------------------------------------------------------------------------ -//! Delete this object (may be over-ridden for custom action). -//------------------------------------------------------------------------------ - -virtual void Delete() {delete this;} - -//------------------------------------------------------------------------------ -//! Constructor. -//! -//! @param dSig - the unique signature for all instances of the class that -//! uses this class as its base (i.e. the derived class). -//------------------------------------------------------------------------------ - - XrdSecAttr(const void *dSig) : Signature(dSig) {} - -//------------------------------------------------------------------------------ -//! Destructor (always externally done via Delete() method). -//------------------------------------------------------------------------------ -protected: - -virtual ~XrdSecAttr() {} - -private: - -const void *Signature; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdSec/XrdSecEntity.hh b/test/binary/usr/include/xrootd/XrdSec/XrdSecEntity.hh deleted file mode 100644 index 138db32b4..000000000 --- a/test/binary/usr/include/xrootd/XrdSec/XrdSecEntity.hh +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef __SEC_ENTITY_H__ -#define __SEC_ENTITY_H__ -/******************************************************************************/ -/* */ -/* X r d S e c E n t i t y . h h */ -/* */ -/* (c) 2019 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! This object is returned during authentication. This is most relevant for -//! client authentication unless mutual authentication has been implemented -//! in which case the client can also authenticate the server. It is embeded -//! in each security protocol object to facilitate mutual authentication. Note -//! that the destructor does nothing and it is the responsibility of the -//! security protocol object to delete the public XrdSecEntity data members. -//! -//! Note: The host member contents are depdent on the dnr/nodnr setting and -//! and contain a host name or an IP address. To get the real host name -//! use addrInfo->Name(), this is required for any hostname comparisons. -//------------------------------------------------------------------------------ - -#include - -#define XrdSecPROTOIDSIZE 8 - -class XrdNetAddrInfo; -class XrdSecEntityAttr; -class XrdSysError; - -/******************************************************************************/ -/* X r d S e c E n t i t y */ -/******************************************************************************/ - -// The XrdSecEntity describes the client associated with a connection. One -// such object is allocated for each clent connection and it persists until -// the connection is closed. Note that when an entity has more than one -// role or vorg, the fields form a columnar tuple. This -// tuple must be repeated whenever any one of the values differs. -// -class XrdSecEntity -{ -public: - char prot[XrdSecPROTOIDSIZE]; //!< Auth protocol used (e.g. krb5) - char prox[XrdSecPROTOIDSIZE]; //!< Auth extractor used (e.g. xrdvoms) - char *name; //!< Entity's name - char *host; //!< Entity's host name dnr dependent - char *vorg; //!< Entity's virtual organization(s) - char *role; //!< Entity's role(s) - char *grps; //!< Entity's group name(s) - char *caps; //!< Entity's capabilities - char *endorsements; //!< Protocol specific endorsements - char *moninfo; //!< Information for monitoring - char *creds; //!< Raw entity credentials or cert - int credslen; //!< Length of the 'creds' data -unsigned int ueid; //!< Unique ID of entity instance -XrdNetAddrInfo *addrInfo; //!< Entity's connection details -const char *tident; //!< Trace identifier always preset -const char *pident; //!< Trace identifier (originator) - void *sessvar; //!< Plugin settable storage pointer, - //!< now deprecated. Use settable - //!< attribute objects instead. - uid_t uid; //!< Unix uid or 0 if none - gid_t gid; //!< Unix gid or 0 if none - - void *future[3]; //!< Reserved for future expansion - -XrdSecEntityAttr *eaAPI; //!< non-const API to attributes - -//------------------------------------------------------------------------------ -//! Dislay the contents of this object for debugging purposes. -//! -//! @param mDest - Reference to the message object to use. -//------------------------------------------------------------------------------ - - void Display(XrdSysError &mDest); - -//------------------------------------------------------------------------------ -//! Reset object to it's pristine self. -//! -//! @param spV - The name of the security protocol. -//------------------------------------------------------------------------------ - - void Reset(const char *spV=0); - -//------------------------------------------------------------------------------ -//! Constructor. -//! -//! @param spName - The name of the security protocol. -//------------------------------------------------------------------------------ - - XrdSecEntity(const char *spName=0); - - ~XrdSecEntity(); - -private: -void Init(const char *spV); -}; - -#define XrdSecClientName XrdSecEntity -#define XrdSecServerName XrdSecEntity - -#endif diff --git a/test/binary/usr/include/xrootd/XrdSec/XrdSecEntityAttr.hh b/test/binary/usr/include/xrootd/XrdSec/XrdSecEntityAttr.hh deleted file mode 100644 index e787ea55b..000000000 --- a/test/binary/usr/include/xrootd/XrdSec/XrdSecEntityAttr.hh +++ /dev/null @@ -1,179 +0,0 @@ -#ifndef __SEC_ENTITYATTR_H__ -#define __SEC_ENTITYATTR_H__ -/******************************************************************************/ -/* */ -/* X r d S e c E n t i t y A t t r . h h */ -/* */ -/* (c) 2019 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! This object is a non-const extension of the XrdSecEntity object. It is -//! used as the interface to XrdSecEntity attributes. Normally, a const -//! pointer is used for the XrdSecEntity object as nothing changes in the -//! entity. However, attributes may be added and deleted from the entity -//! changing the logical view of the entity. This provides a non-const -//! mechanism to this without the need to recast the XrdSecEntity pointer. -//------------------------------------------------------------------------------ - -#include - -#include -#include - -class XrdSecAttr; -class XrdSecEntityAttrCB; -class XrdSecEntityXtra; - -/******************************************************************************/ -/* X r d S e c E n t i t y A t t r */ -/******************************************************************************/ - -class XrdSecEntityAttr -{ -public: -friend class XrdSecEntity; - -//------------------------------------------------------------------------------ -//! Add an attribute object to this entity. -//! -//! @param attr - Reference to the attribute object. -//! -//! @return True, the object was added. -//! @return False, the object was not added because such an object exists. -//------------------------------------------------------------------------------ - - bool Add(XrdSecAttr &attr); - -//------------------------------------------------------------------------------ -//! Add a key-value attribute to this entity. If one exists it is replaced. -//! -//! @param key - Reference to the key. -//! @param val - Reference to the value. -//! @param replace - When true, any existing key-value is replaced. Otherwise, -//! the add is not performed. -//! -//! @return True, the key-value was added or replaced. -//! @return False, the key already exists so he value was not added. -//------------------------------------------------------------------------------ - - bool Add(const std::string &key, - const std::string &val, bool replace=false); - -//------------------------------------------------------------------------------ -//! Get an attribute object associated with this entity. -//! -//! @param sigkey - A unique attribute object signature key. -//! -//! @return Upon success a pointer to the attribute object is returned. -//! Otherwise, a nil pointer is returned. -//------------------------------------------------------------------------------ - -XrdSecAttr *Get(const void *sigkey); - -//------------------------------------------------------------------------------ -//! Get an attribute key value associated with this entity. -//! -//! @param key - The reference to the key. -//! @param val - The reference to the string object to receive the value. -//! -//! @return Upon success true is returned. If the key does not exist, false -//! is returned and the val object remains unchanged. -//------------------------------------------------------------------------------ - - bool Get(const std::string &key, std::string &val); - -//------------------------------------------------------------------------------ -//! Get all the keys for associated attribytes. -//! -//! @return A vector containing all of the keys. -//------------------------------------------------------------------------------ - -std::vector Keys(); - -//------------------------------------------------------------------------------ -//! List key-value pairs via iterative callback on passed ovject. -//! -//! @param attrCB - Reference to the callback object to receive list entries. -//------------------------------------------------------------------------------ - - void List(XrdSecEntityAttrCB &attrCB); - -//------------------------------------------------------------------------------ -//! Constructor and Destructor. -//! -//! @param xtra - Pointer to the data for the implementation. -//------------------------------------------------------------------------------ - - XrdSecEntityAttr(XrdSecEntityXtra *xtra) : entXtra(xtra) {} - - ~XrdSecEntityAttr() {} - -private: - -XrdSecEntityXtra *entXtra; -}; - -/******************************************************************************/ -/* X r d S e c E n t i t y A t t r C B */ -/******************************************************************************/ - -// The XrdSecEntityAttrCB class defines the callback object passed to the -// XrdSecEntity::List() method to iteratively obtain the key-value attribute -// pairs associated with the entity. The XrdSecEntityAttrCB::Attr() method is -// called for each key-value pair. The end of the list is indicated by calling -// Attr() with nil key-value pointers. The Attr() method should not call -// the XrdSecEntity::Add() or XrdSecEntity::Get() methods; otherwise, a -// deadlock will occur. -// -class XrdSecEntityAttrCB -{ -public: - -//------------------------------------------------------------------------------ -//! Acceppt a key-value attribute pair from the XrdSecEntity::List() method. -//! -//! @param key - The key, if nil this is the end of the list. -//! @param val - The associated value, if nil this is the end of the list. -//! -//! @return One of the Action enum values. The return value is ignored when -//! the end of the list indicator is returned. -//------------------------------------------------------------------------------ - -enum Action {Delete = -1, //!< Delete the key-value and proceed to next one - Stop = 0, //!< Stop the iteration - Next = 1 //!< Proceed to the next key-value pair - }; - -virtual Action Attr(const char *key, const char *val) = 0; - -//------------------------------------------------------------------------------ -//! Constructor and Destructor. -//------------------------------------------------------------------------------ - - XrdSecEntityAttrCB() {} -virtual ~XrdSecEntityAttrCB() {} -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdSec/XrdSecEntityPin.hh b/test/binary/usr/include/xrootd/XrdSec/XrdSecEntityPin.hh deleted file mode 100644 index d4585bb71..000000000 --- a/test/binary/usr/include/xrootd/XrdSec/XrdSecEntityPin.hh +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef __SEC_ENTITYPIN_H__ -#define __SEC_ENTITYPIN_H__ -/******************************************************************************/ -/* */ -/* X r d S e c E n t i t y P i n . h h */ -/* */ -/* (c) 2020 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -/*! This class defines the XrdSecEntity object post processing plugin. When - authentication succeeds, the plugin is called to inspect and possible - decorate (e.g. add attributes) the entity object. The plugin also has the - capability of returning failure due to some problem. When failure ooccurs, - the security framework moves on to another authentication protocol, if one - is avalable. Entity post processing plugins may be stacked. You always - return the results of the stacked plugin whether or not you wish to handle - the entity object, if a stacked plugin exists; unless you return false. -*/ - -class XrdSecEntityPin -{ -public: - -//------------------------------------------------------------------------------ -//! Post process an authenticated entity object. -//! -//! @param entity Reference to the entity object. -//! @param einfo Reference to errinfo object where a message that should be -//! returned to the client on why post processing failed. -//! -//! @return true upon success and false upon failure with einfo containing -//! the reason for the failure. -//------------------------------------------------------------------------------ - -virtual bool Process(XrdSecEntity &entity, XrdOucErrInfo &einfo) = 0; - - XrdSecEntityPin() {} -virtual ~XrdSecEntityPin() {} -}; - -/*! An instance of the plugin is obtained by the plugin manager using the - XrdOucPinObject class. The most straightforward way to implement this - is to inherit the XrdOucPinObject class by a class of your choosing - that defines a file level object named SecEntityPin, as follows: - - class myPinObject : public XrdOucPinObject - {public: - - XrdSecEntityPin *getInstance(...) {provide concrete implementation} - - } SecEntityPin; - - see XrdOucPinObject.hh for additional details. There are many other - ways to accomplish this including inheriting this class along with the - XrdSecEntityPin class by the post processing implementation class. - - You should also specify the compilation version. That is, the XRootD - version you used to compile your plug-in. Decalre it as: - - #include "XrdVersion.hh" - XrdVERSIONINFO(SecEntityPin,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ -#endif diff --git a/test/binary/usr/include/xrootd/XrdSec/XrdSecInterface.hh b/test/binary/usr/include/xrootd/XrdSec/XrdSecInterface.hh deleted file mode 100644 index ea4ec12b5..000000000 --- a/test/binary/usr/include/xrootd/XrdSec/XrdSecInterface.hh +++ /dev/null @@ -1,678 +0,0 @@ -#ifndef __SEC_INTERFACE_H__ -#define __SEC_INTERFACE_H__ -/******************************************************************************/ -/* */ -/* X r d S e c I n t e r f a c e . h h */ -/* */ -/* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#ifndef WIN32 -#include -#endif -#include -#include -#include - -#include "XrdSec/XrdSecEntity.hh" - -/******************************************************************************/ -/* X r d S e c C r e d e n t i a l s & X r d S e c P a r a m e t e r s */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! Generic structure to pass security information back and forth. -//------------------------------------------------------------------------------ - -struct XrdSecBuffer -{ - int size; //!< Size of the buffer or length of data in the buffer - char *buffer; //!< Pointer to the buffer - - XrdSecBuffer(char *bp=0, int sz=0) : size(sz), buffer(bp), membuf(bp) {} - ~XrdSecBuffer() {if (membuf) free(membuf);} - -private: - char *membuf; // Stable copy of the buffer address -}; - -//------------------------------------------------------------------------------ -//! When the buffer is used for credentials, the start of the buffer always -//! holds the credential protocol name (e.g., krb4) as a string. The client -//! will get credentials and the size will be filled out so that the contents -//! of buffer can be easily transmitted to the server. -//------------------------------------------------------------------------------ - -typedef XrdSecBuffer XrdSecCredentials; - -//------------------------------------------------------------------------------ -//! When the buffer is used for parameters, the contents must be interpreted -//! in the context that it is used. For instance, the server will send the -//! security configuration parameters on the initial login. The format differs -//! from, say, the x.500 continuation paremeters that would be sent during -//! PKI authentication via an "authmore" return status. -//------------------------------------------------------------------------------ - -typedef XrdSecBuffer XrdSecParameters; - -/******************************************************************************/ -/* X r d S e c P r o t o c o l */ -/******************************************************************************/ -/*! - The XrdSecProtocol is used to generate authentication credentials and to - authenticate those credentials. For example, When a server indicates - that authentication is needed (i.e., it returns security parameters), the - client must call XrdSecgetProtocol() to get an appropriate XrdSecProtocol - (i.e., one specific to the authentication protocol that needs to be used). - Then the client can use the first form getCredentials() to generate the - appropriate identification information. On subsequent calls in response to - "authmore" the client must use the second form, providing the additional - parameters the the server sends. The server uses Authenticate() to verify - the credentials. When XrdOucErrInfo is null (as it will usually be), error - messages are routed to standard error. So, for example, a client would - - 1) Call XrdSecGetProtocol() to get an appropriate XrdSecProtocol - (i.e., one specific to the authentication protocol that needs to be used). - Note that successive calls to XrdSecGetProtocol() using the same - XrdSecParameters will use the subsequent protocol named in the list of - protocols that the server returned. Failure is indicated when the list - is exhausted or none of the protocols apply (which exhausts the list). - - 2) Call getCredentials() without supplying any parameters so as to - generate identification information and send them to the server. - - 3) If the server indicates "authmore", call getCredentials() supplying - the additional parameters sent by the server. The returned credentials - are then sent to the server using the "authneticate" request code. - - 4) Repeat step (3) as often as "authmore" is requested by the server. - - The server uses Authenticate() to verify the credentials and getParms() - to generate initial parameters to start the authentication process. - - When XrdOucErrInfo is null (as it will usually be), error messages are - are routed to standard error. - - Server-side security is handled by the XrdSecService object and, while - it uses XrdSecProtocol objects to perform authentication, the XrdSecService - object is used to initialize the security environment and to generate - the appropriate protocol objects at run-time. For an implementation, see - XrdSecServer.hh and XrdSecServer.cc. - - MT Requirements: Must be MT_Safe. -*/ - -class XrdOucErrInfo; - -class XrdSecProtocol -{ -public: - -//------------------------------------------------------------------------------ -//! Structure holding the entity's identification. It is filled in by a -//! successful call to Authenticate() (i.e. it returns 0). -//------------------------------------------------------------------------------ - -XrdSecEntity Entity; - -//------------------------------------------------------------------------------ -//! Authenticate a client. -//! -//! @param cred Credentials supplied by the client. -//! @param parms Place where the address of additional authentication data is -//! to be placed for another autrhentication handshake. -//! @param einfo The error information object where error messages should be -//! placed. The messages are returned to the client. Should einfo -//! be null, messages should be written to stderr. -//! -//! @return > 0 -> parms present (more authentication needed) -//! = 0 -> Entity present (authentication suceeded) -//! < 0 -> einfo present (error has occurred) -//------------------------------------------------------------------------------ - -virtual int Authenticate (XrdSecCredentials *cred, - XrdSecParameters **parms, - XrdOucErrInfo *einfo=0)=0; - -//------------------------------------------------------------------------------ -//! Generate client credentials to be used in the authentication process. -//! -//! @param parm Pointer to the information returned by the server either in -//! the initial login response or the authmore response. -//! @param einfo The error information object where error messages should be -//! placed. The messages are returned to the client. Should einfo -//! be null, messages should be written to stderr. -//! -//! @return Success: Pointer to credentials to sent to the server. The caller -//! is responsible for deleting the object. -//! Failure: Null pointer with einfo, if supplied, containing the -//! reason for the failure. -//------------------------------------------------------------------------------ - -virtual XrdSecCredentials *getCredentials(XrdSecParameters *parm=0, - XrdOucErrInfo *einfo=0)=0; - -//------------------------------------------------------------------------------ -//! Encrypt data in inbuff using the session key. -//! -//! @param inbuff buffer holding data to be encrypted. -//! @param inlen length of the data. -//! @param outbuff place where a pointer to the encrypted data is placed. -//! -//! @return < 0 Failed, the return value is -errno of the reason. Typically, -//! -EINVAL - one or more arguments are invalid. -//! -NOTSUP - encryption not supported by the protocol -//! -ENOENT - Context not innitialized -//! = 0 Success, outbuff contains a pointer to the encrypted data. -//! The caller is responsible for deleting the returned object. -//------------------------------------------------------------------------------ - -virtual int Encrypt(const char *inbuff, // Data to be encrypted - int inlen, // Length of data in inbuff - XrdSecBuffer **outbuff // Returns encrypted data - ) -{ - (void) inbuff; (void) inlen; (void) outbuff; - return -ENOTSUP; -} - -//------------------------------------------------------------------------------ -//! Decrypt data in inbuff using the session key. -//! -//! @param inbuff buffer holding data to be decrypted. -//! @param inlen length of the data. -//! @param outbuff place where a pointer to the decrypted data is placed. -//! -//! @return < 0 Failed,the return value is -errno (see Encrypt). -//! = 0 Success, outbuff contains a pointer to the decrypted data. -//! The caller is responsible for deleting the returned object. -//------------------------------------------------------------------------------ - -virtual int Decrypt(const char *inbuff, // Data to be decrypted - int inlen, // Length of data in inbuff - XrdSecBuffer **outbuff // Buffer for decrypted data - ) -{ - (void) inbuff; (void) inlen; (void) outbuff; - return -ENOTSUP; -} - -//------------------------------------------------------------------------------ -//! Sign data in inbuff using the session key. -//! -//! @param inbuff buffer holding data to be signed. -//! @param inlen length of the data. -//! @param outbuff place where a pointer to the signature is placed. -//! -//! @return < 0 Failed,the return value is -errno (see Encrypt). -//! = 0 Success, outbuff contains a pointer to the signature. -//! The caller is responsible for deleting the returned object. -//------------------------------------------------------------------------------ - -virtual int Sign(const char *inbuff, // Data to be signed - int inlen, // Length of data in inbuff - XrdSecBuffer **outbuff // Buffer for the signature - ) -{ - (void) inbuff; (void) inlen; (void) outbuff; - return -ENOTSUP; -} - -//------------------------------------------------------------------------------ -//! Verify a signature using the session key. -//! -//! @param inbuff buffer holding data to be verified. -//! @param inlen length of the data. -//! @param sigbuff pointer to the signature data. -//! @param siglen length of the signature data. -//! -//! @return < 0 Failed,the return value is -errno (see Encrypt). -//! = 0 Success, signature is correct. -//! > 0 Failed to verify, signature does not match inbuff data. -//------------------------------------------------------------------------------ - -virtual int Verify(const char *inbuff, // Data to be decrypted - int inlen, // Length of data in inbuff - const char *sigbuff, // Buffer for signature - int siglen) // Length if signature -{ - (void) inbuff; (void) inlen; (void) sigbuff; (void) siglen; - return -ENOTSUP; -} - -//------------------------------------------------------------------------------ -//! Get the current encryption key (i.e. session key) -//! -//! @param buff buffer to hold the key, and may be null. -//! @param size size of the buffer. -//! -//! @returns < 0 Failed, returned value if -errno (see Encrypt) -//! >= 0 The size of the encyption key. The supplied buffer of length -//! size hold the key. If the buffer address is supplied, the -//! key is placed in the buffer. -//! -//------------------------------------------------------------------------------ - -virtual int getKey(char *buff = 0, int size = 0) -{ - (void) buff; (void) size; - return -ENOTSUP; -} - -//------------------------------------------------------------------------------ -//! Set the current encryption key -//! -//! @param buff buffer that holds the key. -//! @param size size of the key. -//! -//! @returns: < 0 Failed, returned value if -errno (see Encrypt) -//! = 0 The new key has been set. -//------------------------------------------------------------------------------ - -virtual int setKey(char *buff, int size) -{ - (void) buff; (void) size; - return -ENOTSUP; -} - -//------------------------------------------------------------------------------ -//! Check if this protocol requires TLS to properly function. -//------------------------------------------------------------------------------ - -virtual bool needTLS() {return false;} - -//------------------------------------------------------------------------------ -//! Delete the protocol object. DO NOT use C++ delete() on this object. -//------------------------------------------------------------------------------ - -virtual void Delete()=0; // Normally does "delete this" - -//------------------------------------------------------------------------------ -//! Constructor -//------------------------------------------------------------------------------ - - XrdSecProtocol(const char *pName) : Entity(pName) {} -protected: - -//------------------------------------------------------------------------------ -//! Destructor (prevents use of direct delete). -//------------------------------------------------------------------------------ - -virtual ~XrdSecProtocol() {} -}; - -/******************************************************************************/ -/* P r o t o c o l N a m i n g C o n v e n t i o n s */ -/******************************************************************************/ - -/*! Each specific protocol resides in a shared library named "libXrdSec

.so" - where

is the protocol identifier (e.g., krb5, gsi, etc). The library - contains a class derived from the XrdSecProtocol object. The library must - also contain a three extern "C" functions: - 1) XrdSecProtocol

Init() - Called for one-time protocol ininitialization. - 2) XrdSecProtocol

Object() - Called for protocol object instantiation. - 3) XrdSecProtocol

Object_ - Inspected for the protocol object xrootd version number used in - compilation; defined by the XrdVERSIONINFO macro (see later comments). -*/ - -//------------------------------------------------------------------------------ -//! Perform one-time initialization when the shared library containing the -//! the protocol is loaded. -//! -//! @param who contains 'c' when called on the client side and 's' when -//! called on the server side. -//! @param parms when who == 'c' (client) the pointer is null. -//! when who == 's' (server) argument points to any parameters -//! specified in the config file with the seclib directive. If no -//! parameters were specified, the pointer may be null. -//! @param einfo The error information object where error messages should be -//! placed. Should einfo be null, messages should be written to -//! stderr. -//! -//! @return Success: The initial security token to be sent to the client during -//! the login phase (i.e. authentication handshake). If no -//! token need to be sent, a pointer to null string should be -//! returned. However, if protocol needs TLS to properly -//! authenticate, the token must start with "TLS:" immediately -//! by the token to be sent to the client, if any. See the -//! for more information TLS-based protocols. -//! Failure: A null pointer with einfo, if supplied, holding the reason -//! for the failure. -//! -//! Notes: 1) Function is called since in single-thread mode and need not be -//! thread-safe (server-side only). -//! 2) If the protocol is TLS based then, in addition to returning a -//! "TLS:" prefixed token it should do two more things: -//! a) Make sure that the connection is in fact using TLS. Simply -//! invoke the endPoint argument as endPoint.isUsingTLS() and -//! make sure it returns true. -//! b) Override the virtual XrdSecProtocol::needTLS() method and -//! return true (the default is to return false). -//------------------------------------------------------------------------------ - -/*! @code {.cpp} - extern "C" char *XrdSecProtocol

Init (const char who, - const char *parms, - XrdOucErrInfo *einfo) {. . . .} - @endcode -*/ - -//------------------------------------------------------------------------------ -//! Obtain an instance of a protocol object. -//! -//! @param who contains 'c' when called on the client side and 's' when -//! called on the server side. -//! @param hostname The client's host name or the IP address as text. An IP -//! may be supplied if the host address is not resolvable. Use -//! endPoint to get the hostname only if it's actually needed. -//! @param endPoint the XrdNetAddrInfo object describing the end-point. When -//! who == 'c' this is the client, otherwise it is the server. -//! @param parms when who == 'c' (client) points to the parms sent by the -//! server upon the initial handshake (see Init() above). -//! when who == 's' (server) is null. -//! @param einfo The error information object where error messages should be -//! placed. Should einfo be null, messages should be written to -//! stderr. -//! -//! @return Success: A pointer to the protocol object. -//! Failure: A null pointer with einfo, if supplied, holding the reason -//! for the failure. -//! -//! Notes 1) Warning! The protocol *must* allow both 'c' and 's' calls within -//! the same execution context. This occurs when a server acts like -//! a client. -//! 2) This function must be thread-safe. -//! 3) Additionally, you *should* declare the xrootd version you used -//! to compile your plug-in using XrdVERSIONINFO where \ is -//! the 1- to 15-character unquoted name of your plugin. This is a -//! mandatory requirement! -//------------------------------------------------------------------------------ - -/*! Example: - - #include "XrdVersion.hh" - XrdVERSIONINFO(XrdSecProtocol

Object,); - - extern "C" XrdSecProtocol *XrdSecProtocol

Object - (const char who, - const char *hostname, - XrdnetAddrInfo &endPoint, - const char *parms, - XrdOucErrInfo *einfo - ) {. . .} -*/ - -/******************************************************************************/ -/* P r o t o c o l O b j e c t M a n a g e m e n t */ -/******************************************************************************/ - -//! The following extern "C" functions provide protocol object management. That -//! is, coordinating the use of the right authentication protocol between the -//! client and server. The default implementation may be replaced via a plugin. - -/******************************************************************************/ -/* X r d S e c G e t P r o t o c o l */ -/* */ -/* C l i e n t S i d e U S e O n l y */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! Create a client security context and get a supported XrdSecProtocol object -//! for one of the protocols suggested by the server and possibly based on the -//! server's hostname or host address, as needed. -//! -//! @param hostname The client's host name or the IP address as text. An IP -//! may be supplied if the host address is not resolvable. Use -//! endPoint to get the hostname only if it's actually needed. -//! @param endPoint the XrdNetAddrInfo object describing the server end-point. -//! @param sectoken The security token supplied by the server. -//! @param einfo The structure to record any error messages. These are -//! normally sent to the client. If einfo is a null pointer, -//! the messages should be sent to standard error. -//! -//! @return Success: Address of protocol object to be used for authentication. -//! If cred was null, a host protocol object should be -//! returned if so allowed. The object's delete method should -//! be called to release the storage. -//! Failure: Null, no protocol can be returned. The einfo parameter, -//! if supplied, has the reason. -//! -//! Notes: 1) There should be one protocol object per physical TCP/IP -//! connections. -//! 2) When the connection is closed, the protocol's Delete() method -//! should be called to properly delete the object. -//! 3) The method and the returned object should be MT-safe. -//! 4) When replacing the default implementation with a plug-in the -//! extern "C" function below must exist in your shared library. -//! 5) Additionally, you *should* declare the xrootd version you used -//! to compile your plug-in using XrdVERSIONINFO where \ is -//! the 1- to 15-character unquoted name of your plugin. This is a -//! mandatory requirement! -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -//! Typedef to simplify the encoding of methods returning XrdSecProtocol. -//------------------------------------------------------------------------------ - -typedef XrdSecProtocol *(*XrdSecGetProt_t)(const char *hostname, - XrdNetAddrInfo &endPoint, - XrdSecParameters §oken, - XrdOucErrInfo *einfo); - -/*! Example: - - #include "XrdVersion.hh" - XrdVERSIONINFO(XrdSecGetProtocol,); - - extern "C" XrdSecProtocol *XrdSecGetProtocol - (const char *hostname, - XrdNetAddrInfo &endPoint, - XrdSecParameters §oken, - XrdOucErrInfo *einfo=0) - {....} -*/ - -/******************************************************************************/ -/* X r d S e c G e t P r o t e c t i o n */ -/* */ -/* C l i e n t S i d e U s e O n l y */ -/******************************************************************************/ - -/*! The XrdSecGetProtection function returns a protection object to secure - an XRootD request stream from injection attacks. An object is returned - when the response to kXR_protocol request indicates that the server - requires that the client secure the connection. This protection is based - on the authentication method used. Therefore, authentication must occur - before a protection object can be obtained. Usually, a protection object - is requested right after authentication. The function description is - - @param rc Where an error return code is to be placed. - @param aprot Uses the authentication protocol to protect requests. It - must be supplied and must be he protocol the client used - for authentication. Hence, authentication must occur first. - @param presp The protocol value returned in response to kXR_protocol. - The value must be host byte order. - - @return >0 pointer to the protect object placed in protP. - @return =0 No protection is needed, protP set to zero. - @return <0 An error occurred getting the protection object the - return value is -errno and protP has been set to zero. - - Simply declare the following in the place where this is called: - - extern int XrdSecGetProtection(XrdSecProtect *&protP, - XrdSecProtocol &aprot, - kXR_int32 presp); -*/ - -/******************************************************************************/ -/* X r d S e c S e r v i c e */ -/* */ -/* S e r v e r S i d e U s e O n l y */ -/******************************************************************************/ - -/*! The XrdSecService object is the the object that the server uses to obtain - parameters to be passed to the client on initial contact and to create the - appropriate protocol on the initial receipt of the client's credentials. - Server-side processing is a bit more complicated because the set of valid - protocols needs to be configured and that configuration needs to be supplied - to the client so that both can agree on a compatible protocol. This object - is created via a call to XrdSecgetService, defined later on. You may replace - the default implementation by defining a plugin via the seclib directive. - - Warning: The XrdSecService object as well as any objects returned by it - should be MT-safe. -*/ - -class XrdSecService -{ -public: - -//------------------------------------------------------------------------------ -//! Obtain security parameters to be sent to the client upon initial contact. -//! -//! @param size Where the length of the return parameters are to be placed. -//! @param endPoint The client's address information. It may also be a null -//! pointer if the client's host is immaterial. -//! -//! @return EITHER The address of the parameter string (which may be -//! host-specific if hname was supplied). The length of the -//! string must be returned in size parameter. -//! OR A null pointer if authentication need not occur for the -//! client. The size parameter should be set to zero as well. -//------------------------------------------------------------------------------ - -virtual const char *getParms(int &size, XrdNetAddrInfo *endPoint=0) = 0; - -//------------------------------------------------------------------------------ -//! Obtain a protocol object suitable for authentication based on cred and -//! possibly based on the hostname or host address, as needed. -//! -//! @param host The client's host name or the IP address as text. An IP -//! may be supplied if the host address is not resolvable or -//! resolution has been suppressed (i.e. nodnr). Use endPoint -//! to get the hostname if it's actually needed. -//! @param endPoint the XrdNetAddrInfo object describing the client end-point. -//! @param cred The initial credentials supplied by the client, the pointer -//! may be null if the client did not supply credentials. -//! @param einfo The structure to record any error messages. These are -//! normally sent to the client. -//! -//! @return Success: Address of protocol object to be used for authentication. -//! If cred was null, a host protocol object shouldpo be -//! returned if so allowed. -//! Failure: Null, no protocol can be returned. The einfo parameter, -//! if supplied, has the reason. -//------------------------------------------------------------------------------ - -virtual XrdSecProtocol *getProtocol(const char *host, // In - XrdNetAddrInfo &endPoint,// In - const XrdSecCredentials *cred, // In - XrdOucErrInfo &einfo)=0;// Out - -//------------------------------------------------------------------------------ -//! Post process a fully authenticated XrdSecEntity object. -//! -//! @param entity The fully authenticated entity object. -//! @param einfo The structure to record any error messages. These are -//! normally sent to the client. If einfo is a null pointer, -//! the messages should be sent to standard error via an -//! XrdSysError object using the supplied XrdSysLogger when the -//! the plugin was initialized. -//! @return Success: True should be returned. -//! Failure: False should be returned and the einfo object should hold -//! the reason. In this case the authentication fails. -//------------------------------------------------------------------------------ - -virtual bool PostProcess(XrdSecEntity &entity, - XrdOucErrInfo &einfo) {return true;} - -//------------------------------------------------------------------------------ -//! Get a list of authentication protocols that require TLS. -//! -//! @return Pointer to a list of protocols that require TLS or a nil if none. -//------------------------------------------------------------------------------ - -virtual const char *protTLS()=0; - -//------------------------------------------------------------------------------ -//! Constructor -//------------------------------------------------------------------------------ - - XrdSecService() {} - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - -virtual ~XrdSecService() {} -}; - -/******************************************************************************/ -/* X r d g e t S e c S e r v i c e */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! Create a server's security context and get an XrdSecService object. -//! -//! @param lp The logging object that should be associated with an -//! XrdSysError object to route messages. -//! @param cfn The configuration file name. -//! -//! @return Success: Pointer to the XrdSecService object. This object is never -//! deleted by the server. -//! Failure: Null pointer which causes initialization to fail. -//! -//! Notes: 1) The XrdSecSgetService function is called once during server -//! initialization. So, it need not be thread safe. -//! 2) If you choose to replace the default implementation with your -//! own plugin, the extern "C" function below must be defined in -//! your plugin shared library. -//! 3) Additionally, you *should* declare the xrootd version you used -//! to compile your plug-in using XrdVERSIONINFO where \ is -//! the 1- to 15-character unquoted name of your plugin. This is a -//! mandatory requirement! -//------------------------------------------------------------------------------ - - -//------------------------------------------------------------------------------ -//! Typedef to simplify the encoding of methods returning XrdSecService. -//------------------------------------------------------------------------------ - -class XrdSysLogger; -typedef XrdSecService *(*XrdSecGetServ_t)(XrdSysLogger *, const char *); - -/*! Example: - - #include "XrdVersion.hh" - XrdVERSIONINFO(XrdSecgetService,); - - extern "C" XrdSecService *XrdSecgetService(XrdSysLogger *lp, const char *cfn) -*/ -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysAtomics.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysAtomics.hh deleted file mode 100644 index 6c8c2d85e..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysAtomics.hh +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef _XRDSYSATOMICS_ -#define _XRDSYSATOMICS_ -/******************************************************************************/ -/* */ -/* X r d S y s A t o m i c s . h h */ -/* */ -/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -/* The following instruction acronyms are used: - AtomicCAS() -> Compare And [if equal] Set - AtomicFAZ() -> Fetch And Zero -*/ - -/* Portability note: When using fetch-add or fetch-sub in the context of an - assignment statement, you must use the the AtomicFAdd - and AtomicFSub macros to ensure portability and correct - results. Additionally, whenever you use AtomicFAZ as the - only consequent of an if-else statement you *must* places - braces around it otherwise the code will not be portable! - Alternatively, always use the AtomicFZAP macro. -*/ - -#ifdef HAVE_ATOMICS -#define AtomicBeg(Mtx) -#define AtomicEnd(Mtx) -#define AtomicAdd(x, y) __sync_fetch_and_add(&x, y) -#define AtomicFAdd(w,x,y) w = __sync_fetch_and_add(&x, y) -#define AtomicCAS(x, y, z) __sync_bool_compare_and_swap(&x, y, z) -#define AtomicDec(x) __sync_fetch_and_sub(&x, 1) -#define AtomicFAZ(x) __sync_fetch_and_and(&x, 0) -#define AtomicFZAP(w,x) w = __sync_fetch_and_and(&x, 0) -#define AtomicGet(x) __sync_fetch_and_or(&x, 0) -#define AtomicInc(x) __sync_fetch_and_add(&x, 1) -#define AtomicSub(x, y) __sync_fetch_and_sub(&x, y) -#define AtomicFSub(w,x,y) w = __sync_fetch_and_sub(&x, y) -#define AtomicZAP(x) __sync_fetch_and_and(&x, 0) -#define AtomicRet(mtx, x) return AtomicGet(x) -#else -#define AtomicBeg(Mtx) Mtx.Lock() -#define AtomicEnd(Mtx) Mtx.UnLock() -#define AtomicAdd(x, y) x += y // When assigning use AtomicFAdd! -#define AtomicFAdd(w,x,y) {w = x; x += y;} -#define AtomicCAS(x, y, z) if (x == y) x = z -#define AtomicDec(x) x-- -#define AtomicFAZ(x) x; x = 0 // Braces when used with if-else! -#define AtomicFZAP(w,x) {w = x; x = 0;} -#define AtomicGet(x) x -#define AtomicInc(x) x++ -#define AtomicSub(x, y) x -= y // When assigning use AtomicFSub! -#define AtomicFSub(w,x,y) {w = x; x -= y;} -#define AtomicZAP(x) x = 0 -#define AtomicRet(mtx, x) {mtx.Lock(); int _ ## x = x; \ - mtx.UnLock(); return _ ## x;} -#endif -#endif - -/* - * The following definitions give a mechanism for using C++ atomics - * (when using at least C++11). *Note* that these can't be relied - * on for correct behavior as they are non-atomic for C++03 compilers. - * - * Only use them for standards correctness (eliminating C++11 undefined - * behavior). - */ -#if __cplusplus >= 201103L -#include -#define CPP_ATOMIC_LOAD(x, order) x.load(order) -#define CPP_ATOMIC_STORE(x, val, order) x.store(val, order) -#define CPP_ATOMIC_TYPE(kind) std::atomic -#else -#define CPP_ATOMIC_LOAD(x, order) x -#define CPP_ATOMIC_STORE(x, val, order) x = val -#define CPP_ATOMIC_TYPE(kind) kind -#endif - - diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysError.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysError.hh deleted file mode 100644 index 0d970db52..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysError.hh +++ /dev/null @@ -1,179 +0,0 @@ -#ifndef __SYS_ERROR_H__ -#define __SYS_ERROR_H__ -/******************************************************************************/ -/* */ -/* X r d S y s E r r o r . h h */ -/* */ -/*(c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/*Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Deprtment of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#ifndef WIN32 -#include -#include -#include -#else -#include -#endif - -/******************************************************************************/ -/* o o u c _ E r r o r _ T a b l e */ -/******************************************************************************/ - -class XrdSysError_Table -{ -public: -friend class XrdSysError; - -char *Lookup(int mnum) - {return (char *)(mnum < base_msgnum || mnum > last_msgnum - ? 0 : msg_text[mnum - base_msgnum]); - } - XrdSysError_Table(int base, int last, const char **text) - : next(0), - base_msgnum(base), - last_msgnum(last), - msg_text(text) {} - ~XrdSysError_Table() {} - -private: -XrdSysError_Table *next; // -> Next table or 0; -int base_msgnum; // Starting message number -int last_msgnum; // Ending message number -const char **msg_text; // Array of message text -}; - -/******************************************************************************/ -/* L o g M a s k D e f i n i t i o n s */ -/******************************************************************************/ - -const int SYS_LOG_01 = 1; -const int SYS_LOG_02 = 2; -const int SYS_LOG_03 = 4; -const int SYS_LOG_04 = 8; -const int SYS_LOG_05 = 16; -const int SYS_LOG_06 = 32; -const int SYS_LOG_07 = 64; -const int SYS_LOG_08 = 128; -// 0x00000100 to 0x0000ffff reseved for XRootD use -// 0x00010000 to 0xffff0000 reseved for non-XRootD use - -/******************************************************************************/ -/* o o u c _ E r r o r */ -/******************************************************************************/ - -class XrdSysLogger; - -class XrdSysError -{ -public: - XrdSysError(XrdSysLogger *lp, const char *ErrPrefix="sys") - : epfx(0), - epfxlen(0), - msgMask(-1), - Logger(lp) - { SetPrefix(ErrPrefix); } - - ~XrdSysError() {} - -// addTable allows you to add a new error table for errno handling. Any -// number of table may be added and must consist of statis message text -// since the table are deleted but the text is not freed. Error tables -// must be setup without multi-threading. There is only one global table. -// -static void addTable(XrdSysError_Table *etp) {etp->next = etab; etab = etp;} - -// baseFD() returns the original FD associated with this object. -// -int baseFD(); - -// ec2text tyranslates an error code to the correspodning error text or returns -// null if matching text cannot be found. -// -static const char *ec2text(int ecode); - -// Emsg() produces a message of various forms. The message is written to the -// constructor specified file descriptor. See variations below. -// -// : error (syser[]); " -// (returns abs(ecode)). -// -int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0); - -// : -// -void Emsg(const char *esfx, const char *text1, - const char *text2=0, - const char *text3=0); - -// : -// -inline void Log(int mask, const char *esfx, - const char *text1, - const char *text2=0, - const char *text3=0) - {if (mask & msgMask) Emsg(esfx, text1, text2, text3);} - -// logger() sets/returns the logger object for this message message handler. -// -XrdSysLogger *logger(XrdSysLogger *lp=0) - {XrdSysLogger *oldp = Logger; - if (lp) Logger = lp; - return oldp; - } - -// Say() route a line without timestamp or prefix -// -void Say(const char *text1, const char *text2=0, const char *txt3=0, - const char *text4=0, const char *text5=0, const char *txt6=0); - -// Set/Get the loging mask (only used by clients of this object) -// -void setMsgMask(int mask) {msgMask = mask;} - -int getMsgMask() {return msgMask;} - -// SetPrefix() dynamically changes the error prefix -// -inline const char *SetPrefix(const char *prefix) - {const char *oldpfx = epfx; - epfx = prefix; epfxlen = strlen(epfx); - return oldpfx; - } - -// TBeg() is used to start a trace on ostream cerr. The TEnd() ends the trace. -// -void TBeg(const char *txt1=0, const char *txt2=0, const char *txt3=0); -void TEnd(); - -private: - -static XrdSysError_Table *etab; -const char *epfx; -int epfxlen; -int msgMask; -XrdSysLogger *Logger; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysFD.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysFD.hh deleted file mode 100644 index a81553e8b..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysFD.hh +++ /dev/null @@ -1,164 +0,0 @@ -#ifndef __XRDSYS_FD_H__ -#define __XRDSYS_FD_H__ -/******************************************************************************/ -/* */ -/* X r d S y s F D . h h */ -/* */ -/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -//----------------------------------------------------------------------------- -//! XrdSysFD defines a set of alternate functions that make sure that the -//! CLOEXEC attribute is associated with any new file descriptors returned by -//! by commonly used functions. This is platform sensitive as some platforms -//! allow atomic setting of the attribute while others do not. These functions -//! are used to provide platform portability. -//----------------------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include - -namespace -{ -#if ( defined(__linux__) || defined(__GNU__) ) && defined(SOCK_CLOEXEC) && defined(O_CLOEXEC) -inline int XrdSysFD_Accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) - {return accept4(sockfd, addr, addrlen, SOCK_CLOEXEC);} - -inline int XrdSysFD_Dup(int oldfd) - {return fcntl(oldfd, F_DUPFD_CLOEXEC, 0);} - -inline int XrdSysFD_Dup1(int oldfd, int minfd) - {return fcntl(oldfd, F_DUPFD_CLOEXEC, minfd);} - -inline int XrdSysFD_Dup2(int oldfd, int newfd) - {return dup3(oldfd, newfd, O_CLOEXEC);} - -inline int XrdSysFD_Open(const char *path, int flags) - {return open(path, flags|O_CLOEXEC);} - -inline int XrdSysFD_Open(const char *path, int flags, mode_t mode) - {return open(path, flags|O_CLOEXEC, mode);} - -inline DIR* XrdSysFD_OpenDir(const char *path) - {int fd; - if ((fd = open(path, O_RDONLY|O_CLOEXEC)) < 0) return 0; - DIR *dP = fdopendir(fd); - if (!dP) {int rc = errno; close(fd); errno = rc;} - return dP; - } - -inline int XrdSysFD_Pipe(int pipefd[2]) - {return pipe2(pipefd, O_CLOEXEC);} - -inline int XrdSysFD_Socket(int domain, int type, int protocol) - {return socket(domain, type|SOCK_CLOEXEC, protocol);} - -inline int XrdSysFD_Socketpair(int domain, int type, int protocol, int sfd[2]) - {return socketpair(domain, type|SOCK_CLOEXEC, protocol, sfd);} -#else -inline int XrdSysFD_Accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen) - {int newfd = accept(sockfd, addr, addrlen); - if (newfd >= 0) fcntl(newfd, F_SETFD, FD_CLOEXEC); - return newfd; - } - -inline int XrdSysFD_Dup(int oldfd) - {int newfd = dup(oldfd); - if (newfd >= 0) fcntl(newfd, F_SETFD, FD_CLOEXEC); - return newfd; - } - -inline int XrdSysFD_Dup1(int oldfd, int minfd) - {int newfd = fcntl(oldfd, F_DUPFD, minfd); - if (newfd >= 0) fcntl(newfd, F_SETFD, FD_CLOEXEC); - return newfd; - } - -inline int XrdSysFD_Dup2(int oldfd, int newfd) - {int rc = dup2(oldfd, newfd); - if (!rc) fcntl(newfd, F_SETFD, FD_CLOEXEC); - return rc; - } - -inline int XrdSysFD_Open(const char *path, int flags) - {int newfd = open(path, flags); - if (newfd >= 0) fcntl(newfd, F_SETFD, FD_CLOEXEC); - return newfd; - } - -inline int XrdSysFD_Open(const char *path, int flags, mode_t mode) - {int newfd = open(path, flags, mode); - if (newfd >= 0) fcntl(newfd, F_SETFD, FD_CLOEXEC); - return newfd; - } - -inline DIR* XrdSysFD_OpenDir(const char *path) - {int fd = XrdSysFD_Open(path, O_RDONLY); - if (fd < 0) return 0; - fcntl(fd, F_SETFD, FD_CLOEXEC); - DIR *dP = fdopendir(fd); - if (!dP) {int rc = errno; close(fd); errno = rc;} - return dP; - } - -inline int XrdSysFD_Pipe(int pipefd[2]) - {int rc = pipe(pipefd); - if (!rc) {fcntl(pipefd[0], F_SETFD, FD_CLOEXEC); - fcntl(pipefd[1], F_SETFD, FD_CLOEXEC); - } - return rc; - } - -inline int XrdSysFD_Socket(int domain, int type, int protocol) - {int newfd = socket(domain, type, protocol); - if (newfd >= 0) fcntl(newfd, F_SETFD, FD_CLOEXEC); - return newfd; - } - -inline int XrdSysFD_Socketpair(int domain, int type, int protocol, int sfd[2]) - {int rc = socketpair(domain, type, protocol, sfd); - if (!rc) {fcntl(sfd[0], F_SETFD, FD_CLOEXEC); - fcntl(sfd[1], F_SETFD, FD_CLOEXEC); - } - return rc; - } -#endif - -// openat is part of POSIX.1-2008; in Linux, BSD, and Solaris -inline int XrdSysFD_Openat(int dirfd, const char *pathname, int flags) - {return openat(dirfd, pathname, flags | O_CLOEXEC);} - -inline bool XrdSysFD_Yield(int fd) - {int fdFlags = fcntl(fd, F_GETFD); - if (fdFlags < 0) return false; - return 0 == fcntl(fd, F_SETFD, fdFlags & ~FD_CLOEXEC); - } -} -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysHeaders.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysHeaders.hh deleted file mode 100644 index 88230fd5c..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysHeaders.hh +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __XRDSYS_HEADERS_H__ -#define __XRDSYS_HEADERS_H__ -/******************************************************************************/ -/* */ -/* X r d S y s H e a d e r s . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -// This header has been introduced to help the transition to new versions -// of the gcc compiler which deprecates or even not support some standard -// headers in the form .h -// - -#if !defined(HAVE_OLD_HDRS) || defined(WIN32) - -// gcc >= 4.3, cl require this -# include -using namespace std; - -#else - -# include - -#endif - - - -#endif // __XRDSYS_HEADERS_H__ diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysLogPI.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysLogPI.hh deleted file mode 100644 index 953399b16..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysLogPI.hh +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef __SYS_LOGPI_H__ -#define __SYS_LOGPI_H__ -/******************************************************************************/ -/* */ -/* X r d S y s L o g P I . h h */ -/* */ -/*(c) 2016 by the Board of Trustees of the Leland Stanford, Jr., University */ -/*Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Deprtment of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include - -//----------------------------------------------------------------------------- -//! This header file defines the plugin interface used by the logging subsystem. -//! The following function is called for each message. A pointer to the -//! function is returned by XrdSysLogPInit(); see the definition below. The -//! log message function must be thread safe in synchronous mode as any number -//! of threads may call it at the same time. In async mode, only one thread -//! invokes the function for each message. -//! -//! @param mtime The time the message was generated. The time value is -//! zero when tID is zero (see below). -//! @param tID The thread ID that issued the message (Linux -> gettid()). -//! If tID is zero then the msg was captured from stderr. -//! @param msg Pointer to the null-terminaed message text. -//! @param mlen Length of the message text (exclusive of null byte). -//----------------------------------------------------------------------------- - -typedef void (*XrdSysLogPI_t)(struct timeval const &mtime, - unsigned long tID, - const char *msg, - int mlen); - -//----------------------------------------------------------------------------- -//! Initialize and return a pointer to the plugin. This function must reside in -//! the plugin shared library as an extern "C" function. The shared library is -//! library identified by the "-l @library" command line option. This function -//! is called only once during loging initialization. -//! -//! @param cfgn -> Configuration filename (nil if none). -//! @param argv -> command line arguments after "-+xrdlog". -//! @param argc number of command line arguments in argv. -//! -//! @return Upon success a pointer of type XrdSysLogPI_t which is the function -//! that handles log messages (see above). Upon failure, a nil pointer -//! should be returned. A sample deinition is shown below. -//----------------------------------------------------------------------------- - -/*! - extern "C" XrdSysLogPI_t XrdSysLogPInit(const char *cfgn, - char **argv, - int argc) { . . . } -*/ - -typedef XrdSysLogPI_t (*XrdSysLogPInit_t)(const char *cfgn, - char **argv, - int argc); - -//------------------------------------------------------------------------------ -/*! Specify the compilation version. - - Additionally, you *should* declare the xrootd version you used to compile - your plug-in. The plugin manager automatically checks for compatibility. - Declare it as follows: - - #include "XrdVersion.hh" - XrdVERSIONINFO(XrdSysLogPInit,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ -//------------------------------------------------------------------------------ -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysLogger.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysLogger.hh deleted file mode 100644 index b33bf82ca..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysLogger.hh +++ /dev/null @@ -1,285 +0,0 @@ -#ifndef __SYS_LOGGER_H__ -#define __SYS_LOGGER_H__ -/******************************************************************************/ -/* */ -/* X r d S y s L o g g e r . h h */ -/* */ -/*(c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/*Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Deprtment of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#ifndef WIN32 -#include -#include -#include -#else -#include -#include -#include "XrdSys/XrdWin32.hh" -#endif - -#include "XrdSys/XrdSysPthread.hh" - -//----------------------------------------------------------------------------- -//! XrdSysLogger is the object that is used to route messages to wherever they -//! need to go and also handles log file rotation and trimming. -//----------------------------------------------------------------------------- - -class XrdOucTListFIFO; - -class XrdSysLogger -{ -public: - -//----------------------------------------------------------------------------- -//! Constructor -//! -//! @param ErrFD is the filedescriptor of where error messages normally -//! go if this class is not used. Default is stderr. -//! @param xrotate when not zero performs internal log rotatation. Otherwise, -//! log rotation is suppressed. See also setRotate(). -//----------------------------------------------------------------------------- - - XrdSysLogger(int ErrFD=STDERR_FILENO, int xrotate=1); - -//----------------------------------------------------------------------------- -//! Destructor -//----------------------------------------------------------------------------- - - ~XrdSysLogger() - { - RmLogRotateLock(); - if (ePath) - free(ePath); - } - -//----------------------------------------------------------------------------- -//! Add a message to be printed at midnight. -//! -//! @param msg The message to be printed. A copy of the message is saved. -//----------------------------------------------------------------------------- - -void AddMsg(const char *msg); - -//----------------------------------------------------------------------------- -//! Add a task to be run at midnight. Tasks are run sequentially lifo. -//! -//! @param mnTask Pointer to an instance of the task object below. -//----------------------------------------------------------------------------- - -class Task -{ -public: -friend class XrdSysLogger; - -virtual void Ring() = 0; //!< This method gets called at midnight - -inline Task *Next() {return next;} - - Task() : next(0) {} -virtual ~Task() {} - -private: -Task *next; -}; - -void AtMidnight(Task *mnTask); - -//----------------------------------------------------------------------------- -//! Bind allows you to bind the file descriptor passed at construction time to -//! a file with an optional periodic closing and opening of the file. -//! -//! @param path The log file path. The file is created, if need be. -//! If path is null, messages are routed to stderr and the -//! lfh argument is ignored. -//! @param lfh Log file handling: -//! >0 file is to be closed and opened at midnight. -//! This implies automatic log rotation. -//! =0 file is to be left open all the time. -//! This implies no log rotation. -//! <0 file is to be closed and opened only on signal abs(lfh) -//! unless the value equals onFifo. In this case a fifo is -//! used to control log file rotation. The name of the fifo -//! is path with the filename component prefixed by dot. -//! This implies manual log rotation. Warning! Using -//! signals requires that Bind() be called before starting -//! any threads so that the signal is properly blocked. -//! -//! @return 0 Processing successful. -//! @return <0 Unable to bind, returned value is -errno of the reason. -//----------------------------------------------------------------------------- - -static const int onFifo = (int)0x80000000; - -int Bind(const char *path, int lfh=0); - -//----------------------------------------------------------------------------- -//! Capture allows you to capture all messages (they are not routed). This is -//! a global setting so use with caution! -//! -//! @param tFIFO Pointer to the XrdOucTListFIFO where messages are saved. -//! If the pointer is nil, capturing is turned off. -//----------------------------------------------------------------------------- - -void Capture(XrdOucTListFIFO *tFIFO); - -//----------------------------------------------------------------------------- -//! Flush any pending output -//----------------------------------------------------------------------------- - -void Flush() {fsync(eFD);} - -//----------------------------------------------------------------------------- -//! Get the file descriptor passed at construction time. -//! -//! @return the file descriptor passed to the constructor. -//----------------------------------------------------------------------------- - -int originalFD() {return baseFD;} - -//----------------------------------------------------------------------------- -//! Parse the keep option argument. -//! -//! @param arg Pointer to the argument. The argument syntax is: -//! \ | \ | fifo | \ -//! -//! @return !0 Parsing succeeded. The return value is the argument that -//! must be passed as the lfh parameter to Bind(). -//! @return =0 Invalid keep argument. -//----------------------------------------------------------------------------- - -int ParseKeep(const char *arg); - -//----------------------------------------------------------------------------- -//! Output data and optionally prefix with date/time -//! -//! @param iovcnt The number of elements in iov vector. -//! @param iov The vector describing what to print. If iov[0].iov_base -//! is zero, the message is prefixed by date and time. -//----------------------------------------------------------------------------- - -void Put(int iovcnt, struct iovec *iov); - -//----------------------------------------------------------------------------- -//! Set call-out to logging plug-in on or off. -//----------------------------------------------------------------------------- - -static -void setForwarding(bool onoff) {doForward = onoff;} - -//----------------------------------------------------------------------------- -//! Set log file timstamp to high resolution (hh:mm:ss.uuuu). -//----------------------------------------------------------------------------- - -void setHiRes() {hiRes = true;} - -//----------------------------------------------------------------------------- -//! Set log file keep value. -//! -//! @param knum The keep value. If knum < 0 then abs(knum) files are kept. -//! Otherwise, only knum bytes of log files are kept. -//----------------------------------------------------------------------------- - -void setKeep(long long knum) {eKeep = knum;} - -//----------------------------------------------------------------------------- -//! Set log file rotation on/off. -//! -//! @param onoff When !0 turns on log file rotations. Otherwise, rotation -//! is turned off. -//----------------------------------------------------------------------------- - -void setRotate(int onoff) {doLFR = onoff;} - -//----------------------------------------------------------------------------- -//! Start trace message serialization. This method must be followed by a call -//! to traceEnd(). -//! -//! @return pointer to the time buffer to be used as the msg timestamp. -//----------------------------------------------------------------------------- - -char *traceBeg() {Logger_Mutex.Lock(); Time(TBuff); return TBuff;} - -//----------------------------------------------------------------------------- -//! Stop trace message serialization. This method must be preceeded by a call -//! to traceBeg(). -//! -//! @return pointer to a new line character to terminate the message. -//----------------------------------------------------------------------------- - -char traceEnd() {Logger_Mutex.UnLock(); return '\n';} - -//----------------------------------------------------------------------------- -//! Get the log file routing. -//! -//! @return the filename of the log file or "stderr". -//----------------------------------------------------------------------------- - -const char *xlogFN() {return (ePath ? ePath : "stderr");} - -//----------------------------------------------------------------------------- -//! Internal method to handle the logfile. This is public because it needs to -//! be called by an external thread. -//----------------------------------------------------------------------------- - -void zHandler(); - -private: -int FifoMake(); -void FifoWait(); -int Time(char *tbuff); -static int TimeStamp(struct timeval &tVal, unsigned long tID, - char *tbuff, int tbsz, bool hires); -int HandleLogRotateLock( bool dorotate ); -void RmLogRotateLock(); - -struct mmMsg - {mmMsg *next; - int mlen; - char *msg; - }; -mmMsg *msgList; -Task *taskQ; -XrdSysMutex Logger_Mutex; -long long eKeep; -char TBuff[32]; // Trace header buffer -int eFD; -int baseFD; -char *ePath; -char Filesfx[8]; -int eInt; -int reserved1; -char *fifoFN; -bool hiRes; -bool doLFR; -pthread_t lfhTID; - -static bool doForward; - -void putEmsg(char *msg, int msz); -int ReBind(int dorename=1); -void Trim(); -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysPageSize.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysPageSize.hh deleted file mode 100644 index 9771186a2..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysPageSize.hh +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __XRDSYS_PAGESIZE_H__ -#define __XRDSYS_PAGESIZE_H__ -/******************************************************************************/ -/* */ -/* X r d S y s P a g e S i z e . h h */ -/* */ -/* (c) 2020 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -// Define a uniform page size for all components -// -namespace XrdSys -{ -static const int PageSize = 4096; -static const int PageMask = 4095; -static const int PageBits = 12; -} -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysPlatform.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysPlatform.hh deleted file mode 100644 index a1ac544ad..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysPlatform.hh +++ /dev/null @@ -1,288 +0,0 @@ -#ifndef __XRDSYS_PLATFORM_H__ -#define __XRDSYS_PLATFORM_H__ -/******************************************************************************/ -/* */ -/* X r d S y s P l a t f o r m . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -// Include stdlib so that ENDIAN macros are defined properly -// -#include - -#ifdef __linux__ -#include -#include -#include -#include -#include -#define MAXNAMELEN NAME_MAX -#endif - -#ifdef __APPLE__ -#include -#include -#include -#define fdatasync(x) fsync(x) -#define MAXNAMELEN NAME_MAX -#ifndef dirent64 -# define dirent64 dirent -#endif -#ifndef off64_t -#define off64_t int64_t -#endif -#if (!defined(MAC_OS_X_VERSION_10_5) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5) -#ifndef stat64 -# define stat64 stat -#endif -#endif -#endif - -#if defined(__FreeBSD__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) -#include -#include -#define MAXNAMELEN NAME_MAX -#endif - -#ifdef __GNU__ -#include -#include -// These are undefined on purpose in GNU/Hurd. -// The values below are the ones used in Linux. -// The proper fix is to rewrite the code to not use hardcoded values, -// but instead allocate memory dynamically at runtime when sizes are known. -// This is true also for systems where these constants are defined. -#define MAXNAMELEN 255 -#define MAXPATHLEN 4096 -#define MAXHOSTNAMELEN 64 -#endif - -#ifdef WIN32 -#define MAXNAMELEN 256 -#define MAXPATHLEN 1024 -#endif - -// The following provides historical support for Solaris 5.10.x -// -#if defined(__solaris__) && defined(__SunOS_5_10) -#define posix_memalign(memp, algn, sz) \ - ((*memp = memalign(algn, sz)) ? 0 : ENOMEM) -#define __USE_LEGACY_PROTOTYPES__ 1 -#endif - -#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) - -#define S_IAMB 0x1FF /* access mode bits */ - -#define STATFS statfs -#define STATFS_BUFF struct statfs - -#define FS_BLKFACT 4 - -#define FLOCK_t struct flock - -typedef off_t offset_t; - -#define GTZ_NULL (struct timezone *)0 - -#else - -#define STATFS statvfs -#define STATFS_BUFF struct statvfs - -#define FS_BLKFACT 1 - -#define SHMDT_t char * - -#define FLOCK_t flock_t - -#define GTZ_NULL (void *)0 - -#endif - -#ifdef __linux__ - -#define SHMDT_t const void * -#endif - -// For alternative platforms -// -#ifdef __APPLE__ -#ifndef POLLRDNORM -#define POLLRDNORM 0 -#endif -#ifndef POLLRDBAND -#define POLLRDBAND 0 -#endif -#ifndef POLLWRNORM -#define POLLWRNORM 0 -#endif -#define O_LARGEFILE 0 -#define SHMDT_t void * -#ifndef EDEADLOCK -#define EDEADLOCK EDEADLK -#endif -#endif - -#ifdef __FreeBSD__ -#define O_LARGEFILE 0 -typedef off_t off64_t; -#endif - -// Only sparc platforms have structure alignment problems w/ optimization -// so the h2xxx() variants are used when converting network streams. - -#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \ - defined(__IEEE_BIG_ENDIAN) || \ - (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN) -#define Xrd_Big_Endian -#ifndef htonll -#define htonll(_x_) _x_ -#endif -#ifndef h2nll -#define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long)) -#endif -#ifndef ntohll -#define ntohll(_x_) _x_ -#endif -#ifndef n2hll -#define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long)) -#endif - -#elif defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || \ - defined(__IEEE_LITTLE_ENDIAN) || \ - (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) -#if !defined(__GNUC__) || defined(__APPLE__) - -#if !defined(__sun) || (defined(__sun) && (!defined(_LP64) || defined(__SunOS_5_10))) -extern "C" unsigned long long Swap_n2hll(unsigned long long x); -#ifndef htonll -#define htonll(_x_) Swap_n2hll(_x_) -#endif -#ifndef ntohll -#define ntohll(_x_) Swap_n2hll(_x_) -#endif -#endif - -#else - -#ifndef htonll -#define htonll(_x_) __bswap_64(_x_) -#endif -#ifndef ntohll -#define ntohll(_x_) __bswap_64(_x_) -#endif - -#endif - -#ifndef h2nll -#define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\ - _y_ = htonll(_y_) -#endif -#ifndef n2hll -#define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\ - _y_ = ntohll(_y_) -#endif - -#else -#ifndef WIN32 -#error Unable to determine target architecture endianness! -#endif -#endif - -#ifndef HAVE_STRLCPY -extern "C" -{extern size_t strlcpy(char *dst, const char *src, size_t size);} -#endif - -// -// To make socklen_t portable use SOCKLEN_t -// -#if defined(__solaris__) && !defined(__linux__) -# if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90 -# define XR__SUNGCC3 -# endif -#endif -#if defined(__linux__) -# include -# if __GNU_LIBRARY__ == 6 -# ifndef XR__GLIBC -# define XR__GLIBC -# endif -# endif -#endif -#if defined(__GNU__) -# define XR__GLIBC -#endif -#if defined(_AIX) || \ - (defined(XR__SUNGCC3) && !defined(__arch64__)) -# define SOCKLEN_t size_t -#elif defined(XR__GLIBC) || \ - defined(__FreeBSD__) || \ - (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) || \ - (defined(XR__SUNGCC3) && defined(__arch64__)) || defined(__APPLE__) || \ - (defined(__sun) && defined(_SOCKLEN_T)) -# ifndef SOCKLEN_t -# define SOCKLEN_t socklen_t -# endif -#elif !defined(SOCKLEN_t) -# define SOCKLEN_t int -#endif - -#ifdef _LP64 -#define PTR2INT(x) static_cast((long long)x) -#else -#define PTR2INT(x) int(x) -#endif - -#ifdef WIN32 -#include "XrdSys/XrdWin32.hh" -#define Netdata_t void * -#define Sokdata_t char * -#define IOV_INIT(data,dlen) dlen,data -#define MAKEDIR(path,mode) mkdir(path) -#define CHMOD(path, mode) {} -#define net_errno WSAGetLastError() -#else -#define O_BINARY 0 -#define Netdata_t char * -#define Sokdata_t void * -#define IOV_INIT(data,dlen) data,dlen -#define MAKEDIR(path,mode) mkdir(path,mode) -#define CHMOD(path, mode) chmod(path,mode) -#define net_errno errno -#endif - -// The following gets arround a relative new gcc compiler bug -// -#define XRDABS(x) (x < 0 ? -x : x) - -#ifndef LT_MODULE_EXT -#define LT_MODULE_EXT ".so" -#endif - -#endif // __XRDSYS_PLATFORM_H__ diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysPlugin.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysPlugin.hh deleted file mode 100644 index 3cf7df7ad..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysPlugin.hh +++ /dev/null @@ -1,250 +0,0 @@ -#ifndef __XRDSYSPLUGIN__ -#define __XRDSYSPLUGIN__ -/******************************************************************************/ -/* */ -/* X r d S y s P l u g i n . h h */ -/* */ -/* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include - -struct XrdVersionInfo; - -class XrdSysError; - -//------------------------------------------------------------------------------ -//! Handy class to load run-time plugins and optionally check if the version -//! is compatible with the caller's version number. Version numbers are defined -//! as "aaa.bb.cc" where aaa is a decimnal major version, bb is a decimal minor -//! version, and cc is the decimal patch version number. Only the major and, -//! optionally, minor version numbers are checked. The checking rules are -//! defined in XrdVersion.hh and are rather liberal in nature. In order to -//! check versions, the plugin versioning rule must be defined in XrdVersion.hh -//! and constructor #2 or #3 must be used. The symbolic name of the plugin's -//! version information is the plugin symbol being looked up appended with -//! "Version" and must be defined as an XrdVersionInfo structure. -//------------------------------------------------------------------------------ - -class XrdSysPlugin -{ -public: - -//------------------------------------------------------------------------------ -//! Prepare shared library for use (optional call). -//! -//! @param allMsgs When true messages all messages are handled as directed by -//! the constructor. Otherwise, only messages regarding ENOENT -//! (file not found ) are suppressed. -//! @param global when true then the symbols defined in the plug-in shared -//! library are made available for symbol resolution of -//! subsequently loaded libraries. -//! -//! @return !0 Library successfully prepared. -//! =0 Library cannot be prepared; if mBuff is supplied, it -//! contains the error message. If the file was not found, -//! errno is set to ENOENT; otherwise to ENOEXEC. -//! -//! @note This method is implicitly called when calling getPlugin(). -//------------------------------------------------------------------------------ - -void *getLibrary(bool allMsgs=true, bool global=false); - -//------------------------------------------------------------------------------ -//! Get the address of a plugin from a shared library, opening the plug-in -//! shared library if not already open. Symbols in the library are local. -//! -//! @param pname the plug-in extern "C" symbolic name -//! @param optional when 0 then issue error message when symbol isn't found. -//! Otherwise, the mising symbol is treated as an error. -//! -//! @return Success: the address of the symbol in the shared library/executable. -//! The address becomes invalid when this object is deleted -//! unless Persist() is called prior to deletion. -//! Failure: Null -//------------------------------------------------------------------------------ - -void *getPlugin(const char *pname, int optional=0); - -//------------------------------------------------------------------------------ -//! Get the address of a plugin from a shared library, opening the plug-in -//! shared library if not already open and optionally make the symbols global. -//! -//! @param pname the plug-in extern "C" symbolic name -//! @param optional when 0 then issue error message when symbol isn't found. -//! Otherwise, the mising symbol is treated as an error. When -//! optional is greater than 1, the load message is suppressed. -//! @param global when true then the symbols defined in the plug-in shared -//! library are made available for symbol resolution of -//! subsequently loaded libraries. -//! @return Success: the address of the symbol in the shared library/executable. -//! The address becomes invalid when this object is deleted -//! unless Persist() is called prior to deletion. -//! Failure: Null -//------------------------------------------------------------------------------ - -void *getPlugin(const char *pname, int optional, bool global); - -//------------------------------------------------------------------------------ -//! Make library persistent even when the plugin object is deleted. Note that -//! if getPlugin() is called afterwards, the library will be re-opened! -//! -//! @return pointer to the opened shared library. -//------------------------------------------------------------------------------ - -void *Persist() {void *lHan = libHandle; libHandle = 0; return lHan;} - -//------------------------------------------------------------------------------ -//! Preload a shared library. This method is meant for those threading models -//! that require libraries to be opened in the main thread (e.g. MacOS). This -//! method is meant to be called before therads start and is not thread-safe. -//! -//! @param path -> to the library path, typically this should just be the -//! library filename so that LD_LIBRARY_PATH is used to -//! discover the directory path. This allows getPlugin() -//! to properly match preloaded libraries. -//! @param ebuff -> buffer where eror message is to be placed. The message -//! will always end with a null byte. If no error buffer -//! is supplied, any error messages are discarded. -//! @param eblen -> length of the supplied buffer, eBuff. -//! -//! @return True The library was preloaded. -//! False The library could not be preloaded, ebuff, if supplied, -//! contains the error message text. -//------------------------------------------------------------------------------ - -static -bool Preload(const char *path, char *ebuff=0, int eblen=0); - -//------------------------------------------------------------------------------ -//! Compare two versions for compatibility, optionally printing a warning. -//! -//! @param vInf1 -> Version information for source. -//! @param vInf2 -> Version information for target. -//! @param noMsg -> If true, no error messages are written to stderr. -//! -//! @return True if versions are compatible (i.e. major and minor versions are -//! identical as required for locally linked code); false otherwise. -//------------------------------------------------------------------------------ - -static -bool VerCmp(XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false); - -//------------------------------------------------------------------------------ -//! Constructor #1 (version number checking is not to be performed) -//! -//! @param erp -> error message object to display error messages. -//! @param path -> path to the shared library containing a plug-in. If NULL -//! the the executable image is searched for the plug-in. -//! Storage must persist while this object is alive. -//------------------------------------------------------------------------------ - - XrdSysPlugin(XrdSysError *erp, const char *path) - : eDest(erp), libName(0), libPath(path ? strdup(path) : 0), - libHandle(0), myInfo(0), eBuff(0), eBLen(0), msgCnt(-1) {} - -//------------------------------------------------------------------------------ -//! Constructor #2 (version number checking may be performed) -//! -//! @param erp -> error message object to display error messages. -//! @param path -> path to the shared library containing a plug-in. If NULL -//! the the executable image is searched for the plug-in. -//! Storage must persist while this object is alive. -//! @param lname -> logical name of the plugin library (e.g. osslib) to be -//! used in any error messages. -//! Storage must persist while this object is alive. -//! @param vinf -> permanent version information of the plug-in loader. -//! If zero, then no version checking is performed. -//! @param msgNum -> Number of times getPlugin() is to produce a version -//! message for a loaded plugin. The default is always. -//------------------------------------------------------------------------------ - - XrdSysPlugin(XrdSysError *erp, const char *path, const char *lname, - XrdVersionInfo *vinf=0, int msgNum=-1) - : eDest(erp), libName(lname), - libPath(path ? strdup(path) : 0), libHandle(0), - myInfo(vinf), eBuff(0), eBLen(0), msgCnt(msgNum) {} - -//------------------------------------------------------------------------------ -//! Constructor #3 (version number checking may be performed and any error -//! is returned in a supplied buffer) -//! -//! @param ebuff -> buffer where eror message is to be placed. The message -//! will always end with a null byte. -//! @param eblen -> length of the supplied buffer, eBuff. -//! @param path -> path to the shared library containing a plug-in. If NULL -//! the the executable image is searched for the plug-in. -//! Storage must persist while this object is alive. -//! @param lname -> logical name of the plugin library (e.g. osslib) to be -//! used in any error messages. -//! Storage must persist while this object is alive. -//! @param vinf -> permanent version information of the plug-in loader. -//! If Zero, then no version checking is performed. -//! @param msgNum -> Number of times getPlugin() is to produce a version -//! message for a loaded plugin. The default is always. -//------------------------------------------------------------------------------ - - XrdSysPlugin(char *ebuff, int eblen, const char *path, const char *lname, - XrdVersionInfo *vinf=0, int msgNum=-1) - : eDest(0), libName(lname), - libPath(path ? strdup(path) : 0), libHandle(0), - myInfo(vinf), eBuff(ebuff), eBLen(eblen), msgCnt(msgNum) {} - -//------------------------------------------------------------------------------ -//! Destructor -//------------------------------------------------------------------------------ - - ~XrdSysPlugin(); - -private: -enum cvResult {cvBad = 0, cvNone, cvMissing, cvClean, cvDirty}; - -cvResult badVersion(XrdVersionInfo &urInfo,char mmv,int majv,int minv); -cvResult chkVersion(XrdVersionInfo &urInfo, const char *pname, void *lh); -static int DLflags(); -static void *Find(const char *libname); -void Inform(const char *txt1, const char *txt2=0, const char *txt3=0, - const char *txt4=0, const char *txt5=0, int noHush=0); -cvResult libMsg(const char *txt1, const char *txt2, const char *mSym=0); -const char *msgSuffix(const char *Word, char *buff, int bsz); - -XrdSysError *eDest; -const char *libName; -char *libPath; -void *libHandle; -XrdVersionInfo *myInfo; -char *eBuff; -int eBLen; -int msgCnt; - -struct PLlist {PLlist *next; - char *libPath; - void *libHandle; - }; - -static PLlist *plList; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysPthread.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysPthread.hh deleted file mode 100644 index 17f8fd0be..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysPthread.hh +++ /dev/null @@ -1,612 +0,0 @@ -#ifndef __SYS_PTHREAD__ -#define __SYS_PTHREAD__ -/******************************************************************************/ -/* */ -/* X r d S y s P t h r e a d . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#ifdef WIN32 -#define HAVE_STRUCT_TIMESPEC 1 -#endif -#include -#include -#ifdef AIX -#include -#else -#include -#endif - -#ifdef __APPLE__ -#ifndef CLOCK_REALTIME -#include -#include -#endif -namespace -{ - template< typename TYPE > - void get_apple_realtime( TYPE & wait ) - { -#ifdef CLOCK_REALTIME - clock_gettime(CLOCK_REALTIME, &wait); -#else - clock_serv_t cclock; - mach_timespec_t mts; - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - wait.tv_sec = mts.tv_sec; - wait.tv_nsec = mts.tv_nsec; -#endif - } -} -#endif - -#include "XrdSys/XrdSysError.hh" - -/******************************************************************************/ -/* X r d S y s C o n d V a r */ -/******************************************************************************/ - -// XrdSysCondVar implements the standard POSIX-compliant condition variable. -// Methods correspond to the equivalent pthread condvar functions. - -class XrdSysCondVar -{ -public: - -inline void Lock() {pthread_mutex_lock(&cmut);} - -inline void Signal() {if (relMutex) pthread_mutex_lock(&cmut); - pthread_cond_signal(&cvar); - if (relMutex) pthread_mutex_unlock(&cmut); - } - -inline void Broadcast() {if (relMutex) pthread_mutex_lock(&cmut); - pthread_cond_broadcast(&cvar); - if (relMutex) pthread_mutex_unlock(&cmut); - } - -inline void UnLock() {pthread_mutex_unlock(&cmut);} - - int Wait(); - int Wait(int sec); - int WaitMS(int msec); - - XrdSysCondVar( int relm=1, // 0->Caller will handle lock/unlock - const char *cid=0 // ID string for debugging only - ) {pthread_cond_init(&cvar, NULL); - pthread_mutex_init(&cmut, NULL); - relMutex = relm; condID = (cid ? cid : "unk"); - } - ~XrdSysCondVar() {pthread_cond_destroy(&cvar); - pthread_mutex_destroy(&cmut); - } -private: - -pthread_cond_t cvar; -pthread_mutex_t cmut; -int relMutex; -const char *condID; -}; - - -/******************************************************************************/ -/* X r d S y s C o n d V a r H e l p e r */ -/******************************************************************************/ - -// XrdSysCondVarHelper is used to implement monitors with the Lock of a a condvar. -// Monitors are used to lock -// whole regions of code (e.g., a method) and automatically -// unlock with exiting the region (e.g., return). The -// methods should be self-evident. - -class XrdSysCondVarHelper -{ -public: - -inline void Lock(XrdSysCondVar *CndVar) - {if (cnd) {if (cnd != CndVar) cnd->UnLock(); - else return; - } - CndVar->Lock(); - cnd = CndVar; - }; - -inline void UnLock() {if (cnd) {cnd->UnLock(); cnd = 0;}} - - XrdSysCondVarHelper(XrdSysCondVar *CndVar=0) - {if (CndVar) CndVar->Lock(); - cnd = CndVar; - } - XrdSysCondVarHelper(XrdSysCondVar &CndVar) - {CndVar.Lock(); - cnd = &CndVar; - } - - ~XrdSysCondVarHelper() {if (cnd) UnLock();} -private: -XrdSysCondVar *cnd; -}; - - -/******************************************************************************/ -/* X r d S y s M u t e x */ -/******************************************************************************/ - -// XrdSysMutex implements the standard POSIX mutex. The methods correspond -// to the equivalent pthread mutex functions. - -class XrdSysMutex -{ -public: -friend class XrdSysCondVar2; - -inline int CondLock() - {if (pthread_mutex_trylock( &cs )) return 0; - return 1; - } -#ifdef __APPLE__ -inline int TimedLock( int wait_ms ) -{ - struct timespec wait, cur, dur; - get_apple_realtime(wait); - wait.tv_sec += (wait_ms / 1000); - wait.tv_nsec += (wait_ms % 1000) * 1000000; - wait.tv_sec += (wait.tv_nsec / 1000000000); - wait.tv_nsec = wait.tv_nsec % 1000000000; - - int rc; - while( ( rc = pthread_mutex_trylock( &cs ) ) == EBUSY ) - { - get_apple_realtime(cur); - if( ( cur.tv_sec > wait.tv_sec ) || - ( ( cur.tv_sec == wait.tv_sec ) && ( cur.tv_nsec >= wait.tv_nsec ) ) ) - return 0; - - dur.tv_sec = wait.tv_sec - cur.tv_sec; - dur.tv_nsec = wait.tv_nsec - cur.tv_nsec; - if( dur.tv_nsec < 0 ) - { - --dur.tv_sec; - dur.tv_nsec += 1000000000; - } - - if( ( dur.tv_sec != 0 ) || ( dur.tv_nsec > 1000000 ) ) - { - dur.tv_sec = 0; - dur.tv_nsec = 1000000; - } - - nanosleep( &dur, 0 ); - } - - return !rc; -} -#else -inline int TimedLock(int wait_ms) - {struct timespec wait; - clock_gettime(CLOCK_REALTIME, &wait); - wait.tv_sec += (wait_ms / 1000); - wait.tv_nsec += (wait_ms % 1000) * 1000000; - wait.tv_sec += (wait.tv_nsec / 1000000000); - wait.tv_nsec = wait.tv_nsec % 1000000000; - return !pthread_mutex_timedlock(&cs, &wait); - } -#endif - -inline void Lock() {pthread_mutex_lock(&cs);} - -inline void UnLock() {pthread_mutex_unlock(&cs);} - - XrdSysMutex() {pthread_mutex_init(&cs, NULL);} - ~XrdSysMutex() {pthread_mutex_destroy(&cs);} - -protected: - -pthread_mutex_t cs; -}; - -/******************************************************************************/ -/* X r d S y s R e c M u t e x */ -/******************************************************************************/ - -// XrdSysRecMutex implements the recursive POSIX mutex. The methods correspond -// to the equivalent pthread mutex functions. - -class XrdSysRecMutex: public XrdSysMutex -{ -public: - -XrdSysRecMutex(); - -int InitRecMutex(); -int ReInitRecMutex(); - -}; - - -/******************************************************************************/ -/* X r d S y s M u t e x H e l p e r */ -/******************************************************************************/ - -// XrdSysMutexHelper us ised to implement monitors. Monitors are used to lock -// whole regions of code (e.g., a method) and automatically -// unlock with exiting the region (e.g., return). The -// methods should be self-evident. - -class XrdSysMutexHelper -{ -public: - -inline void Lock(XrdSysMutex *Mutex) - {if (mtx) {if (mtx != Mutex) mtx->UnLock(); - else return; - } - Mutex->Lock(); - mtx = Mutex; - }; - -inline void UnLock() {if (mtx) {mtx->UnLock(); mtx = 0;}} - - XrdSysMutexHelper(XrdSysMutex *mutex=0) - {if (mutex) mutex->Lock(); - mtx = mutex; - } - XrdSysMutexHelper(XrdSysMutex &mutex) - {mutex.Lock(); - mtx = &mutex; - } - - ~XrdSysMutexHelper() {if (mtx) UnLock();} -private: -XrdSysMutex *mtx; -}; - -/******************************************************************************/ -/* X r d S y s C o n d V a r 2 */ -/******************************************************************************/ - -// XrdSysCondVar2 implements the standard POSIX-compliant condition variable but -// unlike XrdSysCondVar requires the caller to supply a working -// mutex and does not handle any locking other than what is -// defined by POSIX. - -class XrdSysCondVar2 -{ -public: - -inline void Signal() {pthread_cond_signal(&cvar);} - -inline void Broadcast() {pthread_cond_broadcast(&cvar);} - -inline int Wait() {return pthread_cond_wait(&cvar, mtxP);} - bool Wait(int sec) {return WaitMS(sec*1000);} - bool WaitMS(int msec); - - XrdSysCondVar2(XrdSysMutex &mtx) : mtxP(&mtx.cs) - {pthread_cond_init(&cvar, NULL);} - - ~XrdSysCondVar2() {pthread_cond_destroy(&cvar);} - -protected: - -pthread_cond_t cvar; -pthread_mutex_t *mtxP; -}; - -/******************************************************************************/ -/* X r d S y s R W L o c k */ -/******************************************************************************/ - -// XrdSysRWLock implements the standard POSIX wrlock mutex. The methods correspond -// to the equivalent pthread wrlock functions. - -class XrdSysRWLock -{ -public: - -inline int CondReadLock() - {if (pthread_rwlock_tryrdlock( &lock )) return 0; - return 1; - } -inline int CondWriteLock() - {if (pthread_rwlock_trywrlock( &lock )) return 0; - return 1; - } - -inline void ReadLock() {pthread_rwlock_rdlock(&lock);} -inline void WriteLock() {pthread_rwlock_wrlock(&lock);} - -inline void ReadLock( int &status ) {status = pthread_rwlock_rdlock(&lock);} -inline void WriteLock( int &status ) {status = pthread_rwlock_wrlock(&lock);} - -inline void UnLock() {pthread_rwlock_unlock(&lock);} - -enum PrefType {prefWR=1}; - - XrdSysRWLock(PrefType ptype) - { -#ifdef __linux__ - pthread_rwlockattr_t attr; - pthread_rwlockattr_setkind_np(&attr, - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); - pthread_rwlock_init(&lock, &attr); -#else - pthread_rwlock_init(&lock, NULL); -#endif - } - - XrdSysRWLock() {pthread_rwlock_init(&lock, NULL);} - ~XrdSysRWLock() {pthread_rwlock_destroy(&lock);} - -inline void ReInitialize(PrefType ptype) -{ - pthread_rwlock_destroy(&lock); -#ifdef __linux__ - pthread_rwlockattr_t attr; - pthread_rwlockattr_setkind_np(&attr, - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); - pthread_rwlock_init(&lock, &attr); -#else - pthread_rwlock_init(&lock, NULL); -#endif -} - -inline void ReInitialize() -{ - pthread_rwlock_destroy(&lock); - pthread_rwlock_init(&lock, NULL); -} - -protected: - -pthread_rwlock_t lock; -}; - -/******************************************************************************/ -/* X r d S y s W R L o c k H e l p e r */ -/******************************************************************************/ - -// XrdSysWRLockHelper : helper class for XrdSysRWLock - -class XrdSysRWLockHelper -{ -public: - -inline void Lock(XrdSysRWLock *lock, bool rd = 1) - {if (lck) {if (lck != lock) lck->UnLock(); - else return; - } - if (rd) lock->ReadLock(); - else lock->WriteLock(); - lck = lock; - }; - -inline void UnLock() {if (lck) {lck->UnLock(); lck = 0;}} - - XrdSysRWLockHelper(XrdSysRWLock *l=0, bool rd = 1) - { if (l) {if (rd) l->ReadLock(); - else l->WriteLock(); - } - lck = l; - } - XrdSysRWLockHelper(XrdSysRWLock &l, bool rd = 1) - { if (rd) l.ReadLock(); - else l.WriteLock(); - lck = &l; - } - - ~XrdSysRWLockHelper() {if (lck) UnLock();} -private: -XrdSysRWLock *lck; -}; - -/******************************************************************************/ -/* X r d S y s F u s e d M u t e x */ -/******************************************************************************/ - -class XrdSysFusedMutex -{ -public: - -inline void Lock() {isRW ? rwLok->WriteLock() : mutex->Lock();} - -inline void ReadLock() {isRW ? rwLok->ReadLock() : mutex->Lock();} - -inline void WriteLock() {isRW ? rwLok->WriteLock() : mutex->Lock();} - -inline void UnLock() {isRW ? rwLok->UnLock() : mutex->UnLock();} - - XrdSysFusedMutex(XrdSysRWLock &mtx) - : rwLok(&mtx), isRW(true) {} - - XrdSysFusedMutex(XrdSysMutex &mtx) - : mutex(&mtx), isRW(false) {} - - ~XrdSysFusedMutex() {} -private: - -union {XrdSysRWLock *rwLok; XrdSysMutex *mutex;}; -bool isRW; -}; - -/******************************************************************************/ -/* X r d S y s S e m a p h o r e */ -/******************************************************************************/ - -// XrdSysSemaphore implements the classic counting semaphore. The methods -// should be self-evident. Note that on certain platforms -// semaphores need to be implemented based on condition -// variables since no native implementation is available. - -#if defined(__APPLE__) || defined(__GNU__) -class XrdSysSemaphore -{ -public: - - int CondWait(); - - void Post(); - - void Wait(); - -static void CleanUp(void *semVar); - - XrdSysSemaphore(int semval=1,const char *cid=0) : semVar(0, cid) - {semVal = semval; semWait = 0;} - ~XrdSysSemaphore() {} - -private: - -XrdSysCondVar semVar; -int semVal; -int semWait; -}; - -#else - -class XrdSysSemaphore -{ -public: - -inline int CondWait() - {while(sem_trywait( &h_semaphore )) - {if (errno == EAGAIN) return 0; - if (errno != EINTR) { throw "sem_CondWait() failed";} - } - return 1; - } - -inline void Post() {if (sem_post(&h_semaphore)) - {throw "sem_post() failed";} - } - -inline void Wait() {while (sem_wait(&h_semaphore)) - {if (EINTR != errno) - {throw "sem_wait() failed";} - } - } - - XrdSysSemaphore(int semval=1, const char * =0) - {if (sem_init(&h_semaphore, 0, semval)) - {throw "sem_init() failed";} - } - ~XrdSysSemaphore() {if (sem_destroy(&h_semaphore)) - {abort();} - } - -private: - -sem_t h_semaphore; -}; -#endif - -/******************************************************************************/ -/* X r d S y s T h r e a d */ -/******************************************************************************/ - -// The C++ standard makes it impossible to link extern "C" methods with C++ -// methods. Thus, making a full thread object is nearly impossible. So, this -// object is used as the thread manager. Since it is static for all intense -// and purposes, one does not need to create an instance of it. -// - -// Options to Run() -// -// BIND creates threads that are bound to a kernel thread. -// -#define XRDSYSTHREAD_BIND 0x001 - -// HOLD creates a thread that needs to be joined to get its ending value. -// Otherwise, a detached thread is created. -// -#define XRDSYSTHREAD_HOLD 0x002 - -class XrdSysThread -{ -public: - -static int Cancel(pthread_t tid) {return pthread_cancel(tid);} - -static int Detach(pthread_t tid) {return pthread_detach(tid);} - - -static int SetCancelOff() { - return pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0); - }; - -static int Join(pthread_t tid, void **ret) { - return pthread_join(tid, ret); - }; - -static int SetCancelOn() { - return pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0); - }; - -static int SetCancelAsynchronous() { - return pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0); - }; - -static int SetCancelDeferred() { - return pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, 0); - }; - -static void CancelPoint() { - pthread_testcancel(); - }; - - -static pthread_t ID(void) {return pthread_self();} - -static int Kill(pthread_t tid) {return pthread_cancel(tid);} - -static unsigned long Num(void); - -static int Run(pthread_t *, void *(*proc)(void *), void *arg, - int opts=0, const char *desc = 0); - -static int Same(pthread_t t1, pthread_t t2) - {return pthread_equal(t1, t2);} - -static void setDebug(XrdSysError *erp) {eDest = erp;} - -static void setStackSize(size_t stsz, bool force=false); - -static int Signal(pthread_t tid, int snum) - {return pthread_kill(tid, snum);} - -static int Wait(pthread_t tid); - - XrdSysThread() {} - ~XrdSysThread() {} - -private: -static XrdSysError *eDest; -static size_t stackSize; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysSemWait.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysSemWait.hh deleted file mode 100644 index f91e5eda4..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysSemWait.hh +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef __SYS_SEMWAIT__ -#define __SYS_SEMWAIT__ - -/******************************************************************************/ -/* X r d S y s S e m W a i t */ -/* */ -/* Author: Fabrizio Furano (INFN, 2005) */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/* */ -/* A counting semaphore with timed out wait primitive */ -/******************************************************************************/ - -#include "XrdSys/XrdSysPthread.hh" - -class XrdSysSemWait { - public: - - int CondWait() { - - int rc = 0; - // Wait until the sempahore value is positive. This will not be starvation - // free is the OS implements an unfair mutex; - // Returns 0 if signalled, non-0 if would block - // - - semVar.Lock(); - if (semVal > 0) semVal--; - else { - rc = 1; - } - - semVar.UnLock(); - - return rc; - - }; - - void Post() { - // Add one to the semaphore counter. If we the value is > 0 and there is a - // thread waiting for the sempagore, signal it to get the semaphore. - // - semVar.Lock(); - - if (semWait > 0) { - semVar.Signal(); - semWait--; - } - else - semVal++; - - semVar.UnLock(); - }; - - void Wait() { - // Wait until the sempahore value is positive. This will not be starvation - // free is the OS implements an unfair mutex; - // - - semVar.Lock(); - if (semVal > 0) semVal--; - else { - semWait++; - semVar.Wait(); - } - - semVar.UnLock(); - - }; - - int Wait(int secs) { - int rc = 0; - // Wait until the sempahore value is positive. This will not be starvation - // free is the OS implements an unfair mutex; - // Returns 0 if signalled, non-0 if timeout - // - - semVar.Lock(); - if (semVal > 0) semVal--; - else { - semWait++; - rc = semVar.Wait(secs); - if (rc) semWait--; - } - - semVar.UnLock(); - - return rc; - }; - - XrdSysSemWait(int semval=1,const char *cid=0) : semVar(0, cid) { - semVal = semval; semWait = 0; - } - - ~XrdSysSemWait() {} - -private: - -XrdSysCondVar semVar; -int semVal; -int semWait; -}; - - - -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysTimer.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysTimer.hh deleted file mode 100644 index 43d772b46..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysTimer.hh +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef __XrdSysTimer__ -#define __XrdSysTimer__ -/******************************************************************************/ -/* */ -/* X r d S y s T i m e r . h h */ -/* */ -/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#ifndef WIN32 -#include -#else -#include -#include -#include "XrdSys/XrdWin32.hh" -#endif - -/* This include file describes the oo elapsed time interval interface. It is - used by the oo Real Time Monitor, among others. -*/ - -class XrdSysTimer { - -public: - struct timeval *Delta_Time(struct timeval &tbeg); - -static time_t Midnight(time_t tnow=0); - -inline int TimeLE(time_t tsec) {return StopWatch.tv_sec <= tsec;} - - // The following routines return the current interval added to the - // passed argument as well as returning the current Unix seconds - // - unsigned long Report(double &); - unsigned long Report(unsigned long &); - unsigned long Report(unsigned long long &); - unsigned long Report(struct timeval &); - -inline void Reset() {gettimeofday(&StopWatch, 0);} - -inline time_t Seconds() {return StopWatch.tv_sec;} - -inline void Set(struct timeval &tod) - {StopWatch.tv_sec = tod.tv_sec; - StopWatch.tv_usec = tod.tv_usec; - } - -static void Snooze(int seconds); - -static char *s2hms(int sec, char *buff, int blen); - -static int TimeZone(); - -static void Wait(int milliseconds); - -static void Wait4Midnight(); - - XrdSysTimer() {Reset();} - -private: - struct timeval StopWatch; // Current running clock - struct timeval LastReport; // Total time from last report - - unsigned long Report(); // Place interval in Last Report -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysXAttr.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysXAttr.hh deleted file mode 100644 index bd4e79482..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysXAttr.hh +++ /dev/null @@ -1,283 +0,0 @@ -#ifndef __XRDSYSXATTR_HH__ -#define __XRDSYSXATTR_HH__ -/******************************************************************************/ -/* */ -/* X r d S y s X A t t r . h h */ -/* */ -/* (c) 2014 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! This pure abstract class defines the extended attribute interface and is -//! used by extended attribute plugin writers to implement extended attribute -//! handling. The plugin is loaded via the ofs.xattrlib directive. -//------------------------------------------------------------------------------ - -class XrdOucEnv; -class XrdSysError; - -class XrdSysXAttr -{ -public: -//------------------------------------------------------------------------------ -//! Definition of a structure to hold an attribute name and the size of the -//! name as well as the size of its associated value. The structure is a list -//! and is used as an argument to Free() and is returned by List(). The size of -//! the struct is dynamic and should be sized to hold all of the information. -//------------------------------------------------------------------------------ - -struct AList - {AList *Next; //!< -> next element. - int Vlen; //!< The length of the attribute value; - int Nlen; //!< The length of the attribute name that follows. - char Name[1]; //!< Start of the name (size of struct is dynamic) - }; - -//------------------------------------------------------------------------------ -//! Copy one or all extended attributes from one file to another (a default -//! implementation is supplied). -//! -//! @param iPath -> Path of the file whose attribute(s) are to be copied. -//! @param iFD If >=0 is the file descriptor of the opened source file. -//! @param oPath -> Path of the file to receive the extended attribute(s). -//! Duplicate attributes are replaced. -//! @param oFD If >=0 is the file descriptor of the opened target file. -//! @param Aname -> if nil, the all of the attributes of the source file are -//! copied. Otherwise, only the attribute name pointed to by -//! Aname is copied. If Aname does not exist or extended -//! attributes are not supported, the operation succeeds by -//! copying nothing. -//! -//! @return =0 Attribute(s) successfully copied, did not exist, or extended -//! attributes are not supported for source or target. -//! @return <0 Attribute(s) not copied, the return value is -errno that -//! describes the reason for the failure. -//------------------------------------------------------------------------------ - -virtual int Copy(const char *iPath, int iFD, const char *oPath, int oFD, - const char *Aname=0); - -//------------------------------------------------------------------------------ -//! Remove an extended attribute. -//! -//! @param Aname -> The attribute name. -//! @param Path -> Path of the file whose attribute is to be removed. -//! @param fd If >=0 is the file descriptor of the opened subject file. -//! -//! @return =0 Attribute was successfully removed. -//! @return <0 Attribute was not removed or does not exist. The return value -//! is -errno that describes the reason for the failure. -//------------------------------------------------------------------------------ - -virtual int Del(const char *Aname, const char *Path, int fd=-1) = 0; - -//------------------------------------------------------------------------------ -//! Release storage occupied by the Alist structure returned by List(). -//! -//! @param aPL -> The first element of the AList structure. -//------------------------------------------------------------------------------ - -virtual void Free(AList *aPL) = 0; - -//------------------------------------------------------------------------------ -//! Get an attribute value and its size. -//! -//! @param Aname -> The attribute name. -//! @param Aval -> Buffer to receive the attribute value. -//! @param Avsz Length of the buffer in bytes. Only up to this number of -//! bytes should be returned. However, should Avsz be zero -//! the the size of the attribute value should be returned -//! and the Aval argument should be ignored. -//! @param Path -> Path of the file whose attribute is to be fetched. -//! @param fd -> If >=0 is the file descriptor of the opened subject file. -//! -//! @return >0 The number of bytes placed in Aval. However, if avsz is zero -//! then the value is the actual size of the attribute value. -//! @return =0 The attribute exists but has no associated value. -//! @return <0 The attribute value could not be returned. The returned -//! value is -errno describing the reason. -//------------------------------------------------------------------------------ - -virtual int Get(const char *Aname, void *Aval, int Avsz, - const char *Path, int fd=-1) = 0; - -//------------------------------------------------------------------------------ -//! Get all of the attributes associated with a file. -//! -//! @param aPL -> the pointer to hold the first element of AList. The -//! storage occupied by the returned AList must be released -//! by calling Free(). -//! @param Path -> Path of the file whose attributes are t be returned. -//! @param fd -> If >=0 is the file descriptor of the opened subject file. -//! @param getSz When != 0 then the size of the maximum attribute value -//! should be returned. Otherwise, upon success 0 is returned. -//! -//! @return >0 Attributes were returned and aPL points to the first -//! attribute value. The returned value is the largest size -//! of an attribute value encountered (getSz != 0). -//! @return =0 Attributes were returned and aPL points to the first -//! attribute value (getSz == 0). -//! @return <0 The attribute values could not be returned. The returned -//! value is -errno describing the reason. -//------------------------------------------------------------------------------ - -virtual int List(AList **aPL, const char *Path, int fd=-1, int getSz=0) = 0; - -//------------------------------------------------------------------------------ -//! Set an attribute. -//! -//! @param Aname -> The attribute name. -//! @param Aval -> Buffer holding the attribute value. -//! @param Avsz Length of the buffer in bytes. This is the length of the -//! attribute value which may contain binary data. -//! @param Path -> Path of the file whose attribute is to be set. -//! @param fd -> If >=0 is the file descriptor of the opened subject file. -//! @param isNew When !0 then the attribute must not exist (i.e. new). -//! Otherwise, if it does exist, the value is replaced. In -//! either case, if it does not exist it should be created. -//! -//! @return =0 The attribute was successfully set. -//! @return <0 The attribute values could not be set. The returned -//! value is -errno describing the reason. -//------------------------------------------------------------------------------ - -virtual int Set(const char *Aname, const void *Aval, int Avsz, - const char *Path, int fd=-1, int isNew=0) = 0; - -//------------------------------------------------------------------------------ -//! Establish the error message routing. Unless it's established, no messages -//! should be produced. A default implementation is supplied. -//! -//! @param errP -> Pointer to the error message object. If it is a nil -//! pointer, no error messages should be produced. -//! -//! @return The previous setting. -//------------------------------------------------------------------------------ - -virtual XrdSysError *SetMsgRoute(XrdSysError *errP); - -//------------------------------------------------------------------------------ -//! Constructor and Destructor -//------------------------------------------------------------------------------ - - XrdSysXAttr() : Say(0) {} -virtual ~XrdSysXAttr() {} - -protected: - -XrdSysError *Say; -}; - -/******************************************************************************/ -/* X r d S y s X A t t r O b j e c t I n s t a n t i a t o r */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! Get an instance of a configured XrdSysXAttr object. -//! -//! @param errP -> Error message object for error messages. -//! @param config_fn -> The name of the config file. -//! @param parms -> Any parameters specified on the ofs.xattrlib -//! directive. If there are no parameters parms may be 0. -//! -//! @return Success: -> an instance of the XrdSysXattr object to be used. -//! Failure: Null pointer which causes initialization to fail. -//! -//! The object creation function must be declared as an extern "C" function -//! in the plug-in shared library as follows: -//------------------------------------------------------------------------------ - -typedef XrdSysXAttr *(*XrdSysGetXAttrObject_t)(XrdSysError *errP, - const char *config_fn, - const char *parms); -/*! -extern "C" XrdSysXAttr *XrdSysGetXAttrObject(XrdSysError *errP, - const char *config_fn, - const char *parms); -*/ - -//------------------------------------------------------------------------------ -//! Add an instance of a configured XrdSysXAttr object, wrapping previous one. -//! -//! @param errP -> Error message object for error messages. -//! @param config_fn -> The name of the config file. -//! @param parms -> Any parameters specified on the ofs.xattrlib -//! directive. If there are no parameters parms may be 0. -//! @param envP -> To environmental information (may be nil). -//! @param attrP -> the current attribue object that should be wraped by -//! this object. -//! -//! @return Success: -> an instance of the XrdSysXattr object to be used. -//! Failure: Null pointer which causes initialization to fail. -//! -//! The object creation function must be declared as an extern "C" function -//! in the plug-in shared library as follows: -//------------------------------------------------------------------------------ - -typedef XrdSysXAttr *(*XrdSysAddXAttrObject_t)(XrdSysError *errP, - const char *config_fn, - const char *parms, - XrdOucEnv *envP, - XrdSysXAttr *attrP); -/*! - extern "C" XrdSysXAttr *XrdSysAddXAttrObject(XrdSysError *errP, - const char *config_fn, - const char *parms, - XrdOucEnv *envP, - XrdSysXAttr *attrP); -*/ -//------------------------------------------------------------------------------ -//! Declare compilation version. -//! -//! Additionally, you *should* declare the xrootd version you used to compile -//! your plug-in. Declare it as: -//------------------------------------------------------------------------------ - -/*! #include "XrdVersion.hh" - XrdVERSIONINFO(XrdSysGetXAttrObject,); - - where is a 1- to 15-character unquoted name identifying your plugin. -*/ - -/******************************************************************************/ -/* X r d S y s X A t t r I m p l e m e n t a t i o n s */ -/******************************************************************************/ - -//------------------------------------------------------------------------------ -//! Access the native implementation in libXrdUtils.so: -//! -//! extern XrdSysXAttr XrdSysXAttrNative; -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -//! Access the active implementation in libXrdUtils.so: -//! -//! extern XrdSysXAttr *XrdSysXAttrActive; -//! -//! The active implementatiuon is the one being used. This may be a pointer to -//! the native implementation or to a specified plugin loaded by the OFS layer. -//------------------------------------------------------------------------------ -#endif diff --git a/test/binary/usr/include/xrootd/XrdSys/XrdSysXSLock.hh b/test/binary/usr/include/xrootd/XrdSys/XrdSysXSLock.hh deleted file mode 100644 index 531ca55c7..000000000 --- a/test/binary/usr/include/xrootd/XrdSys/XrdSysXSLock.hh +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef __SYS_XSLOCK_HH__ -#define __SYS_XSLOCK_HH__ -/******************************************************************************/ -/* */ -/* X r d S y s X S L o c k . h h */ -/* */ -/* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* All Rights Reserved */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -#include -#include "XrdSys/XrdSysPthread.hh" - -// These are valid usage options -// -enum XrdSysXS_Type {xs_None = 0, xs_Shared = 1, xs_Exclusive = 2}; - -// This class implements the shared lock. Any number of readers are allowed -// by requesting a shared lock. Only one exclusive writer is allowed by -// requesting an exclusive lock. Up/downgrading is not supported. -// -class XrdSysXSLock -{ -public: - -void Lock(const XrdSysXS_Type usage); - -void UnLock(const XrdSysXS_Type usage=xs_None); - - XrdSysXSLock() : cur_usage(xs_None), cur_count(0), exc_wait(0), - shr_wait(0), toggle(0), WantShr(0), WantExc(0) {} - ~XrdSysXSLock(); - -private: - -XrdSysXS_Type cur_usage; -int cur_count; -int exc_wait; -int shr_wait; -int toggle; - -XrdSysMutex LockContext; -XrdSysSemaphore WantShr; -XrdSysSemaphore WantExc; -}; -#endif diff --git a/test/binary/usr/include/xrootd/XrdVersion.hh b/test/binary/usr/include/xrootd/XrdVersion.hh deleted file mode 100644 index 2a8521f38..000000000 --- a/test/binary/usr/include/xrootd/XrdVersion.hh +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************/ -/* */ -/* X r d V e r s i o n . h h . i n */ -/* */ -/* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -// this file is automatically updated by the genversion.sh script -// if you touch anything make sure that it still works - -#ifndef __XRD_VERSION_H__ -#define __XRD_VERSION_H__ - -#define XrdVERSION "v5.5.4" - -// Numeric representation of the version tag -// The format for the released code is: xyyzz, where: x is the major version, -// y is the minor version and zz is the bugfix revision number -// For the non-released code the value is 1000000 -#define XrdVNUMUNK 1000000 -#define XrdVNUMBER 50504 - -#if XrdDEBUG -#define XrdVSTRING XrdVERSION "_dbg" -#else -#define XrdVSTRING XrdVERSION -#endif - -// The following defines the shared library version number of any plug-in. -// Generally, all plug-ins have a uniform version number releative to a -// specific compilation. This version is appended to the so-name and for -// dylibs becomes part of he actual filename (MacOS format). -// -#ifndef XRDPLUGIN_SOVERSION -#define XRDPLUGIN_SOVERSION "5" -#endif - -#define XrdDEFAULTPORT 1094; - -// The following macros extract version digits from a numeric version number -#define XrdMajorVNUM(x) x/10000 -#define XrdMinorVNUM(x) x/100%100 -#define XrdPatchVNUM(x) x%100 - -// The following structure defines the standard way to record a version. You can -// determine component version numbers within an object file by simply executing -// "strings | grep '@V:'". -// -struct XrdVersionInfo {int vNum; const char vOpt; const char vPfx[3];\ - const char vStr[64];}; - -// Macro to define the suffix to use when generating the extern version symbol. -// This is used by SysPlugin. We cannot use it here as cpp does not expand the -// macro when catenating tokens togther and we want to avoid yet another macro. -// -#define XrdVERSIONINFOSFX "_" - -// The following macro defines a local copy of version information. Parameters: -// x -> The variable name of the version information structure -// y -> An unquoted 1- to 15-character component name (e.g. cmsd, seckrb5) -// vn -> The integer version number to be used -// vs -> The string version number to be used -// -#define XrdVERSIONINFODEF(x,y,vn,vs) \ - XrdVersionInfo x = \ - {vn, (sizeof(#y)-1) & 0x0f,{'@','V',':'}, #y " " vs} - -// The following macro defines an externally referencable structure that records -// the version used to compile code. It is used by the plugin loader. Parms: -// x -> The variable name of the version information structure -// y -> An unquoted 1- to 15-character component name (e.g. cmsd, seckrb5, etc). -// -#define XrdVERSIONINFO(x,y) \ - extern "C" {XrdVERSIONINFODEF(x##_,y,XrdVNUMBER,XrdVERSION);} - -// The following macro is an easy way to declare externally defined version -// information. This macro must be used at file level. -// -#define XrdVERSIONINFOREF(x) extern "C" XrdVersionInfo x##_ - -// The following macro can be used to reference externally defined version -// information. As the composition of the symbolic name may change you should -// use this macro to refer to the version information declaration. -// -#define XrdVERSIONINFOVAR(x) x##_ -#endif diff --git a/test/binary/usr/include/xrootd/XrdXml/XrdXmlReader.hh b/test/binary/usr/include/xrootd/XrdXml/XrdXmlReader.hh deleted file mode 100644 index 79f624396..000000000 --- a/test/binary/usr/include/xrootd/XrdXml/XrdXmlReader.hh +++ /dev/null @@ -1,170 +0,0 @@ -#ifndef __XRDXMLREADER_HH__ -#define __XRDXMLREADER_HH__ -/******************************************************************************/ -/* */ -/* X r d X m l R e a d e r . h h */ -/* */ -/* (c) 2015 by the Board of Trustees of the Leland Stanford, Jr., University */ -/* Produced by Andrew Hanushevsky for Stanford University under contract */ -/* DE-AC02-76-SFO0515 with the Department of Energy */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/******************************************************************************/ - -//----------------------------------------------------------------------------- -//! The XrdXmlReader object provides a virtual interface to read xml files, -//! irrespective of the underlying mplementation. Obtain an XML reader using -//! GetRead(). You may also wish to call Init() prior to obtaining a reader -//! in multi-threader applications. As some implementations may not be MT-safe. -//! See GetReader() for more information. -//----------------------------------------------------------------------------- - -class XrdXmlReader -{ -public: - -//----------------------------------------------------------------------------- -//! Get attributes from an XML tag. GetAttributes() should only be called after -//! a successful GetElement() call. -//! -//! @param aname Pointer to an array of attribute names whose values are -//! to be returned. The last entry in the array must be nil. -//! -//! @param aval Pointer to an array where the corresponding attribute -//! values are to be placed in 1-to-1 correspondence. The -//! values must be freed using free(). -//! -//! @return true One or more attributes have been returned. -//! false No specified attributes were found. -//----------------------------------------------------------------------------- - -virtual bool GetAttributes(const char **aname, char **aval)=0; - -//----------------------------------------------------------------------------- -//! Find an XML tag element. -//! -//! @param ename Pointer to an array of tag names any of which should be -//! searched for. The last entry in the array must be nil. -//! The first element of the array should contain the name of -//! the context tag. Elements are searched only within the -//! scope of that tag. When searching for the first desired -//! tag, use a null string to indicate document scope. -//! -//! @param reqd When true one of the tag elements listed in ename must be -//! found otherwise an error is generated. -//! -//! @return =0 No specified tag was found. Note that this corresponds to -//! encountering the tag present in ename[0], i.e. scope end. -//! >0 A tag was found, the return value is the index into ename -//! that corresponds to the tag's name. -//----------------------------------------------------------------------------- - -virtual int GetElement(const char **ename, bool reqd=false)=0; - -//----------------------------------------------------------------------------- -//! Get the description of the last error encountered. -//! -//! @param ecode The error code associated with the error. -//! -//! @return Pointer to text describing the error. The text may be destroyed on a -//! subsequent call to any other method. Otherwise it is stable. A nil -//! pointer indicates that no error is present. -//----------------------------------------------------------------------------- -virtual -const char *GetError(int &ecode)=0; - -//----------------------------------------------------------------------------- -//! Get a reader object to parse an XML file. -//! -//! @param fname Pointer to the filepath of the file to be parsed. -//! -//! @param enc Pointer to the encoding specification. When nil, UTF-8 is -//! used. Currently, this parameter is ignored. -//! -//! @param impl Pointer to the desired implementation. When nil, the -//! default implementation, tinyxml, is used. The following -//! are supported -//! -//! tinyxml - builtin xml reader. Each instance is independent -//! Since it builds a full DOM tree in memory, it -//! is only good for small amounts of xml. Certain -//! esoteric xml features are not supported. -//! -//! libxml2 - full-fledged xml reader. Instances are not -//! independent if multiple uses involve setting -//! callbacks, allocators, or I/O overrides. For -//! MT-safeness, it must be initialized in the -//! main thread (see Init() below). It is used in -//! streaming mode and is good for large documents. -//! -//! -//! @return !0 Pointer to an XML reader object. -//! @return =0 An XML reader object could not be created; errno holds -//! the error code of the reason. -//----------------------------------------------------------------------------- -static -XrdXmlReader *GetReader(const char *fname, - const char *enc=0, const char *impl=0); - -//----------------------------------------------------------------------------- -//! Get the text portion of an XML tag element. GetText() should only be called -//! after a successful call to GetElement() with a possibly intervening call -//! to GetAttributes(). -//! -//! @param ename Pointer to the corresponding tag name. -//! -//! @param reqd When true text must exist and not be null. Otherwise, an -//! error is generated if the text is missing or null. -//! -//! @return =0 No text found. -//! @return !0 Pointer to the tag's text field. It must be free using -//! free(). -//----------------------------------------------------------------------------- - -virtual char *GetText(const char *ename, bool reqd=false)=0; - -//----------------------------------------------------------------------------- -//! Preinitialze the desired implementation for future use. This is meant to be -//! used in multi-threaded applications, as some implementation must be -//! initialized using the main thread before spawning other threads. An exmaple -//! is libxml2 which is generally MT-unsafe unles preinitialized. -//! -//! @param impl Pointer to the desired implementation. When nil, the -//! default implementation is used. Currently, only "libxml2" -//! and "tinyxml" are supported. -//! -//! @return true Initialization suceeded. -//! @return false Initialization failed, errno has the reason. -//----------------------------------------------------------------------------- - -static bool Init(const char *impl=0); - -//----------------------------------------------------------------------------- -//! Constructor & Destructor -//----------------------------------------------------------------------------- - - XrdXmlReader() {} -virtual ~XrdXmlReader() {} - -private: - -}; -#endif diff --git a/test/binary/usr/lib/erlang/m-no-CInf.beam b/test/binary/usr/lib/erlang/m-no-CInf.beam deleted file mode 100644 index 624ef84484534ff15b8523dbd3e8db029f5208a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 524 zcmZ?s4>Dw6U}AA{b@X*C3AJEgU@!t=cE((mw8Z2Rw$!4W#JqGyT}CbL-29Z%oYeTt zytI7&^wg4gBt8R!bAC!HP+vI^3ji?)tOQ~XAZBJ1m?^*{q$I$opl-^@JX4^SRe*t6 zP?$$R!GW2@K^Q2)BA^Nu7GPm!77`FEKP0OTHR^Dh~cCJlV^* zIOt0^SCJym@&JE%@dZ08e}3dxyqQ5`jnZ16H9nbnpg0l*Vi*9$56CYJjzA0mV+?7n diff --git a/test/binary/usr/lib/erlang/m.beam b/test/binary/usr/lib/erlang/m.beam deleted file mode 100644 index 3c1c39490185236f309e43e3fb97f994a2999be5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 640 zcmZ?s4>Dw6V5)F(b@X*C3AJEgU@!t=cE((mw8Z2Rw$!4W#JqGyT}CbL-29Z%oYeTt zytI7&^wg4gBt8R!bAC!HP+vI^3ji?)tOQ~XAZBJ1m?^*{q$I$opl-^@JX4^SRe*t6 zP?$$R!GW2@K^Q2)BA^Nu7GPm!77`FfGTsq>X||6*~?OkiZk=`vKd&-_0054z+(9YB|xEK zusJCVym|TYDXB@N>EKAn0;ymt&Mz%WPR(Xe)X&JzP1R3KD$UGE(Jv~?HPo#2=Fz}M4P%eVjh8Sm5m`o=zq0zSH@I{kgL^fbME z^g8{|`FoyC@JdWLdHTHf*~El|1g4KOCZ7)8B)R0P@u%Y8ufmhPjEjT5baNFc@+=SV pmlt2Kv-0Ohj>Vf9G}b7s1zO{inFmT2qCgA-pfmvrKL$r21^``zjH>_u diff --git a/test/binary/usr/lib/libfoo-2.so b/test/binary/usr/lib/libfoo-2.so deleted file mode 100755 index b8a948511f20b21089f8f011e3ea34be5ac9b889..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15360 zcmeHOU1%It6u!Hgw25u9sjW7)Vulhy#co4OG*Z%T+9aLUq}7;01?$ZuyU8x>PuQJc z(uxLZA4(}iT0{^*M5GqMz6c`zv{s6b)(5H3hafFf@FxmN`e4U%X6`qco!yA|AS(C5 z&N=5h=es{=?(Uu4z4yhwf&OSDB2Z#thhQt&;vq>m9)UtW(Ipz`+A7w&v2{zXD(#SR zLJCzcw^7g0$_~pW)g?&y8Fs5Qm`ufRufBX$nUF!=3i6F4ynvA%mGXjW?+Ycti&7Z# zCKYc|@qDS`CzWjQs&)Iw{p{ijYRGmE7Le|k2z%m&opNc|(m066xV~*U>9RuRZ$@ig$-kpLt`JbmaQ)Dzv8PC)B9nd3YI|^H3|E+pmQmB>YZshY)K>p~7)) zk#ZtmEXcBLm24@6+&erdQ|VHAB3ri8rQyNdxndzbY>np9p0Bn?j!j!~JX^4G*&}H& zUM!AUC6UXHlD2tkqFfZ1x0q)O>PBYNyaaw;;jKxpd%$7O@APoau|EdVZw7ERb=|;) z0M7RjWifzbF2bj!&VbH<&VbH<&VbH<&VbH<&VbIqzbgagvF{tqll4Dr5yCuv!Hzm# zn#VqGxa4=z>HL;l&i&Wv8gEOIc8;|1IRu!ey1!xWsrs*2Jho`xMb*8+I#t)`%*Wei zIrfs06#tGJ-}xqs2XC7v7R-x3?ldnh#>~iN^U7^|9aS)>Drj)#$K!3iOZ?gHEV;zg zmV@T8?)z9ZPu#FqngJ$g z)UHoobOv+=bOv+=bOv+=bOv+=bOv+=bOv+=bO!!68Hj9*ZEvU1@PB&7g5xAfc96`F z6hAx8EK4f_=@@UFYw7TvmI+-v{2L>^il-_8w(p-|I$Y<2&RAWn=#Tb zs3iEe9IroqJ<9)23G8DJw}*YgVH`GpSC7&@=%m_b44lWo_+$vbTj7`oi06IT5&Ct& zNO}l<1K953ae@2ld4(7yh3m(>0$yo^S=^bAux|C@#^uiKSu95Ba{aZZxkIh@#^{G#aHLY!>jY@;Z5QJ zgSE;M6V>y9BVwX@UU_)+eDLr!0{i9JMu{zZzt)QIJYh~OFwarPFQn8uPjHKH13>}V zKyQ#*_@-s>9n0Wi>1=|u^Ky(&CzOShsiK_7(W!%+OxeX!Sz1%mVyu{-%%$ygD)H#H zuFl#)d}tvnty0OFk?De6ni1nAE1#CBseFEhC;>}Sq+JmzW&cpmV4v*U-^)iQdY|6k zGq`s*vFO+YK$$8RWyUI`_y7ghKyEsCBKu55HhYJJ+Y2H03>?_iGawK2_dnG)EQfn` z4fIJIrjV6KEZlP%wa;Sw*$Ixy!yY10p2^$RC`r5I$qckY(M~5O3R8*EscbH_Ihzu$ zm9fehkx0!Hi0MhYBod``&SFp`+z}=wb9Q2)Xp4lMo~A43SR~RJmCa0wD6l+=msT$l zI@M?8vt!h5(dHVdIm@<0VzgWiOsv1D@_Ni`UR3e%IR(kT4+jg@V_;iJ;WZfi5v4%# z`oIM|tf#Q~Sk`Z}hJufE9TM#$9(=b_x^&Tt*L3i)?nBP0K<*>GmHg)ltlvq(yfu#$ zD)=0Q%y_VW@G~)<|L~lP^LXKS*pM$1Hy+^Qc`3th3@V88tR)-x z>*V0MgZA+}has~M!sbV`kiFvM2 ze>~v7M~)yL>u#&!BQDH`{XQuigZ>*y&tojZ=eB}{ZQT1H4*peDF+czETta^^E}oxg eJIG($=2?TG21BNM46zo!uhZjy7_5}^F#iu19nPBo diff --git a/test/binary/usr/lib/libfoo-2.so.foo b/test/binary/usr/lib/libfoo-2.so.foo deleted file mode 100644 index 323fae03f..000000000 --- a/test/binary/usr/lib/libfoo-2.so.foo +++ /dev/null @@ -1 +0,0 @@ -foobar diff --git a/test/binary/usr/lib/libfoo.so b/test/binary/usr/lib/libfoo.so deleted file mode 120000 index a1d0edfb7..000000000 --- a/test/binary/usr/lib/libfoo.so +++ /dev/null @@ -1 +0,0 @@ -libfoo.so.1 \ No newline at end of file diff --git a/test/binary/usr/lib/libfoo.so.1 b/test/binary/usr/lib/libfoo.so.1 deleted file mode 100755 index 7d40b18a3068210b744e057f8dec1f05c9befac0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14056 zcmeHOPiz!b7=KHt6e+YClmbd8Sd(I8*luZeD=DlZFp^dU+GwI=JMGSPCvJC}-Kn;C zumn92(xfM1yl6~FkQ0d)6A#d!#DfR*B=OQ1h?w}N9yEB6@%v`J-!cp((Th>@zGUb3 zzCXYB-u(8>Zg%I*8~XKo>}6ZSNLCV^UD6=Ps*GAq#|`Sipmyc0)E%uC zB?(m0FOSj4)#Ar-txO4sJcolW4JMNr!Lg2SiwlhM?xEa>85WG}z8x>hc%KP^w}Q%; zHz~YH;nh*k3Sx+QAb5v}$MgKF2H6kG zcz4s~JvlERsaC1g>SyQGWjXbh4VZwuID!R z)C`Q}3D!Z(=Q{AHnMKWok*j}5>9Vk&qQ)|r$L|tn9hR%-@t2DaQ~Z8)uTu9>gN*9} z%jL!=D&<_wv#VY%r*h8>4d(Jr)fsndo>Ltf+*_)YogsU)lW*5N#4k!tV_htOS~-`P7iVTi+jR2Yg|7EYG04UW$6Zm zOOZIgkFXn&IMyO^8npsi0j+>mKr5gX&lm3&NY6;(09XofVw-)ZR&2dzu3|~ z%e9vTss4kYzUO_0Z8xoxOV+|qd#r^U4OZf^_2o@(J#{cB9W?oig_icGZ}DgQT}r8` z9mCd%{w>_JPG0kxtyBF6$+>>i_xxAeZmL!?tQ}OJTiP_pE2N;r>3_VeP+t+GE&J@GTD{N7%x?wSKXRh zDI1yYLT^uRdZ&}l3y+B0D#+SH#t;f~R`6_0zQ;cU-V=4h>^%(2SEgj4q7 z^89U|*A1@?Syp#E7r_6cL=Ec}v8~kLwF*AgGm!VUvw??o2Y(CYextPpKGr`Fald|V$uYzW~w^8YyCW1S}{#%mmWTyMZ4<)RkKV7uJ`9ptYNTpzhxPUnS6-uyv;CC8fC2%ry>qne70#nrB z?+$!U;`;#4t;Fl$1CJB8CBnz|MNyvXK^>I@1|K*_QC>S3AD^4`=Ysg;$nbpv9^Qum z%5e$!c>ZFMb}6wL!SU7seBfzHMfoZ#waE~%&LvvE{=k2i5>Y-r-`j+bx;P*H8ESA1 s=5J)fjByt}j}^6ZnZU0xtgefA4QBEt(%e#Ka2*c4IaXO0*wDn-~a#s diff --git a/test/binary/usr/lib64/libXrdAppUtils.so b/test/binary/usr/lib64/libXrdAppUtils.so deleted file mode 120000 index 25d3bc29d..000000000 --- a/test/binary/usr/lib64/libXrdAppUtils.so +++ /dev/null @@ -1 +0,0 @@ -libXrdAppUtils.so.2 \ No newline at end of file diff --git a/test/binary/usr/lib64/libXrdCrypto.so b/test/binary/usr/lib64/libXrdCrypto.so deleted file mode 120000 index ed7854fcd..000000000 --- a/test/binary/usr/lib64/libXrdCrypto.so +++ /dev/null @@ -1 +0,0 @@ -libXrdCrypto.so.2 \ No newline at end of file diff --git a/test/binary/usr/lib64/libXrdCryptoLite.so b/test/binary/usr/lib64/libXrdCryptoLite.so deleted file mode 120000 index f55369e84..000000000 --- a/test/binary/usr/lib64/libXrdCryptoLite.so +++ /dev/null @@ -1 +0,0 @@ -libXrdCryptoLite.so.2 \ No newline at end of file diff --git a/test/binary/usr/lib64/libXrdUtils.so b/test/binary/usr/lib64/libXrdUtils.so deleted file mode 120000 index af7bdf0c1..000000000 --- a/test/binary/usr/lib64/libXrdUtils.so +++ /dev/null @@ -1 +0,0 @@ -libXrdUtils.so.3 \ No newline at end of file diff --git a/test/binary/usr/lib64/libXrdXml.so b/test/binary/usr/lib64/libXrdXml.so deleted file mode 120000 index 41585ab31..000000000 --- a/test/binary/usr/lib64/libXrdXml.so +++ /dev/null @@ -1 +0,0 @@ -libXrdXml.so.3 \ No newline at end of file diff --git a/test/binary/usr/share/xrootd/cmake/XRootDConfig.cmake b/test/binary/usr/share/xrootd/cmake/XRootDConfig.cmake deleted file mode 100644 index ee54a56fb..000000000 --- a/test/binary/usr/share/xrootd/cmake/XRootDConfig.cmake +++ /dev/null @@ -1,242 +0,0 @@ -################################################################################ -# Module for locating XRootD. -# -# XROOTD_FOUND -# Indicates whether the library has been found. -# -# XROOTD_INCLUDE_DIRS -# Specifies XRootD include directory. -# -# XROOTD_LIBRARIES -# Specifies XRootD libraries that should be passed to target_link_libararies. -# -# XROOTD__LIBRARIES -# Specifies the libraries of a specific -# -# XROOTD__FOUND -# Indicates whether the specified was found. -# -# List of components: CLIENT, UTILS, SERVER, POSIX, HTTP and SSI -################################################################################ - -################################################################################ -# Make sure all *_FOUND variables are intialized to FALSE -################################################################################ -SET( XROOTD_FOUND FALSE ) -SET( XROOTD_CLIENT_FOUND FALSE ) -SET( XROOTD_UTILS_FOUND FALSE ) -SET( XROOTD_SERVER_FOUND FALSE ) -SET( XROOTD_POSIX_FOUND FALSE ) -SET( XROOTD_HTTP_FOUND FALSE ) -SET( XROOTD_SSI_FOUND FALSE ) - -################################################################################ -# Set XRootD include paths -################################################################################ -FIND_PATH( XROOTD_INCLUDE_DIRS XrdVersion.hh - HINTS - ${XROOTD_DIR} - $ENV{XROOTD_DIR} - /usr - /opt/xrootd - PATH_SUFFIXES include/xrootd - PATHS /opt/xrootd -) - -IF( NOT "${XROOTD_INCLUDE_DIRS}" STREQUAL "XROOTD_INCLUDE_DIRS-NOTFOUND" ) - SET( XROOTD_FOUND TRUE ) - SET( XROOTD_INCLUDE_DIRS "${XROOTD_INCLUDE_DIRS};${XROOTD_INCLUDE_DIRS}/private" ) -ENDIF() - -IF( NOT XROOTD_FOUND ) - LIST( APPEND _XROOTD_MISSING_COMPONENTS XROOTD_FOUND ) -ENDIF() - -################################################################################ -# XRootD client libs -# - libXrdCl -################################################################################ -FIND_LIBRARY( XROOTD_CLIENT_LIBRARIES XrdCl - HINTS - ${XROOTD_DIR} - $ENV{XROOTD_DIR} - /usr - /opt/xrootd - PATH_SUFFIXES lib lib64 -) - -IF( NOT "${XROOTD_CLIENT_LIBRARIES}" STREQUAL "XROOTD_CLIENT_LIBRARIES-NOTFOUND" ) - SET( XROOTD_CLIENT_FOUND TRUE ) - LIST( APPEND XROOTD_LIBRARIES ${XROOTD_CLIENT_LIBRARIES} ) -ENDIF() - -IF( XRootD_FIND_REQUIRED_CLIENT AND NOT XROOTD_CLIENT_FOUND ) - MESSAGE( "XRootD client required but not found!" ) - LIST( APPEND _XROOTD_MISSING_COMPONENTS XROOTD_CLIENT_FOUND ) - SET( XROOTD_FOUND FALSE ) -ENDIF() - -################################################################################ -# XRootD utils libs -# - libXrdUtils -################################################################################ -FIND_LIBRARY( XROOTD_UTILS_LIBRARIES XrdUtils - HINTS - ${XROOTD_DIR} - $ENV{XROOTD_DIR} - /usr - /opt/xrootd - PATH_SUFFIXES lib lib64 -) - -IF( NOT "${XROOTD_UTILS_LIBRARIES}" STREQUAL "XROOTD_UTILS_LIBRARIES-NOTFOUND" ) - SET( XROOTD_UTILS_FOUND TRUE ) - LIST( APPEND XROOTD_LIBRARIES ${XROOTD_UTILS_LIBRARIES} ) -ENDIF() - -IF( XRootD_FIND_REQUIRED_UTILS AND NOT XROOTD_UTILS_FOUND ) - MESSAGE( "XRootD utils required but not found!" ) - LIST( APPEND _XROOTD_MISSING_COMPONENTS XROOTD_UTILS_FOUND ) - SET( XROOTD_FOUND FALSE ) -ENDIF() - -################################################################################ -# XRootD server libs -# - libXrdServer -################################################################################ -FIND_LIBRARY( XROOTD_SERVER_LIBRARIES XrdServer - HINTS - ${XROOTD_DIR} - $ENV{XROOTD_DIR} - /usr - /opt/xrootd - PATH_SUFFIXES lib lib64 -) - -IF( NOT "${XROOTD_SERVER_LIBRARIES}" STREQUAL "XROOTD_SERVER_LIBRARIES-NOTFOUND" ) - SET( XROOTD_SERVER_FOUND TRUE ) - LIST( APPEND XROOTD_LIBRARIES ${XROOTD_SERVER_LIBRARIES} ) -ENDIF() - -IF( XRootD_FIND_REQUIRED_SERVER AND NOT XROOTD_SERVER_FOUND ) - MESSAGE( "XRootD server required but not found!" ) - LIST( APPEND _XROOTD_MISSING_COMPONENTS XROOTD_SERVER_FOUND ) - SET( XROOTD_FOUND FALSE ) -ENDIF() - -################################################################################ -# XRootD posix libs -# - libXrdPosix -# - libXrdPosixPreload -################################################################################ -FIND_LIBRARY( XROOTD_POSIX_LIBRARY XrdPosix - HINTS - ${XROOTD_DIR} - $ENV{XROOTD_DIR} - /usr - /opt/xrootd - PATH_SUFFIXES lib lib64 -) - -FIND_LIBRARY( XROOTD_POSIX_PRELOAD_LIBRARY XrdPosixPreload - HINTS - ${XROOTD_DIR} - $ENV{XROOTD_DIR} - /usr - /opt/xrootd - PATH_SUFFIXES lib lib64 -) - -IF( NOT "${XROOTD_POSIX_LIBRARY}" STREQUAL "XROOTD_POSIX_LIBRARY-NOTFOUND" ) - IF( NOT "${XROOTD_POSIX_PRELOAD_LIBRARY}" STREQUAL "XROOTD_POSIX_PRELOAD_LIBRARY-NOTFOUND" ) - SET( XROOTD_POSIX_LIBRARIES ${XROOTD_POSIX_LIBRARY} ${XROOTD_POSIX_PRELOAD_LIBRARY} ) - SET( XROOTD_POSIX_FOUND TRUE ) - LIST( APPEND XROOTD_LIBRARIES ${XROOTD_POSIX_LIBRARIES} ) - ENDIF() -ENDIF() - -IF( XRootD_FIND_REQUIRED_POSIX AND NOT XROOTD_POSIX_FOUND ) - MESSAGE( "XRootD posix required but not found!" ) - LIST( APPEND _XROOTD_MISSING_COMPONENTS XROOTD_POSIX_FOUND ) - SET( XROOTD_FOUND FALSE ) -ENDIF() - -################################################################################ -# XRootD HTTP (XrdHttp) libs -# - libXrdHtppUtils -################################################################################ -FIND_LIBRARY( XROOTD_HTTP_LIBRARIES XrdHttpUtils - HINTS - ${XROOTD_DIR} - $ENV{XROOTD_DIR} - /usr - /opt/xrootd - PATH_SUFFIXES lib lib64 -) - -IF( NOT "${XROOTD_HTTP_LIBRARIES}" STREQUAL "XROOTD_HTTP_LIBRARIES-NOTFOUND" ) - SET( XROOTD_HTTP_FOUND TRUE ) - LIST( APPEND XROOTD_LIBRARIES ${XROOTD_HTTP_LIBRARIES} ) -ENDIF() - -IF( XRootD_FIND_REQUIRED_HTTP AND NOT XROOTD_HTTP_FOUND ) - MESSAGE( "XRootD http required but not found!" ) - LIST( APPEND _XROOTD_MISSING_COMPONENTS XROOTD_HTTP_FOUND ) - SET( XROOTD_FOUND FALSE ) -ENDIF() - -################################################################################ -# XRootD SSI libs -# - XrdSsiLib -# - XrdSsiShMap -################################################################################ -FIND_LIBRARY( XROOTD_SSI_LIBRARY XrdSsiLib - HINTS - ${XROOTD_DIR} - $ENV{XROOTD_DIR} - /usr - /opt/xrootd - PATH_SUFFIXES lib lib64 -) - -FIND_LIBRARY( XROOTD_SSI_SHMAP_LIBRARY XrdSsiShMap - HINTS - ${XROOTD_DIR} - $ENV{XROOTD_DIR} - /usr - /opt/xrootd - PATH_SUFFIXES lib lib64 -) - -IF( NOT "${XROOTD_SSI_LIBRARY}" STREQUAL "XROOTD_SSI_LIBRARY-NOTFOUND" ) - IF( NOT "${XROOTD_SSI_SHMAP_LIBRARY}" STREQUAL "XROOTD_SSI_SHMAP_LIBRARY-NOTFOUND" ) - SET( XROOTD_SSI_LIBRARIES ${XROOTD_SSI_LIBRARY} ${XROOTD_SSI_SHMAP_LIBRARY} ) - SET( XROOTD_SSI_FOUND TRUE ) - LIST( APPEND XROOTD_LIBRARIES ${XROOTD_SSI_LIBRARIES} ) - ENDIF() -ENDIF() - -IF( XRootD_FIND_REQUIRED_SSI AND NOT XROOTD_SSI_FOUND ) - MESSAGE( "XRootD ssi required but not found!" ) - LIST (APPEND _XROOTD_MISSING_COMPONENTS XROOTD_SSI_FOUND ) - SET( XROOTD_FOUND FALSE ) -ENDIF() - -################################################################################ -# Utility variables for plug-in development -################################################################################ -IF( XROOTD_FOUND ) - SET( XROOTD_PLUGIN_VERSION 5 ) -ENDIF() - -################################################################################ -# Set up the XRootD find module -################################################################################ - -IF( XRootD_FIND_REQUIRED ) - INCLUDE( FindPackageHandleStandardArgs ) - FIND_PACKAGE_HANDLE_STANDARD_ARGS( XRootD - REQUIRED_VARS XROOTD_INCLUDE_DIRS ${_XROOTD_MISSING_COMPONENTS} - ) -ENDIF() -