|
xrootd
|
00001 #ifndef __XRDOFSTPC_HH__ 00002 #define __XRDOFSTPC_HH__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O f s T P C . h h */ 00006 /* */ 00007 /* (c) 2012 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 <stdlib.h> 00034 #include <string.h> 00035 00036 #include "XrdOfs/XrdOfsTPCInfo.hh" 00037 00038 class XrdAccAuthorize; 00039 class XrdOfsTPCAllow; 00040 class XrdOfsTPCJob; 00041 class XrdOss; 00042 class XrdOucEnv; 00043 class XrdOucErrInfo; 00044 class XrdOucPListAnchor; 00045 class XrdOucTList; 00046 class XrdSecEntity; 00047 00048 class XrdOfsTPC 00049 { 00050 public: 00051 00052 struct Facts 00053 {const char *Key; 00054 const char *Lfn; 00055 const char *Pfn; 00056 const char *Org; 00057 const char *Dst; 00058 const XrdSecEntity *Usr; 00059 XrdOucErrInfo *eRR; 00060 XrdOucEnv *Env; 00061 00062 Facts(const XrdSecEntity *vEnt, XrdOucErrInfo *vInf, XrdOucEnv *vEnv, 00063 const char *vKey, const char *vLfn, const char *vPfn=0) 00064 : Key(vKey), Lfn(vLfn), Pfn(vPfn), Org(0), Dst(0), 00065 Usr(vEnt), eRR(vInf), Env(vEnv) {} 00066 }; 00067 00068 static void Allow(char *vDN, char *vGN, char *vHN, char *vVO); 00069 00070 static int Authorize(XrdOfsTPC **theTPC, 00071 Facts &Args, 00072 int isPLE=0); 00073 00074 virtual void Del() {} 00075 00076 struct iParm {char *Pgm; 00077 char *Ckst; 00078 int Dflttl; 00079 int Maxttl; 00080 int Logok; 00081 int Strm; 00082 int Xmax; 00083 iParm() : Pgm(0), Ckst(0), Dflttl(-1), Maxttl(-1), 00084 Logok(-1), Strm(-1), Xmax(-1) {} 00085 }; 00086 00087 static void Init(iParm &Parms); 00088 00089 static void Init(XrdAccAuthorize *accP) {fsAuth = accP;} 00090 00091 static void Init(XrdOss *ossP) {OfsOss = ossP;} 00092 00093 static const int reqALL = 0; 00094 static const int reqDST = 1; 00095 static const int reqORG = 2; 00096 00097 static void Require(const char *Auth, int RType); 00098 00099 static int Restrict(const char *Path); 00100 00101 static int Start(); 00102 00103 virtual int Sync(XrdOucErrInfo *error) {return 0;} 00104 00105 static int Validate (XrdOfsTPC **theTPC, Facts &Args); 00106 00107 XrdOfsTPC() : Refs(1), inQ(0) {} 00108 00109 XrdOfsTPC(const char *Url, const char *Org, 00110 const char *Lfn, const char *Pfn, const char *Cks=0) 00111 : Info(Url, Org, Lfn, Pfn, Cks), Refs(1), inQ(0) {} 00112 00113 virtual ~XrdOfsTPC() {} 00114 00115 XrdOfsTPCInfo Info; 00116 00117 static char *cksType; 00118 00119 protected: 00120 00121 static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0); 00122 static int genOrg(const XrdSecEntity *client, char *Buff, int Blen); 00123 static int getTTL(XrdOucEnv *Env); 00124 static int Screen(Facts &Args, XrdOucTList *tP, int wasEnc=0); 00125 static char *Verify(const char *Who,const char *Name,char *Buf,int Blen); 00126 static const char *Yield(const char *Name,char *Buf,int Blen); 00127 00128 static XrdAccAuthorize *fsAuth; 00129 static XrdOss *OfsOss; 00130 00131 static char *XfrProg; 00132 00133 static XrdOucTList *AuthDst; 00134 static XrdOucTList *AuthOrg; 00135 00136 static XrdOfsTPCAllow *ALList; 00137 static XrdOucPListAnchor *RPList; 00138 00139 static int dflTTL; 00140 static int maxTTL; 00141 static int LogOK; 00142 static int nStrms; 00143 static int xfrMax; 00144 static int tpcOK; 00145 static int encTPC; 00146 00147 char Refs; // Reference count 00148 char inQ; // Object in queue 00149 }; 00150 #endif
1.7.6.1