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