00001 #ifndef __XRDSSIRESPINFO_HH__ 00002 #define __XRDSSIRESPINFO_HH__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d S s i R e s p I n f o . h h */ 00006 /* */ 00007 /* (c) 2014 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00009 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00010 /* */ 00011 /* This file is part of the XRootD software suite. */ 00012 /* */ 00013 /* XRootD is free software: you can redistribute it and/or modify it under */ 00014 /* the terms of the GNU Lesser General Public License as published by the */ 00015 /* Free Software Foundation, either version 3 of the License, or (at your */ 00016 /* option) any later version. */ 00017 /* */ 00018 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00019 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00020 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00021 /* License for more details. */ 00022 /* */ 00023 /* You should have received a copy of the GNU Lesser General Public License */ 00024 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00025 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00026 /* */ 00027 /* The copyright holder's institutional names and contributor's names may not */ 00028 /* be used to endorse or promote products derived from this software without */ 00029 /* specific prior written permission of the institution or contributor. */ 00030 /******************************************************************************/ 00031 00032 //----------------------------------------------------------------------------- 00039 //----------------------------------------------------------------------------- 00040 00041 class XrdSsiStream; 00042 00043 struct XrdSsiRespInfo 00044 {union {const char *buff; 00045 00046 const char *eMsg; 00047 long long fsize; 00048 XrdSsiStream *strmP; 00049 }; 00050 union { int blen; 00051 00052 int eNum; 00053 int fdnum; 00054 }; 00055 int mdlen; 00056 const char *mdata; 00057 00058 enum Resp_t {isNone = 0, isData, isError, isFile, isStream, isHandle}; 00059 Resp_t rType; 00060 00061 inline void Init() {fsize=0; blen=0; mdlen=0; mdata=0; rType=isNone;} 00062 00063 const char *State() const {if (rType == isData ) return "isData"; 00064 if (rType == isError ) return "isError"; 00065 if (rType == isHandle) return "isHandle"; 00066 if (rType == isFile ) return "isFile"; 00067 if (rType == isStream) return "isStream"; 00068 if (rType == isNone ) return "isNone"; 00069 return "isUndef"; 00070 } 00071 00072 XrdSsiRespInfo() {Init();} 00073 ~XrdSsiRespInfo() {} 00074 }; 00075 00076 /******************************************************************************/ 00077 /* X r d S s i R e s p M s g */ 00078 /******************************************************************************/ 00079 00080 //----------------------------------------------------------------------------- 00084 //----------------------------------------------------------------------------- 00085 00086 class XrdSsiRespInfoMsg 00087 { 00088 public: 00089 00090 //----------------------------------------------------------------------------- 00097 //----------------------------------------------------------------------------- 00098 00099 inline char *GetMsg(int &mlen) {mlen = msgLen; return msgBuf;} 00100 00101 //----------------------------------------------------------------------------- 00106 //----------------------------------------------------------------------------- 00107 00108 virtual void RecycleMsg(bool sent=true) = 0; 00109 00110 //----------------------------------------------------------------------------- 00115 //----------------------------------------------------------------------------- 00116 00117 XrdSsiRespInfoMsg(char *msgP, int mlen) 00118 : msgBuf(msgP), msgLen(mlen) {} 00119 00120 protected: 00121 00122 //----------------------------------------------------------------------------- 00124 //----------------------------------------------------------------------------- 00125 00126 virtual ~XrdSsiRespInfoMsg() {} 00127 00128 char *msgBuf; 00129 int msgLen; 00130 }; 00131 #endif