Loading...
Searching...
No Matches
XrdSsiRequest.hh
Go to the documentation of this file.
#ifndef __XRDSSIREQUEST_HH__
#define __XRDSSIREQUEST_HH__
/******************************************************************************/
/* */
/* X r d S s i R e q u e s t . h h */
/* */
/* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */
/* Produced by Andrew Hanushevsky for Stanford University under contract */
/* DE-AC02-76-SFO0515 with the Department of Energy */
/* */
/* This file is part of the XRootD software suite. */
/* */
/* XRootD is free software: you can redistribute it and/or modify it under */
/* the terms of the GNU Lesser General Public License as published by the */
/* Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
/* */
/* The copyright holder's institutional names and contributor's names may not */
/* be used to endorse or promote products derived from this software without */
/* specific prior written permission of the institution or contributor. */
/******************************************************************************/
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include "XrdSsi/XrdSsiAtomics.hh"
#include "XrdSsi/XrdSsiErrInfo.hh"
#include "XrdSsi/XrdSsiRespInfo.hh"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class XrdSsiResponder;
class XrdSsiRequest
{
public:
friend class XrdSsiResponder;
friend class XrdSsiRRAgent;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
bool Finished(bool cancel=false);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
inline uint32_t GetDetachTTL() {return detTTL;}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
std::string GetEndPoint();
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
const char *GetMetadata(int &dlen);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual char *GetRequest(int &dlen) = 0;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
inline
const char *GetRequestID() {return reqID;}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void GetResponseData(char *buff, int blen);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
uint16_t GetTimeOut() {return tOut;}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual bool ProcessResponse(const XrdSsiErrInfo &eInfo,
const XrdSsiRespInfo &rInfo)=0;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual void ProcessResponseData(const XrdSsiErrInfo &eInfo, char *buff,
int blen, bool last) {}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void ReleaseRequestBuffer();
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
XrdSsiRequest(const char *reqid=0, uint16_t tmo=0);
protected:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual void Alert(XrdSsiRespInfoMsg &aMsg) {aMsg.RecycleMsg(false);}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual void RelRequestBuffer() {}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
inline void SetDetachTTL(uint32_t dttl) {detTTL = dttl;}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SetRetry(bool onoff);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SetTimeOut(uint16_t tmo) {tOut = tmo;}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
virtual ~XrdSsiRequest() {}
private:
virtual void BindDone() {}
void CleanUp();
bool CopyData(char *buff, int blen);
virtual void Dispose() {}
const char *reqID;
XrdSsiMutex *rrMutex;
XrdSsiResponder *theRespond; // Set via XrdSsiResponder::BindRequest()
XrdSsiRespInfo Resp; // Set via XrdSsiResponder::SetResponse()
XrdSsiErrInfo errInfo;
long long rsvd1;
const char *epNode;
uint32_t detTTL;
uint16_t tOut;
bool onClient;
char flags;
static const int isaRetry = 1;
};
#endif
XrdSsiAtomics.hh
XrdSsiErrInfo.hh
XrdSsiRespInfo.hh
XrdSsiErrInfo
Definition XrdSsiErrInfo.hh:41
XrdSsiRequest::GetEndPoint
std::string GetEndPoint()
Definition XrdSsiRequest.cc:142
XrdSsiRequest::~XrdSsiRequest
virtual ~XrdSsiRequest()
Definition XrdSsiRequest.hh:297
XrdSsiRequest::GetTimeOut
uint16_t GetTimeOut()
Definition XrdSsiRequest.hh:168
XrdSsiRequest::GetMetadata
const char * GetMetadata(int &dlen)
Definition XrdSsiRequest.cc:153
XrdSsiRequest::Finished
bool Finished(bool cancel=false)
Definition XrdSsiRequest.cc:115
XrdSsiRequest::XrdSsiRequest
XrdSsiRequest(const char *reqid=0, uint16_t tmo=0)
Definition XrdSsiRequest.cc:56
XrdSsiRequest::ProcessResponse
virtual bool ProcessResponse(const XrdSsiErrInfo &eInfo, const XrdSsiRespInfo &rInfo)=0
XrdSsiRequest::XrdSsiResponder
friend class XrdSsiResponder
Definition XrdSsiRequest.hh:73
XrdSsiRequest::RelRequestBuffer
virtual void RelRequestBuffer()
Definition XrdSsiRequest.hh:251
XrdSsiRequest::Alert
virtual void Alert(XrdSsiRespInfoMsg &aMsg)
Send or receive a server generated alert.
Definition XrdSsiRequest.hh:238
XrdSsiRequest::ReleaseRequestBuffer
void ReleaseRequestBuffer()
Definition XrdSsiRequest.cc:187
XrdSsiRequest::SetDetachTTL
void SetDetachTTL(uint32_t dttl)
Set the detached request time to live value.
Definition XrdSsiRequest.hh:269
XrdSsiRequest::SetRetry
void SetRetry(bool onoff)
Definition XrdSsiRequest.cc:197
XrdSsiRequest::ProcessResponseData
virtual void ProcessResponseData(const XrdSsiErrInfo &eInfo, char *buff, int blen, bool last)
Definition XrdSsiRequest.hh:198
XrdSsiRequest::SetTimeOut
void SetTimeOut(uint16_t tmo)
Definition XrdSsiRequest.hh:288
XrdSsiRequest::XrdSsiRRAgent
friend class XrdSsiRRAgent
Definition XrdSsiRequest.hh:74
XrdSsiRequest::GetRequestID
const char * GetRequestID()
Definition XrdSsiRequest.hh:147
XrdSsiRequest::GetRequest
virtual char * GetRequest(int &dlen)=0
XrdSsiRequest::GetResponseData
void GetResponseData(char *buff, int blen)
Definition XrdSsiRequest.cc:164
XrdSsiRequest::GetDetachTTL
uint32_t GetDetachTTL()
Definition XrdSsiRequest.hh:101
XrdSsiRespInfoMsg
Definition XrdSsiRespInfo.hh:87
XrdSsiRespInfoMsg::RecycleMsg
virtual void RecycleMsg(bool sent=true)=0
XrdSsiResponder
Definition XrdSsiResponder.hh:69
XrdSsiRespInfo
Definition XrdSsiRespInfo.hh:44