xrootd
Loading...
Searching...
No Matches
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 <cstdint>
33#include <cstdlib>
34#include <cstring>
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//-----------------------------------------------------------------------------
196//-----------------------------------------------------------------------------
197
198virtual void ProcessResponseData(const XrdSsiErrInfo &eInfo, char *buff,
199 int blen, bool last) {}
200
201//-----------------------------------------------------------------------------
205//-----------------------------------------------------------------------------
206
208
209//-----------------------------------------------------------------------------
218//-----------------------------------------------------------------------------
219
220 XrdSsiRequest(const char *reqid=0, uint16_t tmo=0);
221
222protected:
223
224//-----------------------------------------------------------------------------
236//-----------------------------------------------------------------------------
237
238virtual void Alert(XrdSsiRespInfoMsg &aMsg) {aMsg.RecycleMsg(false);}
239
240//-----------------------------------------------------------------------------
249//-----------------------------------------------------------------------------
250
251virtual void RelRequestBuffer() {}
252
253//-----------------------------------------------------------------------------
267//-----------------------------------------------------------------------------
268
269inline void SetDetachTTL(uint32_t dttl) {detTTL = dttl;}
270
271//-----------------------------------------------------------------------------
277//-----------------------------------------------------------------------------
278
279 void SetRetry(bool onoff);
280
281//-----------------------------------------------------------------------------
286//-----------------------------------------------------------------------------
287
288 void SetTimeOut(uint16_t tmo) {tOut = tmo;}
289
290//-----------------------------------------------------------------------------
295//-----------------------------------------------------------------------------
296
297virtual ~XrdSsiRequest() {}
298
299private:
300virtual void BindDone() {}
301 void CleanUp();
302 bool CopyData(char *buff, int blen);
303virtual void Dispose() {}
304
305const char *reqID;
307XrdSsiResponder *theRespond; // Set via XrdSsiResponder::BindRequest()
308XrdSsiRespInfo Resp; // Set via XrdSsiResponder::SetResponse()
310long long rsvd1;
311const char *epNode;
312uint32_t detTTL;
313uint16_t tOut;
315char flags;
316static const int isaRetry = 1;
317};
318#endif
Definition XrdSsiErrInfo.hh:41
Definition XrdSsiAtomics.hh:110
Definition XrdSsiRRAgent.hh:38
Definition XrdSsiRequest.hh:71
std::string GetEndPoint()
virtual ~XrdSsiRequest()
Definition XrdSsiRequest.hh:297
uint16_t GetTimeOut()
Definition XrdSsiRequest.hh:168
char flags
Definition XrdSsiRequest.hh:315
uint32_t detTTL
Definition XrdSsiRequest.hh:312
const char * reqID
Definition XrdSsiRequest.hh:305
virtual void BindDone()
Definition XrdSsiRequest.hh:300
const char * GetMetadata(int &dlen)
bool Finished(bool cancel=false)
virtual void Dispose()
Definition XrdSsiRequest.hh:303
XrdSsiRequest(const char *reqid=0, uint16_t tmo=0)
static const int isaRetry
Definition XrdSsiRequest.hh:316
uint16_t tOut
Definition XrdSsiRequest.hh:313
virtual bool ProcessResponse(const XrdSsiErrInfo &eInfo, const XrdSsiRespInfo &rInfo)=0
bool onClient
Definition XrdSsiRequest.hh:314
virtual void RelRequestBuffer()
Definition XrdSsiRequest.hh:251
virtual void Alert(XrdSsiRespInfoMsg &aMsg)
Send or receive a server generated alert.
Definition XrdSsiRequest.hh:238
const char * epNode
Definition XrdSsiRequest.hh:311
void ReleaseRequestBuffer()
bool CopyData(char *buff, int blen)
void SetDetachTTL(uint32_t dttl)
Set the detached request time to live value.
Definition XrdSsiRequest.hh:269
void SetRetry(bool onoff)
virtual void ProcessResponseData(const XrdSsiErrInfo &eInfo, char *buff, int blen, bool last)
Definition XrdSsiRequest.hh:198
void SetTimeOut(uint16_t tmo)
Definition XrdSsiRequest.hh:288
XrdSsiResponder * theRespond
Definition XrdSsiRequest.hh:307
const char * GetRequestID()
Definition XrdSsiRequest.hh:147
virtual char * GetRequest(int &dlen)=0
void GetResponseData(char *buff, int blen)
XrdSsiErrInfo errInfo
Definition XrdSsiRequest.hh:309
long long rsvd1
Definition XrdSsiRequest.hh:310
uint32_t GetDetachTTL()
Definition XrdSsiRequest.hh:101
XrdSsiRespInfo Resp
Definition XrdSsiRequest.hh:308
XrdSsiMutex * rrMutex
Definition XrdSsiRequest.hh:306
Definition XrdSsiRespInfo.hh:87
virtual void RecycleMsg(bool sent=true)=0
Definition XrdSsiResponder.hh:69
Definition XrdSsiRespInfo.hh:44