00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TXNetSystem
00013 #define ROOT_TXNetSystem
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROOT_TNetSystem
00029 #include "TNetFile.h"
00030 #endif
00031
00032 #ifndef ROOT_Rtypes
00033 #include "Rtypes.h"
00034 #endif
00035
00036 #ifndef ROOT_TString
00037 #include "TString.h"
00038 #endif
00039
00040 #ifndef OLDXRDLOCATE
00041 #ifndef ROOT_THashList
00042 #include "THashList.h"
00043 #endif
00044 #endif
00045
00046 #include "XrdOuc/XrdOucString.hh"
00047 #include "XrdClient/XrdClientVector.hh"
00048
00049 class XrdClientAdmin;
00050 class TCollection;
00051 class TXNetSystemConnectGuard;
00052
00053 typedef XrdClientVector<XrdOucString> vecString;
00054 typedef XrdClientVector<bool> vecBool;
00055
00056 #ifndef OLDXRDLOCATE
00057 class TXrdClientAdminWrapper : public TNamed {
00058 public:
00059 TXrdClientAdminWrapper(const char *key, XrdClientAdmin *ca) : TNamed(key,""), fXCA(ca) { }
00060 virtual ~TXrdClientAdminWrapper();
00061 XrdClientAdmin *fXCA;
00062 };
00063 #endif
00064
00065 class TXNetSystem : public TNetSystem {
00066
00067 friend class TXNetSystemConnectGuard;
00068
00069 private:
00070 Bool_t fIsRootd;
00071 Bool_t fIsXRootd;
00072 TString fDir;
00073 void *fDirp;
00074 vecString fDirList;
00075 Bool_t fDirListValid;
00076 TString fDirEntry;
00077 TString fUrl;
00078
00079 static Bool_t fgInitDone;
00080 static Bool_t fgRootdBC;
00081
00082 XrdClientAdmin *Connect(const char *url);
00083 void *GetDirPtr() const { return fDirp; }
00084 void InitXrdClient();
00085
00086 #ifndef OLDXRDLOCATE
00087 static THashList fgAddrFQDN;
00088 static THashList fgAdminHash;
00089 static XrdClientAdmin *GetClientAdmin(const char *url);
00090 static TString GetKey(const char *url);
00091 #endif
00092
00093 public:
00094 TXNetSystem(Bool_t owner = kTRUE);
00095 TXNetSystem(const char *url, Bool_t owner = kTRUE);
00096 virtual ~TXNetSystem() { }
00097
00098 Bool_t AccessPathName(const char *path, EAccessMode mode);
00099 virtual Bool_t ConsistentWith(const char *path, void *dirptr);
00100 virtual void FreeDirectory(void *dirp);
00101 virtual const char *GetDirEntry(void *dirp);
00102 virtual Int_t GetPathInfo(const char* path, FileStat_t &buf);
00103 virtual Bool_t IsPathLocal(const char *path);
00104 virtual Int_t Locate(const char* path, TString &endurl);
00105 virtual Int_t MakeDirectory(const char* dir);
00106 virtual void *OpenDirectory(const char* dir);
00107 virtual int Unlink(const char *path);
00108
00109
00110 Bool_t GetPathsInfo(const char *paths, UChar_t *info);
00111 Bool_t IsOnline(const char *path);
00112 Bool_t Prepare(const char *path, UChar_t opt = 8, UChar_t prio = 0);
00113 Int_t Prepare(TCollection *paths,
00114 UChar_t opt = 8, UChar_t prio = 0, TString *buf = 0);
00115
00116 ClassDef(TXNetSystem,0)
00117 };
00118
00119
00120
00121
00122 class TXNetSystemConnectGuard {
00123
00124 private:
00125 XrdClientAdmin *fClientAdmin;
00126
00127 public:
00128 TXNetSystemConnectGuard(TXNetSystem *xn, const char *url);
00129 ~TXNetSystemConnectGuard();
00130
00131 bool IsValid() const { return ((fClientAdmin) ? 1 : 0); }
00132
00133 XrdClientAdmin *ClientAdmin() const { return fClientAdmin; }
00134
00135 void NotifyLastError();
00136 };
00137
00138 #endif