xrootd
XrdSsiRequest.hh
Go to the documentation of this file.
1#ifndef __XRDSSIREQUEST_HH__
2#define __XRDSSIREQUEST_HH__
3/******************************************************************************/
4/* */
5/* X r d S s i R e q u e s t . h h */
6/* */
7/* (c) 2013 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#include <stdint.h>
33#include <stdlib.h>
34#include <string.h>
35
39
40//-----------------------------------------------------------------------------
66//-----------------------------------------------------------------------------
67
68class XrdSsiResponder;
69
71{
72public:
73friend class XrdSsiResponder;
74friend class XrdSsiRRAgent;
75
76//-----------------------------------------------------------------------------
89//-----------------------------------------------------------------------------
90
91 bool Finished(bool cancel=false);
92
93//-----------------------------------------------------------------------------
99//-----------------------------------------------------------------------------
100
101inline uint32_t GetDetachTTL() {return detTTL;}
102
103//-----------------------------------------------------------------------------
109//-----------------------------------------------------------------------------
110
111std::string GetEndPoint();
112
113//-----------------------------------------------------------------------------
123//-----------------------------------------------------------------------------
124
125const char *GetMetadata(int &dlen);
126
127//-----------------------------------------------------------------------------
136//-----------------------------------------------------------------------------
137
138virtual char *GetRequest(int &dlen) = 0;
139
140//-----------------------------------------------------------------------------
144//-----------------------------------------------------------------------------
145
146inline
147const char *GetRequestID() {return reqID;}
148
149//-----------------------------------------------------------------------------
158//-----------------------------------------------------------------------------
159
160 void GetResponseData(char *buff, int blen);
161
162//-----------------------------------------------------------------------------
166//-----------------------------------------------------------------------------
167
168 uint16_t GetTimeOut() {return tOut;}
169
170//-----------------------------------------------------------------------------
180//-----------------------------------------------------------------------------
181
182virtual bool ProcessResponse(const XrdSsiErrInfo &eInfo,
183 const XrdSsiRespInfo &rInfo)=0;
184
185//-----------------------------------------------------------------------------
206//-----------------------------------------------------------------------------
207
209
210virtual PRD_Xeq ProcessResponseData(const XrdSsiErrInfo &eInfo, char *buff,
211 int blen, bool last) {return PRD_Normal;}
212
213//-----------------------------------------------------------------------------
217//-----------------------------------------------------------------------------
218
220
221//-----------------------------------------------------------------------------
252//-----------------------------------------------------------------------------
253
255
256struct RDR_Info{int rCount;
257 int qCount;
258 int iAllow;
259 int fAllow;
260
261 RDR_Info() : rCount(0), qCount(0), iAllow(0), fAllow(0) {}
262 };
263
264static RDR_Info RestartDataResponse(RDR_How rhow, const char *reqid=0);
265
266//-----------------------------------------------------------------------------
275//-----------------------------------------------------------------------------
276
277 XrdSsiRequest(const char *reqid=0, uint16_t tmo=0);
278
279protected:
280
281//-----------------------------------------------------------------------------
293//-----------------------------------------------------------------------------
294
295virtual void Alert(XrdSsiRespInfoMsg &aMsg) {aMsg.RecycleMsg(false);}
296
297//-----------------------------------------------------------------------------
306//-----------------------------------------------------------------------------
307
308virtual void RelRequestBuffer() {}
309
310//-----------------------------------------------------------------------------
324//-----------------------------------------------------------------------------
325
326inline void SetDetachTTL(uint32_t dttl) {detTTL = dttl;}
327
328//-----------------------------------------------------------------------------
333//-----------------------------------------------------------------------------
334
335 void SetTimeOut(uint16_t tmo) {tOut = tmo;}
336
337//-----------------------------------------------------------------------------
342//-----------------------------------------------------------------------------
343
344virtual ~XrdSsiRequest() {}
345
346private:
347virtual void BindDone() {}
348 void CleanUp();
349 bool CopyData(char *buff, int blen);
350virtual void Dispose() {}
351
352const char *reqID;
354XrdSsiResponder *theRespond; // Set via XrdSsiResponder::BindRequest()
355XrdSsiRespInfo Resp; // Set via XrdSsiResponder::SetResponse()
357long long rsvd1;
358const char *epNode;
359uint32_t detTTL;
360uint16_t tOut;
362char rsvd2;
363};
364#endif
Definition: XrdSsiErrInfo.hh:41
Definition: XrdSsiAtomics.hh:111
Definition: XrdSsiRRAgent.hh:38
Definition: XrdSsiRequest.hh:71
std::string GetEndPoint()
virtual ~XrdSsiRequest()
Definition: XrdSsiRequest.hh:344
uint16_t GetTimeOut()
Definition: XrdSsiRequest.hh:168
uint32_t detTTL
Definition: XrdSsiRequest.hh:359
const char * reqID
Definition: XrdSsiRequest.hh:352
virtual void BindDone()
Definition: XrdSsiRequest.hh:347
const char * GetMetadata(int &dlen)
bool Finished(bool cancel=false)
virtual void Dispose()
Definition: XrdSsiRequest.hh:350
XrdSsiRequest(const char *reqid=0, uint16_t tmo=0)
uint16_t tOut
Definition: XrdSsiRequest.hh:360
virtual bool ProcessResponse(const XrdSsiErrInfo &eInfo, const XrdSsiRespInfo &rInfo)=0
bool onClient
Definition: XrdSsiRequest.hh:361
virtual void RelRequestBuffer()
Definition: XrdSsiRequest.hh:308
virtual void Alert(XrdSsiRespInfoMsg &aMsg)
Send or receive a server generated alert.
Definition: XrdSsiRequest.hh:295
const char * epNode
Definition: XrdSsiRequest.hh:358
void ReleaseRequestBuffer()
bool CopyData(char *buff, int blen)
void SetDetachTTL(uint32_t dttl)
Set the detached request time to live value.
Definition: XrdSsiRequest.hh:326
static RDR_Info RestartDataResponse(RDR_How rhow, const char *reqid=0)
char rsvd2
Definition: XrdSsiRequest.hh:362
void SetTimeOut(uint16_t tmo)
Definition: XrdSsiRequest.hh:335
virtual PRD_Xeq ProcessResponseData(const XrdSsiErrInfo &eInfo, char *buff, int blen, bool last)
Definition: XrdSsiRequest.hh:210
XrdSsiResponder * theRespond
Definition: XrdSsiRequest.hh:354
const char * GetRequestID()
Definition: XrdSsiRequest.hh:147
virtual char * GetRequest(int &dlen)=0
RDR_How
Definition: XrdSsiRequest.hh:254
@ RDR_All
Definition: XrdSsiRequest.hh:254
@ RDR_Query
Definition: XrdSsiRequest.hh:254
@ RDR_One
Definition: XrdSsiRequest.hh:254
@ RDR_Immed
Definition: XrdSsiRequest.hh:254
@ RDR_Hold
Definition: XrdSsiRequest.hh:254
@ RDR_Post
Definition: XrdSsiRequest.hh:254
void GetResponseData(char *buff, int blen)
XrdSsiErrInfo errInfo
Definition: XrdSsiRequest.hh:356
long long rsvd1
Definition: XrdSsiRequest.hh:357
uint32_t GetDetachTTL()
Definition: XrdSsiRequest.hh:101
XrdSsiRespInfo Resp
Definition: XrdSsiRequest.hh:355
XrdSsiMutex * rrMutex
Definition: XrdSsiRequest.hh:353
PRD_Xeq
Definition: XrdSsiRequest.hh:208
@ PRD_Hold
Definition: XrdSsiRequest.hh:208
@ PRD_HoldLcl
Definition: XrdSsiRequest.hh:208
@ PRD_Normal
Definition: XrdSsiRequest.hh:208
Definition: XrdSsiRespInfo.hh:87
virtual void RecycleMsg(bool sent=true)=0
Definition: XrdSsiResponder.hh:69
Definition: XrdSsiRequest.hh:256
RDR_Info()
Definition: XrdSsiRequest.hh:261
int iAllow
Initial value of the allowed restart count.
Definition: XrdSsiRequest.hh:258
int fAllow
Final value of the allowed restart count.
Definition: XrdSsiRequest.hh:259
int rCount
Number restarted.
Definition: XrdSsiRequest.hh:256
int qCount
Number of queued request remaining.
Definition: XrdSsiRequest.hh:257
Definition: XrdSsiRespInfo.hh:44