source: trunk/ETSI-Testsuites/ETSI_auto_IOT/adapter/src/Dispatcher/Dissector.h @ 53

Last change on this file since 53 was 22, checked in by rings, 14 years ago
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#ifndef DISSECTOR_H
2#define DISSECTOR_H
3
4#include <string>
5#include <list>
6#include "DispatchInfo.h"
7
8#ifdef _MSC_VER
9typedef int ssize_t;
10#endif
11
12class Dissector {
13 
14 public:
15  Dissector();
16  virtual ~Dissector();
17  virtual Dissector * Clone() const = 0;
18  virtual bool Dissect(const unsigned char * pData, const ssize_t nDataLen) = 0;
19  virtual bool NeedReassembly() const = 0;
20  virtual bool Reassemble(Dissector * pDissector, ProtocolInfo * pProtocolInfo);
21  virtual const EProtocolType GetUpperLayerType() const = 0;
22  virtual void SaveResult(DispatchInfo & info) const;
23  virtual bool IsPacketValid() const;
24  virtual bool FinishDissection();
25  virtual bool CreatesUnprocessedData() const;
26  bool ContainsUnprocessedData();
27  std::pair<const unsigned char *, ssize_t> GetUnprocessedData() const;
28  void SetProtocolInfo(ProtocolInfo * pInfo);
29  ProtocolInfoElement * GetLayerInfo() const;
30 protected:
31  void SaveLayerInfo();
32  virtual ProtocolInfoElement * CreateLayerInfo() = 0;
33  void SavePayload(const unsigned char * pData, ssize_t nPayloadSize);
34  void AllocPayload(ssize_t nPayloadSize);
35  void SetPayloadAt(const unsigned char * pSrcData, ssize_t nSrcSize, int nOffset);
36  void AppendPayload(Dissector * pSrc);
37  unsigned char * GetPayload() const;
38  ssize_t GetPayloadSize() const;
39  std::pair<unsigned char *, ssize_t> DetachData(); 
40  void SeparateUnprocessedData(int nNewPayloadSize);
41  ProtocolInfo * GetProtocolInfo() const;
42  bool MatchProtocolInfo(ProtocolInfo * pInfo) const;
43 private:
44  unsigned char * m_pPayload, * m_pUnprocessedData;
45  ssize_t m_nPayloadSize, m_nUnprocessedSize;
46  ProtocolInfoElement * m_pLayerInfo;
47  ProtocolInfo * m_pProtocolInfo;
48};
49
50#endif
Note: See TracBrowser for help on using the repository browser.