xrootd
XrdMonDecOnePacket.hh
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* */
3 /* XrdMonDecOnePacket.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 XRDMONDECONEPACKET_HH
14 #define XRDMONDECONEPACKET_HH
15 
16 #include "XrdMon/XrdMonCommon.hh"
17 
18 #include <fstream>
19 #include <sys/time.h>
20 using std::fstream;
21 using std::ostream;
22 
24 public:
26  XrdMonDecOnePacket(bool); // LOST
27  XrdMonDecOnePacket(int errType, kXR_int64 pos);
28  int init(const char* buf, int bytesLeft, kXR_int64 fPos);
29 
30  static dictid_t minDictId() { return _minDictId; }
31  static dictid_t maxDictId() { return _maxDictId; }
32  static void resetNextNr() { _nextNr = 0; }
33 
34  long myNr() const { return _myNr; }
35  kXR_int64 fPos() const { return _fPos; }
36  kXR_int16 seq() const { return _seq; }
37  dictid_t dictId() const { return _dictId; }
38  packetlen_t len() const { return _len; }
39  kXR_int32 stod() const { return _stod; }
40 
41  bool isLost() const { return _seq == LOST; }
42 
43  void setOOOStatus() { _seq = OOO; }
44 
45 
46  enum { REGULAR = 257, // not lost, not out of order
47  LOST = -1, // lost packet
48  OOO = -2, // out of order
49  INVALID = -3 // just ignore this slot
50  };
51 
52 private:
53  static long _nextNr;
56 
57  long _myNr; // id to identify this packet
58 
59  kXR_int64 _fPos; // offset of this packet in the file
60  kXR_int16 _seq; // seqNo, or info: lost/outoforder/emptyslot
61  dictid_t _dictId; // dict id, or -1
62  packetlen_t _len; // packet size
63  kXR_int32 _stod; // when xrd server was started
64 
65  friend ostream& operator<<(ostream& o, const XrdMonDecOnePacket& p);
66 };
67 
68 #endif /* XRDMONDECONEPACKET_HH */