xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XrdCmsRedirLocal.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
3 // Author: Paul-Niklas Kramp <p.n.kramp@gsi.de>
4 // Jan Knedlik <j.knedlik@gsi.de>
5 //------------------------------------------------------------------------------
6 // XRootD is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU Lesser General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // XRootD is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
18 //------------------------------------------------------------------------------
19 
20 
21 /* README:
22  Options for xrootd config
23  - Enable:
24  - Enable with ofs.cmslib libXrdCmsRedirectLocal.so
25  - allow only readonly request to be redirected to local, default is false
26  - XrdCmsRedirLocal.readonlyredirect true
27 */
28 
29 #ifndef XRDCMSREDIRPLUGIN_HH_
30 #define XRDCMSREDIRPLUGIN_HH_
31 #include <XrdCms/XrdCmsFinder.hh>
32 #include <XrdCms/XrdCmsClient.hh>
33 #include <XrdNet/XrdNetAddr.hh>
34 #include <XrdOss/XrdOss.hh>
35 #include <XrdOuc/XrdOucEnv.hh>
36 #include <XrdSec/XrdSecEntity.hh>
38 #include <XrdOuc/XrdOucStream.hh>
39 #include <XrdOuc/XrdOucString.hh>
40 #include <XrdVersion.hh>
41 #include <string>
42 #include <fcntl.h>
43 
45 public:
46  XrdCmsRedirLocal(XrdSysLogger *Logger, int opMode, int myPort, XrdOss *theSS);
48  int Configure(const char *cfn, char *Parms, XrdOucEnv *EnvInfo);
49  void loadConfig(const char *filename);
50  int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
51  XrdOucEnv *EnvInfo);
52 
53  int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *EnvInfo);
54  void Added(const char *path, int Pend = 0) {
55  nativeCmsFinder->Added(path, Pend);
56  }
57  int Forward(XrdOucErrInfo &Resp, const char *cmd, const char *arg1 = 0,
58  const char *arg2 = 0, XrdOucEnv *Env1 = 0, XrdOucEnv *Env2 = 0) {
59  return nativeCmsFinder->Forward(Resp, cmd, arg1, arg2, Env1, Env2);
60  }
61  int isRemote() { return nativeCmsFinder->isRemote(); }
63  int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs, XrdOucEnv *Info = 0) {
64  return nativeCmsFinder->Prepare(Resp, pargs, Info);
65  }
66  void Removed(const char *path) { return nativeCmsFinder->Removed(path); }
67  void Resume(int Perm = 1) { nativeCmsFinder->Resume(Perm); }
68  void Suspend(int Perm = 1) { nativeCmsFinder->Suspend(Perm); }
69  int Resource(int n) { return nativeCmsFinder->Resource(n); }
70  int Reserve(int n = 1) { return nativeCmsFinder->Reserve(n); }
71  int Release(int n = 1) { return nativeCmsFinder->Release(n); }
72 
73  //---------------------------------------------------------------------------
75  //---------------------------------------------------------------------------
79  std::string localroot;
81 };
82 
83 #endif // XRDCMSREDIRPLUGIN_HH_
virtual int Release(int n=1)
Definition: XrdCmsClient.hh:316
int Configure(const char *cfn, char *Parms, XrdOucEnv *EnvInfo)
std::string localroot
Definition: XrdCmsRedirLocal.hh:79
virtual int Forward(XrdOucErrInfo &Resp, const char *cmd, const char *arg1=0, const char *arg2=0, XrdOucEnv *Env1=0, XrdOucEnv *Env2=0)
Definition: XrdCmsClient.hh:173
int Release(int n=1)
Definition: XrdCmsRedirLocal.hh:71
XrdCmsRedirLocal(XrdSysLogger *Logger, int opMode, int myPort, XrdOss *theSS)
virtual int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs, XrdOucEnv *Info=0)
Definition: XrdCmsClient.hh:244
bool httpRedirect
Definition: XrdCmsRedirLocal.hh:78
XrdSysError Say
Definition: XrdCmsRedirLocal.hh:80
Definition: XrdCmsClient.hh:115
virtual int Reserve(int n=1)
Definition: XrdCmsClient.hh:303
void Suspend(int Perm=1)
Definition: XrdCmsRedirLocal.hh:68
virtual int Resource(int n)
Definition: XrdCmsClient.hh:291
Definition: XrdSysError.hh:89
void Resume(int Perm=1)
Definition: XrdCmsRedirLocal.hh:67
int isRemote()
Definition: XrdCmsRedirLocal.hh:61
Definition: XrdOucErrInfo.hh:100
virtual void Removed(const char *path)
Definition: XrdCmsClient.hh:258
Definition: XrdOucEnv.hh:41
int Reserve(int n=1)
Definition: XrdCmsRedirLocal.hh:70
XrdCmsClient * nativeCmsFinder
used to forward requests to CmsFinder with regular implementation
Definition: XrdCmsRedirLocal.hh:76
virtual void Suspend(int Perm=1)
Definition: XrdCmsClient.hh:276
Definition: XrdOucTList.hh:41
int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *EnvInfo)
Definition: XrdSysLogger.hh:52
int Locate(XrdOucErrInfo &Resp, const char *path, int flags, XrdOucEnv *EnvInfo)
int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs, XrdOucEnv *Info=0)
Definition: XrdCmsRedirLocal.hh:63
void Removed(const char *path)
Definition: XrdCmsRedirLocal.hh:66
XrdOucTList * Managers()
Definition: XrdCmsRedirLocal.hh:62
void Added(const char *path, int Pend=0)
Definition: XrdCmsRedirLocal.hh:54
Definition: XrdOss.hh:497
void loadConfig(const char *filename)
bool readOnlyredirect
Definition: XrdCmsRedirLocal.hh:77
Definition: XrdMacaroonsHandler.hh:18
virtual int isRemote()
Definition: XrdCmsClient.hh:188
Definition: XrdCmsRedirLocal.hh:44
int Resource(int n)
Definition: XrdCmsRedirLocal.hh:69
&lt; Prepare parameters
Definition: XrdSfsInterface.hh:167
int Forward(XrdOucErrInfo &Resp, const char *cmd, const char *arg1=0, const char *arg2=0, XrdOucEnv *Env1=0, XrdOucEnv *Env2=0)
Definition: XrdCmsRedirLocal.hh:57
virtual void Added(const char *path, int Pend=0)
Definition: XrdCmsClient.hh:128
virtual XrdOucTList * Managers()
Definition: XrdCmsClient.hh:232
virtual void Resume(int Perm=1)
Definition: XrdCmsClient.hh:267