xrootd
|
00001 /*****************************************************************************/ 00002 /* */ 00003 /* XrdMonDecStageInfo.hh */ 00004 /* */ 00005 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 00006 /* All Rights Reserved */ 00007 /* Produced by Jacek Becla for Stanford University under contract */ 00008 /* DE-AC02-76SF00515 with the Department of Energy */ 00009 /*****************************************************************************/ 00010 00011 // $Id$ 00012 00013 #ifndef XRDMONDECSTAGEINFO_HH 00014 #define XRDMONDECSTAGEINFO_HH 00015 00016 #include "XrdMon/XrdMonCommon.hh" 00017 #include "XrdMon/XrdMonTypes.hh" 00018 #include "XrdSys/XrdSysHeaders.hh" 00019 00020 #include <string> 00021 #include <strings.h> 00022 #include <string.h> 00023 00024 using std::ostream; 00025 using std::string; 00026 00027 class XrdMonDecStageInfo { 00028 public: 00029 00030 XrdMonDecStageInfo(); 00031 XrdMonDecStageInfo(dictid_t id, 00032 dictid_t uniqueId, 00033 const char* theString, 00034 int len, 00035 senderid_t senderId); 00036 XrdMonDecStageInfo(const char* buf, int& pos); 00037 00038 dictid_t xrdId() const { return _myXrdId; } 00039 dictid_t uniqueId() const { return _myUniqueId; } 00040 senderid_t senderId() const { return _senderId; } 00041 00042 const char* convert2string() const; 00043 const char* writeRT2Buffer() const; 00044 00045 private: 00046 int doOne(const char* s, char* buf, int len, char delim) { 00047 int x = 0; 00048 while ( x < len && *(s+x) != delim ) { 00049 ++x; 00050 } 00051 if ( x >= len ) { 00052 return -1; 00053 } 00054 00055 memcpy(buf, s, x); 00056 *(buf+x) = '\0'; 00057 return x; 00058 } 00059 00060 dictid_t _myXrdId; // the one that come inside packet, not unique 00061 dictid_t _myUniqueId; // unique (across all dictIds for given xrd server) 00062 00063 string _user; 00064 kXR_int16 _pid; 00065 string _cHost; // client host 00066 string _path; 00067 kXR_int32 _tod; 00068 senderid_t _senderId; 00069 kXR_int32 _bytes; 00070 kXR_int32 _seconds; 00071 00072 00073 friend ostream& operator<<(ostream& o, 00074 const XrdMonDecStageInfo& m); 00075 }; 00076 00077 #endif /* XRDMONDECSTAGEINFO_HH */