Go to the documentation of this file.00001 #ifndef __ODC_FINDER__
00002 #define __ODC_FINDER__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "XrdOdc/XrdOdcConfDefs.hh"
00016 #include "XrdSys/XrdSysPthread.hh"
00017
00018 class XrdOdcManager;
00019 class XrdOucEnv;
00020 class XrdSysError;
00021 class XrdOucErrInfo;
00022 class XrdSysLogger;
00023 class XrdOucTList;
00024 struct XrdOdcData;
00025 struct XrdSfsPrep;
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class XrdOdcFinder
00042 {
00043 public:
00044 virtual int Configure(char *cfn) = 0;
00045
00046 virtual int Forward(XrdOucErrInfo &Resp, const char *cmd,
00047 const char *arg1=0, const char *arg2=0) = 0;
00048
00049 virtual int isRemote() {return myPersona == XrdOdcFinder::amRemote;}
00050
00051 virtual int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00052 XrdOucEnv *Info=0) = 0;
00053
00054 virtual int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs) = 0;
00055
00056 enum Persona {amLocal, amProxy, amRemote, amTarget};
00057
00058 XrdOdcFinder(XrdSysLogger *lp, Persona acting);
00059 virtual ~XrdOdcFinder() {}
00060
00061 protected:
00062
00063 Persona myPersona;
00064 static char *OLBPath;
00065 };
00066
00067
00068
00069
00070
00071 #define XRDODCMAXMAN 16
00072
00073 #define XrdOdcIsProxy 1
00074 #define XrdOdcIsRedir 2
00075 #define XrdOdcIsTarget 4
00076
00077 class XrdOdcFinderRMT : public XrdOdcFinder
00078 {
00079 public:
00080 int Configure(char *cfn);
00081
00082 int Forward(XrdOucErrInfo &Resp, const char *cmd,
00083 const char *arg1=0, const char *arg2=0);
00084
00085 int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00086 XrdOucEnv *Info=0);
00087
00088 int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs);
00089
00090 XrdOdcFinderRMT(XrdSysLogger *lp, int whoami = 0);
00091 ~XrdOdcFinderRMT();
00092
00093 private:
00094 int Decode(char **resp);
00095 XrdOdcManager *SelectManager(XrdOucErrInfo &Resp, const char *path);
00096 void SelectManFail(XrdOucErrInfo &Resp);
00097 int send2Man(XrdOucErrInfo &, const char *, struct iovec *, int);
00098 int StartManagers(XrdOucTList *);
00099
00100 XrdOdcManager *myManTable[XRDODCMAXMAN];
00101 XrdOdcManager *myManagers;
00102 int myManCount;
00103 XrdSysMutex myData;
00104 int ConWait;
00105 int RepDelay;
00106 int RepNone;
00107 int RepWait;
00108 int PrepWait;
00109 int isTarget;
00110 unsigned char SMode;
00111 };
00112
00113
00114
00115
00116
00117 class XrdOucStream;
00118
00119 class XrdOdcFinderTRG : public XrdOdcFinder
00120 {
00121 public:
00122 void Added(const char *path);
00123
00124 int Configure(char *cfn);
00125
00126 int Forward(XrdOucErrInfo &Resp, const char *cmd,
00127 const char *arg1=0, const char *arg2=0) {return 0;}
00128
00129 int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00130 XrdOucEnv *Info=0) {return 0;}
00131
00132 int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs) {return 0;}
00133
00134 void Removed(const char *path);
00135
00136 void *Start();
00137
00138 XrdOdcFinderTRG(XrdSysLogger *lp, int whoami, int port);
00139 ~XrdOdcFinderTRG();
00140
00141 private:
00142
00143 void Hookup();
00144
00145 XrdOucStream *OLBp;
00146 XrdSysMutex myData;
00147 int myPort;
00148 char *OLBPath;
00149 char *Login;
00150 int isRedir;
00151 int isProxy;
00152 int Active;
00153 };
00154 #endif