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 vSegs; 00128 uint32_t rCount; 00129 uint32_t vCount; 00130 uint32_t wCount; 00131 const XRootDStatus *status; 00132 }; 00133 00134 //------------------------------------------------------------------------ 00136 //------------------------------------------------------------------------ 00137 struct ErrorInfo 00138 { 00139 enum Operation 00140 { 00141 ErrOpen = 0, 00142 ErrRead, 00143 ErrReadV, 00144 ErrWrite, 00145 ErrUnc 00146 }; 00147 00148 ErrorInfo(): file(0), opCode( ErrUnc ) {} 00149 const URL *file; 00150 const XRootDStatus *status; 00151 Operation opCode; 00152 }; 00153 00154 //------------------------------------------------------------------------ 00156 //------------------------------------------------------------------------ 00157 struct TransferInfo 00158 { 00159 TransferInfo(): origin(0), target(0) {} 00160 const URL *origin; 00161 const URL *target; 00162 }; 00163 00164 //------------------------------------------------------------------------ 00168 //------------------------------------------------------------------------ 00169 struct CopyBInfo 00170 { 00171 TransferInfo transfer; 00172 }; 00173 00174 //------------------------------------------------------------------------ 00176 //------------------------------------------------------------------------ 00177 struct CopyEInfo 00178 { 00179 CopyEInfo(): sources(0), status(0) 00180 { 00181 bTOD.tv_sec = 0; bTOD.tv_usec = 0; 00182 eTOD.tv_sec = 0; eTOD.tv_usec = 0; 00183 } 00184 TransferInfo transfer; 00185 int sources; 00186 timeval bTOD; 00187 timeval eTOD; 00188 const XRootDStatus *status; 00189 }; 00190 00191 //------------------------------------------------------------------------ 00193 //------------------------------------------------------------------------ 00194 struct CheckSumInfo 00195 { 00196 CheckSumInfo(): oTime(0), tTime(0), isOK(false) {} 00197 TransferInfo transfer; 00198 std::string cksum; 00199 uint64_t oTime; 00200 uint64_t tTime; 00201 bool isOK; 00202 }; 00203 00204 //------------------------------------------------------------------------ 00207 //------------------------------------------------------------------------ 00208 enum EventCode 00209 { 00210 EvCopyBeg, 00211 EvCopyEnd, 00212 EvCheckSum, 00213 EvOpen, 00214 EvClose, 00215 EvErrIO, 00216 EvConnect, 00217 EvDisconnect 00218 00219 }; 00220 00221 //------------------------------------------------------------------------ 00228 //------------------------------------------------------------------------ 00229 virtual void Event( EventCode evCode, void *evData ) = 0; 00230 }; 00231 }; 00232 00233 #endif // __XRD_CL_MONITOR_HH