XRootD
Loading...
Searching...
No Matches
XrdXrootdTpcMon Class Reference

#include <XrdXrootdTpcMon.hh>

+ Collaboration diagram for XrdXrootdTpcMon:

Classes

struct  TpcInfo
 

Public Member Functions

 XrdXrootdTpcMon (const char *proto, XrdSysLogger *logP, XrdXrootdGStream &gStrm)
 
void Report (TpcInfo &info)
 

Detailed Description

Definition at line 40 of file XrdXrootdTpcMon.hh.

Constructor & Destructor Documentation

◆ XrdXrootdTpcMon()

XrdXrootdTpcMon::XrdXrootdTpcMon ( const char * proto,
XrdSysLogger * logP,
XrdXrootdGStream & gStrm )

Constructor

Parameters
proto- the protocol being used for this object.
logP- Pointer to the logging object.
gStrm- Reference to the gStream to be used for reporting info.

Definition at line 58 of file XrdXrootdTpcMon.cc.

61 : protocol(proto), gStream(gStrm)
62{
63 const char *colon = ":";
64 char buff[512];
65
66// Initialize eror object
67//
68 eDest.logger(logP);
69
70// Get our host:port
71//
72 const char *host = getenv("XRDHOST"); if (!host) host = "localhost";
73 const char *port = getenv("XRDPORT"); if (!port) {colon = ""; port = "";}
74
75 snprintf(buff, sizeof(buff), "%s%s%s", host, colon, port);
76 hostport = strdup(buff);
77}
static XrdSysError eDest(0,"crypto_")
XrdSysLogger * logger(XrdSysLogger *lp=0)

References eDest, and XrdSysError::logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ Report()

void XrdXrootdTpcMon::Report ( XrdXrootdTpcMon::TpcInfo & info)

Report a TPC event.

Parameters
info- Reference to the filled in TpcInfo object.

Definition at line 124 of file XrdXrootdTpcMon.cc.

125{
126 const char *srcURL, *dstURL;
127 char bt_buff[40], et_buff[40], sBuff[1024], dBuff[1024], buff[8192];
128
129// Get correct source and destination URLs
130//
131 srcURL = getURL(info.srcURL, protocol, sBuff, sizeof(sBuff));
132 dstURL = getURL(info.dstURL, protocol, dBuff, sizeof(dBuff));
133
134// Format the line
135//
136 int n = snprintf(buff, sizeof(buff), json_fmt, protocol, info.clID,
137 getUTC(info.begT, bt_buff, sizeof(bt_buff)),
138 getUTC(info.endT, et_buff, sizeof(et_buff)),
139 info.endRC, static_cast<unsigned int>(info.strm),
140 (info.opts & TpcInfo::isaPush ? "push" : "pull"),
141 (info.opts & TpcInfo::isIPv4 ? '4' : '6'),
142 srcURL, dstURL, info.fSize);
143
144// Check for truncation
145//
146 if (n >= (int)sizeof(buff))
147 eDest.Emsg("TpcMon", protocol, "invalid json; line truncated!");
148
149// Send the message
150//
151 if (!gStream.Insert(buff, n+1))
152 eDest.Emsg("TpcMon", protocol, "invalid json; gStream buffer rejected!");
153}
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
bool Insert(const char *data, int dlen)

References XrdXrootdTpcMon::TpcInfo::begT, XrdXrootdTpcMon::TpcInfo::clID, XrdXrootdTpcMon::TpcInfo::dstURL, eDest, XrdSysError::Emsg(), XrdXrootdTpcMon::TpcInfo::endRC, XrdXrootdTpcMon::TpcInfo::endT, XrdXrootdTpcMon::TpcInfo::fSize, XrdXrootdGStream::Insert(), XrdXrootdTpcMon::TpcInfo::isaPush, XrdXrootdTpcMon::TpcInfo::isIPv4, XrdXrootdTpcMon::TpcInfo::opts, XrdXrootdTpcMon::TpcInfo::srcURL, and XrdXrootdTpcMon::TpcInfo::strm.

Referenced by XrdOfsTPCProg::Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: