00001 #ifndef __XRDCKS_HH__ 00002 #define __XRDCKS_HH__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C k s . h h */ 00006 /* */ 00007 /* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /* */ 00012 /* This file is part of the XRootD software suite. */ 00013 /* */ 00014 /* XRootD is free software: you can redistribute it and/or modify it under */ 00015 /* the terms of the GNU Lesser General Public License as published by the */ 00016 /* Free Software Foundation, either version 3 of the License, or (at your */ 00017 /* option) any later version. */ 00018 /* */ 00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00022 /* License for more details. */ 00023 /* */ 00024 /* You should have received a copy of the GNU Lesser General Public License */ 00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00027 /* */ 00028 /* The copyright holder's institutional names and contributor's names may not */ 00029 /* be used to endorse or promote products derived from this software without */ 00030 /* specific prior written permission of the institution or contributor. */ 00031 /******************************************************************************/ 00032 00033 #include "XrdCks/XrdCksData.hh" 00034 00035 class XrdCks; 00036 class XrdCksCalc; 00037 class XrdOucStream; 00038 class XrdSysError; 00039 class XrdSysPlugin; 00040 00048 /******************************************************************************/ 00049 /* X r d C k s P C B */ 00050 /******************************************************************************/ 00055 class XrdCksPCB 00056 { 00057 public: 00058 00059 //------------------------------------------------------------------------------ 00063 //------------------------------------------------------------------------------ 00064 00065 virtual void Info(long long fsize, long long csbytes); 00066 00067 long long rsvd; 00068 00069 XrdCksPCB() : rsvd(0) {} 00070 virtual ~XrdCksPCB() {} 00071 }; 00072 00073 /******************************************************************************/ 00074 /* X r d C k s */ 00075 /******************************************************************************/ 00076 00077 class XrdCks 00078 { 00079 public: 00080 00081 //------------------------------------------------------------------------------ 00095 //------------------------------------------------------------------------------ 00096 virtual 00097 int Calc( const char *Pfn, XrdCksData &Cks, int doSet=1) = 0; 00098 00099 virtual 00100 int Calc( const char *Pfn, XrdCksData &Cks, XrdCksPCB *pcbP, int doSet=1) 00101 {(void)pcbP; return Calc(Pfn, Cks, doSet);} 00102 00103 //------------------------------------------------------------------------------ 00108 //------------------------------------------------------------------------------ 00109 virtual 00110 int Del( const char *Pfn, XrdCksData &Cks) = 0; 00111 00112 //------------------------------------------------------------------------------ 00123 //------------------------------------------------------------------------------ 00124 virtual 00125 int Get( const char *Pfn, XrdCksData &Cks) = 0; 00126 00127 //------------------------------------------------------------------------------ 00135 //------------------------------------------------------------------------------ 00136 virtual 00137 int Config(const char *Token, char *Line) = 0; 00138 00139 //------------------------------------------------------------------------------ 00150 //------------------------------------------------------------------------------ 00151 virtual 00152 int Init(const char *ConfigFN, const char *DfltCalc=0) = 0; 00153 00154 //------------------------------------------------------------------------------ 00167 //------------------------------------------------------------------------------ 00168 virtual 00169 char *List(const char *Pfn, char *Buff, int Blen, char Sep=' ') = 0; 00170 00171 //------------------------------------------------------------------------------ 00180 //------------------------------------------------------------------------------ 00181 virtual const 00182 char *Name(int seqNum=0) = 0; 00183 00184 //------------------------------------------------------------------------------ 00195 //------------------------------------------------------------------------------ 00196 virtual 00197 XrdCksCalc *Object(const char *name) 00198 { 00199 (void)name; 00200 return 0; 00201 } 00202 00203 //------------------------------------------------------------------------------ 00210 //------------------------------------------------------------------------------ 00211 virtual 00212 int Size( const char *Name=0) = 0; 00213 00214 //------------------------------------------------------------------------------ 00225 //------------------------------------------------------------------------------ 00226 virtual 00227 int Set( const char *Pfn, XrdCksData &Cks, int myTime=0) = 0; 00228 00229 //------------------------------------------------------------------------------ 00243 //------------------------------------------------------------------------------ 00244 virtual 00245 int Ver( const char *Pfn, XrdCksData &Cks) = 0; 00246 00247 virtual 00248 int Ver( const char *Pfn, XrdCksData &Cks, XrdCksPCB *pcbP) 00249 {(void)pcbP; return Ver(Pfn, Cks);} 00250 00251 //------------------------------------------------------------------------------ 00253 //------------------------------------------------------------------------------ 00254 00255 XrdCks(XrdSysError *erP) : eDest(erP) {} 00256 00257 //------------------------------------------------------------------------------ 00259 //------------------------------------------------------------------------------ 00260 virtual ~XrdCks() {} 00261 00270 protected: 00271 00272 XrdSysError *eDest; 00273 }; 00274 00275 /******************************************************************************/ 00276 /* X r d C k s I n i t */ 00277 /******************************************************************************/ 00278 00279 #define XRDCKSINITPARMS XrdSysError *, const char *, const char * 00280 00281 //------------------------------------------------------------------------------ 00299 //------------------------------------------------------------------------------ 00300 00306 //------------------------------------------------------------------------------ 00312 //------------------------------------------------------------------------------ 00313 00319 #endif