00001 #ifndef XRDCPWORKLST_HH 00002 #define XRDCPWORKLST_HH 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C p W o r k L s t . h h */ 00006 /* */ 00007 /* Author: Fabrizio Furano (INFN Padova, 2004) */ 00008 /* */ 00009 /* This file is part of the XRootD software suite. */ 00010 /* */ 00011 /* XRootD is free software: you can redistribute it and/or modify it under */ 00012 /* the terms of the GNU Lesser General Public License as published by the */ 00013 /* Free Software Foundation, either version 3 of the License, or (at your */ 00014 /* option) any later version. */ 00015 /* */ 00016 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00017 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00018 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00019 /* License for more details. */ 00020 /* */ 00021 /* You should have received a copy of the GNU Lesser General Public License */ 00022 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00023 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00024 /* */ 00025 /* The copyright holder's institutional names and contributor's names may not */ 00026 /* be used to endorse or promote products derived from this software without */ 00027 /* specific prior written permission of the institution or contributor. */ 00028 /******************************************************************************/ 00029 00031 // // 00032 // A class implementing a list of cp to do for XrdCp // 00033 // // 00035 00036 #include <sys/types.h> 00037 #include "XrdClient/XrdClientAdmin.hh" 00038 #include "XrdClient/XrdClient.hh" 00039 #include <stdint.h> 00040 00041 class XrdSysDir; 00042 const char *ServerError(XrdClient *cli); 00043 void PrintLastServerError(XrdClient *cli); 00044 bool PedanticOpen4Write(XrdClient *cli, kXR_unt16 mode, kXR_unt16 options); 00045 00046 //------------------------------------------------------------------------------ 00047 // Check if the opaque data provides the file size information and add it 00048 // if needed 00049 //------------------------------------------------------------------------------ 00050 XrdOucString AddSizeHint( const char *dst, off_t size ); 00051 00052 class XrdCpWorkLst { 00053 00054 vecString fWorkList; 00055 uint64_t pSourceSize; // set if the source URL refers to a file 00056 int srcPathLen; 00057 int fWorkIt; 00058 00059 XrdClientAdmin *xrda_src, *xrda_dst; 00060 00061 XrdOucString fSrc, fDest; 00062 bool fDestIsDir, fSrcIsDir; 00063 00064 public: 00065 00066 XrdCpWorkLst(); 00067 ~XrdCpWorkLst(); 00068 00069 00070 // Sets the source path for the file copy 00071 int SetSrc(XrdClient **srccli, XrdOucString url, 00072 XrdOucString urlopaquedata, bool do_recurse, int newCP=0); 00073 00074 // Sets the destination of the file copy 00075 int SetDest(XrdClient **xrddest, const char *url, 00076 const char *urlopaquedata, 00077 kXR_unt16 xrdopenflags, int newCP=0); 00078 00079 inline void GetDest(XrdOucString &dest, bool& isdir) { 00080 dest = fDest; 00081 isdir = fDestIsDir; 00082 } 00083 00084 inline void GetSrc(XrdOucString &src, bool& isdir) { 00085 src = fSrc; 00086 isdir = fSrcIsDir; 00087 } 00088 00089 00090 // Actually builds the worklist 00091 int BuildWorkList_xrd(XrdOucString url, XrdOucString opaquedata); 00092 int BuildWorkList_loc(XrdSysDir *dir, XrdOucString pat); 00093 00094 bool GetCpJob(XrdOucString &src, XrdOucString &dest); 00095 00096 }; 00097 #endif