// This C++ source file was generated by the TTCN-3 compiler
// of the TTCN-3 Test Executor version 11.1.0
// The generation of user and time information were disabled by the -D flag.

// Copyright (c) 2000-2025 Ericsson Telecom AB

// Do not edit this file unless you know what you are doing.

/* Including header files */

#include "DIAMETER_CodecPort.hh"

namespace DIAMETER__CodecPort {

/* Literal string constants */

const unsigned char module_checksum[] = { 0x7b, 0xd3, 0x31, 0xa9, 0x49, 0x2d, 0x09, 0x0f, 0xb3, 0x48, 0x8f, 0x08, 0xbc, 0xbb, 0x5d, 0x13 };

/* Global variable definitions */

const XERdescriptor_t       DIAMETER__RecvFrom_connId_xer_ = { {"connId>\n", "connId>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t DIAMETER__RecvFrom_connId_descr_ = { "@DIAMETER_CodecPort.DIAMETER_RecvFrom.connId", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &DIAMETER__RecvFrom_connId_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       DIAMETER__RecvFrom_remName_xer_ = { {"remName>\n", "remName>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t DIAMETER__RecvFrom_remName_descr_ = { "@DIAMETER_CodecPort.DIAMETER_RecvFrom.remName", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &DIAMETER__RecvFrom_remName_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       DIAMETER__RecvFrom_remPort_xer_ = { {"remPort>\n", "remPort>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t DIAMETER__RecvFrom_remPort_descr_ = { "@DIAMETER_CodecPort.DIAMETER_RecvFrom.remPort", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &DIAMETER__RecvFrom_remPort_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       DIAMETER__RecvFrom_locName_xer_ = { {"locName>\n", "locName>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t DIAMETER__RecvFrom_locName_descr_ = { "@DIAMETER_CodecPort.DIAMETER_RecvFrom.locName", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &DIAMETER__RecvFrom_locName_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       DIAMETER__RecvFrom_locPort_xer_ = { {"locPort>\n", "locPort>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t DIAMETER__RecvFrom_locPort_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t DIAMETER__RecvFrom_locPort_descr_ = { "@DIAMETER_CodecPort.DIAMETER_RecvFrom.locPort", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &DIAMETER__RecvFrom_locPort_xer_, &INTEGER_json_, &DIAMETER__RecvFrom_locPort_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DIAMETER__RecvFrom_msg_default_coding("RAW");
// No XER for DIAMETER__RecvFrom
const TTCN_Typedescriptor_t DIAMETER__RecvFrom_descr_ = { "@DIAMETER_CodecPort.DIAMETER_RecvFrom", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       DIAMETER__Send_connId_xer_ = { {"connId>\n", "connId>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_OERdescriptor_t DIAMETER__Send_connId_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL };
const TTCN_Typedescriptor_t DIAMETER__Send_connId_descr_ = { "@DIAMETER_CodecPort.DIAMETER_Send.connId", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &DIAMETER__Send_connId_xer_, &INTEGER_json_, &DIAMETER__Send_connId_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING DIAMETER__Send_msg_default_coding("RAW");
// No XER for DIAMETER__Send
const TTCN_Typedescriptor_t DIAMETER__Send_descr_ = { "@DIAMETER_CodecPort.DIAMETER_Send", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
TTCN_Module module_object("DIAMETER_CodecPort", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

const RuntimeVersionChecker ver_checker(  current_runtime_version.requires_major_version_11,
  current_runtime_version.requires_minor_version_1,
  current_runtime_version.requires_patch_level_0,  current_runtime_version.requires_runtime_1);

/* Member functions of C++ classes */

DIAMETER__RecvFrom::DIAMETER__RecvFrom()
{
}

DIAMETER__RecvFrom::DIAMETER__RecvFrom(const INTEGER& par_connId,
    const CHARSTRING& par_remName,
    const INTEGER& par_remPort,
    const CHARSTRING& par_locName,
    const INTEGER& par_locPort,
    const DIAMETER__Types::PDU__DIAMETER& par_msg)
  :   field_connId(par_connId),
  field_remName(par_remName),
  field_remPort(par_remPort),
  field_locName(par_locName),
  field_locPort(par_locPort),
  field_msg(par_msg)
{
}

DIAMETER__RecvFrom::DIAMETER__RecvFrom(const DIAMETER__RecvFrom& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
if (other_value.connId().is_bound()) field_connId = other_value.connId();
else field_connId.clean_up();
if (other_value.remName().is_bound()) field_remName = other_value.remName();
else field_remName.clean_up();
if (other_value.remPort().is_bound()) field_remPort = other_value.remPort();
else field_remPort.clean_up();
if (other_value.locName().is_bound()) field_locName = other_value.locName();
else field_locName.clean_up();
if (other_value.locPort().is_bound()) field_locPort = other_value.locPort();
else field_locPort.clean_up();
if (other_value.msg().is_bound()) field_msg = other_value.msg();
else field_msg.clean_up();
}

void DIAMETER__RecvFrom::clean_up()
{
field_connId.clean_up();
field_remName.clean_up();
field_remPort.clean_up();
field_locName.clean_up();
field_locPort.clean_up();
field_msg.clean_up();
}

const TTCN_Typedescriptor_t* DIAMETER__RecvFrom::get_descriptor() const { return &DIAMETER__RecvFrom_descr_; }
DIAMETER__RecvFrom& DIAMETER__RecvFrom::operator=(const DIAMETER__RecvFrom& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
  if (other_value.connId().is_bound()) field_connId = other_value.connId();
  else field_connId.clean_up();
  if (other_value.remName().is_bound()) field_remName = other_value.remName();
  else field_remName.clean_up();
  if (other_value.remPort().is_bound()) field_remPort = other_value.remPort();
  else field_remPort.clean_up();
  if (other_value.locName().is_bound()) field_locName = other_value.locName();
  else field_locName.clean_up();
  if (other_value.locPort().is_bound()) field_locPort = other_value.locPort();
  else field_locPort.clean_up();
  if (other_value.msg().is_bound()) field_msg = other_value.msg();
  else field_msg.clean_up();
}
return *this;
}

boolean DIAMETER__RecvFrom::operator==(const DIAMETER__RecvFrom& other_value) const
{
return field_connId==other_value.field_connId
  && field_remName==other_value.field_remName
  && field_remPort==other_value.field_remPort
  && field_locName==other_value.field_locName
  && field_locPort==other_value.field_locPort
  && field_msg==other_value.field_msg;
}

boolean DIAMETER__RecvFrom::is_bound() const
{
return (field_connId.is_bound())
  || (field_remName.is_bound())
  || (field_remPort.is_bound())
  || (field_locName.is_bound())
  || (field_locPort.is_bound())
  || (field_msg.is_bound());
}
boolean DIAMETER__RecvFrom::is_value() const
{
return field_connId.is_value()
  && field_remName.is_value()
  && field_remPort.is_value()
  && field_locName.is_value()
  && field_locPort.is_value()
  && field_msg.is_value();
}
void DIAMETER__RecvFrom::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ connId := ");
field_connId.log();
TTCN_Logger::log_event_str(", remName := ");
field_remName.log();
TTCN_Logger::log_event_str(", remPort := ");
field_remPort.log();
TTCN_Logger::log_event_str(", locName := ");
field_locName.log();
TTCN_Logger::log_event_str(", locPort := ");
field_locPort.log();
TTCN_Logger::log_event_str(", msg := ");
field_msg.log();
TTCN_Logger::log_event_str(" }");
}

void DIAMETER__RecvFrom::set_implicit_omit()
{
if (connId().is_bound()) connId().set_implicit_omit();
if (remName().is_bound()) remName().set_implicit_omit();
if (remPort().is_bound()) remPort().set_implicit_omit();
if (locName().is_bound()) locName().set_implicit_omit();
if (locPort().is_bound()) locPort().set_implicit_omit();
if (msg().is_bound()) msg().set_implicit_omit();
}

void DIAMETER__RecvFrom::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (6<param.get_size()) {
      param.error("record value of type @DIAMETER_CodecPort.DIAMETER_RecvFrom has 6 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) connId().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) remName().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) remPort().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) locName().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) locPort().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) msg().set_param(*param.get_elem(5));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "connId")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          connId().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "remName")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          remName().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "remPort")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          remPort().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "locName")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          locName().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "locPort")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          locPort().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "msg")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          msg().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @DIAMETER_CodecPort.DIAMETER_RecvFrom: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@DIAMETER_CodecPort.DIAMETER_RecvFrom");
  }
}

void DIAMETER__RecvFrom::encode_text(Text_Buf& text_buf) const
{
field_connId.encode_text(text_buf);
field_remName.encode_text(text_buf);
field_remPort.encode_text(text_buf);
field_locName.encode_text(text_buf);
field_locPort.encode_text(text_buf);
field_msg.encode_text(text_buf);
}

void DIAMETER__RecvFrom::decode_text(Text_Buf& text_buf)
{
field_connId.decode_text(text_buf);
field_remName.decode_text(text_buf);
field_remPort.decode_text(text_buf);
field_locName.decode_text(text_buf);
field_locPort.decode_text(text_buf);
field_msg.decode_text(text_buf);
}

struct DIAMETER__RecvFrom_template::single_value_struct {
INTEGER_template field_connId;
CHARSTRING_template field_remName;
INTEGER_template field_remPort;
CHARSTRING_template field_locName;
INTEGER_template field_locPort;
DIAMETER__Types::PDU__DIAMETER_template field_msg;
};

void DIAMETER__RecvFrom_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_connId = ANY_VALUE;
single_value->field_remName = ANY_VALUE;
single_value->field_remPort = ANY_VALUE;
single_value->field_locName = ANY_VALUE;
single_value->field_locPort = ANY_VALUE;
single_value->field_msg = ANY_VALUE;
}
}
}

void DIAMETER__RecvFrom_template::copy_value(const DIAMETER__RecvFrom& other_value)
{
single_value = new single_value_struct;
if (other_value.connId().is_bound()) {
  single_value->field_connId = other_value.connId();
} else {
  single_value->field_connId.clean_up();
}
if (other_value.remName().is_bound()) {
  single_value->field_remName = other_value.remName();
} else {
  single_value->field_remName.clean_up();
}
if (other_value.remPort().is_bound()) {
  single_value->field_remPort = other_value.remPort();
} else {
  single_value->field_remPort.clean_up();
}
if (other_value.locName().is_bound()) {
  single_value->field_locName = other_value.locName();
} else {
  single_value->field_locName.clean_up();
}
if (other_value.locPort().is_bound()) {
  single_value->field_locPort = other_value.locPort();
} else {
  single_value->field_locPort.clean_up();
}
if (other_value.msg().is_bound()) {
  single_value->field_msg = other_value.msg();
} else {
  single_value->field_msg.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void DIAMETER__RecvFrom_template::copy_template(const DIAMETER__RecvFrom_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.connId().get_selection()) {
single_value->field_connId = other_value.connId();
} else {
single_value->field_connId.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.remName().get_selection()) {
single_value->field_remName = other_value.remName();
} else {
single_value->field_remName.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.remPort().get_selection()) {
single_value->field_remPort = other_value.remPort();
} else {
single_value->field_remPort.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.locName().get_selection()) {
single_value->field_locName = other_value.locName();
} else {
single_value->field_locName.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.locPort().get_selection()) {
single_value->field_locPort = other_value.locPort();
} else {
single_value->field_locPort.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.msg().get_selection()) {
single_value->field_msg = other_value.msg();
} else {
single_value->field_msg.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new DIAMETER__RecvFrom_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new DIAMETER__RecvFrom_template(*other_value.implication_.precondition);
implication_.implied_template = new DIAMETER__RecvFrom_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
break;
}
set_selection(other_value);
}

DIAMETER__RecvFrom_template::DIAMETER__RecvFrom_template()
{
}

DIAMETER__RecvFrom_template::DIAMETER__RecvFrom_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

DIAMETER__RecvFrom_template::DIAMETER__RecvFrom_template(const DIAMETER__RecvFrom& other_value)
{
copy_value(other_value);
}

DIAMETER__RecvFrom_template::DIAMETER__RecvFrom_template(const OPTIONAL<DIAMETER__RecvFrom>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const DIAMETER__RecvFrom&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom from an unbound optional field.");
}
}

DIAMETER__RecvFrom_template::DIAMETER__RecvFrom_template(DIAMETER__RecvFrom_template* p_precondition, DIAMETER__RecvFrom_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

DIAMETER__RecvFrom_template::DIAMETER__RecvFrom_template(Dynamic_Match_Interface<DIAMETER__RecvFrom>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<DIAMETER__RecvFrom>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

DIAMETER__RecvFrom_template::DIAMETER__RecvFrom_template(const DIAMETER__RecvFrom_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

DIAMETER__RecvFrom_template::~DIAMETER__RecvFrom_template()
{
clean_up();
}

DIAMETER__RecvFrom_template& DIAMETER__RecvFrom_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

DIAMETER__RecvFrom_template& DIAMETER__RecvFrom_template::operator=(const DIAMETER__RecvFrom& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

DIAMETER__RecvFrom_template& DIAMETER__RecvFrom_template::operator=(const OPTIONAL<DIAMETER__RecvFrom>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const DIAMETER__RecvFrom&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
}
return *this;
}

DIAMETER__RecvFrom_template& DIAMETER__RecvFrom_template::operator=(const DIAMETER__RecvFrom_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean DIAMETER__RecvFrom_template::match(const DIAMETER__RecvFrom& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.connId().is_bound()) return FALSE;
if(!single_value->field_connId.match(other_value.connId(), legacy))return FALSE;
if(!other_value.remName().is_bound()) return FALSE;
if(!single_value->field_remName.match(other_value.remName(), legacy))return FALSE;
if(!other_value.remPort().is_bound()) return FALSE;
if(!single_value->field_remPort.match(other_value.remPort(), legacy))return FALSE;
if(!other_value.locName().is_bound()) return FALSE;
if(!single_value->field_locName.match(other_value.locName(), legacy))return FALSE;
if(!other_value.locPort().is_bound()) return FALSE;
if(!single_value->field_locPort.match(other_value.locPort(), legacy))return FALSE;
if(!other_value.msg().is_bound()) return FALSE;
if(!single_value->field_msg.match(other_value.msg(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
}
return FALSE;
}

boolean DIAMETER__RecvFrom_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_connId.is_bound()
 || single_value->field_remName.is_bound()
 || single_value->field_remPort.is_bound()
 || single_value->field_locName.is_bound()
 || single_value->field_locPort.is_bound()
 || single_value->field_msg.is_bound();
}

boolean DIAMETER__RecvFrom_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_connId.is_value()
 && single_value->field_remName.is_value()
 && single_value->field_remPort.is_value()
 && single_value->field_locName.is_value()
 && single_value->field_locPort.is_value()
 && single_value->field_msg.is_value();
}

void DIAMETER__RecvFrom_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

DIAMETER__RecvFrom DIAMETER__RecvFrom_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
DIAMETER__RecvFrom ret_val;
if (single_value->field_connId.is_bound()) {
ret_val.connId() = single_value->field_connId.valueof();
}
if (single_value->field_remName.is_bound()) {
ret_val.remName() = single_value->field_remName.valueof();
}
if (single_value->field_remPort.is_bound()) {
ret_val.remPort() = single_value->field_remPort.valueof();
}
if (single_value->field_locName.is_bound()) {
ret_val.locName() = single_value->field_locName.valueof();
}
if (single_value->field_locPort.is_bound()) {
ret_val.locPort() = single_value->field_locPort.valueof();
}
if (single_value->field_msg.is_bound()) {
ret_val.msg() = single_value->field_msg.valueof();
}
return ret_val;
}

void DIAMETER__RecvFrom_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new DIAMETER__RecvFrom_template[list_length];
}

DIAMETER__RecvFrom_template& DIAMETER__RecvFrom_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
return value_list.list_value[list_index];
}

INTEGER_template& DIAMETER__RecvFrom_template::connId()
{
set_specific();
return single_value->field_connId;
}

const INTEGER_template& DIAMETER__RecvFrom_template::connId() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field connId of a non-specific template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
return single_value->field_connId;
}

CHARSTRING_template& DIAMETER__RecvFrom_template::remName()
{
set_specific();
return single_value->field_remName;
}

const CHARSTRING_template& DIAMETER__RecvFrom_template::remName() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field remName of a non-specific template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
return single_value->field_remName;
}

INTEGER_template& DIAMETER__RecvFrom_template::remPort()
{
set_specific();
return single_value->field_remPort;
}

const INTEGER_template& DIAMETER__RecvFrom_template::remPort() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field remPort of a non-specific template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
return single_value->field_remPort;
}

CHARSTRING_template& DIAMETER__RecvFrom_template::locName()
{
set_specific();
return single_value->field_locName;
}

const CHARSTRING_template& DIAMETER__RecvFrom_template::locName() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field locName of a non-specific template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
return single_value->field_locName;
}

INTEGER_template& DIAMETER__RecvFrom_template::locPort()
{
set_specific();
return single_value->field_locPort;
}

const INTEGER_template& DIAMETER__RecvFrom_template::locPort() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field locPort of a non-specific template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
return single_value->field_locPort;
}

DIAMETER__Types::PDU__DIAMETER_template& DIAMETER__RecvFrom_template::msg()
{
set_specific();
return single_value->field_msg;
}

const DIAMETER__Types::PDU__DIAMETER_template& DIAMETER__RecvFrom_template::msg() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field msg of a non-specific template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
return single_value->field_msg;
}

int DIAMETER__RecvFrom_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 6;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
  }
  return 0;
}

void DIAMETER__RecvFrom_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ connId := ");
single_value->field_connId.log();
TTCN_Logger::log_event_str(", remName := ");
single_value->field_remName.log();
TTCN_Logger::log_event_str(", remPort := ");
single_value->field_remPort.log();
TTCN_Logger::log_event_str(", locName := ");
single_value->field_locName.log();
TTCN_Logger::log_event_str(", locPort := ");
single_value->field_locPort.log();
TTCN_Logger::log_event_str(", msg := ");
single_value->field_msg.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void DIAMETER__RecvFrom_template::log_match(const DIAMETER__RecvFrom& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_connId.match(match_value.connId(), legacy)){
TTCN_Logger::log_logmatch_info(".connId");
single_value->field_connId.log_match(match_value.connId(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_remName.match(match_value.remName(), legacy)){
TTCN_Logger::log_logmatch_info(".remName");
single_value->field_remName.log_match(match_value.remName(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_remPort.match(match_value.remPort(), legacy)){
TTCN_Logger::log_logmatch_info(".remPort");
single_value->field_remPort.log_match(match_value.remPort(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_locName.match(match_value.locName(), legacy)){
TTCN_Logger::log_logmatch_info(".locName");
single_value->field_locName.log_match(match_value.locName(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_locPort.match(match_value.locPort(), legacy)){
TTCN_Logger::log_logmatch_info(".locPort");
single_value->field_locPort.log_match(match_value.locPort(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_msg.match(match_value.msg(), legacy)){
TTCN_Logger::log_logmatch_info(".msg");
single_value->field_msg.log_match(match_value.msg(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ connId := ");
single_value->field_connId.log_match(match_value.connId(), legacy);
TTCN_Logger::log_event_str(", remName := ");
single_value->field_remName.log_match(match_value.remName(), legacy);
TTCN_Logger::log_event_str(", remPort := ");
single_value->field_remPort.log_match(match_value.remPort(), legacy);
TTCN_Logger::log_event_str(", locName := ");
single_value->field_locName.log_match(match_value.locName(), legacy);
TTCN_Logger::log_event_str(", locPort := ");
single_value->field_locPort.log_match(match_value.locPort(), legacy);
TTCN_Logger::log_event_str(", msg := ");
single_value->field_msg.log_match(match_value.msg(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void DIAMETER__RecvFrom_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (connId().is_bound()) connId().set_implicit_omit();
if (remName().is_bound()) remName().set_implicit_omit();
if (remPort().is_bound()) remPort().set_implicit_omit();
if (locName().is_bound()) locName().set_implicit_omit();
if (locPort().is_bound()) locPort().set_implicit_omit();
if (msg().is_bound()) msg().set_implicit_omit();
}

void DIAMETER__RecvFrom_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_connId.encode_text(text_buf);
single_value->field_remName.encode_text(text_buf);
single_value->field_remPort.encode_text(text_buf);
single_value->field_locName.encode_text(text_buf);
single_value->field_locPort.encode_text(text_buf);
single_value->field_msg.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
}
}

void DIAMETER__RecvFrom_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_connId.decode_text(text_buf);
single_value->field_remName.decode_text(text_buf);
single_value->field_remPort.decode_text(text_buf);
single_value->field_locName.decode_text(text_buf);
single_value->field_locPort.decode_text(text_buf);
single_value->field_msg.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new DIAMETER__RecvFrom_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom.");
}
}

void DIAMETER__RecvFrom_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    DIAMETER__RecvFrom_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (6<param.get_size()) {
      param.error("record template of type @DIAMETER_CodecPort.DIAMETER_RecvFrom has 6 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) connId().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) remName().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) remPort().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) locName().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) locPort().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) msg().set_param(*param.get_elem(5));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "connId")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          connId().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "remName")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          remName().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "remPort")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          remPort().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "locName")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          locName().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "locPort")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          locPort().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "msg")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          msg().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @DIAMETER_CodecPort.DIAMETER_RecvFrom: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    DIAMETER__RecvFrom_template* precondition = new DIAMETER__RecvFrom_template;
    precondition->set_param(*param.get_elem(0));
    DIAMETER__RecvFrom_template* implied_template = new DIAMETER__RecvFrom_template;
    implied_template->set_param(*param.get_elem(1));
    *this = DIAMETER__RecvFrom_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@DIAMETER_CodecPort.DIAMETER_RecvFrom");
  }
  is_ifpresent = param.get_ifpresent();
}

void DIAMETER__RecvFrom_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_connId.check_restriction(t_res, t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_RecvFrom");
single_value->field_remName.check_restriction(t_res, t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_RecvFrom");
single_value->field_remPort.check_restriction(t_res, t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_RecvFrom");
single_value->field_locName.check_restriction(t_res, t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_RecvFrom");
single_value->field_locPort.check_restriction(t_res, t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_RecvFrom");
single_value->field_msg.check_restriction(t_res, t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_RecvFrom");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_RecvFrom");
}

boolean DIAMETER__RecvFrom_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean DIAMETER__RecvFrom_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

DIAMETER__Send::DIAMETER__Send()
{
}

DIAMETER__Send::DIAMETER__Send(const INTEGER& par_connId,
    const DIAMETER__Types::PDU__DIAMETER& par_msg)
  :   field_connId(par_connId),
  field_msg(par_msg)
{
}

DIAMETER__Send::DIAMETER__Send(const DIAMETER__Send& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @DIAMETER_CodecPort.DIAMETER_Send.");
if (other_value.connId().is_bound()) field_connId = other_value.connId();
else field_connId.clean_up();
if (other_value.msg().is_bound()) field_msg = other_value.msg();
else field_msg.clean_up();
}

void DIAMETER__Send::clean_up()
{
field_connId.clean_up();
field_msg.clean_up();
}

const TTCN_Typedescriptor_t* DIAMETER__Send::get_descriptor() const { return &DIAMETER__Send_descr_; }
DIAMETER__Send& DIAMETER__Send::operator=(const DIAMETER__Send& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @DIAMETER_CodecPort.DIAMETER_Send.");
  if (other_value.connId().is_bound()) field_connId = other_value.connId();
  else field_connId.clean_up();
  if (other_value.msg().is_bound()) field_msg = other_value.msg();
  else field_msg.clean_up();
}
return *this;
}

boolean DIAMETER__Send::operator==(const DIAMETER__Send& other_value) const
{
return field_connId==other_value.field_connId
  && field_msg==other_value.field_msg;
}

boolean DIAMETER__Send::is_bound() const
{
return (field_connId.is_bound())
  || (field_msg.is_bound());
}
boolean DIAMETER__Send::is_value() const
{
return field_connId.is_value()
  && field_msg.is_value();
}
void DIAMETER__Send::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ connId := ");
field_connId.log();
TTCN_Logger::log_event_str(", msg := ");
field_msg.log();
TTCN_Logger::log_event_str(" }");
}

void DIAMETER__Send::set_implicit_omit()
{
if (connId().is_bound()) connId().set_implicit_omit();
if (msg().is_bound()) msg().set_implicit_omit();
}

void DIAMETER__Send::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "record value");
  switch (param.get_type()) {
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record value of type @DIAMETER_CodecPort.DIAMETER_Send has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) connId().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) msg().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "connId")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          connId().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "msg")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          msg().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @DIAMETER_CodecPort.DIAMETER_Send: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@DIAMETER_CodecPort.DIAMETER_Send");
  }
}

void DIAMETER__Send::encode_text(Text_Buf& text_buf) const
{
field_connId.encode_text(text_buf);
field_msg.encode_text(text_buf);
}

void DIAMETER__Send::decode_text(Text_Buf& text_buf)
{
field_connId.decode_text(text_buf);
field_msg.decode_text(text_buf);
}

struct DIAMETER__Send_template::single_value_struct {
INTEGER_template field_connId;
DIAMETER__Types::PDU__DIAMETER_template field_msg;
};

void DIAMETER__Send_template::set_specific()
{
if (template_selection != SPECIFIC_VALUE) {
template_sel old_selection = template_selection;
clean_up();
single_value = new single_value_struct;
set_selection(SPECIFIC_VALUE);
if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) {
single_value->field_connId = ANY_VALUE;
single_value->field_msg = ANY_VALUE;
}
}
}

void DIAMETER__Send_template::copy_value(const DIAMETER__Send& other_value)
{
single_value = new single_value_struct;
if (other_value.connId().is_bound()) {
  single_value->field_connId = other_value.connId();
} else {
  single_value->field_connId.clean_up();
}
if (other_value.msg().is_bound()) {
  single_value->field_msg = other_value.msg();
} else {
  single_value->field_msg.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void DIAMETER__Send_template::copy_template(const DIAMETER__Send_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.connId().get_selection()) {
single_value->field_connId = other_value.connId();
} else {
single_value->field_connId.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.msg().get_selection()) {
single_value->field_msg = other_value.msg();
} else {
single_value->field_msg.clean_up();
}
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
value_list.n_values = other_value.value_list.n_values;
value_list.list_value = new DIAMETER__Send_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]);
break;
case IMPLICATION_MATCH:
implication_.precondition = new DIAMETER__Send_template(*other_value.implication_.precondition);
implication_.implied_template = new DIAMETER__Send_template(*other_value.implication_.implied_template);
break;
case DYNAMIC_MATCH:
dyn_match = other_value.dyn_match;
dyn_match->ref_count++;
break;
default:
TTCN_error("Copying an uninitialized/unsupported template of type @DIAMETER_CodecPort.DIAMETER_Send.");
break;
}
set_selection(other_value);
}

DIAMETER__Send_template::DIAMETER__Send_template()
{
}

DIAMETER__Send_template::DIAMETER__Send_template(template_sel other_value)
 : Base_Template(other_value)
{
check_single_selection(other_value);
}

DIAMETER__Send_template::DIAMETER__Send_template(const DIAMETER__Send& other_value)
{
copy_value(other_value);
}

DIAMETER__Send_template::DIAMETER__Send_template(const OPTIONAL<DIAMETER__Send>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const DIAMETER__Send&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of type @DIAMETER_CodecPort.DIAMETER_Send from an unbound optional field.");
}
}

DIAMETER__Send_template::DIAMETER__Send_template(DIAMETER__Send_template* p_precondition, DIAMETER__Send_template* p_implied_template)
 : Base_Template(IMPLICATION_MATCH)
{
implication_.precondition = p_precondition;
implication_.implied_template = p_implied_template;
}

DIAMETER__Send_template::DIAMETER__Send_template(Dynamic_Match_Interface<DIAMETER__Send>* p_dyn_match)
 : Base_Template(DYNAMIC_MATCH)
{
dyn_match = new dynmatch_struct<DIAMETER__Send>;
dyn_match->ptr = p_dyn_match;
dyn_match->ref_count = 1;
}

DIAMETER__Send_template::DIAMETER__Send_template(const DIAMETER__Send_template& other_value)
: Base_Template()
{
copy_template(other_value);
}

DIAMETER__Send_template::~DIAMETER__Send_template()
{
clean_up();
}

DIAMETER__Send_template& DIAMETER__Send_template::operator=(template_sel other_value)
{
check_single_selection(other_value);
clean_up();
set_selection(other_value);
return *this;
}

DIAMETER__Send_template& DIAMETER__Send_template::operator=(const DIAMETER__Send& other_value)
{
clean_up();
copy_value(other_value);
return *this;
}

DIAMETER__Send_template& DIAMETER__Send_template::operator=(const OPTIONAL<DIAMETER__Send>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const DIAMETER__Send&)other_value);
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of type @DIAMETER_CodecPort.DIAMETER_Send.");
}
return *this;
}

