00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef XRDMONDECPREPROCESS_HH
00014 #define XRDMONDECPREPROCESS_HH
00015
00016 #include "XrdMon/XrdMonCommon.hh"
00017 #include "XrdMon/XrdMonDecOnePacket.hh"
00018 #include <deque>
00019 #include <fstream>
00020 #include <utility>
00021 #include <vector>
00022 using std::deque;
00023 using std::pair;
00024 using std::vector;
00025
00026
00027
00028
00029
00030
00031 class XrdMonDecPreProcess {
00032 public:
00033 XrdMonDecPreProcess(fstream& theFile,
00034 kXR_int64 fSize,
00035 sequen_t lastSeq,
00036 kXR_int32 ignoreIfBefore,
00037 vector< pair<packetlen_t, kXR_int64> >& allPackets);
00038 void operator()();
00039
00040 private:
00041 void checkFile();
00042 kXR_char previousSeq() const;
00043 bool outOfOrder(XrdMonDecOnePacket& packet);
00044 void keepPacket(XrdMonDecOnePacket& packet);
00045 void add2TempBuf(XrdMonDecOnePacket& packet);
00046 int processOnePacket(const char* buf,
00047 int bytesLeft,
00048 kXR_int64 fPos,
00049 kXR_int32& xrdStartTime);
00050 void reportAndThrowIfTooBad();
00051
00052 private:
00053 fstream& _file;
00054 kXR_int64 _fSize;
00055
00056 enum { TBUFSIZE = 20, MAXTBUFELEM = TBUFSIZE-1 };
00057
00058 XrdMonDecOnePacket _tempBuf[TBUFSIZE];
00059 short _tempBufPos;
00060 bool _markNextSlotAsSpecial;
00061
00062 kXR_int32 _ignoreIfBefore;
00063
00064 vector< pair<packetlen_t, kXR_int64> >& _allPackets;
00065
00066
00067 vector<int> _lostPackets;
00068 vector<int> _oooPackets;
00069
00070 sequen_t _lastSeq;
00071 };
00072
00073 #endif