xrootd
Loading...
Searching...
No Matches
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/* 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
35
37
38/******************************************************************************/
39/* X r d C m s R e s p C B */
40/******************************************************************************/
41
43{
44public:
45
46void Done(int &Result, XrdOucErrInfo *eInfo, const char *Path=0)
47 {respSync.Post();}
48
49void Init() {while(respSync.CondWait()) {}}
50
51int Same(unsigned long long arg1, unsigned long long arg2) {return 0;}
52
53void Wait() {respSync.Wait();}
54
57
58private:
59
61};
62
63/******************************************************************************/
64/* X r d C m s R e s p */
65/******************************************************************************/
66
67class XrdOucBuffer;
68
69class XrdCmsResp : public XrdOucEICB, public XrdOucErrInfo
70{
71public:
72friend class XrdCmsRespQ;
73
74static XrdCmsResp *Alloc(XrdOucErrInfo *erp, int msgid);
75
76 void Done(int &Result, XrdOucErrInfo *eInfo, const char *Path=0)
77 {Recycle();}
78
79inline int ID() {return myID;}
80
81 void Reply(const char *Man, XrdCms::CmsRRHdr &rrhdr,
82 XrdOucBuffer *netbuff);
83
84static void Reply();
85
86 int Same(unsigned long long arg1, unsigned long long arg2)
87 {return 0;}
88
89static void setDelay(int repdly) {RepDelay = repdly;}
90
93
94private:
95 void Recycle();
96 void ReplyXeq();
97
99static XrdSysMutex rdyMutex; // Protects the below
102
103static XrdSysMutex myMutex; // Protects above and below
105static int numFree;
106static const int maxFree = 300;
107static int RepDelay;
108
111char theMan[128];
112
116char UserID[64];
117};
118
119/******************************************************************************/
120/* X r d O d c R e s p Q */
121/******************************************************************************/
122
124{
125public:
126 void Add(XrdCmsResp *rp);
127
128 void Purge();
129
130 XrdCmsResp *Rem(int msgid);
131
134
135private:
136
137 XrdSysMutex myMutex; // Protects above and below
138static const int mqSize = 512;
139
141};
142#endif
Definition XrdCmsResp.hh:43
XrdSysSemaphore respSync
Definition XrdCmsResp.hh:60
void Init()
Definition XrdCmsResp.hh:49
void Done(int &Result, XrdOucErrInfo *eInfo, const char *Path=0)
Definition XrdCmsResp.hh:46
void Wait()
Definition XrdCmsResp.hh:53
int Same(unsigned long long arg1, unsigned long long arg2)
Definition XrdCmsResp.hh:51
~XrdCmsRespCB()
Definition XrdCmsResp.hh:56
XrdCmsRespCB()
Definition XrdCmsResp.hh:55
Definition XrdCmsResp.hh:124
XrdCmsResp * Rem(int msgid)
static const int mqSize
Definition XrdCmsResp.hh:138
void Add(XrdCmsResp *rp)
void Purge()
XrdCmsResp * mqTab[mqSize]
Definition XrdCmsResp.hh:140
~XrdCmsRespQ()
Definition XrdCmsResp.hh:133
XrdSysMutex myMutex
Definition XrdCmsResp.hh:137
Definition XrdCmsResp.hh:70
void ReplyXeq()
XrdCmsRespCB SyncCB
Definition XrdCmsResp.hh:113
static XrdCmsResp * Last
Definition XrdCmsResp.hh:101
static int numFree
Definition XrdCmsResp.hh:105
char UserID[64]
Definition XrdCmsResp.hh:116
int myID
Definition XrdCmsResp.hh:115
XrdCmsResp()
Definition XrdCmsResp.hh:91
static XrdCmsResp * Alloc(XrdOucErrInfo *erp, int msgid)
static void setDelay(int repdly)
Definition XrdCmsResp.hh:89
int ID()
Definition XrdCmsResp.hh:79
static void Reply()
void Reply(const char *Man, XrdCms::CmsRRHdr &rrhdr, XrdOucBuffer *netbuff)
~XrdCmsResp()
Definition XrdCmsResp.hh:92
void Done(int &Result, XrdOucErrInfo *eInfo, const char *Path=0)
Definition XrdCmsResp.hh:76
XrdCms::CmsRRHdr myRRHdr
Definition XrdCmsResp.hh:109
void Recycle()
XrdCmsResp * next
Definition XrdCmsResp.hh:114
int Same(unsigned long long arg1, unsigned long long arg2)
Definition XrdCmsResp.hh:86
char theMan[128]
Definition XrdCmsResp.hh:111
static XrdCmsResp * First
Definition XrdCmsResp.hh:100
static const int maxFree
Definition XrdCmsResp.hh:106
static int RepDelay
Definition XrdCmsResp.hh:107
static XrdSysMutex myMutex
Definition XrdCmsResp.hh:103
XrdOucBuffer * myBuff
Definition XrdCmsResp.hh:110
static XrdSysMutex rdyMutex
Definition XrdCmsResp.hh:99
static XrdCmsResp * nextFree
Definition XrdCmsResp.hh:104
static XrdSysSemaphore isReady
Definition XrdCmsResp.hh:98
Definition XrdOucBuffer.hh:141
Definition XrdOucErrInfo.hh:483
Definition XrdOucErrInfo.hh:101
Definition XrdSysPthread.hh:165
Definition XrdSysPthread.hh:494
void Wait()
Definition XrdSysPthread.hh:509
void Post()
Definition XrdSysPthread.hh:505
int CondWait()
Definition XrdSysPthread.hh:497
Definition YProtocol.hh:83