DIAMETER__Send_template& DIAMETER__Send_template::operator=(const DIAMETER__Send_template& other_value)
{
if (&other_value != this) {
clean_up();
copy_template(other_value);
}
return *this;
}

boolean DIAMETER__Send_template::match(const DIAMETER__Send& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) {
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
if(!other_value.connId().is_bound()) return FALSE;
if(!single_value->field_connId.match(other_value.connId(), legacy))return FALSE;
if(!other_value.msg().is_bound()) return FALSE;
if(!single_value->field_msg.match(other_value.msg(), legacy))return FALSE;
return TRUE;
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
case CONJUNCTION_MATCH:
for (unsigned int i = 0; i < value_list.n_values; i++) {
if (!value_list.list_value[i].match(other_value)) {
return FALSE;
}
}
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value);
case DYNAMIC_MATCH:
return dyn_match->ptr->match(other_value);
default:
TTCN_error("Matching an uninitialized/unsupported template of type @DIAMETER_CodecPort.DIAMETER_Send.");
}
return FALSE;
}

boolean DIAMETER__Send_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_connId.is_bound()
 || single_value->field_msg.is_bound();
}

boolean DIAMETER__Send_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_connId.is_value()
 && single_value->field_msg.is_value();
}

void DIAMETER__Send_template::clean_up()
{
switch (template_selection) {
case SPECIFIC_VALUE:
delete single_value;
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
case CONJUNCTION_MATCH:
delete [] value_list.list_value;
break;
case IMPLICATION_MATCH:
delete implication_.precondition;
delete implication_.implied_template;
break;
case DYNAMIC_MATCH:
dyn_match->ref_count--;
if (dyn_match->ref_count == 0) {
delete dyn_match->ptr;
delete dyn_match;
}
break;
default:
break;
}
template_selection = UNINITIALIZED_TEMPLATE;
}

