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 <stdlib.h>
34 #include <string.h>
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 struct iParm {char *Pgm;
82  char *Ckst;
83  char *cpath;
84  int fCreds;
85  int Dflttl;
86  int Maxttl;
87  int Logok;
88  int Strm;
89  int SMax;
90  int Xmax;
91  signed char Grab;
92  signed char xEcho;
93  signed char autoRM;
94  signed char oidsOK;
95  iParm() : Pgm(0), Ckst(0), cpath(0), fCreds(0),
96  Dflttl(-1), Maxttl(-1),
97  Logok(-1), Strm(-1), SMax(64), Xmax(-1), Grab(0),
98  xEcho(-1), autoRM(-1), oidsOK(0) {}
99  };
100 
101 static void Init(iParm &Parms);
102 
103 static void Init(XrdAccAuthorize *accP) {fsAuth = accP;}
104 
105 static const int reqALL = 0;
106 static const int reqDST = 1;
107 static const int reqORG = 2;
108 
109 static void Require(const char *Auth, int RType);
110 
111 static int Restrict(const char *Path);
112 
113 static int Start();
114 
115 virtual int Sync(XrdOucErrInfo *error) {return 0;}
116 
117 static int Validate (XrdOfsTPC **theTPC, Facts &Args);
118 
119  XrdOfsTPC() : Refs(1), inQ(0) {}
120 
121  XrdOfsTPC(const char *Url, const char *Org,
122  const char *Lfn, const char *Pfn, const char *Cks=0,
123  const char *Spr=0, const char *Tpr=0)
124  : Info(Url, Org, Lfn, Pfn, Cks, Spr, Tpr),
125  Refs(1), inQ(0) {}
126 
127 virtual ~XrdOfsTPC() {}
128 
130 
131 protected:
132 
133 static int Death(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
134 static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
135 static int genOrg(const XrdSecEntity *client, char *Buff, int Blen);
136 static int getTTL(XrdOucEnv *Env);
137 static int Screen(Facts &Args, XrdOucTList *tP, int wasEnc=0);
138 static char *Verify(const char *Who,const char *Name,char *Buf,int Blen);
139 
141 
144 static char *cPath;
145 
146 static XrdOfsTPCAllow *ALList;
148 static int maxTTL;
149 static int dflTTL;
150 
151  char Refs; // Reference count
152  char inQ; // Object in queue
153 };
154 #endif
XrdOfsTPC::Facts::Org
const char * Org
Definition: XrdOfsTPC.hh:55
XrdOfsTPC::Validate
static int Validate(XrdOfsTPC **theTPC, Facts &Args)
XrdOfsTPC::Restrict
static int Restrict(const char *Path)
XrdOfsTPC::Sync
virtual int Sync(XrdOucErrInfo *error)
Definition: XrdOfsTPC.hh:115
XrdOfsTPC::Allow
static void Allow(char *vDN, char *vGN, char *vHN, char *vVO)
XrdOfsTPC::ALList
static XrdOfsTPCAllow * ALList
Definition: XrdOfsTPC.hh:146
XrdOfsTPC::Info
XrdOfsTPCInfo Info
Definition: XrdOfsTPC.hh:129
XrdOfsTPC::iParm::Strm
int Strm
Definition: XrdOfsTPC.hh:88
XrdOfsTPC::Death
static int Death(Facts &Args, const char *eMsg, int eCode, int nomsg=0)
XrdOfsTPC::iParm::Pgm
char * Pgm
Definition: XrdOfsTPC.hh:81
XrdOfsTPC::iParm::iParm
iParm()
Definition: XrdOfsTPC.hh:95
XrdOfsTPC::Facts
Definition: XrdOfsTPC.hh:52
XrdOfsTPC::maxTTL
static int maxTTL
Definition: XrdOfsTPC.hh:148
XrdOucPListAnchor
Definition: XrdOucPList.hh:89
XrdOfsTPC::dflTTL
static int dflTTL
Definition: XrdOfsTPC.hh:149
XrdOfsTPC::reqALL
static const int reqALL
Definition: XrdOfsTPC.hh:105
XrdOfsTPC::iParm::oidsOK
signed char oidsOK
Definition: XrdOfsTPC.hh:94
XrdOfsTPC::Require
static void Require(const char *Auth, int RType)
XrdOfsTPC::~XrdOfsTPC
virtual ~XrdOfsTPC()
Definition: XrdOfsTPC.hh:127
XrdOfsTPC::Facts::eRR
XrdOucErrInfo * eRR
Definition: XrdOfsTPC.hh:58
XrdOfsTPC::Verify
static char * Verify(const char *Who, const char *Name, char *Buf, int Blen)
XrdOfsTPC::iParm::Maxttl
int Maxttl
Definition: XrdOfsTPC.hh:86
XrdOfsTPC::Facts::Dst
const char * Dst
Definition: XrdOfsTPC.hh:56
XrdOfsTPC::iParm::Dflttl
int Dflttl
Definition: XrdOfsTPC.hh:85
XrdOfsTPC::Init
static void Init(iParm &Parms)
XrdOfsTPC
Definition: XrdOfsTPC.hh:48
XrdOfsTPCInfo.hh
XrdOfsTPC::reqORG
static const int reqORG
Definition: XrdOfsTPC.hh:107
XrdAccAuthorize
Definition: XrdAccAuthorize.hh:65
XrdOfsTPC::Screen
static int Screen(Facts &Args, XrdOucTList *tP, int wasEnc=0)
XrdOucEnv
Definition: XrdOucEnv.hh:42
XrdOfsTPC::Facts::Key
const char * Key
Definition: XrdOfsTPC.hh:52
XrdOfsTPC::iParm::xEcho
signed char xEcho
Definition: XrdOfsTPC.hh:92
XrdOfsTPC::iParm::Logok
int Logok
Definition: XrdOfsTPC.hh:87
XrdOfsTPC::fsAuth
static XrdAccAuthorize * fsAuth
Definition: XrdOfsTPC.hh:140
XrdOfsTPC::Facts::Facts
Facts(const XrdSecEntity *vEnt, XrdOucErrInfo *vInf, XrdOucEnv *vEnv, const char *vKey, const char *vLfn, const char *vPfn=0)
Definition: XrdOfsTPC.hh:61
XrdOfsTPC::Start
static int Start()
XrdOfsTPC::iParm::SMax
int SMax
Definition: XrdOfsTPC.hh:89
XrdOfsTPC::Authorize
static int Authorize(XrdOfsTPC **theTPC, Facts &Args, int isPLE=0)
XrdOfsTPC::Del
virtual void Del()
Definition: XrdOfsTPC.hh:79
XrdOfsTPC::Init
static void Init(XrdAccAuthorize *accP)
Definition: XrdOfsTPC.hh:103
XrdOfsTPC::genOrg
static int genOrg(const XrdSecEntity *client, char *Buff, int Blen)
XrdOfsTPC::credPath
static const char * credPath()
Definition: XrdOfsTPC.hh:77
XrdOfsTPC::Facts::Usr
const XrdSecEntity * Usr
Definition: XrdOfsTPC.hh:57
XrdOfsTPC::XrdOfsTPC
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:121
XrdOfsTPC::AuthOrg
static XrdOucTList * AuthOrg
Definition: XrdOfsTPC.hh:143
XrdOfsTPC::iParm::autoRM
signed char autoRM
Definition: XrdOfsTPC.hh:93
XrdOfsTPC::Facts::Pfn
const char * Pfn
Definition: XrdOfsTPC.hh:54
XrdOfsTPC::cPath
static char * cPath
Definition: XrdOfsTPC.hh:144
XrdOfsTPC::getTTL
static int getTTL(XrdOucEnv *Env)
XrdOfsTPC::iParm
Definition: XrdOfsTPC.hh:81
XrdOfsTPC::Facts::Env
XrdOucEnv * Env
Definition: XrdOfsTPC.hh:59
XrdOfsTPC::iParm::Xmax
int Xmax
Definition: XrdOfsTPC.hh:90
XrdOfsTPCJob
Definition: XrdOfsTPCJob.hh:39
XrdOfsTPC::RPList
static XrdOucPListAnchor * RPList
Definition: XrdOfsTPC.hh:147
XrdOfsTPC::XrdOfsTPC
XrdOfsTPC()
Definition: XrdOfsTPC.hh:119
XrdSecEntity
Definition: XrdSecEntity.hh:52
XrdOucErrInfo
Definition: XrdOucErrInfo.hh:100
XrdOfsTPCInfo
Definition: XrdOfsTPCInfo.hh:42
XrdOfsTPC::Fatal
static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0)
XrdOfsTPC::iParm::Grab
signed char Grab
Definition: XrdOfsTPC.hh:91
XrdOfsTPC::iParm::Ckst
char * Ckst
Definition: XrdOfsTPC.hh:82
XrdOfsTPC::Refs
char Refs
Definition: XrdOfsTPC.hh:151
XrdOfsTPC::inQ
char inQ
Definition: XrdOfsTPC.hh:152
XrdOfsTPC::iParm::fCreds
int fCreds
Definition: XrdOfsTPC.hh:84
XrdOucTList
Definition: XrdOucTList.hh:42
XrdOfsTPC::AuthDst
static XrdOucTList * AuthDst
Definition: XrdOfsTPC.hh:142
XrdOfsTPC::AddAuth
static const char * AddAuth(const char *auth, const char *avar)
XrdOfsTPC::Facts::Lfn
const char * Lfn
Definition: XrdOfsTPC.hh:53
XrdOfsTPC::reqDST
static const int reqDST
Definition: XrdOfsTPC.hh:106
XrdOfsTPC::iParm::cpath
char * cpath
Definition: XrdOfsTPC.hh:83