00001 #ifndef __CMS_MANAGER__H
00002 #define __CMS_MANAGER__H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <stdlib.h>
00034 #include <string.h>
00035 #include <strings.h>
00036
00037 #include "XProtocol/YProtocol.hh"
00038
00039 #include "XrdCms/XrdCmsManList.hh"
00040 #include "XrdCms/XrdCmsTypes.hh"
00041 #include "XrdSys/XrdSysPthread.hh"
00042
00043 class XrdLink;
00044 class XrdCmsManList;
00045 class XrdCmsManTree;
00046 class XrdCmsNode;
00047 class XrdOucTList;
00048
00049
00050
00051
00052
00053
00054
00055 class XrdCmsManager
00056 {
00057 public:
00058 friend class XrdCmsDelNode;
00059
00060 XrdCmsManList *myMans;
00061 XrdCmsManTree *ManTree;
00062
00063 static const int MTMax = 16;
00064
00065 XrdCmsNode *Add(XrdLink *lp, int Lvl, bool &xit);
00066
00067 void Delete(XrdCmsNode *nodeP);
00068
00069 void Finished(const char *manP, int mPort);
00070
00071 static void Inform(const char *What, const char *Data, int Dlen);
00072 static void Inform(const char *What, struct iovec *vP, int vN, int vT=0);
00073 static void Inform(XrdCms::CmsReqCode rCode, int rMod, const char *Arg=0, int Alen=0);
00074 static void Inform(XrdCms::CmsRRHdr &Hdr, const char *Arg=0, int Alen=0);
00075
00076 static bool Present() {return MTHi >= 0;};
00077
00078 void Remove(XrdCmsNode *nP, const char *reason=0);
00079
00080 void Rerun(char *newMans);
00081
00082 static void Reset();
00083
00084 static bool Start(const XrdOucTList *mL);
00085
00086 bool Verify(XrdLink *lP, const char *sid, const char *sname);
00087
00088 XrdCmsManager(XrdOucTList *mlP, int snum);
00089 ~XrdCmsManager() {}
00090
00091 private:
00092 int Run(XrdOucTList *manP);
00093
00094
00095
00096 static XrdSysMutex MTMutex;
00097 static XrdCmsNode *MastTab[MTMax];
00098 static char MastSID[MTMax];
00099 static int MTHi;
00100
00101
00102
00103 XrdOucTList *newManList;
00104 XrdOucTList *curManList;
00105 char *theSite;
00106 char *theHost;
00107 char *theSID;
00108 int curManCnt;
00109 short siteID;
00110 bool wasRedir;
00111 };
00112 #endif