xrootd
|
00001 #ifndef __CMS_FINDER__ 00002 #define __CMS_FINDER__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C m s F i n d e r . h h */ 00006 /* */ 00007 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id$ 00014 00015 #include "XrdCms/XrdCmsClient.hh" 00016 00017 #include "XrdSys/XrdSysPthread.hh" 00018 00019 class XrdCmsClientMan; 00020 class XrdOss; 00021 class XrdOucEnv; 00022 class XrdOucErrInfo; 00023 class XrdOucTList; 00024 struct XrdCmsData; 00025 class XrdCmsRRData; 00026 struct XrdSfsPrep; 00027 class XrdSysLogger; 00028 00029 /******************************************************************************/ 00030 /* R e m o t e F i n d e r */ 00031 /******************************************************************************/ 00032 00033 class XrdCmsFinderRMT : public XrdCmsClient 00034 { 00035 public: 00036 void Added(const char *path, int Pend=0) {} 00037 00038 int Configure(char *cfn); 00039 00040 int Forward(XrdOucErrInfo &Resp, const char *cmd, 00041 const char *arg1=0, const char *arg2=0, 00042 const char *arg3=0, const char *arg4=0); 00043 00044 int Locate(XrdOucErrInfo &Resp, const char *path, int flags, 00045 XrdOucEnv *Info=0); 00046 00047 int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs); 00048 00049 void Removed(const char *path) {} 00050 00051 void setSS(XrdOss *thess) {} 00052 00053 int Space(XrdOucErrInfo &Resp, const char *path); 00054 00055 XrdCmsFinderRMT(XrdSysLogger *lp, int whoami=0, int Port=0); 00056 ~XrdCmsFinderRMT(); 00057 00058 static const int MaxMan = 16; 00059 00060 private: 00061 int Decode(char **resp); 00062 void Inform(XrdCmsClientMan *xman, struct iovec xmsg[], int xnum); 00063 XrdCmsClientMan *SelectManager(XrdOucErrInfo &Resp, const char *path); 00064 void SelectManFail(XrdOucErrInfo &Resp); 00065 int send2Man(XrdOucErrInfo &, const char *, struct iovec *, int); 00066 int StartManagers(XrdOucTList *); 00067 00068 XrdCmsClientMan *myManTable[MaxMan]; 00069 XrdCmsClientMan *myManagers; 00070 int myManCount; 00071 XrdSysMutex myData; 00072 char *CMSPath; 00073 int ConWait; 00074 int RepDelay; 00075 int RepNone; 00076 int RepWait; 00077 int FwdWait; 00078 int PrepWait; 00079 int isMeta; 00080 int isTarget; 00081 int myPort; 00082 unsigned char SMode; 00083 unsigned char sendID; 00084 }; 00085 00086 /******************************************************************************/ 00087 /* T a r g e t F i n d e r */ 00088 /******************************************************************************/ 00089 00090 class XrdOucStream; 00091 00092 class XrdCmsFinderTRG : public XrdCmsClient 00093 { 00094 public: 00095 void Added(const char *path, int Pend=0); 00096 00097 int Configure(char *cfn); 00098 00099 int Forward(XrdOucErrInfo &Resp, const char *cmd, 00100 const char *arg1=0, const char *arg2=0, 00101 const char *arg3=0, const char *arg4=0) {return 0;} 00102 00103 int Locate(XrdOucErrInfo &Resp, const char *path, int flags, 00104 XrdOucEnv *Info=0) {return 0;} 00105 00106 int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs) {return 0;} 00107 00108 void Removed(const char *path); 00109 00110 int RunAdmin(char *Path); 00111 00112 int Space(XrdOucErrInfo &Resp, const char *path) {return 0;} 00113 00114 void *Start(); 00115 00116 XrdCmsFinderTRG(XrdSysLogger *, int, int, XrdOss *theSS=0); 00117 ~XrdCmsFinderTRG(); 00118 00119 private: 00120 00121 void Hookup(); 00122 int Process(XrdCmsRRData &Data); 00123 00124 XrdOss *SS; 00125 XrdOucStream *CMSp; 00126 XrdSysMutex myData; 00127 int myPort; 00128 char *CMSPath; 00129 char *Login; 00130 int isRedir; 00131 int isProxy; 00132 int Active; 00133 }; 00134 00135 namespace XrdCms 00136 { 00137 enum {IsProxy = 1, IsRedir = 2, IsTarget = 4, IsMeta = 8}; 00138 } 00139 #endif