xrootd
XrdClientAbs.hh
Go to the documentation of this file.
1#ifndef XRD_ABSCLIENTBASE_H
2#define XRD_ABSCLIENTBASE_H
3/******************************************************************************/
4/* */
5/* X r d C l i e n t A b s . h h */
6/* */
7/* Author: Fabrizio Furano (INFN Padova, 2004) */
8/* Adapted from TXNetFile (root.cern.ch) originally done by */
9/* Alvise Dorigo, Fabrizio Furano */
10/* INFN Padova, 2003 */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
34// //
35// Base class for objects handling redirections keeping open files //
36// //
38
39#include <string.h>
40
43
44#include "XProtocol/XPtypes.hh"
45
47class XrdClientConn;
48
50
51 // Do NOT abuse of this
52 friend class XrdClientConn;
53
54
55protected:
57
58 char fHandle[4]; // The file handle returned by the server,
59 // to be used for successive requests
60
61
63 void * fXrdCcbArg;
64
65 // After a redirection the file must be reopened.
66 virtual bool OpenFileWhenRedirected(char *newfhandle,
67 bool &wasopen) = 0;
68
69 // In some error circumstances (e.g. when writing)
70 // a redirection on error must be denied
71 virtual bool CanRedirOnError() = 0;
72
73public:
74
75 XrdClientAbs(XrdClientCallback *XrdCcb = 0, void *XrdCcbArg = 0) {
76 memset( fHandle, 0, sizeof(fHandle) );
77
78 // Set the callback object, if any
79 fXrdCcb = XrdCcb;
80 fXrdCcbArg = XrdCcbArg;
81 }
82
83 virtual bool IsOpen_wait() {
84 return true;
85 };
86
87 void SetParm(const char *parm, int val);
88 void SetParm(const char *parm, double val);
89
90 // Hook to the open connection (needed by TXNetFile)
92
94
95 // The last response got from a non-async request
97
99
100 // Asks for the value of some parameter
101 //---------------------------------------------------------------------------
106 //---------------------------------------------------------------------------
107 bool Query(kXR_int16 ReqCode, const kXR_char *Args, kXR_char *Resp, kXR_int32 MaxResplen);
108
109 //---------------------------------------------------------------------------
116 //---------------------------------------------------------------------------
117 bool Query( kXR_int16 ReqCode, const kXR_char *Args, kXR_char **Resp, kXR_int32 MaxResplen );
118
119};
120#endif
int kXR_int32
Definition: XPtypes.hh:89
short kXR_int16
Definition: XPtypes.hh:66
unsigned char kXR_char
Definition: XPtypes.hh:65
Definition: XrdClientUnsolMsg.hh:51
Definition: XrdClientAbs.hh:49
virtual bool OpenFileWhenRedirected(char *newfhandle, bool &wasopen)=0
XrdClientAbs(XrdClientCallback *XrdCcb=0, void *XrdCcbArg=0)
Definition: XrdClientAbs.hh:75
struct ServerResponseBody_Error * LastServerError()
XrdClientCallback * fXrdCcb
Definition: XrdClientAbs.hh:62
virtual bool CanRedirOnError()=0
XrdClientUrlInfo GetCurrentUrl()
bool Query(kXR_int16 ReqCode, const kXR_char *Args, kXR_char **Resp, kXR_int32 MaxResplen)
XrdClientConn * GetClientConn() const
Definition: XrdClientAbs.hh:91
void SetParm(const char *parm, double val)
virtual bool IsOpen_wait()
Definition: XrdClientAbs.hh:83
struct ServerResponseHeader * LastServerResp()
char fHandle[4]
Definition: XrdClientAbs.hh:58
void SetParm(const char *parm, int val)
XrdClientConn * fConnModule
Definition: XrdClientAbs.hh:56
void * fXrdCcbArg
Definition: XrdClientAbs.hh:63
bool Query(kXR_int16 ReqCode, const kXR_char *Args, kXR_char *Resp, kXR_int32 MaxResplen)
Definition: XrdClientCallback.hh:39
Definition: XrdClientConn.hh:54
Definition: XrdClientUrlInfo.hh:50
Definition: XProtocol.hh:789
Definition: XProtocol.hh:711