|
xrootd
|
00001 #ifndef __CMS_PROTOCOL_H__ 00002 #define __CMS_PROTOCOL_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C m s P r o t o c o l . 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 "Xrd/XrdProtocol.hh" 00014 #include "XrdCms/XrdCmsParser.hh" 00015 #include "XrdCms/XrdCmsTypes.hh" 00016 #include "XrdSys/XrdSysPthread.hh" 00017 00018 class XrdLink; 00019 class XrdCmsNode; 00020 class XrdCmsRRData; 00021 class XrdCmsRouting; 00022 00023 class XrdCmsProtocol : public XrdProtocol 00024 { 00025 friend class XrdCmsJob; 00026 public: 00027 00028 static XrdCmsProtocol *Alloc(const char *theRole = "", 00029 const char *theMan = 0, int thePort=0); 00030 00031 void DoIt(); 00032 00033 int Execute(XrdCmsRRData &Data); 00034 00035 XrdProtocol *Match(XrdLink *lp); // Upon accept 00036 00037 int Process(XrdLink *lp); // Initial entry 00038 00039 void Recycle(XrdLink *lp, int consec, const char *reason); 00040 00041 int Stats(char *buff, int blen, int do_sync=0); 00042 00043 XrdCmsProtocol() : XrdProtocol("cms protocol handler"), 00044 ProtLink(0), myRole("?"), myNode(0), RSlot(0) 00045 {} 00046 ~XrdCmsProtocol() {} 00047 00048 private: 00049 00050 XrdCmsRouting *Admit(); 00051 XrdCmsRouting *Admit_DataServer(int); 00052 XrdCmsRouting *Admit_Redirector(int); 00053 XrdCmsRouting *Admit_Supervisor(int); 00054 SMask_t AddPath(XrdCmsNode *nP, const char *pType, const char *Path); 00055 int Authenticate(); 00056 void ConfigCheck(unsigned char *theConfig); 00057 enum Bearing {isDown, isLateral, isUp}; 00058 const char *Dispatch(Bearing cDir, int maxWait, int maxTries); 00059 XrdCmsRouting *Login_Failed(const char *Reason); 00060 void Pander(const char *manager, int mport); 00061 void Reissue(XrdCmsRRData &Data); 00062 void Reply_Delay(XrdCmsRRData &Data, kXR_unt32 theDelay); 00063 void Reply_Error(XrdCmsRRData &Data, int ecode, const char *etext); 00064 00065 static XrdSysMutex ProtMutex; 00066 static XrdCmsProtocol *ProtStack; 00067 static XrdCmsParser ProtArgs; 00068 XrdCmsProtocol *ProtLink; 00069 00070 XrdCmsRouting *Routing; // Request routing for this instance 00071 00072 static const int maxReqSize = 16384; 00073 00074 XrdLink *Link; 00075 static int readWait; 00076 const char *myRole; 00077 const char *myMan; 00078 int myManPort; 00079 XrdCmsNode *myNode; 00080 short RSlot; // True only for redirectors 00081 char loggedIn; // True of login succeeded 00082 }; 00083 #endif
1.7.5