xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCms
XrdCmsResp.hh
Go to the documentation of this file.
1
#ifndef __CMS_RESP__
2
#define __CMS_RESP__
3
/******************************************************************************/
4
/* */
5
/* X r d C m s r e s p . 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 "
XrdOuc/XrdOucErrInfo.hh
"
14
#include "
XrdSys/XrdSysPthread.hh
"
15
16
#include "
XProtocol/YProtocol.hh
"
17
18
/******************************************************************************/
19
/* X r d C m s R e s p C B */
20
/******************************************************************************/
21
22
class
XrdCmsRespCB
:
XrdOucEICB
23
{
24
public
:
25
26
void
Done
(
int
&Result,
XrdOucErrInfo
*eInfo,
const
char
*
Path
=0)
27
{
respSync
.
Post
();}
28
29
void
Init
() {
while
(
respSync
.
CondWait
()) {}}
30
31
int
Same
(
unsigned
long
long
arg1,
unsigned
long
long
arg2) {
return
0;}
32
33
void
Wait
() {
respSync
.
Wait
();}
34
35
XrdCmsRespCB
() :
respSync
(0) {}
36
~XrdCmsRespCB
() {}
37
38
private
:
39
40
XrdSysSemaphore
respSync
;
41
};
42
43
/******************************************************************************/
44
/* X r d C m s R e s p */
45
/******************************************************************************/
46
47
class
XrdNetBuffer
;
48
49
class
XrdCmsResp
:
public
XrdOucEICB
,
public
XrdOucErrInfo
50
{
51
public
:
52
friend
class
XrdCmsRespQ
;
53
54
static
XrdCmsResp
*
Alloc
(
XrdOucErrInfo
*erp,
int
msgid);
55
56
void
Done
(
int
&Result,
XrdOucErrInfo
*eInfo,
const
char
*
Path
=0)
57
{
Recycle
();}
58
59
inline
int
ID
() {
return
myID
;}
60
61
void
Reply
(
const
char
*Man,
XrdCms::CmsRRHdr
&rrhdr,
62
XrdNetBuffer
*netbuff);
63
64
static
void
Reply
();
65
66
int
Same
(
unsigned
long
long
arg1,
unsigned
long
long
arg2)
67
{
return
0;}
68
69
static
void
setDelay
(
int
repdly) {
RepDelay
= repdly;}
70
71
XrdCmsResp
() :
XrdOucErrInfo
(
UserID
) {
next
= 0;
myBuff
= 0;}
72
~XrdCmsResp
() {}
73
74
private
:
75
void
Recycle
();
76
void
ReplyXeq
();
77
78
static
XrdSysSemaphore
isReady
;
79
static
XrdSysMutex
rdyMutex
;
// Protects the below
80
static
XrdCmsResp
*
First
;
81
static
XrdCmsResp
*
Last
;
82
83
static
XrdSysMutex
myMutex
;
// Protects above and below
84
static
XrdCmsResp
*
nextFree
;
85
static
int
numFree
;
86
static
const
int
maxFree
= 300;
87
static
int
RepDelay
;
88
89
XrdCms::CmsRRHdr
myRRHdr
;
90
XrdNetBuffer
*
myBuff
;
91
char
theMan
[128];
92
93
XrdCmsRespCB
SyncCB
;
94
XrdCmsResp
*
next
;
95
int
myID
;
96
char
UserID
[64];
97
};
98
99
/******************************************************************************/
100
/* X r d O d c R e s p Q */
101
/******************************************************************************/
102
103
class
XrdCmsRespQ
104
{
105
public
:
106
void
Add
(
XrdCmsResp
*rp);
107
108
void
Purge
();
109
110
XrdCmsResp
*
Rem
(
int
msgid);
111
112
XrdCmsRespQ
();
113
~XrdCmsRespQ
() {
Purge
();}
114
115
private
:
116
117
XrdSysMutex
myMutex
;
// Protects above and below
118
static
const
int
mqSize
= 512;
119
120
XrdCmsResp
*
mqTab
[
mqSize
];
121
};
122
#endif
Generated by
1.8.1.2