XRootD
Loading...
Searching...
No Matches
XrdCmsClientMan.hh
Go to the documentation of this file.
1#ifndef __CMS_CLIENTMAN__
2#define __CMS_CLIENTMAN__
3/******************************************************************************/
4/* */
5/* X r d C m s C l i e n t M a n . 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 <cstdio>
34#include <sys/uio.h>
35
37
38#include "XrdCms/XrdCmsResp.hh"
43
44class XrdInet;
45class XrdLink;
46
48{
49public:
50
51static char doDebug;
52
53int delayResp(XrdOucErrInfo &Resp);
54
55inline int isActive() {AtomicRet(myData, Active);}
56
58
59char *Name() {return Host;}
60char *NPfx() {return HPfx;}
61
62int manPort() {return Port;}
63
64int Send(unsigned int &iMan, char *msg, int mlen=0);
65int Send(unsigned int &iMan, const struct iovec *iov,
66 int iovcnt, int iotot=0);
67
68void *Start();
69
70inline int Suspended() {AtomicBeg(myData);
71 int sVal = AtomicGet(Suspend);
72 AtomicEnd(myData);
73 if (!sVal) return sVal;
74 return chkStatus();
75 }
76
77void setNext(XrdCmsClientMan *np) {Next = np;}
78
79static void setNetwork(XrdInet *nP) {Network = nP;}
80
81static void setConfig(const char *cfn) {ConfigFN = cfn;}
82
83int whatsUp(const char *user, const char *path,
84 unsigned int iMan);
85
86inline int waitTime() {AtomicRet(myData, repWait);}
87
88 XrdCmsClientMan(char *host,int port,int cw,int nr,int rw,int rd);
90
91private:
92int Hookup();
93int Receive();
94void relayResp();
95int chkStatus();
96void setStatus();
97
98static XrdSysMutex manMutex;
99static XrdOucBuffPool BuffPool;
100static XrdInet *Network;
101static const char *ConfigFN;
102static const int chkVal = 256;
103
104XrdSysSemaphore syncResp;
105XrdCmsRespQ RespQ;
106
107XrdCmsClientMan *Next;
108XrdSysMutex myData;
109XrdLink *Link;
110char *Host;
111char *HPfx;
112int Port;
113unsigned int manInst;
114int manMask;
115int dally;
116int Active;
117int Silent;
118int Suspend;
119int RecvCnt;
120int SendCnt;
121int nrMax;
122int maxMsgID;
123int repWait;
124int repWMax;
125int minDelay;
126int maxDelay;
127int qTime;
128int chkCount;
129time_t lastUpdt;
130time_t lastTOut;
131XrdCms::CmsRRHdr Response;
132XrdOucBuffer *NetBuff;
133};
134#endif
#define AtomicBeg(Mtx)
#define AtomicGet(x)
#define AtomicEnd(Mtx)
#define AtomicRet(mtx, x)
void setNext(XrdCmsClientMan *np)
int Send(unsigned int &iMan, char *msg, int mlen=0)
XrdCmsClientMan * nextManager()
int delayResp(XrdOucErrInfo &Resp)
static void setConfig(const char *cfn)
static void setNetwork(XrdInet *nP)
int whatsUp(const char *user, const char *path, unsigned int iMan)
static char doDebug