XRootD
Loading...
Searching...
No Matches
XrdCmsProtocol.hh
Go to the documentation of this file.
1#ifndef __CMS_PROTOCOL_H__
2#define __CMS_PROTOCOL_H__
3/******************************************************************************/
4/* */
5/* X r d C m s P r o t o c o l . 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 "Xrd/XrdProtocol.hh"
35#include "XrdCms/XrdCmsTypes.hh"
37
38class XrdLink;
39class XrdCmsManager;
40class XrdCmsNode;
41class XrdCmsRRData;
42class XrdCmsRouting;
43
45{
46friend class XrdCmsJob;
47public:
48
49static XrdCmsProtocol *Alloc(const char *theRole = "", XrdCmsManager *mP=0,
50 const char *theMan = 0, int thePort=0);
51
52 void DoIt();
53
54 int Execute(XrdCmsRRData &Data);
55
56 XrdProtocol *Match(XrdLink *lp); // Upon accept
57
58 int Process(XrdLink *lp); // Initial entry
59
60 void Recycle(XrdLink *lp, int consec, const char *reason);
61
62 void Ref(int rcnt);
63
64 int Stats(char *buff, int blen, int do_sync=0);
65
66 XrdCmsProtocol() : XrdProtocol("cms protocol handler") {Init();}
68
69private:
70
71XrdCmsRouting *Admit();
72XrdCmsRouting *Admit_DataServer(int);
73XrdCmsRouting *Admit_Redirector(int);
74XrdCmsRouting *Admit_Supervisor(int);
75SMask_t AddPath(XrdCmsNode *nP, const char *pType, const char *Path);
76int Authenticate();
77void ConfigCheck(unsigned char *theConfig);
78enum Bearing {isDown, isLateral, isUp};
79const char *Dispatch(Bearing cDir, int maxWait, int maxTries);
80void Init(const char *iRole="?", XrdCmsManager *uMan=0,
81 const char *iMan="?", int iPort=0);
82XrdCmsRouting *Login_Failed(const char *Reason);
83void Pander(const char *manager, int mport);
84void Reissue(XrdCmsRRData &Data);
85void Reply_Delay(XrdCmsRRData &Data, kXR_unt32 theDelay);
86void Reply_Error(XrdCmsRRData &Data, int ecode, const char *etext);
87bool SendPing();
88void Sync();
89
90static XrdSysMutex ProtMutex;
91static XrdCmsProtocol *ProtStack;
92static XrdCmsParser ProtArgs;
93 XrdCmsProtocol *ProtLink;
94
95 XrdCmsRouting *Routing; // Request routing for this instance
96
97static const int maxReqSize = 16384;
98 XrdSysMutex refMutex;
99 XrdSysSemaphore *refWait;
100 XrdLink *Link;
101static int readWait;
102const char *myRole;
103 XrdCmsNode *myNode;
104 XrdCmsManager *Manager;
105const char *myMan;
106 int myManPort;
107 int refCount;
108 short RSlot; // True only for redirectors
109 char loggedIn; // True if login succeeded
110 bool isNBSQ; // True if nbsq is active
111};
112#endif
unsigned int kXR_unt32
Definition XPtypes.hh:90
unsigned long long SMask_t
XrdOucString Path
friend class XrdCmsJob
void Recycle(XrdLink *lp, int consec, const char *reason)
int Process(XrdLink *lp)
void Ref(int rcnt)
int Execute(XrdCmsRRData &Data)
int Stats(char *buff, int blen, int do_sync=0)
static XrdCmsProtocol * Alloc(const char *theRole="", XrdCmsManager *mP=0, const char *theMan=0, int thePort=0)
XrdProtocol * Match(XrdLink *lp)
XrdProtocol(const char *jname)