• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

XrdOdcFinder.hh

Go to the documentation of this file.
00001 #ifndef __ODC_FINDER__
00002 #define __ODC_FINDER__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                       X r d O d c F i n d e r . h h                        */
00006 /*                                                                            */
00007 /* (c) 2003 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-AC03-76-SFO0515 with the Department of Energy              */
00011 /******************************************************************************/
00012 
00013 //          $Id: XrdOdcFinder.hh,v 1.12 2007/07/31 02:24:54 abh Exp $
00014 
00015 #include "XrdOdc/XrdOdcConfDefs.hh"
00016 #include "XrdSys/XrdSysPthread.hh"
00017 
00018 class  XrdOdcManager;
00019 class  XrdOucEnv;
00020 class  XrdSysError;
00021 class  XrdOucErrInfo;
00022 class  XrdSysLogger;
00023 class  XrdOucTList;
00024 struct XrdOdcData;
00025 struct XrdSfsPrep;
00026 
00027 // The following return conventions are use by Forward(), Locate(), & Prepare()
00028 //
00029 // Return Val   Resp.errcode          Resp.errtext
00030 // ---------    -------------------   --------
00031 // -EREMOTE     port (0 for default)  Host name
00032 // -EINPROGRESS n/a                   n/a
00033 // -EEXIST      Length of errtext     Data to be returned to client as response
00034 // > 0          Wait time (= retval)  Reason for wait
00035 // < 0          Error number          Error message
00036 // = 0          Not applicable        Not applicable (see below)
00037 //                                    Forward() -> Request forwarded
00038 //                                    Locate()  -> Redirection does not apply
00039 //                                    Prepare() -> Request submitted
00040 
00041 class XrdOdcFinder
00042 {
00043 public:
00044 virtual int    Configure(char *cfn) = 0;
00045 
00046 virtual int    Forward(XrdOucErrInfo &Resp, const char *cmd, 
00047                        const char *arg1=0, const char *arg2=0) = 0;
00048 
00049 virtual int    isRemote() {return myPersona == XrdOdcFinder::amRemote;}
00050 
00051 virtual int    Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00052                       XrdOucEnv *Info=0) = 0;
00053 
00054 virtual int    Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs) = 0;
00055 
00056         enum   Persona {amLocal, amProxy, amRemote, amTarget};
00057 
00058                XrdOdcFinder(XrdSysLogger *lp, Persona acting);
00059 virtual       ~XrdOdcFinder() {}
00060 
00061 protected:
00062 
00063 Persona myPersona;
00064 static char *OLBPath;
00065 };
00066 
00067 /******************************************************************************/
00068 /*                         R e m o t e   F i n d e r                          */
00069 /******************************************************************************/
00070 
00071 #define XRDODCMAXMAN 16
00072 
00073 #define XrdOdcIsProxy  1
00074 #define XrdOdcIsRedir  2
00075 #define XrdOdcIsTarget 4
00076   
00077 class XrdOdcFinderRMT : public XrdOdcFinder
00078 {
00079 public:
00080         int    Configure(char *cfn);
00081 
00082         int    Forward(XrdOucErrInfo &Resp, const char *cmd, 
00083                        const char *arg1=0, const char *arg2=0);
00084 
00085         int    Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00086                       XrdOucEnv *Info=0);
00087 
00088         int    Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs);
00089 
00090                XrdOdcFinderRMT(XrdSysLogger *lp, int whoami = 0);
00091               ~XrdOdcFinderRMT();
00092 
00093 private:
00094 int            Decode(char **resp);
00095 XrdOdcManager *SelectManager(XrdOucErrInfo &Resp, const char *path);
00096 void           SelectManFail(XrdOucErrInfo &Resp);
00097 int            send2Man(XrdOucErrInfo &, const char *, struct iovec *, int);
00098 int            StartManagers(XrdOucTList *);
00099 
00100 XrdOdcManager *myManTable[XRDODCMAXMAN];
00101 XrdOdcManager *myManagers;
00102 int            myManCount;
00103 XrdSysMutex    myData;
00104 int            ConWait;
00105 int            RepDelay;
00106 int            RepNone;
00107 int            RepWait;
00108 int            PrepWait;
00109 int            isTarget;
00110 unsigned char  SMode;
00111 };
00112 
00113 /******************************************************************************/
00114 /*                         T a r g e t   F i n d e r                          */
00115 /******************************************************************************/
00116 
00117 class XrdOucStream;
00118   
00119 class XrdOdcFinderTRG : public XrdOdcFinder
00120 {
00121 public:
00122         void   Added(const char *path);
00123 
00124         int    Configure(char *cfn);
00125 
00126         int    Forward(XrdOucErrInfo &Resp, const char *cmd,
00127                        const char *arg1=0, const char *arg2=0) {return 0;}
00128 
00129         int    Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00130                       XrdOucEnv *Info=0) {return 0;}
00131 
00132         int    Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs) {return 0;}
00133 
00134         void   Removed(const char *path);
00135 
00136         void  *Start();
00137 
00138                XrdOdcFinderTRG(XrdSysLogger *lp, int whoami, int port);
00139               ~XrdOdcFinderTRG();
00140 
00141 private:
00142 
00143 void  Hookup();
00144 
00145 XrdOucStream  *OLBp;
00146 XrdSysMutex    myData;
00147 int            myPort;
00148 char          *OLBPath;
00149 char          *Login;
00150 int            isRedir;
00151 int            isProxy;
00152 int            Active;
00153 };
00154 #endif

Generated on Wed Sep 1 2010 for xrootd by  doxygen 1.7.1