DIAMETER__Send DIAMETER__Send_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent)
TTCN_error("Performing a valueof or send operation on a non-specific template of type @DIAMETER_CodecPort.DIAMETER_Send.");
DIAMETER__Send ret_val;
if (single_value->field_connId.is_bound()) {
ret_val.connId() = single_value->field_connId.valueof();
}
if (single_value->field_msg.is_bound()) {
ret_val.msg() = single_value->field_msg.valueof();
}
return ret_val;
}

void DIAMETER__Send_template::set_type(template_sel template_type, unsigned int list_length)
{
if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH)
TTCN_error("Setting an invalid list for a template of type @DIAMETER_CodecPort.DIAMETER_Send.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new DIAMETER__Send_template[list_length];
}

DIAMETER__Send_template& DIAMETER__Send_template::list_item(unsigned int list_index) const
{
if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH)
TTCN_error("Accessing a list element of a non-list template of type @DIAMETER_CodecPort.DIAMETER_Send.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @DIAMETER_CodecPort.DIAMETER_Send.");
return value_list.list_value[list_index];
}

INTEGER_template& DIAMETER__Send_template::connId()
{
set_specific();
return single_value->field_connId;
}

const INTEGER_template& DIAMETER__Send_template::connId() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field connId of a non-specific template of type @DIAMETER_CodecPort.DIAMETER_Send.");
return single_value->field_connId;
}

