00001 #ifndef XRD_CLIENT_ADMIN_H
00002 #define XRD_CLIENT_ADMIN_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00034
00035
00036
00038
00039 #include "XrdClient/XrdClientAbs.hh"
00040 #include "XrdClient/XrdClientVector.hh"
00041 #include "XrdOuc/XrdOucHash.hh"
00042 #include "XrdOuc/XrdOucString.hh"
00043
00044 typedef XrdClientVector<XrdOucString> vecString;
00045 typedef XrdClientVector<bool> vecBool;
00046
00047 void joinStrings(XrdOucString &buf, vecString &vs, int startidx = 0, int endidx=-1);
00048
00049 struct XrdClientLocate_Info {
00050 enum {
00051 kXrdcLocNone,
00052 kXrdcLocDataServer,
00053 kXrdcLocDataServerPending,
00054 kXrdcLocManager,
00055 kXrdcLocManagerPending
00056 } Infotype;
00057
00058 bool CanWrite;
00059
00060 kXR_char Location[256];
00061 };
00062
00063 class XrdClientAdmin : public XrdClientAbs {
00064
00065 XrdOucString fInitialUrl;
00066 bool DirList_low(const char *dir, vecString &entries);
00067 int LocalLocate(kXR_char *path,
00068 XrdClientVector<XrdClientLocate_Info> &res,
00069 bool writable, int opts, bool all = false);
00070 protected:
00071
00072 bool CanRedirOnError() {
00073
00074 return false;
00075 }
00076
00077
00078 bool OpenFileWhenRedirected(char *, bool &);
00079
00080 public:
00081 XrdClientAdmin(const char *url);
00082 virtual ~XrdClientAdmin();
00083
00084 bool Connect();
00085
00086
00087 bool SysStatX(const char *paths_list,
00088 kXR_char *binInfo);
00089
00090 bool Stat(const char *fname,
00091 long &id,
00092 long long &size,
00093 long &flags,
00094 long &modtime);
00095
00096
00097 bool Stat_vfs(const char *fname,
00098 int &rwservers,
00099 long long &rwfree,
00100 int &rwutil,
00101 int &stagingservers,
00102 long long &stagingfree,
00103 int &stagingutil);
00104
00105 bool DirList(const char *dir,
00106 vecString &entries, bool askallservers=false);
00107
00108 struct DirListInfo {
00109 XrdOucString fullpath;
00110 XrdOucString host;
00111 long long size;
00112 long id;
00113 long flags;
00114 long modtime;
00115 };
00116 bool DirList(const char *dir,
00117 XrdClientVector<DirListInfo> &dirlistinfo,
00118 bool askallservers=false);
00119
00120 bool ExistFiles(vecString&,
00121 vecBool&);
00122
00123 bool ExistDirs(vecString&,
00124 vecBool&);
00125
00126
00127
00128 bool GetSpaceInfo(const char *logicalname,
00129 long long &totspace,
00130 long long &totfree,
00131 long long &totused,
00132 long long &largestchunk);
00133
00134 long GetChecksum(kXR_char *path,
00135 kXR_char **chksum);
00136
00137
00138 void GoBackToRedirector();
00139
00140 bool IsFileOnline(vecString&,
00141 vecBool&);
00142
00143 bool Mv(const char *fileSrc,
00144 const char *fileDest);
00145
00146 bool Mkdir(const char *dir,
00147 int user,
00148 int group,
00149 int other);
00150
00151 bool Chmod(const char *file,
00152 int user,
00153 int group,
00154 int other);
00155
00156 bool Rm(const char *file);
00157
00158 bool Rmdir(const char *path);
00159
00160 bool Protocol(kXR_int32 &proto,
00161 kXR_int32 &kind);
00162
00163 bool Prepare(vecString vs,
00164 kXR_char opts,
00165 kXR_char prty);
00166 bool Prepare(const char *paths,
00167 kXR_char opts,
00168 kXR_char prty);
00169
00170
00171
00172
00173
00174 bool Locate(kXR_char *path, XrdClientLocate_Info &resp,
00175 bool writable=false);
00176
00177
00178 bool Locate(kXR_char *path,
00179 XrdClientVector<XrdClientLocate_Info> &hosts)
00180 {
00181 return Locate( path, hosts, 0 );
00182 }
00183
00184 bool Locate(kXR_char *path,
00185 XrdClientVector<XrdClientLocate_Info> &hosts,
00186 int opts );
00187
00188
00189 bool Truncate(const char *path, long long newsize);
00190
00191 UnsolRespProcResult ProcessUnsolicitedMsg(XrdClientUnsolMsgSender *sender,
00192 XrdClientMessage *unsolmsg);
00193
00194 };
00195 #endif