XRootD
XrdOfsTPC.hh
Go to the documentation of this file.
1 #ifndef __XRDOFSTPC_HH__
2 #define __XRDOFSTPC_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d O f s T P C . h h */
6 /* */
7 /* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include <cstdlib>
34 #include <cstring>
35 
36 #include "XrdOfs/XrdOfsTPCInfo.hh"
37 
38 class XrdAccAuthorize;
39 class XrdOfsTPCAllow;
40 class XrdOfsTPCJob;
41 class XrdOucEnv;
42 class XrdOucErrInfo;
43 class XrdOucPListAnchor;
44 class XrdOucTList;
45 class XrdSecEntity;
46 
47 class XrdOfsTPC
48 {
49 public:
50 
51 struct Facts
52  {const char *Key;
53  const char *Lfn;
54  const char *Pfn;
55  const char *Org;
56  const char *Dst;
57  const XrdSecEntity *Usr;
60 
61  Facts(const XrdSecEntity *vEnt, XrdOucErrInfo *vInf, XrdOucEnv *vEnv,
62  const char *vKey, const char *vLfn, const char *vPfn=0)
63  : Key(vKey), Lfn(vLfn), Pfn(vPfn), Org(0), Dst(0),
64  Usr(vEnt), eRR(vInf), Env(vEnv) {}
65  };
66 
67 static
68 const char *AddAuth(const char *auth, const char *avar);
69 
70 static void Allow(char *vDN, char *vGN, char *vHN, char *vVO);
71 
72 static int Authorize(XrdOfsTPC **theTPC,
73  Facts &Args,
74  int isPLE=0);
75 
76 static
77 const char *credPath() {return cPath;}
78 
79 virtual void Del() {}
80 
81 static void Init();
82 
83 static void Init(XrdAccAuthorize *accP) {fsAuth = accP;}
84 
85 static const int reqALL = 0;
86 static const int reqDST = 1;
87 static const int reqORG = 2;
88 
89 static void Require(const char *Auth, int RType);
90 
91 static int Restrict(const char *Path);
92 
93 static int Start();
94 
95 virtual int Sync(XrdOucErrInfo *error) {return 0;}
96 
97 static int Validate (XrdOfsTPC **theTPC, Facts &Args);
98 
99  XrdOfsTPC() : Refs(1), inQ(0) {}
100 
101  XrdOfsTPC(const char *Url, const char *Org,
102  const char *Lfn, const char *Pfn, const char *Cks=0,
103  const char *Spr=0, const char *Tpr=0)
104  : Info(Url, Org, Lfn, Pfn, Cks, Spr, Tpr),
105  Refs(1), inQ(0) {}
106 
107 virtual ~XrdOfsTPC() {}
108 
110 
111 protected:
112 
113 static int Death(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
114 static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
115 static int genOrg(const XrdSecEntity *client, char *Buff, int Blen);
116 static int getTTL(XrdOucEnv *Env);
117 static int Screen(Facts &Args, XrdOucTList *tP, int wasEnc=0);
118 static char *Verify(const char *Who,const char *Name,char *Buf,int Blen);
119 
121 
124 static char *cPath;
125 
128 
129  char Refs; // Reference count
130  char inQ; // Object in queue
131 };
132 #endif
XrdOucString Path
#define eMsg(x)
static int Authorize(XrdOfsTPC **theTPC, Facts &Args, int isPLE=0)
Definition: XrdOfsTPC.cc:221
static int Restrict(const char *Path)
Definition: XrdOfsTPC.cc:465
static XrdOucTList * AuthOrg
Definition: XrdOfsTPC.hh:123
virtual int Sync(XrdOucErrInfo *error)
Definition: XrdOfsTPC.hh:95
static const int reqDST
Definition: XrdOfsTPC.hh:86
static const char * AddAuth(const char *auth, const char *avar)
Definition: XrdOfsTPC.cc:164
static char * Verify(const char *Who, const char *Name, char *Buf, int Blen)
Definition: XrdOfsTPC.cc:683
char Refs
Definition: XrdOfsTPC.hh:129
static int getTTL(XrdOucEnv *Env)
Definition: XrdOfsTPC.cc:396
static XrdAccAuthorize * fsAuth
Definition: XrdOfsTPC.hh:120
static void Init()
Definition: XrdOfsTPC.cc:414
static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0)
Definition: XrdOfsTPC.cc:334
XrdOfsTPC(const char *Url, const char *Org, const char *Lfn, const char *Pfn, const char *Cks=0, const char *Spr=0, const char *Tpr=0)
Definition: XrdOfsTPC.hh:101
static int Start()
Definition: XrdOfsTPC.cc:520
virtual ~XrdOfsTPC()
Definition: XrdOfsTPC.hh:107
static int Death(Facts &Args, const char *eMsg, int eCode, int nomsg=0)
Definition: XrdOfsTPC.cc:319
virtual void Del()
Definition: XrdOfsTPC.hh:79
static const int reqORG
Definition: XrdOfsTPC.hh:87
static void Require(const char *Auth, int RType)
Definition: XrdOfsTPC.cc:445
XrdOfsTPCInfo Info
Definition: XrdOfsTPC.hh:109
static void Allow(char *vDN, char *vGN, char *vHN, char *vVO)
Definition: XrdOfsTPC.cc:209
static XrdOfsTPCAllow * ALList
Definition: XrdOfsTPC.hh:126
static const char * credPath()
Definition: XrdOfsTPC.hh:77
static int Validate(XrdOfsTPC **theTPC, Facts &Args)
Definition: XrdOfsTPC.cc:550
static char * cPath
Definition: XrdOfsTPC.hh:124
static XrdOucTList * AuthDst
Definition: XrdOfsTPC.hh:122
static int Screen(Facts &Args, XrdOucTList *tP, int wasEnc=0)
Definition: XrdOfsTPC.cc:497
char inQ
Definition: XrdOfsTPC.hh:130
static XrdOucPListAnchor * RPList
Definition: XrdOfsTPC.hh:127
static void Init(XrdAccAuthorize *accP)
Definition: XrdOfsTPC.hh:83
static const int reqALL
Definition: XrdOfsTPC.hh:85
static int genOrg(const XrdSecEntity *client, char *Buff, int Blen)
Definition: XrdOfsTPC.cc:359
XrdDigAuth Auth
Definition: XrdDigAuth.cc:63
const XrdSecEntity * Usr
Definition: XrdOfsTPC.hh:57
const char * Key
Definition: XrdOfsTPC.hh:52
XrdOucEnv * Env
Definition: XrdOfsTPC.hh:59
const char * Pfn
Definition: XrdOfsTPC.hh:54
const char * Org
Definition: XrdOfsTPC.hh:55
Facts(const XrdSecEntity *vEnt, XrdOucErrInfo *vInf, XrdOucEnv *vEnv, const char *vKey, const char *vLfn, const char *vPfn=0)
Definition: XrdOfsTPC.hh:61
const char * Lfn
Definition: XrdOfsTPC.hh:53
XrdOucErrInfo * eRR
Definition: XrdOfsTPC.hh:58
const char * Dst
Definition: XrdOfsTPC.hh:56