00001 #ifndef __CMS_FINDER__
00002 #define __CMS_FINDER__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "XrdCms/XrdCmsClient.hh"
00034
00035 #include "XrdSys/XrdSysPthread.hh"
00036
00037 class XrdCmsClientMan;
00038 class XrdOss;
00039 class XrdOucEnv;
00040 class XrdOucErrInfo;
00041 class XrdOucTList;
00042 struct XrdCmsData;
00043 class XrdCmsRRData;
00044 struct XrdSfsPrep;
00045 class XrdSysLogger;
00046 struct XrdVersionInfo;
00047
00048
00049
00050
00051
00052 class XrdCmsFinderRMT : public XrdCmsClient
00053 {
00054 public:
00055 void Added(const char *path, int Pend=0) {}
00056
00057 int Configure(const char *cfn, char *Args, XrdOucEnv *EnvInfo);
00058
00059 int Forward(XrdOucErrInfo &Resp, const char *cmd,
00060 const char *arg1=0, const char *arg2=0,
00061 XrdOucEnv *Env1=0, XrdOucEnv *Env2=0);
00062
00063 int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00064 XrdOucEnv *Info=0);
00065
00066 XrdOucTList *Managers() {return myManList;}
00067
00068 int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs,
00069 XrdOucEnv *Info=0);
00070
00071 void Removed(const char *path) {}
00072
00073 void setSS(XrdOss *thess) {}
00074
00075 int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *Info=0);
00076
00077 static bool VCheck(XrdVersionInfo &urVersion);
00078
00079 XrdCmsFinderRMT(XrdSysLogger *lp, int whoami=0, int Port=0);
00080 ~XrdCmsFinderRMT();
00081
00082 static const int MaxMan = 15;
00083
00084 private:
00085 int Decode(char **resp);
00086 void Inform(XrdCmsClientMan *xman, struct iovec xmsg[], int xnum);
00087 int LocLocal(XrdOucErrInfo &Resp, XrdOucEnv *Env);
00088 XrdCmsClientMan *SelectManager(XrdOucErrInfo &Resp, const char *path);
00089 void SelectManFail(XrdOucErrInfo &Resp);
00090 int send2Man(XrdOucErrInfo &, const char *, struct iovec *, int);
00091 int StartManagers(XrdOucTList *);
00092
00093 XrdCmsClientMan *myManTable[MaxMan];
00094 XrdCmsClientMan *myManagers;
00095 XrdOucTList *myManList;
00096 int myManCount;
00097 XrdSysMutex myData;
00098 char *CMSPath;
00099 int ConWait;
00100 int RepDelay;
00101 int RepNone;
00102 int RepWait;
00103 int FwdWait;
00104 int PrepWait;
00105 int isMeta;
00106 int isProxy;
00107 int isTarget;
00108 int myPort;
00109 unsigned char SMode;
00110 unsigned char sendID;
00111 unsigned char savePath;
00112 };
00113
00114
00115
00116
00117
00118 class XrdOucStream;
00119 class XrdOucTList;
00120
00121 class XrdCmsFinderTRG : public XrdCmsClient
00122 {
00123 public:
00124 void Added(const char *path, int Pend=0);
00125
00126 int Configure(const char *cfn, char *Args, XrdOucEnv *EnvInfo);
00127
00128 int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00129 XrdOucEnv *Info=0);
00130
00131 int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs,
00132 XrdOucEnv *Info=0) {return 0;}
00133
00134 XrdOucTList *Managers() {return myManList;}
00135
00136 void Removed(const char *path);
00137
00138 void Resume (int Perm=1);
00139 void Suspend(int Perm=1);
00140
00141 int Resource(int n);
00142 int Reserve (int n);
00143 int Release (int n);
00144
00145 int RunAdmin(char *Path, const char *vnid);
00146
00147 int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *envP=0)
00148 {return 0;}
00149
00150 void *Start();
00151
00152 static bool VCheck(XrdVersionInfo &urVersion);
00153
00154 XrdCmsFinderTRG(XrdSysLogger *, int, int, XrdOss *theSS=0);
00155 ~XrdCmsFinderTRG();
00156
00157 private:
00158
00159 void Hookup();
00160 int Process(XrdCmsRRData &Data);
00161
00162 XrdOss *SS;
00163 char *CMSPath;
00164 char *Login;
00165 XrdOucTList *myManList;
00166 XrdOucStream *CMSp;
00167 XrdSysMutex myData;
00168 XrdSysMutex rrMutex;
00169 int resMax;
00170 int resCur;
00171 int myPort;
00172 int isRedir;
00173 int isProxy;
00174 int Active;
00175 };
00176 #endif