#ifndef ROOT_TXNetSystem
#define ROOT_TXNetSystem
#ifndef ROOT_TNetSystem
#include "TNetFile.h"
#endif
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_THashList
#include "THashList.h"
#endif
class XrdClientAdmin;
class TCollection;
class TXNetSystemConnectGuard;
typedef void* VecStringVP_t;
class TXrdClientAdminWrapper : public TNamed {
public:
TXrdClientAdminWrapper(const char *key, XrdClientAdmin *ca) : TNamed(key,""), fXCA(ca) { }
virtual ~TXrdClientAdminWrapper();
XrdClientAdmin *fXCA;
};
class TXNetSystem : public TNetSystem {
friend class TXNetSystemConnectGuard;
private:
Bool_t fIsRootd;
Bool_t fIsXRootd;
TString fDir;
void *fDirp;
VecStringVP_t fDirList;
TString fDirEntry;
TString fUrl;
static Bool_t fgInitDone;
static Bool_t fgRootdBC;
XrdClientAdmin *Connect(const char *url);
void *GetDirPtr() const { return fDirp; }
void InitXrdClient();
static THashList fgAddrFQDN;
static THashList fgAdminHash;
static XrdClientAdmin *GetClientAdmin(const char *url);
static TString GetKey(const char *url);
public:
TXNetSystem(Bool_t owner = kTRUE);
TXNetSystem(const char *url, Bool_t owner = kTRUE);
virtual ~TXNetSystem() { }
Bool_t AccessPathName(const char *path, EAccessMode mode);
virtual Bool_t ConsistentWith(const char *path, void *dirptr);
virtual void FreeDirectory(void *dirp);
virtual const char *GetDirEntry(void *dirp);
virtual Int_t GetPathInfo(const char* path, FileStat_t &buf);
virtual Bool_t IsPathLocal(const char *path);
virtual Int_t Locate(const char* path, TString &endurl);
virtual Int_t MakeDirectory(const char* dir);
virtual void *OpenDirectory(const char* dir);
virtual int Unlink(const char *path);
Bool_t GetPathsInfo(const char *paths, UChar_t *info);
Bool_t IsOnline(const char *path);
Bool_t Prepare(const char *path, UChar_t opt = 8, UChar_t prio = 0);
Int_t Prepare(TCollection *paths,
UChar_t opt = 8, UChar_t prio = 0, TString *buf = 0);
ClassDef(TXNetSystem,0)
};
class TXNetSystemConnectGuard {
private:
XrdClientAdmin *fClientAdmin;
public:
TXNetSystemConnectGuard(TXNetSystem *xn, const char *url);
~TXNetSystemConnectGuard();
bool IsValid() const { return ((fClientAdmin) ? 1 : 0); }
XrdClientAdmin *ClientAdmin() const { return fClientAdmin; }
void NotifyLastError();
};
#endif