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 /* 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 "XProtocol/YProtocol.hh"
34 
36 {
37 public:
38 
39 enum {isInvalid = 0x00,
40  isSync = 0x02,
41  Forward = 0x04,
42  noArgs = 0x08,
43  Delayable = 0x10,
44  Repliable = 0x20,
45  AsyncQ0 = 0x40,
46  AsyncQ1 = 0x80
47  };
48 
49 struct theRouting {int reqCode; int reqOpts;};
50 
51 inline int getRoute(int reqCode)
52  {return reqCode < XrdCms::kYR_MaxReq
53  ? valVec[reqCode] : isInvalid;
54  }
55 
57  {memset(valVec, 0, sizeof(valVec));
58  do {valVec[initP->reqCode] = initP->reqOpts;
59  } while((++initP)->reqCode);
60  }
62 
63 private:
65 };
66 
67 /******************************************************************************/
68 /* X r d C m s R o u t e r C l a s s */
69 /******************************************************************************/
70 
71 class XrdCmsNode;
72 class XrdCmsRRData;
73 
75 {
76 public:
77 
78 typedef const char *(XrdCmsNode::*NodeMethod_t)(XrdCmsRRData &);
79 
80 struct theRoute {int reqCode; const char *reqName; NodeMethod_t reqMeth;};
81 
82 inline NodeMethod_t getMethod(int Code)
83  {return Code < XrdCms::kYR_MaxReq
84  ? methVec[Code] : (NodeMethod_t)0;
85  }
86 
87 inline const char *getName(int Code)
88  {return Code < XrdCms::kYR_MaxReq && nameVec[Code]
89  ? nameVec[Code] : "?";
90  }
91 
93  {memset(methVec, 0, sizeof(methVec));
94  do {nameVec[initP->reqCode] = initP->reqName;
95  methVec[initP->reqCode] = initP->reqMeth;
96  } while((++initP)->reqCode);
97  }
99 
100 private:
101 
104 };
105 
106 namespace XrdCms
107 {
108 extern XrdCmsRouter Router;
109 extern XrdCmsRouting manVOps;
110 extern XrdCmsRouting rdrVOps;
111 extern XrdCmsRouting rspVOps;
112 extern XrdCmsRouting srvVOps;
113 extern XrdCmsRouting supVOps;
114 }
115 #endif
Definition: XrdCmsRouting.hh:44
Definition: YProtocol.hh:77
Definition: XrdCmsRouting.hh:74
NodeMethod_t reqMeth
Definition: XrdCmsRouting.hh:80
Definition: XrdCmsRouting.hh:42
Definition: XrdCmsRouting.hh:49
int getRoute(int reqCode)
Definition: XrdCmsRouting.hh:51
~XrdCmsRouting()
Definition: XrdCmsRouting.hh:61
const char * getName(int Code)
Definition: XrdCmsRouting.hh:87
const char * nameVec[XrdCms::kYR_MaxReq]
Definition: XrdCmsRouting.hh:102
XrdCmsRouting supVOps
int reqCode
Definition: XrdCmsRouting.hh:49
int reqOpts
Definition: XrdCmsRouting.hh:49
Definition: XrdCmsRouting.hh:80
Definition: YProtocol.hh:118
XrdCmsRouting srvVOps
XrdCmsRouting rspVOps
Definition: XrdCmsRouting.hh:35
Definition: XrdCmsRouting.hh:40
Definition: XrdCmsRRData.hh:51
NodeMethod_t getMethod(int Code)
Definition: XrdCmsRouting.hh:82
Definition: XrdCmsRouting.hh:43
XrdCmsRouting(theRouting *initP)
Definition: XrdCmsRouting.hh:56
XrdCmsRouter Router
Definition: XrdCmsRouting.hh:41
Definition: XrdCmsRouting.hh:46
int valVec[XrdCms::kYR_MaxReq]
Definition: XrdCmsRouting.hh:64
const char * reqName
Definition: XrdCmsRouting.hh:80
Definition: XrdCmsNode.hh:56
Definition: XrdCmsRouting.hh:45
~XrdCmsRouter()
Definition: XrdCmsRouting.hh:98
XrdCmsRouting manVOps
Definition: XrdCmsRouting.hh:39
const char *(XrdCmsNode::* NodeMethod_t)(XrdCmsRRData &)
Definition: XrdCmsRouting.hh:78
XrdCmsRouting rdrVOps
int reqCode
Definition: XrdCmsRouting.hh:80
NodeMethod_t methVec[XrdCms::kYR_MaxReq]
Definition: XrdCmsRouting.hh:103
XrdCmsRouter(theRoute *initP)
Definition: XrdCmsRouting.hh:92