36#include "XrdOuc/XrdOucString.hh"
38#include "XrdClient/XrdClientAdmin.hh"
42#include "XProtocol/XProtocol.hh"
69 SetTitle(
"(x)rootd system administration");
82 SetTitle(
"(x)rootd system administration");
104 Error(
"TXNetSystem",
"fatal error: connection creation failed.");
123 Error(
"Connect",
"fatal error: new object creation failed.");
133 if (cadm->Connect()) {
140 (cadm->GetClientConn()->GetServerType() ==
kSTRootd);
141 Int_t sd = cadm->GetClientConn()->GetOpenSockFD();
142 if (isRootd && sd > -1) {
149 gROOT->GetListOfSockets()->Remove(s);
156 Error(
"TXNetSystem",
"getting protocol of the rootd server");
162 TUrl uut((cadm->GetClientConn()
163 ->GetCurrentUrl()).GetUrl().c_str());
167 Info(
"Connect",
" url: %s",uu.
Data());
191 Error(
"Connect",
"some severe error occurred while opening"
192 " the connection at %s - exit", url);
193 if (cadm && cadm->LastServerError())
194 Printf(
" '%s'", cadm->LastServerError()->errmsg);
196 Printf(
" (error message not available)");
202 "while opening the connection at %s - exit", url);
224 Info(
"TXNetFile",
"(C) 2005 SLAC TXNetSystem (eXtended TNetSystem) %s",
225 gROOT->GetVersion());
249 if (existDirs.GetSize()>0 && existDirs[0])
258 Info(
"OpenDirectory",
"calling TNetSystem::OpenDirectory");
269 Error(
"FreeDirectory",
"invalid directory pointer (%p, %p)", dirp,
fDirp);
284 Info(
"FreeDirectory",
"calling TNetSystem::FreeDirectory");
309 Info(
"MakeDirectory",
"Calling TNetSystem::MakeDirectory");
321 Error(
"GetDirEntry",
"invalid directory pointer");
349 if (
gDebug > 1)
Info(
"GetDirEntry",
"Calling TNetSystem::GetDirEntry");
384 if (flags & kXR_offline) {
387 buf.
fDev = (
id >> 24);
388 buf.
fIno = (
id & 0x00FFFFFF);
412 Info(
"GetPathInfo",
"Calling TNetSystem::GetPathInfo");
423 Info(
"ConsistentWith",
424 "calling for path: %s, dir: %p", path, dirptr);
449 Info(
"AccessPathName",
"calling TNetSystem::AccessPathName");
474 if (ok && !(flags & kXR_offline)) {
475 if (flags & kXR_isDir)
482 return ((ok) ? 0 : -1);
491 Info(
"Unlink",
"calling TNetSystem::Unlink");
504 Info(
"IsOnline",
"path '%s' cannot be stat'ed", path);
509 Info(
"IsOnline",
"path '%s' is offline", path);
525 vs.Push_back(pathname);
529 Info(
"Prepare",
"Got Status %d for %s",
530 cg.
ClientAdmin()->LastServerResp()->status, pathname.c_str());
531 if (!(cg.
ClientAdmin()->LastServerResp()->status)){
552 Warning(
"Prepare",
"input list is empty!");
568 while ((o = nxt())) {
572 Warning(
"Prepare",
"object is of unexpected type %s - ignoring", o->
ClassName());
583 Info(
"Prepare",
"buffer ready: issuing prepare (opt=%d, prio=%d) ...",
590 Info(
"Prepare",
"Got Status %d",
592 if (!(cg.
ClientAdmin()->LastServerResp()->status)){
610 Warning(
"GetPathsInfo",
"input list is empty!");
619 Info(
"GetPathsInfo",
"Got Status %d",
621 if (!(cg.
ClientAdmin()->LastServerResp()->status)){
662 XrdClientLocate_Info li;
674 if (strlen(
a.GetHostName()) > 0)
696 if (
gDebug > 0)
Info(
"Locate",
"server not Xrootd: method not implemented!");
706 XrdClientAdmin *ca = 0;
718 ca =
new XrdClientAdmin(url);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char mode
R__EXTERN TVirtualMutex * gROOTMutex
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Bool_t R_ISOFF(Int_t mode)
R__EXTERN TSystem * gSystem
#define R__LOCKGUARD(mutex)
TSystem * ROOT_Plugin_TXNetSystem(const char *url, Bool_t owner)
PluginManager creation function.
XrdClientVector< XrdOucString > VecString_t
#define NAME_FIRSTCONNECTMAXCNT
#define EnvPutInt(name, val)
Collection abstract base class.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
static TString GetPathName(TObject *o)
Return the path name contained in object 'o' allowing for TUrl, TObjString or TFileInfo.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
TObject * FindObject(const char *name) const override
Find object using its name.
This class represents an Internet Protocol (IP) address.
void Add(TObject *obj) override
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetTitle() const override
Returns title of object.
void Create(const char *url, TSocket *sock=nullptr)
Create a TNetSystem object.
Int_t MakeDirectory(const char *name) override
Make a directory via rootd.
void InitRemoteEntity(const char *url)
Parse and save coordinates of the remote entity (user, host, port, ...)
Bool_t ConsistentWith(const char *path, void *dirptr) override
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Int_t GetPathInfo(const char *path, FileStat_t &buf) override
Get info about a file.
const char * GetDirEntry(void *dirp=nullptr) override
Get directory entry via rootd. Returns 0 in case no more entries.
void FreeDirectory(void *dirp=nullptr) override
Free directory via rootd.
Bool_t AccessPathName(const char *path, EAccessMode mode) override
Returns FALSE if one can access a file using the specified access mode.
void * OpenDirectory(const char *name) override
Open a directory and return an opaque pointer to a dir structure.
Mother of all ROOT objects.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
virtual Int_t SetOption(ESockOptions opt, Int_t val)
Set socket options.
void SetServType(Int_t st)
void SetRemoteProtocol(Int_t rproto)
void SetService(const char *service)
void SetUrl(const char *url)
void Clear()
Clear string without changing its capacity.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Abstract base class defining a generic interface to the underlying Operating System.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
virtual TInetAddress GetHostByName(const char *server)
Get Internet Protocol (IP) address of host.
This class represents a WWW compatible URL.
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
const char * GetFileAndOptions() const
Return the file and its options (the string specified behind the ?).
const char * GetFile() const
void SetUrl(const char *url, Bool_t defaultIsFile=kFALSE)
Parse url character string and split in its different subcomponents.
void SetProtocol(const char *proto, Bool_t setDefaultPort=kFALSE)
Set protocol and, optionally, change the port accordingly.
const char * GetUser() const
const char * GetHost() const
void SetHost(const char *host)
static void SetEnv()
Set the relevant environment variables.
static void FormUrl(TUrl uut, TString &uu)
Form url for rootd socket.
static Int_t GetRootdProtocol(TSocket *s)
Find out the remote rootd protocol version.
~TXNetSystemConnectGuard()
Destructor: close the connection.
XrdClientAdmin * fClientAdmin
TXNetSystemConnectGuard(TXNetSystem *xn, const char *url)
Construct a guard object.
void NotifyLastError()
Print message about last occured error.
XrdClientAdmin * ClientAdmin() const
virtual Bool_t ConsistentWith(const char *path, void *dirptr)
Check consistency of this helper with the one required by 'path' or 'dirptr'.
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
static THashList fgAddrFQDN
static XrdClientAdmin * GetClientAdmin(const char *url)
Checks if an admin for 'url' exists already.
virtual int Unlink(const char *path)
Unlink 'path' on the remote server system.
virtual Int_t MakeDirectory(const char *dir)
Create a directory. Return 0 on success, -1 otherwise.
Bool_t GetPathsInfo(const char *paths, UChar_t *info)
Retrieve status of a ' '-separated list of files in 'paths'.
void InitXrdClient()
One-time initialization of some communication variables for xrootd protocol.
virtual Bool_t IsPathLocal(const char *path)
Returns TRUE if the url in 'path' points to the local file system.
TXNetSystem(Bool_t owner=kTRUE)
Create system management class without connecting to server.
virtual void FreeDirectory(void *dirp)
Free(Close) the directory referenced by dirp.
virtual void * OpenDirectory(const char *dir)
Open a directory.
virtual Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
static THashList fgAdminHash
Bool_t IsOnline(const char *path)
Check if the file defined by 'path' is ready to be used.
virtual const char * GetDirEntry(void *dirp)
Get directory entry for directory referenced by dirp.
Bool_t Prepare(const char *path, UChar_t opt=8, UChar_t prio=0)
Issue a prepare request for file defined by 'path'.
static TString GetKey(const char *url)
Build from uu a unique ID key used in hash tables.
virtual Int_t Locate(const char *path, TString &endurl)
Get end-point url of a file.
XrdClientAdmin * Connect(const char *url)
Init a connection to the server.
virtual ~TXrdClientAdminWrapper()
Destructor: destroy the instance.