XrdMonDecUserInfo.hh

Go to the documentation of this file.
00001 /*****************************************************************************/
00002 /*                                                                           */
00003 /*                           XrdMonDecUserInfo.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: XrdMonDecUserInfo.hh 24468 2008-06-22 16:47:03Z ganis $
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;    // the one that come inside packet, not unique
00069     dictid_t _myUniqueId; // unique (across all dictIds for given xrd server)
00070 
00071     string    _user;
00072     kXR_int16 _pid;   // client process id
00073     string    _cHost; // client host
00074 
00075     senderid_t _senderId;
00076     
00077     kXR_int32 _sec;   // number of seconds that client was connected
00078     kXR_int32 _dTime; // disconnect time
00079     
00080     friend ostream& operator<<(ostream& o, const XrdMonDecUserInfo& m);
00081 };
00082 
00083 #endif /* XRDMONDECUSERINFO_HH */

Generated on Tue Jul 5 14:46:43 2011 for ROOT_528-00b_version by  doxygen 1.5.1