xrootd
|
00001 #ifndef __CMS_MANAGER__H 00002 #define __CMS_MANAGER__H 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C m s M a n a g 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 <stdlib.h> 00016 #include <string.h> 00017 #include <strings.h> 00018 00019 #include "XProtocol/YProtocol.hh" 00020 00021 #include "XrdCms/XrdCmsManList.hh" 00022 #include "XrdCms/XrdCmsTypes.hh" 00023 #include "XrdSys/XrdSysPthread.hh" 00024 00025 class XrdLink; 00026 class XrdCmsDrop; 00027 class XrdCmsNode; 00028 class XrdCmsServer; 00029 00030 /******************************************************************************/ 00031 /* C l a s s X r d C m s M a n a g e r */ 00032 /******************************************************************************/ 00033 00034 // This a single-instance global class 00035 // 00036 class XrdCmsManager 00037 { 00038 public: 00039 00040 static const int MTMax = 16; // Maximum number of Managers 00041 00042 XrdCmsNode *Add(XrdLink *lp, int Lvl); 00043 00044 void Inform(const char *What, const char *Data, int Dlen); 00045 void Inform(const char *What, struct iovec *vP, int vN, int vT=0); 00046 void Inform(XrdCms::CmsReqCode rCode, int rMod, const char *Arg=0, int Alen=0); 00047 void Inform(XrdCms::CmsRRHdr &Hdr, const char *Arg=0, int Alen=0); 00048 00049 int Present() {return MTHi >= 0;}; 00050 00051 void Remove(XrdCmsNode *nP, const char *reason=0); 00052 00053 void Reset(); 00054 00055 XrdCmsManager(); 00056 ~XrdCmsManager() {} // This object should never be deleted 00057 00058 private: 00059 00060 XrdSysMutex MTMutex; 00061 XrdCmsNode *MastTab[MTMax]; 00062 00063 int MTHi; 00064 }; 00065 00066 namespace XrdCms 00067 { 00068 extern XrdCmsManager Manager; 00069 } 00070 #endif