xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XrdCmsManager.hh
Go to the documentation of this file.
1 #ifndef __CMS_MANAGER__H
2 #define __CMS_MANAGER__H
3 /******************************************************************************/
4 /* */
5 /* X r d C m s M a n a g e r . h h */
6 /* */
7 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include <cstdlib>
34 #include <cstring>
35 #include <strings.h>
36 
37 #include "XProtocol/YProtocol.hh"
38 
39 #include "XrdCms/XrdCmsManList.hh"
40 #include "XrdCms/XrdCmsTypes.hh"
41 #include "XrdSys/XrdSysPthread.hh"
42 
43 class XrdLink;
44 class XrdCmsManList;
45 class XrdCmsManTree;
46 class XrdCmsNode;
47 class XrdOucTList;
48 
49 /******************************************************************************/
50 /* C l a s s X r d C m s M a n a g e r */
51 /******************************************************************************/
52 
53 // This a single-instance global class
54 //
56 {
57 public:
58 friend class XrdCmsDelNode;
59 
62 
63 static const int MTMax = 16; // Maximum number of Managers
64 
65 XrdCmsNode *Add(XrdLink *lp, int Lvl, bool &xit);
66 
67 void Delete(XrdCmsNode *nodeP);
68 
69 void Finished(const char *manP, int mPort);
70 
71 static void Inform(const char *What, const char *Data, int Dlen);
72 static void Inform(const char *What, struct iovec *vP, int vN, int vT=0);
73 static void Inform(XrdCms::CmsReqCode rCode, int rMod, const char *Arg=0, int Alen=0);
74 static void Inform(XrdCms::CmsRRHdr &Hdr, const char *Arg=0, int Alen=0);
75 
76 static bool Present() {return MTHi >= 0;};
77 
78 void Remove(XrdCmsNode *nP, const char *reason=0);
79 
80 void Rerun(char *newMans);
81 
82 static void Reset();
83 
84 static bool Start(const XrdOucTList *mL);
85 
86  bool Verify(XrdLink *lP, const char *sid, const char *sname);
87 
88  XrdCmsManager(XrdOucTList *mlP, int snum);
89  ~XrdCmsManager() {} // This object should never be deleted
90 
91 private:
92 int Run(XrdOucTList *manP);
93 
94 // The following are common across all manager instances
95 //
98 static char MastSID[MTMax];
99 static int MTHi;
100 
101 // The following are specific to a manager instance
102 //
105 char *theSite;
106 char *theHost;
107 char *theSID;
109 short siteID;
110 bool wasRedir;
111 };
112 #endif
Definition: XrdCmsManager.hh:55
Definition: XrdCmsManTree.hh:38
void Finished(const char *manP, int mPort)
Definition: XrdCmsManList.hh:39
int Run(XrdOucTList *manP)
static char MastSID[MTMax]
Definition: XrdCmsManager.hh:98
void Delete(XrdCmsNode *nodeP)
char * theHost
Definition: XrdCmsManager.hh:106
XrdCmsNode * Add(XrdLink *lp, int Lvl, bool &xit)
CmsReqCode
Definition: YProtocol.hh:89
static void Reset()
Definition: YProtocol.hh:82
XrdOucTList * curManList
Definition: XrdCmsManager.hh:104
void Remove(XrdCmsNode *nP, const char *reason=0)
bool Verify(XrdLink *lP, const char *sid, const char *sname)
void Rerun(char *newMans)
char * theSID
Definition: XrdCmsManager.hh:107
XrdCmsManList * myMans
Definition: XrdCmsManager.hh:60
short siteID
Definition: XrdCmsManager.hh:109
Definition: XrdSysPthread.hh:164
static XrdCmsNode * MastTab[MTMax]
Definition: XrdCmsManager.hh:97
friend class XrdCmsDelNode
Definition: XrdCmsManager.hh:58
XrdCmsManTree * ManTree
Definition: XrdCmsManager.hh:61
char * theSite
Definition: XrdCmsManager.hh:105
static XrdSysMutex MTMutex
Definition: XrdCmsManager.hh:96
XrdOucTList * newManList
Definition: XrdCmsManager.hh:103
static int MTHi
Definition: XrdCmsManager.hh:99
Definition: XrdOucTList.hh:41
static const int MTMax
Definition: XrdCmsManager.hh:63
static void Inform(const char *What, const char *Data, int Dlen)
static bool Start(const XrdOucTList *mL)
Definition: XrdCmsNode.hh:57
int curManCnt
Definition: XrdCmsManager.hh:108
~XrdCmsManager()
Definition: XrdCmsManager.hh:89
XrdCmsManager(XrdOucTList *mlP, int snum)
static bool Present()
Definition: XrdCmsManager.hh:76
bool wasRedir
Definition: XrdCmsManager.hh:110