xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCms
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
35
class
XrdCmsRouting
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
56
XrdCmsRouting
(
theRouting
*initP)
57
{memset(
valVec
, 0,
sizeof
(
valVec
));
58
do
{
valVec
[initP->
reqCode
] = initP->
reqOpts
;
59
}
while
((++initP)->reqCode);
60
}
61
~XrdCmsRouting
() {}
62
63
private
:
64
int
valVec
[
XrdCms::kYR_MaxReq
];
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
74
class
XrdCmsRouter
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
92
XrdCmsRouter
(
theRoute
*initP)
93
{memset(
methVec
, 0,
sizeof
(
methVec
));
94
do
{
nameVec
[initP->
reqCode
] = initP->
reqName
;
95
methVec
[initP->
reqCode
] = initP->
reqMeth
;
96
}
while
((++initP)->reqCode);
97
}
98
~XrdCmsRouter
() {}
99
100
private
:
101
102
const
char
*
nameVec
[
XrdCms::kYR_MaxReq
];
103
NodeMethod_t
methVec
[
XrdCms::kYR_MaxReq
];
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
Generated by
1.8.3.1