DIAMETER__Types::PDU__DIAMETER_template& DIAMETER__Send_template::msg()
{
set_specific();
return single_value->field_msg;
}

const DIAMETER__Types::PDU__DIAMETER_template& DIAMETER__Send_template::msg() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field msg of a non-specific template of type @DIAMETER_CodecPort.DIAMETER_Send.");
return single_value->field_msg;
}

int DIAMETER__Send_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_Send which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
    return 2;
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_Send containing an empty list.");
      int item_size = value_list.list_value[0].size_of();
      for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++)
      {
        if (value_list.list_value[l_idx].size_of()!=item_size)
          TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_Send containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_Send containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_Send containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_Send containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_Send containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_Send containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @DIAMETER_CodecPort.DIAMETER_Send containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @DIAMETER_CodecPort.DIAMETER_Send.");
  }
  return 0;
}

void DIAMETER__Send_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ connId := ");
single_value->field_connId.log();
TTCN_Logger::log_event_str(", msg := ");
single_value->field_msg.log();
TTCN_Logger::log_event_str(" }");
break;
case COMPLEMENTED_LIST:
TTCN_Logger::log_event_str("complement");
case CONJUNCTION_MATCH:
if (template_selection == CONJUNCTION_MATCH) {
TTCN_Logger::log_event_str("conjunct");
}
case VALUE_LIST:
TTCN_Logger::log_char('(');
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) {
if (list_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[list_count].log();
}
TTCN_Logger::log_char(')');
break;
case IMPLICATION_MATCH:
implication_.precondition->log();
TTCN_Logger::log_event_str(" implies ");
implication_.implied_template->log();
break;
case DYNAMIC_MATCH:
TTCN_Logger::log_event_str("@dynamic template");
break;
default:
log_generic();
}
log_ifpresent();
}

