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
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
81struct 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
101static void Init(iParm &Parms);
102
103static void Init(XrdAccAuthorize *accP) {fsAuth = accP;}
104
105static const int reqALL = 0;
106static const int reqDST = 1;
107static const int reqORG = 2;
108
109static void Require(const char *Auth, int RType);
110
111static int Restrict(const char *Path);
112
113static int Start();
114
115virtual int Sync(XrdOucErrInfo *error) {return 0;}
116
117static 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
127virtual ~XrdOfsTPC() {}
128
130
131protected:
132
133static int Death(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
134static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0);
135static int genOrg(const XrdSecEntity *client, char *Buff, int Blen);
136static int getTTL(XrdOucEnv *Env);
137static int Screen(Facts &Args, XrdOucTList *tP, int wasEnc=0);
138static char *Verify(const char *Who,const char *Name,char *Buf,int Blen);
139
141
144static char *cPath;
145
146static XrdOfsTPCAllow *ALList;
148static int maxTTL;
149static int dflTTL;
150
151 char Refs; // Reference count
152 char inQ; // Object in queue
153};
154#endif
Definition: XrdAccAuthorize.hh:65
Definition: XrdOfsTPCInfo.hh:42
Definition: XrdOfsTPCJob.hh:39
Definition: XrdOfsTPC.hh:48
virtual int Sync(XrdOucErrInfo *error)
Definition: XrdOfsTPC.hh:115
static XrdAccAuthorize * fsAuth
Definition: XrdOfsTPC.hh:140
static XrdOucPListAnchor * RPList
Definition: XrdOfsTPC.hh:147
XrdOfsTPC()
Definition: XrdOfsTPC.hh:119
static const int reqDST
Definition: XrdOfsTPC.hh:106
static const char * credPath()
Definition: XrdOfsTPC.hh:77
static const char * AddAuth(const char *auth, const char *avar)
char Refs
Definition: XrdOfsTPC.hh:151
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:144
static int Authorize(XrdOfsTPC **theTPC, Facts &Args, int isPLE=0)
static XrdOucTList * AuthDst
Definition: XrdOfsTPC.hh:142
static int Restrict(const char *Path)
static int maxTTL
Definition: XrdOfsTPC.hh:148
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
virtual ~XrdOfsTPC()
Definition: XrdOfsTPC.hh:127
static int Fatal(Facts &Args, const char *eMsg, int eCode, int nomsg=0)
static XrdOucTList * AuthOrg
Definition: XrdOfsTPC.hh:143
virtual void Del()
Definition: XrdOfsTPC.hh:79
static const int reqORG
Definition: XrdOfsTPC.hh:107
static char * Verify(const char *Who, const char *Name, char *Buf, int Blen)
XrdOfsTPCInfo Info
Definition: XrdOfsTPC.hh:129
static int Start()
static void Init(iParm &Parms)
static int dflTTL
Definition: XrdOfsTPC.hh:149
char inQ
Definition: XrdOfsTPC.hh:152
static void Init(XrdAccAuthorize *accP)
Definition: XrdOfsTPC.hh:103
static int genOrg(const XrdSecEntity *client, char *Buff, int Blen)
static const int reqALL
Definition: XrdOfsTPC.hh:105
static XrdOfsTPCAllow * ALList
Definition: XrdOfsTPC.hh:146
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:100
Definition: XrdOucPList.hh:89
Definition: XrdOucTList.hh:42
Definition: XrdSecEntity.hh:52
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
Definition: XrdOfsTPC.hh:81
int Logok
Definition: XrdOfsTPC.hh:87
int Strm
Definition: XrdOfsTPC.hh:88
char * Pgm
Definition: XrdOfsTPC.hh:81
char * Ckst
Definition: XrdOfsTPC.hh:82
signed char autoRM
Definition: XrdOfsTPC.hh:93
signed char oidsOK
Definition: XrdOfsTPC.hh:94
int Maxttl
Definition: XrdOfsTPC.hh:86
iParm()
Definition: XrdOfsTPC.hh:95
int Dflttl
Definition: XrdOfsTPC.hh:85
char * cpath
Definition: XrdOfsTPC.hh:83
signed char Grab
Definition: XrdOfsTPC.hh:91
int Xmax
Definition: XrdOfsTPC.hh:90
signed char xEcho
Definition: XrdOfsTPC.hh:92
int SMax
Definition: XrdOfsTPC.hh:89
int fCreds
Definition: XrdOfsTPC.hh:84