#pragma once

#include <vector>

#include "codec_gen.hh"
#include "params.hh"

#include "avp.hh" 

class Base_Type;
class TTCN_Typedescriptor_t;
class TTCN_Buffer;

namespace LibDiameter__TypesAndValues {
  class DIAMETER__MSG; //! Forward declaration of TITAN class
  class DiameterHeader;
}

class diameter_codec: public codec_gen <
  LibDiameter__TypesAndValues::DIAMETER__MSG,
  LibDiameter__TypesAndValues::DIAMETER__MSG>
{
  std::vector<avp> avps;
public:
  explicit diameter_codec() : codec_gen<LibDiameter__TypesAndValues::DIAMETER__MSG, LibDiameter__TypesAndValues::DIAMETER__MSG>(), avps() { };
  virtual ~diameter_codec() { };

  virtual int encode (const LibDiameter__TypesAndValues::DIAMETER__MSG& p_diameter_msg, OCTETSTRING& p_data);
  virtual int decode (const OCTETSTRING& p_data, LibDiameter__TypesAndValues::DIAMETER__MSG& p_diameter_msg, params* p_params = NULL);

private:
  int encode_header(const LibDiameter__TypesAndValues::DiameterHeader& p_header, TTCN_Buffer& p_encoding_buffer);
  int decode_header(TTCN_Buffer& p_decoding_buffer, LibDiameter__TypesAndValues::DiameterHeader& p_header);
  int padding(TTCN_Buffer& p_encoding_buffer); //padding = (4 - (size & 3)) & 3;
}; // End of class diameter_codec
