xrootd
XrdMonDecDictInfo.hh
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* */
3 /* XrdMonDecDictInfo.hh */
4 /* */
5 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
6 /* All Rights Reserved */
7 /* Produced by Jacek Becla for Stanford University under contract */
8 /* DE-AC02-76SF00515 with the Department of Energy */
9 /*****************************************************************************/
10 
11 // $Id$
12 
13 #ifndef XRDMONDECDICTINFO_HH
14 #define XRDMONDECDICTINFO_HH
15 
16 #include "XrdMon/XrdMonCommon.hh"
17 #include "XrdMon/XrdMonTypes.hh"
18 #include "XrdSys/XrdSysHeaders.hh"
19 
20 #include <string>
21 #include <strings.h>
22 #include <string.h>
23 
24 using std::ostream;
25 using std::string;
26 
27 class XrdMonDecTraceInfo;
28 
30 public:
31 
32  enum TYPE { OPEN, CLOSE };
33 
37  const char* theString,
38  int len,
40  XrdMonDecDictInfo(const char* buf, int& pos);
41 
42  dictid_t xrdId() const { return _myXrdId; }
43  dictid_t uniqueId() const { return _myUniqueId; }
44  senderid_t senderId() const { return _senderId; }
45 
46  bool isClosed() const { return 0 != _close; }
47  int stringSize() const;
48  const char* convert2string() const;
49  const char* writeRT2BufferOpenFile(kXR_int64 fSize) const;
50  const char* writeRT2BufferCloseFile() const;
51  void writeSelf2buf(char* buf, int& pos) const;
52 
53  void openFile(kXR_int32 t, kXR_int64 fSize);
54  void closeFile(kXR_int64 bytesR, kXR_int64 bytesW, kXR_int32 t);
55  bool addTrace(const XrdMonDecTraceInfo& trace);
56 
57  int mySize() const;
58 
59 private:
60  int doOne(const char* s, char* buf, int len, char delim) {
61  int x = 0;
62  while ( x < len && *(s+x) != delim ) {
63  ++x;
64  }
65  if ( x >= len ) {
66  return -1;
67  }
68 
69  memcpy(buf, s, x);
70  *(buf+x) = '\0';
71  return x;
72  }
73 
74  dictid_t _myXrdId; // the one that come inside packet, not unique
75  dictid_t _myUniqueId; // unique (across all dictIds for given xrd server)
76 
77  string _user;
79  string _cHost; // client host
80  string _path;
84 
86  kXR_int64 _noRBytes; // no bytes read
87  kXR_int64 _noWBytes; // no bytes writen
88 
89  friend ostream& operator<<(ostream& o,
90  const XrdMonDecDictInfo& m);
91 };
92 
93 #endif /* XRDMONDECDICTINFO_HH */