xrootd
XrdClientAbs.hh
Go to the documentation of this file.
1 
2 // //
3 // XrdClientAbs //
4 // //
5 // Author: Fabrizio Furano (INFN Padova, 2004) //
6 // Adapted from TXNetFile (root.cern.ch) originally done by //
7 // Alvise Dorigo, Fabrizio Furano //
8 // INFN Padova, 2003 //
9 // //
10 // Base class for objects handling redirections keeping open files //
11 // //
13 
14 // $Id$
15 
16 #ifndef XRD_ABSCLIENTBASE_H
17 #define XRD_ABSCLIENTBASE_H
18 
21 
22 class XrdClientCallback;
23 
25 
26  // Do NOT abuse of this
27  friend class XrdClientConn;
28 
29 
30 protected:
32 
33  char fHandle[4]; // The file handle returned by the server,
34  // to be used for successive requests
35 
36 
38  void * fXrdCcbArg;
39 
40  // After a redirection the file must be reopened.
41  virtual bool OpenFileWhenRedirected(char *newfhandle,
42  bool &wasopen) = 0;
43 
44  // In some error circumstances (e.g. when writing)
45  // a redirection on error must be denied
46  virtual bool CanRedirOnError() = 0;
47 
48 public:
49 
50  XrdClientAbs(XrdClientCallback *XrdCcb = 0, void *XrdCcbArg = 0) {
51  memset( fHandle, 0, sizeof(fHandle) );
52 
53  // Set the callback object, if any
54  fXrdCcb = XrdCcb;
55  fXrdCcbArg = XrdCcbArg;
56  }
57 
58  virtual bool IsOpen_wait() {
59  return true;
60  };
61 
62  void SetParm(const char *parm, int val);
63  void SetParm(const char *parm, double val);
64 
65  // Hook to the open connection (needed by TXNetFile)
67 
69  if (fConnModule)
70  return fConnModule->GetCurrentUrl();
71  else {
72  XrdClientUrlInfo empty;
73  return empty;
74  }
75  }
76 
77  // The last response got from a non-async request
79  IsOpen_wait();
81  else return 0;
82  }
83 
86  else return 0;
87  }
88 
89  // Asks for the value of some parameter
90  //---------------------------------------------------------------------------
93  //---------------------------------------------------------------------------
94  bool Query(kXR_int16 ReqCode, const kXR_char *Args, kXR_char *Resp, kXR_int32 MaxResplen);
95 
96  //---------------------------------------------------------------------------
101  //---------------------------------------------------------------------------
102  bool Query( kXR_int16 ReqCode, const kXR_char *Args, kXR_char **Resp, kXR_int32 MaxResplen );
103 
104 };
105 
106 #endif