XRootD
XrdXrootdTpcMon.hh
Go to the documentation of this file.
1 #ifndef __XRDXROOTDTPCMON_HH__
2 #define __XRDXROOTDTPCMON_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d X r o o t d T p c M o n . h h */
6 /* */
7 /* (c) 2022 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include <stddef.h>
34 #include <time.h>
35 #include <sys/time.h>
36 
37 class XrdSysLogger;
38 class XrdXrootdGStream;
39 
41 {
42 public:
43 
44 struct TpcInfo
45 {
46 const char* clID; // Client ID
47 struct timeval begT; // gettimeofday copy started
48 struct timeval endT; // gettimeofday copy ended
49 const char* srcURL; // The source URL used
50 const char* dstURL; // The destination URL used
51 size_t fSize; // The size of the file
52 int endRC; // Ending return code (0 means success)
53 unsigned short opts; // Additional information:
54 unsigned char strm; // Number of streams used
55 unsigned char rsvd; // Reserved
56 
57 static const int isaPush = 0x0001; // opts: Push request otherwise a pull
58 static const int isIPv4 = 0x0002; // opts: Used IPv4 for xfr else IPv6.
59 
60 void Init() {clID = "";
61  begT.tv_sec = 0; begT.tv_usec = 0;
62  endT.tv_sec = 0; endT.tv_usec = 0;
63  srcURL = ""; dstURL = "";
64  fSize = 0; endRC = 0,
65  opts = 0; strm = 1; rsvd = 0;
66  }
67 
68  TpcInfo() {Init();}
69 
70  ~TpcInfo() {}
71 };
72 
73 //-----------------------------------------------------------------------------
77 //-----------------------------------------------------------------------------
78 
79 void Report(TpcInfo &info);
80 
81 //-----------------------------------------------------------------------------
87 //-----------------------------------------------------------------------------
88 
89  XrdXrootdTpcMon(const char *proto, XrdSysLogger* logP,
90  XrdXrootdGStream& gStrm);
91 
92 private:
93 
94 //-----------------------------------------------------------------------------
96 //-----------------------------------------------------------------------------
97 
98  ~XrdXrootdTpcMon() {}
99 
100 const char *getURL(const char *spec, const char *prot, char *buff, int bsz);
101 const char* getUTC(struct timeval& tod, char* utcBuff, int utcBLen);
102 
103 const char* protocol;
104 XrdXrootdGStream& gStream;
105 };
106 #endif
void Report(TpcInfo &info)
XrdXrootdTpcMon(const char *proto, XrdSysLogger *logP, XrdXrootdGStream &gStrm)
static const int isaPush