void DIAMETER__Send_template::log_match(const DIAMETER__Send& match_value, boolean legacy) const
{
if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
if(match(match_value, legacy)){
TTCN_Logger::print_logmatch_buffer();
TTCN_Logger::log_event_str(" matched");
} else{
if (template_selection == SPECIFIC_VALUE) {
size_t previous_size = TTCN_Logger::get_logmatch_buffer_len();
if(!single_value->field_connId.match(match_value.connId(), legacy)){
TTCN_Logger::log_logmatch_info(".connId");
single_value->field_connId.log_match(match_value.connId(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_msg.match(match_value.msg(), legacy)){
TTCN_Logger::log_logmatch_info(".msg");
single_value->field_msg.log_match(match_value.msg(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}else {
TTCN_Logger::print_logmatch_buffer();
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
TTCN_Logger::log_event_str(" unmatched");
}
}
return;
}
if (template_selection == SPECIFIC_VALUE) {
TTCN_Logger::log_event_str("{ connId := ");
single_value->field_connId.log_match(match_value.connId(), legacy);
TTCN_Logger::log_event_str(", msg := ");
single_value->field_msg.log_match(match_value.msg(), legacy);
TTCN_Logger::log_event_str(" }");
} else {
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
}

void DIAMETER__Send_template::set_implicit_omit()
{
if (template_selection != SPECIFIC_VALUE) return;
if (connId().is_bound()) connId().set_implicit_omit();
if (msg().is_bound()) msg().set_implicit_omit();
}

void DIAMETER__Send_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_connId.encode_text(text_buf);
single_value->field_msg.encode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
text_buf.push_int(value_list.n_values);
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @DIAMETER_CodecPort.DIAMETER_Send.");
}
}

void DIAMETER__Send_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
single_value->field_connId.decode_text(text_buf);
single_value->field_msg.decode_text(text_buf);
case OMIT_VALUE:
case ANY_VALUE:
case ANY_OR_OMIT:
break;
case VALUE_LIST:
case COMPLEMENTED_LIST:
value_list.n_values = text_buf.pull_int().get_val();
value_list.list_value = new DIAMETER__Send_template[value_list.n_values];
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
value_list.list_value[list_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @DIAMETER_CodecPort.DIAMETER_Send.");
}
}

void DIAMETER__Send_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
  switch (param.get_type()) {
  case Module_Param::MP_Omit:
    *this = OMIT_VALUE;
    break;
  case Module_Param::MP_Any:
    *this = ANY_VALUE;
    break;
  case Module_Param::MP_AnyOrNone:
    *this = ANY_OR_OMIT;
    break;
  case Module_Param::MP_List_Template:
  case Module_Param::MP_ComplementList_Template:
  case Module_Param::MP_ConjunctList_Template: {
    DIAMETER__Send_template new_temp;
    new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size());
    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*param.get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Value_List:
    if (2<param.get_size()) {
      param.error("record template of type @DIAMETER_CodecPort.DIAMETER_Send has 2 fields but list value has %d fields", (int)param.get_size());
    }
    if (param.get_size()>0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) connId().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) msg().set_param(*param.get_elem(1));
    break;
  case Module_Param::MP_Assignment_List: {
    Vector<bool> value_used(param.get_size());
    value_used.resize(param.get_size(), FALSE);
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "connId")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          connId().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      if (!strcmp(curr_param->get_id()->get_name(), "msg")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          msg().set_param(*curr_param);
        }
        value_used[val_idx]=TRUE;
      }
    }
    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
      Module_Param* const curr_param = param.get_elem(val_idx);
      curr_param->error("Non existent field name in type @DIAMETER_CodecPort.DIAMETER_Send: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    DIAMETER__Send_template* precondition = new DIAMETER__Send_template;
    precondition->set_param(*param.get_elem(0));
    DIAMETER__Send_template* implied_template = new DIAMETER__Send_template;
    implied_template->set_param(*param.get_elem(1));
    *this = DIAMETER__Send_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@DIAMETER_CodecPort.DIAMETER_Send");
  }
  is_ifpresent = param.get_ifpresent();
}

