xrootd
XrdCmsRouting.hh
Go to the documentation of this file.
1 #ifndef __CMS_ROUTING_H__
2 #define __CMS_ROUTING_H__
3 /******************************************************************************/
4 /* */
5 /* X r d C m s R o u t i n g . 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 
13 #include "XProtocol/YProtocol.hh"
14 
16 {
17 public:
18 
19 enum {isInvalid = 0x00,
20  isSync = 0x02,
21  Forward = 0x04,
22  noArgs = 0x08,
23  Delayable = 0x10,
24  Repliable = 0x20,
25  AsyncQ0 = 0x40,
26  AsyncQ1 = 0x80
27  };
28 
29 struct theRouting {int reqCode; int reqOpts;};
30 
31 inline int getRoute(int reqCode)
32  {return reqCode < XrdCms::kYR_MaxReq
33  ? valVec[reqCode] : isInvalid;
34  }
35 
37  {memset(valVec, 0, sizeof(valVec));
38  do {valVec[initP->reqCode] = initP->reqOpts;
39  } while((++initP)->reqCode);
40  }
42 
43 private:
45 };
46 
47 /******************************************************************************/
48 /* X r d C m s R o u t e r C l a s s */
49 /******************************************************************************/
50 
51 class XrdCmsNode;
52 class XrdCmsRRData;
53 
55 {
56 public:
57 
58 typedef const char *(XrdCmsNode::*NodeMethod_t)(XrdCmsRRData &);
59 
60 struct theRoute {int reqCode; const char *reqName; NodeMethod_t reqMeth;};
61 
62 inline NodeMethod_t getMethod(int Code)
63  {return Code < XrdCms::kYR_MaxReq
64  ? methVec[Code] : (NodeMethod_t)0;
65  }
66 
67 inline const char *getName(int Code)
68  {return Code < XrdCms::kYR_MaxReq && nameVec[Code]
69  ? nameVec[Code] : "?";
70  }
71 
73  {memset(methVec, 0, sizeof(methVec));
74  do {nameVec[initP->reqCode] = initP->reqName;
75  methVec[initP->reqCode] = initP->reqMeth;
76  } while((++initP)->reqCode);
77  }
79 
80 private:
81 
84 };
85 
86 namespace XrdCms
87 {
88 extern XrdCmsRouter Router;
89 extern XrdCmsRouting manVOps;
90 extern XrdCmsRouting rdrVOps;
91 extern XrdCmsRouting rspVOps;
92 extern XrdCmsRouting srvVOps;
93 extern XrdCmsRouting supVOps;
94 }
95 #endif