XRootD
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 <cerrno>
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 //-----------------------------------------------------------------------------
131 //-----------------------------------------------------------------------------
132 
133 virtual
135  const std::string &contact,
136  int oHold=256
137  ) {eInfo.Set("Service not implemented!", ENOTSUP);
138  return 0;
139  }
140 
141 //-----------------------------------------------------------------------------
145 //-----------------------------------------------------------------------------
146 
147 static const int SsiVersion = 0x00010000;
148 
149  int GetVersion() {return SsiVersion;}
150 
151 //-----------------------------------------------------------------------------
170 //-----------------------------------------------------------------------------
171 
172 virtual bool Init(XrdSsiLogger *logP,
173  XrdSsiCluster *clsP,
174  std::string cfgFn,
175  std::string parms,
176  int argc,
177  char **argv
178  ) = 0;
179 
180 //-----------------------------------------------------------------------------
201 //-----------------------------------------------------------------------------
202 
204 
205 virtual rStat QueryResource(const char *rName,
206  const char *contact=0
207  ) = 0;
208 
209 //-----------------------------------------------------------------------------
216 //-----------------------------------------------------------------------------
217 
218 virtual void ResourceAdded(const char *rName) {}
219 
220 //-----------------------------------------------------------------------------
227 //-----------------------------------------------------------------------------
228 
229 virtual void ResourceRemoved(const char *rName) {}
230 
231 //-----------------------------------------------------------------------------
237 //-----------------------------------------------------------------------------
238 
239 virtual void SetCBThreads(int cbNum, int ntNum=0) {(void)cbNum; (void)ntNum;}
240 
241 //-----------------------------------------------------------------------------
252 //-----------------------------------------------------------------------------
253 
279 virtual bool SetConfig(XrdSsiErrInfo &eInfo,
280  std::string &optname,
281  int optvalue)
282  {(void)optname; (void)optvalue; return 0;}
283 
284 //-----------------------------------------------------------------------------
299 //-----------------------------------------------------------------------------
300 
301 virtual void SetSpread(short ssz) {(void)ssz;}
302 
303 //-----------------------------------------------------------------------------
308 //-----------------------------------------------------------------------------
309 
315  stream_T
316  };
317 
318 virtual void SetTimeout(tmoType what, int tmoval) {(void)what; (void)tmoval;}
319 
320 //-----------------------------------------------------------------------------
322 //-----------------------------------------------------------------------------
323 
325 protected:
326 
327 //-----------------------------------------------------------------------------
329 //-----------------------------------------------------------------------------
330 
331 virtual ~XrdSsiProvider() {}
332 };
333 #endif
void Set(const char *eMsg=0, int eNum=0, int eArg=0)
virtual XrdSsiService * GetService(XrdSsiErrInfo &eInfo, const std::string &contact, int oHold=256)
virtual void SetSpread(short ssz)
static const int SsiVersion
virtual void SetTimeout(tmoType what, int tmoval)
virtual int Control(CTL_Cmd cmd, const void *argP, void *&resP)
virtual bool SetConfig(XrdSsiErrInfo &eInfo, std::string &optname, int optvalue)
virtual rStat QueryResource(const char *rName, const char *contact=0)=0
virtual void ResourceAdded(const char *rName)
virtual void SetCBThreads(int cbNum, int ntNum=0)
@ idleClose
Time before an idle socket is closed (client)
@ stream_T
Time to wait for socket activity (Client)
@ connect_T
Time to wait for a connection (client)
@ request_T
Time to wait for a request to finsish(client)
@ response_T
Time for client to wait for a resp (Server)
@ connect_N
Number of times to try connection (client)
virtual ~XrdSsiProvider()
Destructor. The providor object cannot be and never is explicitly deleted.
virtual bool Init(XrdSsiLogger *logP, XrdSsiCluster *clsP, std::string cfgFn, std::string parms, int argc, char **argv)=0
virtual void ResourceRemoved(const char *rName)
XrdSsiProvider()
Constructor.