xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
XrdSsiProvider.hh
Go to the documentation of this file.
1 #ifndef __XRDSSIPROVIDER_HH__
2 #define __XRDSSIPROVIDER_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d S s i P r o v i d e r . h h */
6 /* */
7 /* (c) 2015 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* Produced by Andrew Hanushevsky for Stanford University under contract */
9 /* DE-AC02-76-SFO0515 with the Department of Energy */
10 /* */
11 /* This file is part of the XRootD software suite. */
12 /* */
13 /* XRootD is free software: you can redistribute it and/or modify it under */
14 /* the terms of the GNU Lesser General Public License as published by the */
15 /* Free Software Foundation, either version 3 of the License, or (at your */
16 /* option) any later version. */
17 /* */
18 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21 /* License for more details. */
22 /* */
23 /* You should have received a copy of the GNU Lesser General Public License */
24 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26 /* */
27 /* The copyright holder's institutional names and contributor's names may not */
28 /* be used to endorse or promote products derived from this software without */
29 /* specific prior written permission of the institution or contributor. */
30 /******************************************************************************/
31 
32 //-----------------------------------------------------------------------------
77 //-----------------------------------------------------------------------------
78 
79 #include <errno.h>
80 
81 #include "XrdSsi/XrdSsiErrInfo.hh"
82 #include "XrdSsi/XrdSsiResource.hh"
83 
84 class XrdSsiCluster;
85 class XrdSsiLogger;
86 class XrdSsiService;
87 
89 {
90 public:
91 
92 //-----------------------------------------------------------------------------
103 //-----------------------------------------------------------------------------
104 
105 enum CTL_Cmd {CTL_None = 0};
106 
107 virtual int Control(CTL_Cmd cmd, const void *argP, void *&resP)
108  {(void)cmd; (void)argP; (void)resP;
109  return (cmd == CTL_None ? 0 : -ENOTSUP);
110  }
111 
112 //-----------------------------------------------------------------------------
128 //-----------------------------------------------------------------------------
129 
130 virtual
132  const std::string &contact,
133  int oHold=256
134  ) {eInfo.Set("Service not implemented!", ENOTSUP);
135  return 0;
136  }
137 
138 //-----------------------------------------------------------------------------
142 //-----------------------------------------------------------------------------
143 
144 static const int SsiVersion = 0x00010000;
145 
146  int GetVersion() {return SsiVersion;}
147 
148 //-----------------------------------------------------------------------------
167 //-----------------------------------------------------------------------------
168 
169 virtual bool Init(XrdSsiLogger *logP,
170  XrdSsiCluster *clsP,
171  std::string cfgFn,
172  std::string parms,
173  int argc,
174  char **argv
175  ) = 0;
176 
177 //-----------------------------------------------------------------------------
198 //-----------------------------------------------------------------------------
199 
201 
202 virtual rStat QueryResource(const char *rName,
203  const char *contact=0
204  ) = 0;
205 
206 //-----------------------------------------------------------------------------
213 //-----------------------------------------------------------------------------
214 
215 virtual void ResourceAdded(const char *rName) {}
216 
217 //-----------------------------------------------------------------------------
224 //-----------------------------------------------------------------------------
225 
226 virtual void ResourceRemoved(const char *rName) {}
227 
228 //-----------------------------------------------------------------------------
234 //-----------------------------------------------------------------------------
235 
236 virtual void SetCBThreads(int cbNum, int ntNum=0) {(void)cbNum; (void)ntNum;}
237 
238 //-----------------------------------------------------------------------------
249 //-----------------------------------------------------------------------------
250 
267 virtual bool SetConfig(XrdSsiErrInfo &eInfo,
268  std::string &optname,
269  int optvalue)
270  {(void)optname; (void)optvalue; return 0;}
271 
272 //-----------------------------------------------------------------------------
287 //-----------------------------------------------------------------------------
288 
289 virtual void SetSpread(short ssz) {(void)ssz;}
290 
291 //-----------------------------------------------------------------------------
296 //-----------------------------------------------------------------------------
297 
304  };
305 
306 virtual void SetTimeout(tmoType what, int tmoval) {(void)what; (void)tmoval;}
307 
308 //-----------------------------------------------------------------------------
310 //-----------------------------------------------------------------------------
311 
313 protected:
314 
315 //-----------------------------------------------------------------------------
317 //-----------------------------------------------------------------------------
318 
319 virtual ~XrdSsiProvider() {}
320 };
321 #endif
virtual ~XrdSsiProvider()
Destructor. The providor object cannot be and never is explicitly deleted.
Definition: XrdSsiProvider.hh:319
virtual void SetSpread(short ssz)
Definition: XrdSsiProvider.hh:289
Definition: XrdSsiProvider.hh:200
virtual rStat QueryResource(const char *rName, const char *contact=0)=0
static const int SsiVersion
Definition: XrdSsiProvider.hh:144
XrdSsiProvider()
Constructor.
Definition: XrdSsiProvider.hh:312
Definition: XrdSsiProvider.hh:200
Definition: XrdSsiProvider.hh:105
Time to wait for socket activity (Client)
Definition: XrdSsiProvider.hh:303
CTL_Cmd
Definition: XrdSsiProvider.hh:105
Definition: XrdSsiProvider.hh:88
Definition: XrdSsiLogger.hh:40
Definition: XrdSsiService.hh:54
void Set(const char *eMsg=0, int eNum=0, int eArg=0)
Definition: XrdSsiErrInfo.hh:103
int GetVersion()
Definition: XrdSsiProvider.hh:146
virtual XrdSsiService * GetService(XrdSsiErrInfo &eInfo, const std::string &contact, int oHold=256)
Definition: XrdSsiProvider.hh:131
Time before an idle socket is closed (client)
Definition: XrdSsiProvider.hh:300
virtual bool Init(XrdSsiLogger *logP, XrdSsiCluster *clsP, std::string cfgFn, std::string parms, int argc, char **argv)=0
Number of times to try connection (client)
Definition: XrdSsiProvider.hh:298
virtual void ResourceRemoved(const char *rName)
Definition: XrdSsiProvider.hh:226
Definition: XrdSsiProvider.hh:200
Definition: XrdSsiErrInfo.hh:40
rStat
Definition: XrdSsiProvider.hh:200
virtual void SetCBThreads(int cbNum, int ntNum=0)
Definition: XrdSsiProvider.hh:236
virtual void ResourceAdded(const char *rName)
Definition: XrdSsiProvider.hh:215
Time to wait for a connection (client)
Definition: XrdSsiProvider.hh:299
virtual int Control(CTL_Cmd cmd, const void *argP, void *&resP)
Definition: XrdSsiProvider.hh:107
tmoType
Definition: XrdSsiProvider.hh:298
Time for client to wait for a resp (Server)
Definition: XrdSsiProvider.hh:302
Time to wait for a request to finsish(client)
Definition: XrdSsiProvider.hh:301
virtual void SetTimeout(tmoType what, int tmoval)
Definition: XrdSsiProvider.hh:306
Definition: XrdSsiCluster.hh:40
virtual bool SetConfig(XrdSsiErrInfo &eInfo, std::string &optname, int optvalue)
Definition: XrdSsiProvider.hh:267