00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef XRDMONDECUSERINFO_HH
00014 #define XRDMONDECUSERINFO_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 XrdMonDecTraceInfo;
00028
00029 class XrdMonDecUserInfo {
00030 public:
00031 enum TYPE { CONNECT, DISCONNECT };
00032
00033 XrdMonDecUserInfo();
00034 XrdMonDecUserInfo(dictid_t id,
00035 dictid_t uniqueId,
00036 const char* theString,
00037 int len,
00038 senderid_t senderId);
00039
00040 inline bool readyToBeStored() const {return _dTime > 0;}
00041
00042 void setDisconnectInfo(kXR_int32 sec, kXR_int32 timestamp);
00043
00044 dictid_t xrdId() const { return _myXrdId; }
00045 dictid_t uniqueId() const { return _myUniqueId; }
00046 senderid_t senderId() const { return _senderId; }
00047
00048 const char* convert2string() const;
00049 const char* writeRT2Buffer(TYPE t) const;
00050 string convert2stringRTDisconnect() const;
00051 int mySize();
00052
00053 private:
00054 int doOne(const char* s, char* buf, int len, char delim) {
00055 int x = 0;
00056 while ( x < len && *(s+x) != delim ) {
00057 ++x;
00058 }
00059 if ( x >= len ) {
00060 return -1;
00061 }
00062
00063 memcpy(buf, s, x);
00064 *(buf+x) = '\0';
00065 return x;
00066 }
00067
00068 dictid_t _myXrdId;
00069 dictid_t _myUniqueId;
00070
00071 string _user;
00072 kXR_int16 _pid;
00073 string _cHost;
00074
00075 senderid_t _senderId;
00076
00077 kXR_int32 _sec;
00078 kXR_int32 _dTime;
00079
00080 friend ostream& operator<<(ostream& o, const XrdMonDecUserInfo& m);
00081 };
00082
00083 #endif