void DIAMETER__Send_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return;
switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
case TR_OMIT:
if (template_selection==OMIT_VALUE) return;
case TR_VALUE:
if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break;
single_value->field_connId.check_restriction(t_res, t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_Send");
single_value->field_msg.check_restriction(t_res, t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_Send");
return;
case TR_PRESENT:
if (!match_omit(legacy)) return;
break;
default:
return;
}
TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_CodecPort.DIAMETER_Send");
}

boolean DIAMETER__Send_template::is_present(boolean legacy) const
{
if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
return !match_omit(legacy);
}

boolean DIAMETER__Send_template::match_omit(boolean legacy) const
{
if (is_ifpresent) return TRUE;
switch (template_selection) {
case OMIT_VALUE:
case ANY_OR_OMIT:
return TRUE;
case IMPLICATION_MATCH:
return !implication_.precondition->match_omit() || implication_.implied_template->match_omit();
case VALUE_LIST:
case COMPLEMENTED_LIST:
if (legacy) {
for (unsigned int l_idx=0; l_idx<value_list.n_values; l_idx++)
if (value_list.list_value[l_idx].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void DIAMETER__CODEC__PT::remove_msg_queue_head()
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
switch (my_head->item_selection) {
case MESSAGE_0:
delete (my_head)->message_0;
break;
case MESSAGE_1:
delete (my_head)->message_1;
break;
case MESSAGE_2:
delete (my_head)->message_2;
break;
default:
TTCN_error("Internal error: Invalid message selector in the queue of port %s.", port_name);
}
msg_queue_item_base *next_item = msg_queue_head->next_item;
delete (msg_queue_item*)msg_queue_head;
msg_queue_head = next_item;
if (next_item == NULL) msg_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__msg, port_name, 0, ++msg_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}

void DIAMETER__CODEC__PT::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}

DIAMETER__CODEC__PT::DIAMETER__CODEC__PT(const char *par_port_name)
 : IPL4asp__PortType::IPL4asp__PT_PROVIDER(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}

DIAMETER__CODEC__PT::~DIAMETER__CODEC__PT()
{
clear_queue();
}

void DIAMETER__CODEC__PT::send(const DIAMETER__Send& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of send operation.");
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMSEND:TTCN_Logger::PORTEVENT_MCSEND;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_send(port_name, destination_component,
(TTCN_Logger::begin_event(log_sev, TRUE), TTCN_Logger::log_event_str(" @DIAMETER_CodecPort.DIAMETER_Send : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
IPL4asp__Types::ASP__Send mapped_par;
DIAMETER__to__IPL4__Send(send_par, mapped_par);
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_DUALSEND)) {
TTCN_Logger::log_dualport_map(0, "@IPL4asp_Types.ASP_Send",
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_DUALSEND, TRUE), mapped_par.log(), TTCN_Logger::end_event_log2str()), 0);
}
if (destination_component == SYSTEM_COMPREF) outgoing_send(mapped_par);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@IPL4asp_Types.ASP_Send");
mapped_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void DIAMETER__CODEC__PT::send(const DIAMETER__Send& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect);
}

void DIAMETER__CODEC__PT::send(const DIAMETER__Send& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
if (broadcast) {
if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name);
Text_Buf text_buf;
prepare_message(text_buf, "@DIAMETER_CodecPort.DIAMETER_Send");
send_par.encode_text(text_buf);
send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE),
TTCN_Logger::log_event_str(" @DIAMETER_CodecPort.DIAMETER_Send : "), send_par.log(), TTCN_Logger::end_event_log2str()));
}
else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void DIAMETER__CODEC__PT::send(const DIAMETER__Send_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const DIAMETER__Send& send_par_value = DIAMETER__Send(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void DIAMETER__CODEC__PT::send(const DIAMETER__Send_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect)
{
const DIAMETER__Send& send_par_value = DIAMETER__Send(send_par.valueof());
send(send_par_value, nof_components, destination_components, timestamp_redirect);
}

void DIAMETER__CODEC__PT::send(const DIAMETER__Send_template& send_par, boolean broadcast, FLOAT* timestamp_redirect)
{
const DIAMETER__Send& send_par_value = DIAMETER__Send(send_par.valueof());
send(send_par_value, broadcast, timestamp_redirect);
}

PORT* DIAMETER__CODEC__PT::get_provider_port() {
(void)get_default_destination();
return this;
}

alt_status DIAMETER__CODEC__PT::receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @DIAMETER_CodecPort.DIAMETER_RecvFrom: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @IPL4asp_Types.ASP_ConnId_ReadyToRelease: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::check_receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @DIAMETER_CodecPort.DIAMETER_RecvFrom: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @IPL4asp_Types.ASP_ConnId_ReadyToRelease: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::trigger(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
switch (my_head->item_selection) {
case MESSAGE_0:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @DIAMETER_CodecPort.DIAMETER_RecvFrom: "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_1:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @IPL4asp_Types.ASP_ConnId_ReadyToRelease: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
case MESSAGE_2:
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent: "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::receive(const DIAMETER__RecvFrom_template& value_template, DIAMETER__RecvFrom *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @DIAMETER_CodecPort.DIAMETER_RecvFrom.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @DIAMETER_CodecPort.DIAMETER_RecvFrom : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::check_receive(const DIAMETER__RecvFrom_template& value_template, DIAMETER__RecvFrom *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @DIAMETER_CodecPort.DIAMETER_RecvFrom.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @DIAMETER_CodecPort.DIAMETER_RecvFrom : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::trigger(const DIAMETER__RecvFrom_template& value_template, DIAMETER__RecvFrom *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_0) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @DIAMETER_CodecPort.DIAMETER_RecvFrom.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_0)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_0;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @DIAMETER_CodecPort.DIAMETER_RecvFrom : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::receive(const IPL4asp__Types::ASP__ConnId__ReadyToRelease_template& value_template, IPL4asp__Types::ASP__ConnId__ReadyToRelease *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @IPL4asp_Types.ASP_ConnId_ReadyToRelease.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @IPL4asp_Types.ASP_ConnId_ReadyToRelease : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::check_receive(const IPL4asp__Types::ASP__ConnId__ReadyToRelease_template& value_template, IPL4asp__Types::ASP__ConnId__ReadyToRelease *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @IPL4asp_Types.ASP_ConnId_ReadyToRelease.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @IPL4asp_Types.ASP_ConnId_ReadyToRelease : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::trigger(const IPL4asp__Types::ASP__ConnId__ReadyToRelease_template& value_template, IPL4asp__Types::ASP__ConnId__ReadyToRelease *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_1) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @IPL4asp_Types.ASP_ConnId_ReadyToRelease.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_1)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_1;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_1),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @IPL4asp_Types.ASP_ConnId_ReadyToRelease : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::receive(const Socket__API__Definitions::PortEvent_template& value_template, Socket__API__Definitions::PortEvent *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @Socket_API_Definitions.PortEvent.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::check_receive(const Socket__API__Definitions::PortEvent_template& value_template, Socket__API__Definitions::PortEvent *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @Socket_API_Definitions.PortEvent.", port_name);
return ALT_NO;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status DIAMETER__CODEC__PT::trigger(const Socket__API__Definitions::PortEvent_template& value_template, Socket__API__Definitions::PortEvent *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template");
msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;
if (msg_queue_head == NULL) {
if (is_started) return ALT_MAYBE;
else {
TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name);
return ALT_NO;
}
} else if (!sender_template.match(my_head->sender_component)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name);
sender_template.log_match(my_head->sender_component);
TTCN_Logger::end_event();
}
remove_msg_queue_head();
return ALT_REPEAT;
} else if (my_head->item_selection != MESSAGE_2) {
TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @Socket_API_Definitions.PortEvent.", port_name);
remove_msg_queue_head();
return ALT_REPEAT;
} else if (!value_template.match(*my_head->message_2)) {
const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
remove_msg_queue_head();
return ALT_REPEAT;
} else {
if (value_redirect != NULL) {
*value_redirect = *my_head->message_2;
}
if (sender_ptr != NULL) *sender_ptr = my_head->sender_component;
TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__,
port_name, my_head->sender_component,
(TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_2),
 TTCN_Logger::end_event_log2str()));
}
log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op,
my_head->sender_component, CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @Socket_API_Definitions.PortEvent : "),
my_head->message_2->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

