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 /* This file is part of the XRootD software suite.                            */
00013 /*                                                                            */
00014 /* XRootD is free software: you can redistribute it and/or modify it under    */
00015 /* the terms of the GNU Lesser General Public License as published by the     */
00016 /* Free Software Foundation, either version 3 of the License, or (at your     */
00017 /* option) any later version.                                                 */
00018 /*                                                                            */
00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00021 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00022 /* License for more details.                                                  */
00023 /*                                                                            */
00024 /* You should have received a copy of the GNU Lesser General Public License   */
00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00026 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00027 /*                                                                            */
00028 /* The copyright holder's institutional names and contributor's names may not */
00029 /* be used to endorse or promote products derived from this software without  */
00030 /* specific prior written permission of the institution or contributor.       */
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 /*                         R e m o t e   F i n d e r                          */
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 XrdCmsClientMan *SelectManager(XrdOucErrInfo &Resp, const char *path);
00088 void             SelectManFail(XrdOucErrInfo &Resp);
00089 int              send2Man(XrdOucErrInfo &, const char *, struct iovec *, int);
00090 int              StartManagers(XrdOucTList *);
00091 
00092 XrdCmsClientMan *myManTable[MaxMan];
00093 XrdCmsClientMan *myManagers;
00094 XrdOucTList     *myManList;
00095 int              myManCount;
00096 XrdSysMutex      myData;
00097 char            *CMSPath;
00098 int              ConWait;
00099 int              RepDelay;
00100 int              RepNone;
00101 int              RepWait;
00102 int              FwdWait;
00103 int              PrepWait;
00104 int              isMeta;
00105 int              isProxy;
00106 int              isTarget;
00107 int              myPort;
00108 unsigned char    SMode;
00109 unsigned char    sendID;
00110 unsigned char    savePath;
00111 };
00112 
00113 /******************************************************************************/
00114 /*                         T a r g e t   F i n d e r                          */
00115 /******************************************************************************/
00116 
00117 class XrdOucStream;
00118   
00119 class XrdCmsFinderTRG : public XrdCmsClient
00120 {
00121 public:
00122         void   Added(const char *path, int Pend=0);
00123 
00124         int    Configure(const char *cfn, char *Args, XrdOucEnv *EnvInfo);
00125 
00126         int    Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00127                       XrdOucEnv *Info=0) {return 0;}
00128 
00129         int    Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs,
00130                        XrdOucEnv *Info=0) {return 0;}
00131 
00132         void   Removed(const char *path);
00133 
00134         int    RunAdmin(char *Path);
00135 
00136         int    Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *envP=0)
00137                     {return 0;}
00138 
00139         void  *Start();
00140 
00141 static  bool   VCheck(XrdVersionInfo &urVersion);
00142 
00143                XrdCmsFinderTRG(XrdSysLogger *, int, int, XrdOss *theSS=0);
00144               ~XrdCmsFinderTRG();
00145 
00146 private:
00147 
00148 void  Hookup();
00149 int   Process(XrdCmsRRData &Data);
00150 
00151 XrdOss        *SS;
00152 XrdOucStream  *CMSp;
00153 XrdSysMutex    myData;
00154 int            myPort;
00155 char          *CMSPath;
00156 char          *Login;
00157 int            isRedir;
00158 int            isProxy;
00159 int            Active;
00160 };
00161 #endif