#ifndef GTP_DISSECTOR_H
#define GTP_DISSECTOR_H

#include "Dissector.h"
#include <map>
#include <string>

class GtpDissector : public Dissector {

 public:
  GtpDissector();
  virtual ~GtpDissector();
  virtual GtpDissector * Clone() const;
  virtual bool Dissect(const unsigned char * pData, const ssize_t nDataLen);
  virtual bool NeedReassembly() const;
  virtual const EProtocolType GetUpperLayerType() const;
  //added
  virtual bool IsPacketValid() const;
  virtual const EProtocolType GetDissectorType(){return EProtocolType_Gtp;}

 private:

  struct GtpHeader{
	unsigned char  pn_flag :1;
	unsigned char  s_flag :1;
	unsigned char  e_flag :1;
	unsigned char  spare :1;
	unsigned char  pt :1;
	unsigned char  version :3;

	unsigned char  messageType;
	unsigned char  length[2];
	unsigned char  teid[4];
	unsigned char  seqNum[2];		//optional
	unsigned char  npduNum;			//optional
	unsigned char  extensionHeader;	//optional
  };
  GtpHeader * m_gtpHdr;
  int m_nMessageLength;
  int nUpperIPv;
  static const int HEADER_NOT_PARSED = -1;
  static const int LENGTH_NOT_PARSED = -2;
  static const int PARSING_ERROR = -3;

protected:
  ProtocolInfoElement * CreateLayerInfo();
};

#endif
