xrootd
Loading...
Searching...
No Matches
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
37
38class XrdAccAuthorize;
39class XrdOfsTPCAllow;
40class XrdOfsTPCJob;
41class XrdOucEnv;
42class XrdOucErrInfo;
44class XrdOucTList;
45class XrdSecEntity;
46
48{
49public:
50
51struct Facts
52 {const char *Key;
53 const char *Lfn;
54 const char *Pfn;
55 const char *Org;
56 const char *Dst;
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
67static
68const char *AddAuth(const char *auth, const char *avar);
69
70static void Allow(char *vDN, char *vGN, char *vHN, char *vVO);
71
72static int Authorize(XrdOfsTPC **theTPC,
73 Facts &Args,
74 int isPLE=0);
75
76static
77const char *credPath() {return cPath;}
78
79virtual void Del() {}
80
81static void Init();
82
83static void Init(XrdAccAuthorize *accP) {fsAuth = accP;}
84
85static const int reqALL = 0;
86static const int reqDST = 1;
87static const int reqORG = 2;
88
89static void Require(const char *Auth, int RType);
90
91static int Restrict(const char *Path);
92
93static int Start();
94
95virtual int Sync(XrdOucErrInfo *error) {return 0;}
96
97static 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
107virtual ~XrdOfsTPC() {}
108
110
111protected:
112
113static int Death(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
114static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
115static int genOrg(const XrdSecEntity *client, char *Buff, int Blen);
116static int getTTL(XrdOucEnv *Env);
117static int Screen(Facts &Args, XrdOucTList *tP, int wasEnc=0);
118static char *Verify(const char *Who,const char *Name,char *Buf,int Blen);
119
121
124static char *cPath;
125
126static XrdOfsTPCAllow *ALList;
128
129 char Refs; // Reference count
130 char inQ; // Object in queue
131};
132#endif
Definition XrdAccAuthorize.hh:68
Definition XrdOfsTPCInfo.hh:42
Definition XrdOfsTPCJob.hh:39
Definition XrdOfsTPC.hh:48
virtual int Sync(XrdOucErrInfo *error)
Definition XrdOfsTPC.hh:95
static void Init()
static XrdAccAuthorize * fsAuth
Definition XrdOfsTPC.hh:120
static XrdOucPListAnchor * RPList
Definition XrdOfsTPC.hh:127
XrdOfsTPC()
Definition XrdOfsTPC.hh:99
static const int reqDST
Definition XrdOfsTPC.hh:86
static const char * credPath()
Definition XrdOfsTPC.hh:77
static const char * AddAuth(const char *auth, const char *avar)
char Refs
Definition XrdOfsTPC.hh:129
static int Screen(Facts &Args, XrdOucTList *tP, int wasEnc=0)
static int Validate(XrdOfsTPC **theTPC, Facts &Args)
static int Death(Facts &Args, const char *eMsg, int eCode, int nomsg=0)
static char * cPath
Definition XrdOfsTPC.hh:124
static int Authorize(XrdOfsTPC **theTPC, Facts &Args, int isPLE=0)
static XrdOucTList * AuthDst
Definition XrdOfsTPC.hh:122
static int Restrict(const char *Path)
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
virtual ~XrdOfsTPC()
Definition XrdOfsTPC.hh:107
static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0)
static XrdOucTList * AuthOrg
Definition XrdOfsTPC.hh:123
virtual void Del()
Definition XrdOfsTPC.hh:79
static const int reqORG
Definition XrdOfsTPC.hh:87
static char * Verify(const char *Who, const char *Name, char *Buf, int Blen)
XrdOfsTPCInfo Info
Definition XrdOfsTPC.hh:109
static int Start()
char inQ
Definition XrdOfsTPC.hh:130
static void Init(XrdAccAuthorize *accP)
Definition XrdOfsTPC.hh:83
static int genOrg(const XrdSecEntity *client, char *Buff, int Blen)
static const int reqALL
Definition XrdOfsTPC.hh:85
static XrdOfsTPCAllow * ALList
Definition XrdOfsTPC.hh:126
static int getTTL(XrdOucEnv *Env)
static void Require(const char *Auth, int RType)
static void Allow(char *vDN, char *vGN, char *vHN, char *vVO)
Definition XrdOucEnv.hh:42
Definition XrdOucErrInfo.hh:101
Definition XrdOucPList.hh:89
Definition XrdOucTList.hh:42
Definition XrdSecEntity.hh:65
Definition XrdOfsTPC.hh:52
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