00001 #ifndef __XRDOUCFILEINFO_HH__ 00002 #define __XRDOUCFILEINFO_HH__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O u c F i l e I n f o . h h */ 00006 /* */ 00007 /* (c) 2015 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00009 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00010 /* */ 00011 /* This file is part of the XRootD software suite. */ 00012 /* */ 00013 /* XRootD is free software: you can redistribute it and/or modify it under */ 00014 /* the terms of the GNU Lesser General Public License as published by the */ 00015 /* Free Software Foundation, either version 3 of the License, or (at your */ 00016 /* option) any later version. */ 00017 /* */ 00018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00020 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00021 /* License for more details. */ 00022 /* */ 00023 /* You should have received a copy of the GNU Lesser General Public License */ 00024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00025 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00026 /* */ 00027 /* The copyright holder's institutional names and contributor's names may not */ 00028 /* be used to endorse or promote products derived from this software without */ 00029 /* specific prior written permission of the institution or contributor. */ 00030 /******************************************************************************/ 00031 00032 #include <ctype.h> 00033 #include <stdlib.h> 00034 #include <string.h> 00035 #include <string> 00036 00037 //----------------------------------------------------------------------------- 00040 //----------------------------------------------------------------------------- 00041 00042 class XrdOucFIHash; 00043 class XrdOucFIUrl; 00044 00045 class XrdOucFileInfo 00046 { 00047 public: 00048 00049 //----------------------------------------------------------------------------- 00054 //----------------------------------------------------------------------------- 00055 00056 void AddDigest(const char *hname, const char *hval); 00057 00058 //----------------------------------------------------------------------------- 00068 //----------------------------------------------------------------------------- 00069 00070 void AddUrl(const char *url, const char *cntry=0, 00071 int prty=0, bool fifo=true); 00072 00073 //----------------------------------------------------------------------------- 00077 //----------------------------------------------------------------------------- 00078 00079 void AddFileName(const char * filename); 00080 00081 //----------------------------------------------------------------------------- 00085 //----------------------------------------------------------------------------- 00086 00087 void AddLfn(const char * lfn); 00088 00089 //----------------------------------------------------------------------------- 00093 //----------------------------------------------------------------------------- 00094 00095 void AddProtocol(const char * protname); 00096 00097 //----------------------------------------------------------------------------- 00108 //----------------------------------------------------------------------------- 00109 00110 const char *GetDigest(const char *&hval, bool xrdname=true); 00111 00112 //----------------------------------------------------------------------------- 00117 //----------------------------------------------------------------------------- 00118 00119 const char *GetLfn() {return fLfn;} 00120 00121 //----------------------------------------------------------------------------- 00125 //----------------------------------------------------------------------------- 00126 00127 const char *GetTargetName() {return fTargetName;} 00128 00129 //----------------------------------------------------------------------------- 00133 //----------------------------------------------------------------------------- 00134 00135 long long GetSize() {return fSize;} 00136 00137 //----------------------------------------------------------------------------- 00149 //----------------------------------------------------------------------------- 00150 00151 const char *GetUrl(char *cntry=0, int *prty=0); 00152 00153 //----------------------------------------------------------------------------- 00160 //----------------------------------------------------------------------------- 00161 00162 bool HasProtocol(const char * protname); 00163 00164 //----------------------------------------------------------------------------- 00168 //----------------------------------------------------------------------------- 00169 00170 void SetSize(long long fsz) {fSize = fsz;} 00171 00172 //----------------------------------------------------------------------------- 00176 //----------------------------------------------------------------------------- 00177 00178 XrdOucFileInfo(const char *lfn=0) 00179 : nextFile(0), fHash(0), fHashNext(0), 00180 fUrl(0), fUrlNext(0), fTargetName(0), fSize(-1) 00181 {if (lfn) fLfn = strdup(lfn); 00182 else fLfn = 0; 00183 } 00184 00185 //----------------------------------------------------------------------------- 00187 //----------------------------------------------------------------------------- 00188 00189 ~XrdOucFileInfo(); 00190 00191 //----------------------------------------------------------------------------- 00193 //----------------------------------------------------------------------------- 00194 00195 XrdOucFileInfo *nextFile; 00196 00197 private: 00198 00199 XrdOucFIHash *fHash; 00200 XrdOucFIHash *fHashNext; 00201 XrdOucFIUrl *fUrl; 00202 XrdOucFIUrl *fUrlNext; 00203 char *fLfn; 00204 char *fTargetName; 00205 long long fSize; 00206 std::string protList; 00207 }; 00208 #endif