Skip to content
diameter_codec.cc 1.71 KiB
Newer Older
#include "LibDiameter_TypesAndValues.hh"

#include "diameter_codec.hh"

#include "loggers.hh"
#include "converter.hh"

template <typename T_type> class OPTIONAL;
class TTCN_EncDec;

int diameter_codec::encode(const LibDiameter__TypesAndValues::DIAMETER__MSG& p_diameter_msg, OCTETSTRING& p_data) {
  loggers::get_instance().log_msg(">>> diameter_codec::encode", (const Base_Type &)p_diameter_msg);

  TTCN_EncDec::clear_error();
  TTCN_Buffer encoding_buffer;

  //encode_header(p_diameter_msg.header(), encoding_buffer); // len field is set to 0
  // if (p_diameter_msg.ischosen()) {
  // }
int diameter_codec::decode(const OCTETSTRING& p_data, LibDiameter__TypesAndValues::DIAMETER__MSG& p_diameter_msg, params* p_params) {
  loggers::get_instance().log_msg(">>> diameter_codec::decode: ", (const Base_Type &)p_data);

  TTCN_EncDec::clear_error();
  TTCN_Buffer decoding_buffer;

  // if (decode_header(decoding_buffer, p_diameter_msg.header()) == 0) {
  //   loggers::get_instance().log_warning("diameter_codec::decode: Failed to decode header");
  //   return -1;
  // }

  return 0;
}

int diameter_codec::encode_header(const LibDiameter__TypesAndValues::DiameterHeader& p_header, TTCN_Buffer& p_encoding_buffer) {
  loggers::get_instance().log_msg(">>> diameter_codec::encode_header: ", (const Base_Type &)p_header);

}

int diameter_codec::decode_header(TTCN_Buffer& p_decoding_buffer, LibDiameter__TypesAndValues::DiameterHeader& p_header) {
  loggers::get_instance().log(">>> diameter_codec::decode_header");

}

int diameter_codec::padding(TTCN_Buffer& p_encoding_buffer) { //padding = (4 - (size & 3)) & 3;
  loggers::get_instance().log(">>> diameter_codec::padding");