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), vrBytes(0), wBytes(0), vwBytes(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 vrBytes; 00126 uint64_t wBytes; 00127 uint64_t vwBytes; 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 ErrWriteV, 00147 ErrUnc 00148 }; 00149 00150 ErrorInfo(): file(0), status(0), opCode( ErrUnc ) {} 00151 const URL *file; 00152 const XRootDStatus *status; 00153 Operation opCode; 00154 }; 00155 00156 //------------------------------------------------------------------------ 00158 //------------------------------------------------------------------------ 00159 struct TransferInfo 00160 { 00161 TransferInfo(): origin(0), target(0) {} 00162 const URL *origin; 00163 const URL *target; 00164 }; 00165 00166 //------------------------------------------------------------------------ 00170 //------------------------------------------------------------------------ 00171 struct CopyBInfo 00172 { 00173 TransferInfo transfer; 00174 }; 00175 00176 //------------------------------------------------------------------------ 00178 //------------------------------------------------------------------------ 00179 struct CopyEInfo 00180 { 00181 CopyEInfo(): sources(0), status(0) 00182 { 00183 bTOD.tv_sec = 0; bTOD.tv_usec = 0; 00184 eTOD.tv_sec = 0; eTOD.tv_usec = 0; 00185 } 00186 TransferInfo transfer; 00187 int sources; 00188 timeval bTOD; 00189 timeval eTOD; 00190 const XRootDStatus *status; 00191 }; 00192 00193 //------------------------------------------------------------------------ 00195 //------------------------------------------------------------------------ 00196 struct CheckSumInfo 00197 { 00198 CheckSumInfo(): oTime(0), tTime(0), isOK(false) {} 00199 TransferInfo transfer; 00200 std::string cksum; 00201 uint64_t oTime; 00202 uint64_t tTime; 00203 bool isOK; 00204 }; 00205 00206 //------------------------------------------------------------------------ 00209 //------------------------------------------------------------------------ 00210 enum EventCode 00211 { 00212 EvCopyBeg, 00213 EvCopyEnd, 00214 EvCheckSum, 00215 EvOpen, 00216 EvClose, 00217 EvErrIO, 00218 EvConnect, 00219 EvDisconnect 00220 00221 }; 00222 00223 //------------------------------------------------------------------------ 00230 //------------------------------------------------------------------------ 00231 virtual void Event( EventCode evCode, void *evData ) = 0; 00232 }; 00233 } 00234 00235 #endif // __XRD_CL_MONITOR_HH