00001 //------------------------------------------------------------------------------ 00002 // Copyright (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., 00003 // University 00004 // Copyright (c) 2012 by European Organization for Nuclear Research (CERN) 00005 // Author: Andrew Hanushevsky <abh@stanford.edu> 00006 // Author: Lukasz Janyst <ljanyst@cern.ch> 00007 //------------------------------------------------------------------------------ 00008 // XRootD is free software: you can redistribute it and/or modify 00009 // it under the terms of the GNU Lesser General Public License as published by 00010 // the Free Software Foundation, either version 3 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // XRootD is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Lesser General Public License 00019 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00020 //------------------------------------------------------------------------------ 00021 00022 //------------------------------------------------------------------------------ 00039 //------------------------------------------------------------------------------ 00040 00041 #ifndef __XRD_CL_MONITOR_HH__ 00042 #define __XRD_CL_MONITOR_HH__ 00043 00044 #include "XrdCl/XrdClFileSystem.hh" 00045 00046 namespace XrdCl 00047 { 00048 class URL; 00049 00050 //---------------------------------------------------------------------------- 00052 //---------------------------------------------------------------------------- 00053 class Monitor 00054 { 00055 public: 00056 //------------------------------------------------------------------------ 00058 //------------------------------------------------------------------------ 00059 Monitor() {} 00060 00061 //------------------------------------------------------------------------ 00063 //------------------------------------------------------------------------ 00064 virtual ~Monitor() {} 00065 00066 //------------------------------------------------------------------------ 00068 //------------------------------------------------------------------------ 00069 struct ConnectInfo 00070 { 00071 ConnectInfo(): streams( 0 ) 00072 { 00073 sTOD.tv_sec = 0; sTOD.tv_usec = 0; 00074 eTOD.tv_sec = 0; eTOD.tv_usec = 0; 00075 } 00076 std::string server; 00077 std::string auth; 00078 timeval sTOD; 00079 timeval eTOD; 00080 uint16_t streams; 00081 }; 00082 00083 //------------------------------------------------------------------------ 00085 //------------------------------------------------------------------------ 00086 struct DisconnectInfo 00087 { 00088 DisconnectInfo(): rBytes(0), sBytes(0), cTime(0) 00089 {} 00090 std::string server; 00091 uint64_t rBytes; 00092 uint64_t sBytes; 00093 time_t cTime; 00094 Status status; 00095 }; 00096 00097 //------------------------------------------------------------------------ 00099 //------------------------------------------------------------------------ 00100 struct OpenInfo 00101 { 00102 OpenInfo(): file(0), fSize(0), oFlags(0) {} 00103 const URL *file; 00104 std::string dataServer; 00105 uint64_t fSize; 00106 uint16_t oFlags; 00107 }; 00108 00109 //------------------------------------------------------------------------ 00111 //------------------------------------------------------------------------ 00112 struct CloseInfo 00113 { 00114 CloseInfo(): 00115 file(0), rBytes(0), vBytes(0), wBytes(0), vSegs(0), rCount(0), 00116 vCount(0), wCount(0), status(0) 00117 { 00118 oTOD.tv_sec = 0; oTOD.tv_usec = 0; 00119 cTOD.tv_sec = 0; cTOD.tv_usec = 0; 00120 } 00121 const URL *file; 00122 timeval oTOD; 00123 timeval cTOD; 00124 uint64_t rBytes; 00125 uint64_t vBytes; 00126 uint64_t wBytes; 00127 // uint64_t vwBytes; //!< Total number of bytes written vie writev 00128 uint64_t vSegs; 00129 uint32_t rCount; 00130 uint32_t vCount; 00131 uint32_t wCount; 00132 const XRootDStatus *status; 00133 }; 00134 00135 //------------------------------------------------------------------------ 00137 //------------------------------------------------------------------------ 00138 struct ErrorInfo 00139 { 00140 enum Operation 00141 { 00142 ErrOpen = 0, 00143 ErrRead, 00144 ErrReadV, 00145 ErrWrite, 00146 // TODO 00147 // ErrWriteV, //!< WriteV (we can uncomment only when we do a major 00148 // release as this is an ABI change) 00149 ErrUnc 00150 }; 00151 00152 ErrorInfo(): file(0), status(0), opCode( ErrUnc ) {} 00153 const URL *file; 00154 const XRootDStatus *status; 00155 Operation opCode; 00156 }; 00157 00158 //------------------------------------------------------------------------ 00160 //------------------------------------------------------------------------ 00161 struct TransferInfo 00162 { 00163 TransferInfo(): origin(0), target(0) {} 00164 const URL *origin; 00165 const URL *target; 00166 }; 00167 00168 //------------------------------------------------------------------------ 00172 //------------------------------------------------------------------------ 00173 struct CopyBInfo 00174 { 00175 TransferInfo transfer; 00176 }; 00177 00178 //------------------------------------------------------------------------ 00180 //------------------------------------------------------------------------ 00181 struct CopyEInfo 00182 { 00183 CopyEInfo(): sources(0), status(0) 00184 { 00185 bTOD.tv_sec = 0; bTOD.tv_usec = 0; 00186 eTOD.tv_sec = 0; eTOD.tv_usec = 0; 00187 } 00188 TransferInfo transfer; 00189 int sources; 00190 timeval bTOD; 00191 timeval eTOD; 00192 const XRootDStatus *status; 00193 }; 00194 00195 //------------------------------------------------------------------------ 00197 //------------------------------------------------------------------------ 00198 struct CheckSumInfo 00199 { 00200 CheckSumInfo(): oTime(0), tTime(0), isOK(false) {} 00201 TransferInfo transfer; 00202 std::string cksum; 00203 uint64_t oTime; 00204 uint64_t tTime; 00205 bool isOK; 00206 }; 00207 00208 //------------------------------------------------------------------------ 00211 //------------------------------------------------------------------------ 00212 enum EventCode 00213 { 00214 EvCopyBeg, 00215 EvCopyEnd, 00216 EvCheckSum, 00217 EvOpen, 00218 EvClose, 00219 EvErrIO, 00220 EvConnect, 00221 EvDisconnect 00222 00223 }; 00224 00225 //------------------------------------------------------------------------ 00232 //------------------------------------------------------------------------ 00233 virtual void Event( EventCode evCode, void *evData ) = 0; 00234 }; 00235 } 00236 00237 #endif // __XRD_CL_MONITOR_HH