void DIAMETER__CODEC__PT::incoming_message(const IPL4asp__Types::ASP__RecvFrom& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count+1,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @IPL4asp_Types.ASP_RecvFrom : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
DIAMETER__RecvFrom *mapped_par = new DIAMETER__RecvFrom;
try {
IPL4__to__DIAMETER__RecvFrom(incoming_par, *mapped_par);
} catch (...) {
delete mapped_par;
throw;
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_DUALRECV)) {
TTCN_Logger::log_dualport_map(1, "@DIAMETER_CodecPort.DIAMETER_RecvFrom",
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_DUALRECV, TRUE), mapped_par->log(), TTCN_Logger::end_event_log2str()),
msg_tail_count);
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = mapped_par;
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void DIAMETER__CODEC__PT::incoming_message(const Socket__API__Definitions::PortEvent& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @Socket_API_Definitions.PortEvent : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_2;
new_item->message_2 = new Socket__API__Definitions::PortEvent(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void DIAMETER__CODEC__PT::incoming_message(const IPL4asp__Types::ASP__ConnId__ReadyToRelease& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name);
return;
}
else {
TTCN_error("Port %s is not started but a message has arrived on it.", port_name);
}
}
msg_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_MQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__msg, port_name, sender_component, msg_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MQUEUE, TRUE), TTCN_Logger::log_event_str(" @IPL4asp_Types.ASP_ConnId_ReadyToRelease : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_1;
new_item->message_1 = new IPL4asp__Types::ASP__ConnId__ReadyToRelease(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void DIAMETER__CODEC__PT::incoming_message(const IPL4asp__Types::ASP__RecvFrom& incoming_par)
{
incoming_message(incoming_par, SYSTEM_COMPREF);
}

void DIAMETER__CODEC__PT::incoming_message(const Socket__API__Definitions::PortEvent& incoming_par)
{
incoming_message(incoming_par, SYSTEM_COMPREF);
}

void DIAMETER__CODEC__PT::incoming_message(const IPL4asp__Types::ASP__ConnId__ReadyToRelease& incoming_par)
{
incoming_message(incoming_par, SYSTEM_COMPREF);
}

boolean DIAMETER__CODEC__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@IPL4asp_Types.ASP_RecvFrom")) {
IPL4asp__Types::ASP__RecvFrom incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@Socket_API_Definitions.PortEvent")) {
Socket__API__Definitions::PortEvent incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@IPL4asp_Types.ASP_ConnId_ReadyToRelease")) {
IPL4asp__Types::ASP__ConnId__ReadyToRelease incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}


/* Bodies of functions, altsteps and testcases */

DIAMETER__RecvFrom_template t__DIAMETER__RecvFrom(const DIAMETER__Types::PDU__DIAMETER_template& msg)
{
TTCN_Location current_location("DIAMETER_CodecPort.ttcn", 29, TTCN_Location::LOCATION_TEMPLATE, "t_DIAMETER_RecvFrom");
DIAMETER__RecvFrom_template ret_val;
ret_val.connId() = ANY_VALUE;
ret_val.remName() = ANY_VALUE;
ret_val.remPort() = ANY_VALUE;
ret_val.locName() = ANY_VALUE;
ret_val.locPort() = ANY_VALUE;
ret_val.msg() = msg;
return ret_val;
}

DIAMETER__Send_template t__DIAMETER__Send(const INTEGER_template& connId, const DIAMETER__Types::PDU__DIAMETER_template& msg)
{
TTCN_Location current_location("DIAMETER_CodecPort.ttcn", 43, TTCN_Location::LOCATION_TEMPLATE, "t_DIAMETER_Send");
DIAMETER__Send_template ret_val;
ret_val.connId() = connId;
ret_val.msg() = msg;
return ret_val;
}

void IPL4__to__DIAMETER__RecvFrom(const IPL4asp__Types::ASP__RecvFrom& pin, DIAMETER__RecvFrom& pout)
{
TTCN_Location current_location("DIAMETER_CodecPort.ttcn", 48, TTCN_Location::LOCATION_FUNCTION, "IPL4_to_DIAMETER_RecvFrom");
current_location.update_lineno(49);
/* DIAMETER_CodecPort.ttcn, line 49 */
pout.connId() = const_cast< const IPL4asp__Types::ASP__RecvFrom&>(pin).connId();
current_location.update_lineno(50);
/* DIAMETER_CodecPort.ttcn, line 50 */
pout.remName() = const_cast< const IPL4asp__Types::ASP__RecvFrom&>(pin).remName();
current_location.update_lineno(51);
/* DIAMETER_CodecPort.ttcn, line 51 */
pout.remPort() = const_cast< const IPL4asp__Types::ASP__RecvFrom&>(pin).remPort();
current_location.update_lineno(52);
/* DIAMETER_CodecPort.ttcn, line 52 */
pout.locName() = const_cast< const IPL4asp__Types::ASP__RecvFrom&>(pin).locName();
current_location.update_lineno(53);
/* DIAMETER_CodecPort.ttcn, line 53 */
pout.locPort() = const_cast< const IPL4asp__Types::ASP__RecvFrom&>(pin).locPort();
current_location.update_lineno(54);
/* DIAMETER_CodecPort.ttcn, line 54 */
pout.msg() = DIAMETER__Types::f__DIAMETER__Dec(const_cast< const IPL4asp__Types::ASP__RecvFrom&>(pin).msg());
}

void DIAMETER__to__IPL4__Send(const DIAMETER__Send& pin, IPL4asp__Types::ASP__Send& pout)
{
TTCN_Location current_location("DIAMETER_CodecPort.ttcn", 57, TTCN_Location::LOCATION_FUNCTION, "DIAMETER_to_IPL4_Send");
current_location.update_lineno(58);
/* DIAMETER_CodecPort.ttcn, line 58 */
pout.connId() = const_cast< const DIAMETER__Send&>(pin).connId();
current_location.update_lineno(59);
/* DIAMETER_CodecPort.ttcn, line 59 */
{
Socket__API__Definitions::ProtoTuple& tmp_8 = pout.proto(); /* 7388 */
{
Socket__API__Definitions::SctpTuple& tmp_9 = tmp_8.sctp();
tmp_9.sinfo__stream() = OMIT_VALUE;
tmp_9.sinfo__ppid() = 46;
tmp_9.remSocks() = OMIT_VALUE;
tmp_9.assocId() = OMIT_VALUE;
}
}
current_location.update_lineno(67);
/* DIAMETER_CodecPort.ttcn, line 67 */
pout.msg() = DIAMETER__Types::f__DIAMETER__Enc(const_cast< const DIAMETER__Send&>(pin).msg());
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("DIAMETER_CodecPort.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "DIAMETER_CodecPort");
IPL4asp__PortType::module_object.pre_init_module();
DIAMETER__Types::module_object.pre_init_module();
module_object.add_function("IPL4_to_DIAMETER_RecvFrom", (genericfunc_t)&IPL4__to__DIAMETER__RecvFrom, NULL);
module_object.add_function("DIAMETER_to_IPL4_Send", (genericfunc_t)&DIAMETER__to__IPL4__Send, NULL);
}

void post_init_module()
{
TTCN_Location current_location("DIAMETER_CodecPort.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "DIAMETER_CodecPort");
IPL4asp__PortType::module_object.post_init_module();
DIAMETER__Types::module_object.post_init_module();
}


} /* end of namespace */
