xrootd
Loading...
Searching...
No Matches
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
34
36{
37public:
38
39enum {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
49struct theRouting {int reqCode; int reqOpts;};
50
51inline 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
63private:
65};
66
67/******************************************************************************/
68/* X r d C m s R o u t e r C l a s s */
69/******************************************************************************/
70
71class XrdCmsNode;
72class XrdCmsRRData;
73
75{
76public:
77
78typedef const char *(XrdCmsNode::*NodeMethod_t)(XrdCmsRRData &);
79
80struct theRoute {int reqCode; const char *reqName; NodeMethod_t reqMeth;};
81
82inline NodeMethod_t getMethod(int Code)
83 {return Code < XrdCms::kYR_MaxReq
84 ? methVec[Code] : (NodeMethod_t)0;
85 }
86
87inline 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
100private:
101
104};
105
106namespace XrdCms
107{
108extern XrdCmsRouter Router;
114}
115#endif
Definition XrdCmsNode.hh:58
Definition XrdCmsRRData.hh:52
Definition XrdCmsRouting.hh:75
NodeMethod_t getMethod(int Code)
Definition XrdCmsRouting.hh:82
const char * getName(int Code)
Definition XrdCmsRouting.hh:87
XrdCmsRouter(theRoute *initP)
Definition XrdCmsRouting.hh:92
const char *(XrdCmsNode::* NodeMethod_t)(XrdCmsRRData &)
Definition XrdCmsRouting.hh:78
NodeMethod_t methVec[XrdCms::kYR_MaxReq]
Definition XrdCmsRouting.hh:103
~XrdCmsRouter()
Definition XrdCmsRouting.hh:98
const char * nameVec[XrdCms::kYR_MaxReq]
Definition XrdCmsRouting.hh:102
Definition XrdCmsRouting.hh:36
int valVec[XrdCms::kYR_MaxReq]
Definition XrdCmsRouting.hh:64
~XrdCmsRouting()
Definition XrdCmsRouting.hh:61
XrdCmsRouting(theRouting *initP)
Definition XrdCmsRouting.hh:56
int getRoute(int reqCode)
Definition XrdCmsRouting.hh:51
@ isInvalid
Definition XrdCmsRouting.hh:39
@ noArgs
Definition XrdCmsRouting.hh:42
@ Forward
Definition XrdCmsRouting.hh:41
@ Repliable
Definition XrdCmsRouting.hh:44
@ AsyncQ0
Definition XrdCmsRouting.hh:45
@ Delayable
Definition XrdCmsRouting.hh:43
@ AsyncQ1
Definition XrdCmsRouting.hh:46
@ isSync
Definition XrdCmsRouting.hh:40
Definition YProtocol.hh:78
XrdCmsRouting manVOps
XrdCmsRouter Router
XrdCmsRouting supVOps
XrdCmsRouting rspVOps
XrdCmsRouting srvVOps
XrdCmsRouting rdrVOps
@ kYR_MaxReq
Definition YProtocol.hh:118
Definition XrdCmsRouting.hh:80
const char * reqName
Definition XrdCmsRouting.hh:80
NodeMethod_t reqMeth
Definition XrdCmsRouting.hh:80
int reqCode
Definition XrdCmsRouting.hh:80
Definition XrdCmsRouting.hh:49
int reqOpts
Definition XrdCmsRouting.hh:49
int reqCode
Definition XrdCmsRouting.hh:49