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 PrepWait; 00078 int isMeta; 00079 int isTarget; 00080 int myPort; 00081 unsigned char SMode; 00082 unsigned char sendID; 00083 }; 00084 00085 /******************************************************************************/ 00086 /* T a r g e t F i n d e r */ 00087 /******************************************************************************/ 00088 00089 class XrdOucStream; 00090 00091 class XrdCmsFinderTRG : public XrdCmsClient 00092 { 00093 public: 00094 void Added(const char *path, int Pend=0); 00095 00096 int Configure(char *cfn); 00097 00098 int Forward(XrdOucErrInfo &Resp, const char *cmd, 00099 const char *arg1=0, const char *arg2=0, 00100 const char *arg3=0, const char *arg4=0) {return 0;} 00101 00102 int Locate(XrdOucErrInfo &Resp, const char *path, int flags, 00103 XrdOucEnv *Info=0) {return 0;} 00104 00105 int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs) {return 0;} 00106 00107 void Removed(const char *path); 00108 00109 int RunAdmin(char *Path); 00110 00111 int Space(XrdOucErrInfo &Resp, const char *path) {return 0;} 00112 00113 void *Start(); 00114 00115 XrdCmsFinderTRG(XrdSysLogger *, int, int, XrdOss *theSS=0); 00116 ~XrdCmsFinderTRG(); 00117 00118 private: 00119 00120 void Hookup(); 00121 int Process(XrdCmsRRData &Data); 00122 00123 XrdOss *SS; 00124 XrdOucStream *CMSp; 00125 XrdSysMutex myData; 00126 int myPort; 00127 char *CMSPath; 00128 char *Login; 00129 int isRedir; 00130 int isProxy; 00131 int Active; 00132 }; 00133 00134 namespace XrdCms 00135 { 00136 enum {IsProxy = 1, IsRedir = 2, IsTarget = 4, IsMeta = 8}; 00137 } 00138 #endif