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

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

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

/* Including header files */

#include "IPA_Emulation.hh"

namespace IPA__Emulation {

/* Literal string constants */

const unsigned char os_0_octets[] = { 0 };
extern const OCTETSTRING os_0(1, os_0_octets);
extern const CHARSTRING cs_0(0, NULL),
cs_2(5, "0/1/2"),
cs_3(9, "Connected"),
cs_1(8, "mahlzeit"),
cs_4(7, "unknown");
const unsigned char module_checksum[] = { 0x0f, 0x6b, 0xaf, 0x88, 0x33, 0x20, 0x47, 0x06, 0xcc, 0x32, 0x3a, 0x0c, 0x4f, 0x48, 0x28, 0x47 };

/* Global variable definitions */

BOOLEAN modulepar_mp__ipa__mgcp__uses__osmo__ext;
const BOOLEAN& mp__ipa__mgcp__uses__osmo__ext = modulepar_mp__ipa__mgcp__uses__osmo__ext;
// No XER for IpaMode
const TTCN_Typedescriptor_t IpaMode_descr_ = { "@IPA_Emulation.IpaMode", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for IpaInitBehavior
const TTCN_Typedescriptor_t IpaInitBehavior_descr_ = { "@IPA_Emulation.IpaInitBehavior", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING ASP__IPA__Unitdata_streamId_default_coding("RAW");
const XERdescriptor_t       ASP__IPA__Unitdata_payload_xer_ = { {"payload>\n", "payload>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const int ASP__IPA__Unitdata_payload_oer_ext_arr_[0] = {};
const int ASP__IPA__Unitdata_payload_oer_p_[0] = {};
const TTCN_OERdescriptor_t ASP__IPA__Unitdata_payload_oer_ = { -1, TRUE, -1, FALSE, 0, 0, ASP__IPA__Unitdata_payload_oer_ext_arr_, 0, ASP__IPA__Unitdata_payload_oer_p_};
const TTCN_Typedescriptor_t ASP__IPA__Unitdata_payload_descr_ = { "@IPA_Emulation.ASP_IPA_Unitdata.payload", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &ASP__IPA__Unitdata_payload_xer_, &OCTETSTRING_json_, &ASP__IPA__Unitdata_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for ASP__IPA__Unitdata
const TTCN_Typedescriptor_t ASP__IPA__Unitdata_descr_ = { "@IPA_Emulation.ASP_IPA_Unitdata", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING ASP__IPA__Unitdata_streamIdExt_default_coding("RAW");
// No XER for ASP__IPA__EventType
const TTCN_Typedescriptor_t ASP__IPA__EventType_descr_ = { "@IPA_Emulation.ASP_IPA_EventType", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       ASP__IPA__Event_conn__id_xer_ = { {"conn_id>\n", "conn_id>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t ASP__IPA__Event_conn__id_descr_ = { "@IPA_Emulation.ASP_IPA_Event.conn_id", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &ASP__IPA__Event_conn__id_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
// No XER for ASP__IPA__Event
const TTCN_Typedescriptor_t ASP__IPA__Event_descr_ = { "@IPA_Emulation.ASP_IPA_Event", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
UNIVERSAL_CHARSTRING ASP__IPA__Event_id__resp_default_coding("RAW");
IPA__Types::IpaCcmIdResp_template template_ts__ASP__IPA__EV_id__resp_defval;
const IPA__Types::IpaCcmIdResp_template& ts__ASP__IPA__EV_id__resp_defval = template_ts__ASP__IPA__EV_id__resp_defval;
INTEGER_template template_tr__ASP__IPA__EV_conn__id_defval;
const INTEGER_template& tr__ASP__IPA__EV_conn__id_defval = template_tr__ASP__IPA__EV_conn__id_defval;
IPA__Types::IpaCcmIdResp_template template_tr__ASP__IPA__EV_id__resp_defval;
const IPA__Types::IpaCcmIdResp_template& tr__ASP__IPA__EV_id__resp_defval = template_tr__ASP__IPA__EV_id__resp_defval;
IPA__Types::IpaExtStreamId_template template_t__ASP__IPA__UD_esid_defval;
const IPA__Types::IpaExtStreamId_template& t__ASP__IPA__UD_esid_defval = template_t__ASP__IPA__UD_esid_defval;
const TTCN_Typedescriptor_t& IPA__Emulation__CT_descr_ = COMPONENT_descr_;
IPA__CodecPort::IPA__CODEC__PT IPA__Emulation__CT_component_IPA__PORT("IPA_PORT");
IPA__CFG__PT IPA__Emulation__CT_component_CFG__PORT("CFG_PORT");
IPA__CTRL__PT IPA__Emulation__CT_component_IPA__CTRL__PORT("IPA_CTRL_PORT");
IPA__SP__PT IPA__Emulation__CT_component_IPA__SP__PORT("IPA_SP_PORT");
BOOLEAN IPA__Emulation__CT_component_g__initialized;
BOOLEAN IPA__Emulation__CT_component_g__is__bsc__mgw;
INTEGER IPA__Emulation__CT_component_g__self__conn__id;
INTEGER IPA__Emulation__CT_component_g__last__conn__id;
IpaMode IPA__Emulation__CT_component_g__mode;
BOOLEAN IPA__Emulation__CT_component_g__ccm__enabled;
IpaInitBehavior IPA__Emulation__CT_component_g__init__behavior;
BOOLEAN IPA__Emulation__CT_component_g__server__stop__on__ipa__ev__down;
// No XER for IPA__CCM__Parameters
const TTCN_Typedescriptor_t IPA__CCM__Parameters_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_ser__nr_xer_ = { {"ser_nr>\n", "ser_nr>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_ser__nr_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.ser_nr", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_ser__nr_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_name_xer_ = { {"name>\n", "name>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_name_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.name", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_name_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_location1_xer_ = { {"location1>\n", "location1>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_location1_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.location1", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_location1_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_location2_xer_ = { {"location2>\n", "location2>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_location2_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.location2", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_location2_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_equip__version_xer_ = { {"equip_version>\n", "equip_version>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_equip__version_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.equip_version", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_equip__version_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_sw__version_xer_ = { {"sw_version>\n", "sw_version>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_sw__version_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.sw_version", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_sw__version_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_ip__addr_xer_ = { {"ip_addr>\n", "ip_addr>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_ip__addr_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.ip_addr", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_ip__addr_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_mac__addr_xer_ = { {"mac_addr>\n", "mac_addr>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_mac__addr_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.mac_addr", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_mac__addr_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_unit__id_xer_ = { {"unit_id>\n", "unit_id>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_unit__id_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.unit_id", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_unit__id_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
const XERdescriptor_t       IPA__CCM__Parameters_osmo__rand_xer_ = { {"osmo_rand>\n", "osmo_rand>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE,  NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE };
const TTCN_Typedescriptor_t IPA__CCM__Parameters_osmo__rand_descr_ = { "@IPA_Emulation.IPA_CCM_Parameters.osmo_rand", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &IPA__CCM__Parameters_osmo__rand_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
IPA__CCM__Parameters IPA__Emulation__CT_component_g__ccm__pars;
IPA__CCM__Parameters const_c__IPA__default__ccm__pars;
const IPA__CCM__Parameters& c__IPA__default__ccm__pars = const_c__IPA__default__ccm__pars;
IPA__CCM__Parameters const_f__connect_ccm__pars_defval;
const IPA__CCM__Parameters& f__connect_ccm__pars_defval = const_f__connect_ccm__pars_defval;
IPA__CCM__Parameters const_f__bind_ccm__pars_defval;
const IPA__CCM__Parameters& f__bind_ccm__pars_defval = const_f__bind_ccm__pars_defval;
IPA__Types::PDU__IPA__CCM_template template_ts__IPA__PONG;
const IPA__Types::PDU__IPA__CCM_template& ts__IPA__PONG = template_ts__IPA__PONG;
IPA__Types::PDU__IPA__CCM_template template_ts__IPA__ACK;
const IPA__Types::PDU__IPA__CCM_template& ts__IPA__ACK = template_ts__IPA__ACK;
IPA__Types::PDU__IPA__CCM_template template_ts__IPA__ID__GET;
const IPA__Types::PDU__IPA__CCM_template& ts__IPA__ID__GET = template_ts__IPA__ID__GET;
IPA__Types::PDU__IPA__CCM_template template_tr__IPA__ID__RESP;
const IPA__Types::PDU__IPA__CCM_template& tr__IPA__ID__RESP = template_tr__IPA__ID__RESP;
IPA__CCM__Parameters const_main__client_ccm__pars_defval;
const IPA__CCM__Parameters& main__client_ccm__pars_defval = const_main__client_ccm__pars_defval;
BOOLEAN const_main__client_ccm__enabled_defval;
const BOOLEAN& main__client_ccm__enabled_defval = const_main__client_ccm__enabled_defval;
BOOLEAN const_main__server_ccm__enabled_defval;
const BOOLEAN& main__server_ccm__enabled_defval = const_main__server_ccm__enabled_defval;
IpaInitBehavior const_main__server_init__behavior_defval;
const IpaInitBehavior& main__server_init__behavior_defval = const_main__server_init__behavior_defval;
BOOLEAN const_main__server_server__stop__on__ipa__ev__down_defval;
const BOOLEAN& main__server_server__stop__on__ipa__ev__down_defval = const_main__server_server__stop__on__ipa__ev__down_defval;
const TTCN_Typedescriptor_t& IPA__EventWaiter__CT_descr_ = COMPONENT_descr_;
IPA__SP__PT IPA__EventWaiter__CT_component_IPA__SP__PORT("IPA_SP_PORT");
ASP__IPA__Event_template template_waiter__main_wait__for_defval;
const ASP__IPA__Event_template& waiter__main_wait__for_defval = template_waiter__main_wait__for_defval;
TTCN_Module module_object("IPA_Emulation", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, set_module_param, NULL, log_module_param, init_comp_type, init_system_port, start_ptc_function, NULL);

const RuntimeVersionChecker ver_checker(  current_runtime_version.requires_major_version_9,
  current_runtime_version.requires_minor_version_0,
  current_runtime_version.requires_patch_level_0,  current_runtime_version.requires_runtime_1);

/* Member functions of C++ classes */

IpaMode::IpaMode()
{
enum_value = UNBOUND_VALUE;
}

IpaMode::IpaMode(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @IPA_Emulation.IpaMode with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

IpaMode::IpaMode(enum_type other_value)
{
enum_value = other_value;
}

IpaMode::IpaMode(const IpaMode& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @IPA_Emulation.IpaMode.");
enum_value = other_value.enum_value;
}

IpaMode& IpaMode::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @IPA_Emulation.IpaMode.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

IpaMode& IpaMode::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

IpaMode& IpaMode::operator=(const IpaMode& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @IPA_Emulation.IpaMode.");
enum_value = other_value.enum_value;
return *this;
}

boolean IpaMode::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaMode.");
return enum_value == other_value;
}

boolean IpaMode::operator==(const IpaMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaMode.");
return enum_value == other_value.enum_value;
}

boolean IpaMode::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaMode.");
return enum_value < other_value;
}

boolean IpaMode::operator<(const IpaMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaMode.");
return enum_value < other_value.enum_value;
}

boolean IpaMode::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaMode.");
return enum_value > other_value;
}

boolean IpaMode::operator>(const IpaMode& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaMode.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaMode.");
return enum_value > other_value.enum_value;
}

const char *IpaMode::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case IPA__MODE__CLIENT: return "IPA_MODE_CLIENT";
case IPA__MODE__SERVER: return "IPA_MODE_SERVER";
default: return "<unknown>";
}
}

IpaMode::enum_type IpaMode::str_to_enum(const char *str_par)
{
if (!strcmp(str_par, "IPA_MODE_CLIENT")) return IPA__MODE__CLIENT;
else if (!strcmp(str_par, "IPA_MODE_SERVER")) return IPA__MODE__SERVER;
else return UNKNOWN_VALUE;
}

boolean IpaMode::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
return TRUE;
default:
return FALSE;
}
}

int IpaMode::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @IPA_Emulation.IpaMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int IpaMode::enum2int(const IpaMode& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @IPA_Emulation.IpaMode.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void IpaMode::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @IPA_Emulation.IpaMode.", int_val);
enum_value = (enum_type)int_val;
}

IpaMode::operator IpaMode::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @IPA_Emulation.IpaMode.");
return enum_value;
}

void IpaMode::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void IpaMode::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@IPA_Emulation.IpaMode");
  enum_value = str_to_enum(param.get_enumerated());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @IPA_Emulation.IpaMode.");
  }
}

void IpaMode::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @IPA_Emulation.IpaMode.");
text_buf.push_int(enum_value);
}

void IpaMode::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @IPA_Emulation.IpaMode.", enum_value);
}

void IpaMode_template::copy_template(const IpaMode_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 IpaMode_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 IpaMode_template(*other_value.implication_.precondition);
implication_.implied_template = new IpaMode_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 enumerated type @IPA_Emulation.IpaMode.");
}
}

IpaMode_template::IpaMode_template()
{
}

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

IpaMode_template::IpaMode_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!IpaMode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @IPA_Emulation.IpaMode with unknown numeric value %d.", other_value);
single_value = (IpaMode::enum_type)other_value;
}

IpaMode_template::IpaMode_template(IpaMode::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

IpaMode_template::IpaMode_template(const IpaMode& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == IpaMode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @IPA_Emulation.IpaMode.");
single_value = other_value.enum_value;
}

IpaMode_template::IpaMode_template(const OPTIONAL<IpaMode>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (IpaMode::enum_type)(const IpaMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @IPA_Emulation.IpaMode from an unbound optional field.");
}
}

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

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

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

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

boolean IpaMode_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean IpaMode_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != IpaMode::UNBOUND_VALUE;
}

void IpaMode_template::clean_up()
{
switch (template_selection) {
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;
}

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

IpaMode_template& IpaMode_template::operator=(int other_value)
{
if (!IpaMode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @IPA_Emulation.IpaMode.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (IpaMode::enum_type)other_value;
return *this;
}

IpaMode_template& IpaMode_template::operator=(IpaMode::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

IpaMode_template& IpaMode_template::operator=(const IpaMode& other_value)
{
if (other_value.enum_value == IpaMode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @IPA_Emulation.IpaMode to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

IpaMode_template& IpaMode_template::operator=(const OPTIONAL<IpaMode>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (IpaMode::enum_type)(const IpaMode&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @IPA_Emulation.IpaMode.");
}
return *this;
}

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

boolean IpaMode_template::match(IpaMode::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
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)) 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 enumerated type @IPA_Emulation.IpaMode.");
}
return FALSE;
}

boolean IpaMode_template::match(const IpaMode& other_value, boolean) const
{
if (other_value.enum_value == IpaMode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @IPA_Emulation.IpaMode with an unbound value.");
return match(other_value.enum_value);
}

IpaMode::enum_type IpaMode_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @IPA_Emulation.IpaMode.");
return single_value;
}

void IpaMode_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 type for a template of enumerated type @IPA_Emulation.IpaMode.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new IpaMode_template[list_length];
}

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

void IpaMode_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(IpaMode::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 IpaMode_template::log_match(const IpaMode& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void IpaMode_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @IPA_Emulation.IpaMode.");
}
}

void IpaMode_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (IpaMode::enum_type)text_buf.pull_int().get_val();
if (!IpaMode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @IPA_Emulation.IpaMode.", single_value);
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 IpaMode_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @IPA_Emulation.IpaMode.");
}
}

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

boolean IpaMode_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 i=0; i<value_list.n_values; i++)
if (value_list.list_value[i].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void IpaMode_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->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: {
    IpaMode_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Enumerated: {
    IpaMode::enum_type enum_val = IpaMode::str_to_enum(m_p->get_enumerated());
    if (!IpaMode::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @IPA_Emulation.IpaMode.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    IpaMode_template* precondition = new IpaMode_template;
    precondition->set_param(*m_p->get_elem(0));
    IpaMode_template* implied_template = new IpaMode_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = IpaMode_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@IPA_Emulation.IpaMode");
  }
  is_ifpresent = param.get_ifpresent();
}

void IpaMode_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@IPA_Emulation.IpaMode");
}

IpaInitBehavior::IpaInitBehavior()
{
enum_value = UNBOUND_VALUE;
}

IpaInitBehavior::IpaInitBehavior(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @IPA_Emulation.IpaInitBehavior with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

IpaInitBehavior::IpaInitBehavior(enum_type other_value)
{
enum_value = other_value;
}

IpaInitBehavior::IpaInitBehavior(const IpaInitBehavior& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
enum_value = other_value.enum_value;
}

IpaInitBehavior& IpaInitBehavior::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @IPA_Emulation.IpaInitBehavior.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

IpaInitBehavior& IpaInitBehavior::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

IpaInitBehavior& IpaInitBehavior::operator=(const IpaInitBehavior& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
enum_value = other_value.enum_value;
return *this;
}

boolean IpaInitBehavior::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
return enum_value == other_value;
}

boolean IpaInitBehavior::operator==(const IpaInitBehavior& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
return enum_value == other_value.enum_value;
}

boolean IpaInitBehavior::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
return enum_value < other_value;
}

boolean IpaInitBehavior::operator<(const IpaInitBehavior& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
return enum_value < other_value.enum_value;
}

boolean IpaInitBehavior::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
return enum_value > other_value;
}

boolean IpaInitBehavior::operator>(const IpaInitBehavior& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
return enum_value > other_value.enum_value;
}

const char *IpaInitBehavior::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case IPA__INIT__SEND__IPA__ID__GET: return "IPA_INIT_SEND_IPA_ID_GET";
case IPA__INIT__SEND__IPA__ID__ACK: return "IPA_INIT_SEND_IPA_ID_ACK";
default: return "<unknown>";
}
}

IpaInitBehavior::enum_type IpaInitBehavior::str_to_enum(const char *str_par)
{
if (!strcmp(str_par, "IPA_INIT_SEND_IPA_ID_GET")) return IPA__INIT__SEND__IPA__ID__GET;
else if (!strcmp(str_par, "IPA_INIT_SEND_IPA_ID_ACK")) return IPA__INIT__SEND__IPA__ID__ACK;
else return UNKNOWN_VALUE;
}

boolean IpaInitBehavior::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
return TRUE;
default:
return FALSE;
}
}

int IpaInitBehavior::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @IPA_Emulation.IpaInitBehavior.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int IpaInitBehavior::enum2int(const IpaInitBehavior& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @IPA_Emulation.IpaInitBehavior.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void IpaInitBehavior::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @IPA_Emulation.IpaInitBehavior.", int_val);
enum_value = (enum_type)int_val;
}

IpaInitBehavior::operator IpaInitBehavior::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @IPA_Emulation.IpaInitBehavior.");
return enum_value;
}

void IpaInitBehavior::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void IpaInitBehavior::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@IPA_Emulation.IpaInitBehavior");
  enum_value = str_to_enum(param.get_enumerated());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @IPA_Emulation.IpaInitBehavior.");
  }
}

void IpaInitBehavior::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
text_buf.push_int(enum_value);
}

void IpaInitBehavior::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @IPA_Emulation.IpaInitBehavior.", enum_value);
}

void IpaInitBehavior_template::copy_template(const IpaInitBehavior_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 IpaInitBehavior_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 IpaInitBehavior_template(*other_value.implication_.precondition);
implication_.implied_template = new IpaInitBehavior_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 enumerated type @IPA_Emulation.IpaInitBehavior.");
}
}

IpaInitBehavior_template::IpaInitBehavior_template()
{
}

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

IpaInitBehavior_template::IpaInitBehavior_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!IpaInitBehavior::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @IPA_Emulation.IpaInitBehavior with unknown numeric value %d.", other_value);
single_value = (IpaInitBehavior::enum_type)other_value;
}

IpaInitBehavior_template::IpaInitBehavior_template(IpaInitBehavior::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

IpaInitBehavior_template::IpaInitBehavior_template(const IpaInitBehavior& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == IpaInitBehavior::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior.");
single_value = other_value.enum_value;
}

IpaInitBehavior_template::IpaInitBehavior_template(const OPTIONAL<IpaInitBehavior>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (IpaInitBehavior::enum_type)(const IpaInitBehavior&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @IPA_Emulation.IpaInitBehavior from an unbound optional field.");
}
}

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

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

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

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

boolean IpaInitBehavior_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean IpaInitBehavior_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != IpaInitBehavior::UNBOUND_VALUE;
}

void IpaInitBehavior_template::clean_up()
{
switch (template_selection) {
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;
}

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

IpaInitBehavior_template& IpaInitBehavior_template::operator=(int other_value)
{
if (!IpaInitBehavior::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @IPA_Emulation.IpaInitBehavior.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (IpaInitBehavior::enum_type)other_value;
return *this;
}

IpaInitBehavior_template& IpaInitBehavior_template::operator=(IpaInitBehavior::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

IpaInitBehavior_template& IpaInitBehavior_template::operator=(const IpaInitBehavior& other_value)
{
if (other_value.enum_value == IpaInitBehavior::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @IPA_Emulation.IpaInitBehavior to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

IpaInitBehavior_template& IpaInitBehavior_template::operator=(const OPTIONAL<IpaInitBehavior>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (IpaInitBehavior::enum_type)(const IpaInitBehavior&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @IPA_Emulation.IpaInitBehavior.");
}
return *this;
}

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

boolean IpaInitBehavior_template::match(IpaInitBehavior::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
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)) 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 enumerated type @IPA_Emulation.IpaInitBehavior.");
}
return FALSE;
}

boolean IpaInitBehavior_template::match(const IpaInitBehavior& other_value, boolean) const
{
if (other_value.enum_value == IpaInitBehavior::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @IPA_Emulation.IpaInitBehavior with an unbound value.");
return match(other_value.enum_value);
}

IpaInitBehavior::enum_type IpaInitBehavior_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @IPA_Emulation.IpaInitBehavior.");
return single_value;
}

void IpaInitBehavior_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 type for a template of enumerated type @IPA_Emulation.IpaInitBehavior.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new IpaInitBehavior_template[list_length];
}

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

void IpaInitBehavior_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(IpaInitBehavior::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 IpaInitBehavior_template::log_match(const IpaInitBehavior& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void IpaInitBehavior_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @IPA_Emulation.IpaInitBehavior.");
}
}

void IpaInitBehavior_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (IpaInitBehavior::enum_type)text_buf.pull_int().get_val();
if (!IpaInitBehavior::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @IPA_Emulation.IpaInitBehavior.", single_value);
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 IpaInitBehavior_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @IPA_Emulation.IpaInitBehavior.");
}
}

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

boolean IpaInitBehavior_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 i=0; i<value_list.n_values; i++)
if (value_list.list_value[i].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void IpaInitBehavior_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->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: {
    IpaInitBehavior_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Enumerated: {
    IpaInitBehavior::enum_type enum_val = IpaInitBehavior::str_to_enum(m_p->get_enumerated());
    if (!IpaInitBehavior::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @IPA_Emulation.IpaInitBehavior.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    IpaInitBehavior_template* precondition = new IpaInitBehavior_template;
    precondition->set_param(*m_p->get_elem(0));
    IpaInitBehavior_template* implied_template = new IpaInitBehavior_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = IpaInitBehavior_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@IPA_Emulation.IpaInitBehavior");
  }
  is_ifpresent = param.get_ifpresent();
}

void IpaInitBehavior_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@IPA_Emulation.IpaInitBehavior");
}

ASP__IPA__Unitdata::ASP__IPA__Unitdata()
{
}

ASP__IPA__Unitdata::ASP__IPA__Unitdata(const IPA__Types::IpaStreamId& par_streamId,
    const OPTIONAL< IPA__Types::IpaExtStreamId >& par_streamIdExt,
    const OCTETSTRING& par_payload)
  :   field_streamId(par_streamId),
  field_streamIdExt(par_streamIdExt),
  field_payload(par_payload)
{
}

ASP__IPA__Unitdata::ASP__IPA__Unitdata(const ASP__IPA__Unitdata& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @IPA_Emulation.ASP_IPA_Unitdata.");
if (other_value.streamId().is_bound()) field_streamId = other_value.streamId();
else field_streamId.clean_up();
if (other_value.streamIdExt().is_bound()) field_streamIdExt = other_value.streamIdExt();
else field_streamIdExt.clean_up();
if (other_value.payload().is_bound()) field_payload = other_value.payload();
else field_payload.clean_up();
}

void ASP__IPA__Unitdata::clean_up()
{
field_streamId.clean_up();
field_streamIdExt.clean_up();
field_payload.clean_up();
}

const TTCN_Typedescriptor_t* ASP__IPA__Unitdata::get_descriptor() const { return &ASP__IPA__Unitdata_descr_; }
ASP__IPA__Unitdata& ASP__IPA__Unitdata::operator=(const ASP__IPA__Unitdata& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @IPA_Emulation.ASP_IPA_Unitdata.");
  if (other_value.streamId().is_bound()) field_streamId = other_value.streamId();
  else field_streamId.clean_up();
  if (other_value.streamIdExt().is_bound()) field_streamIdExt = other_value.streamIdExt();
  else field_streamIdExt.clean_up();
  if (other_value.payload().is_bound()) field_payload = other_value.payload();
  else field_payload.clean_up();
}
return *this;
}

boolean ASP__IPA__Unitdata::operator==(const ASP__IPA__Unitdata& other_value) const
{
return field_streamId==other_value.field_streamId
  && field_streamIdExt==other_value.field_streamIdExt
  && field_payload==other_value.field_payload;
}

boolean ASP__IPA__Unitdata::is_bound() const
{
return (field_streamId.is_bound())
  || (OPTIONAL_OMIT == field_streamIdExt.get_selection() || field_streamIdExt.is_bound())
  || (field_payload.is_bound());
}
boolean ASP__IPA__Unitdata::is_value() const
{
return field_streamId.is_value()
  && (OPTIONAL_OMIT == field_streamIdExt.get_selection() || field_streamIdExt.is_value())
  && field_payload.is_value();
}
int ASP__IPA__Unitdata::size_of() const
{
  int ret_val = 2;
  if (field_streamIdExt.ispresent()) ret_val++;
  return ret_val;
}

void ASP__IPA__Unitdata::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ streamId := ");
field_streamId.log();
TTCN_Logger::log_event_str(", streamIdExt := ");
field_streamIdExt.log();
TTCN_Logger::log_event_str(", payload := ");
field_payload.log();
TTCN_Logger::log_event_str(" }");
}

void ASP__IPA__Unitdata::set_implicit_omit()
{
if (streamId().is_bound()) streamId().set_implicit_omit();
if (!streamIdExt().is_bound()) streamIdExt() = OMIT_VALUE;
else streamIdExt().set_implicit_omit();
if (payload().is_bound()) payload().set_implicit_omit();
}

void ASP__IPA__Unitdata::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 (3<param.get_size()) {
      param.error("record value of type @IPA_Emulation.ASP_IPA_Unitdata has 3 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) streamId().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) streamIdExt().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(2));
    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(), "streamId")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          streamId().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(), "streamIdExt")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          streamIdExt().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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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 @IPA_Emulation.ASP_IPA_Unitdata: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@IPA_Emulation.ASP_IPA_Unitdata");
  }
}

void ASP__IPA__Unitdata::encode_text(Text_Buf& text_buf) const
{
field_streamId.encode_text(text_buf);
field_streamIdExt.encode_text(text_buf);
field_payload.encode_text(text_buf);
}

void ASP__IPA__Unitdata::decode_text(Text_Buf& text_buf)
{
field_streamId.decode_text(text_buf);
field_streamIdExt.decode_text(text_buf);
field_payload.decode_text(text_buf);
}

struct ASP__IPA__Unitdata_template::single_value_struct {
IPA__Types::IpaStreamId_template field_streamId;
IPA__Types::IpaExtStreamId_template field_streamIdExt;
OCTETSTRING_template field_payload;
};

void ASP__IPA__Unitdata_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_streamId = ANY_VALUE;
single_value->field_streamIdExt = ANY_OR_OMIT;
single_value->field_payload = ANY_VALUE;
}
}
}

void ASP__IPA__Unitdata_template::copy_value(const ASP__IPA__Unitdata& other_value)
{
single_value = new single_value_struct;
if (other_value.streamId().is_bound()) {
  single_value->field_streamId = other_value.streamId();
} else {
  single_value->field_streamId.clean_up();
}
if (other_value.streamIdExt().is_bound()) {
  if (other_value.streamIdExt().ispresent()) single_value->field_streamIdExt = other_value.streamIdExt()();
  else single_value->field_streamIdExt = OMIT_VALUE;
} else {
  single_value->field_streamIdExt.clean_up();
}
if (other_value.payload().is_bound()) {
  single_value->field_payload = other_value.payload();
} else {
  single_value->field_payload.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void ASP__IPA__Unitdata_template::copy_template(const ASP__IPA__Unitdata_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.streamId().get_selection()) {
single_value->field_streamId = other_value.streamId();
} else {
single_value->field_streamId.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.streamIdExt().get_selection()) {
single_value->field_streamIdExt = other_value.streamIdExt();
} else {
single_value->field_streamIdExt.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.payload().get_selection()) {
single_value->field_payload = other_value.payload();
} else {
single_value->field_payload.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 ASP__IPA__Unitdata_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 ASP__IPA__Unitdata_template(*other_value.implication_.precondition);
implication_.implied_template = new ASP__IPA__Unitdata_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 @IPA_Emulation.ASP_IPA_Unitdata.");
break;
}
set_selection(other_value);
}

ASP__IPA__Unitdata_template::ASP__IPA__Unitdata_template()
{
}

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

ASP__IPA__Unitdata_template::ASP__IPA__Unitdata_template(const ASP__IPA__Unitdata& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

ASP__IPA__Unitdata_template& ASP__IPA__Unitdata_template::operator=(const OPTIONAL<ASP__IPA__Unitdata>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const ASP__IPA__Unitdata&)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 @IPA_Emulation.ASP_IPA_Unitdata.");
}
return *this;
}

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

boolean ASP__IPA__Unitdata_template::match(const ASP__IPA__Unitdata& 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.streamId().is_bound()) return FALSE;
if(!single_value->field_streamId.match(other_value.streamId(), legacy))return FALSE;
if(!other_value.streamIdExt().is_bound()) return FALSE;
if((other_value.streamIdExt().ispresent() ? !single_value->field_streamIdExt.match((const IPA__Types::IpaExtStreamId&)other_value.streamIdExt(), legacy) : !single_value->field_streamIdExt.match_omit(legacy)))return FALSE;
if(!other_value.payload().is_bound()) return FALSE;
if(!single_value->field_payload.match(other_value.payload(), 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 @IPA_Emulation.ASP_IPA_Unitdata.");
}
return FALSE;
}

boolean ASP__IPA__Unitdata_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_streamId.is_bound()
 || (single_value->field_streamIdExt.is_omit() || single_value->field_streamIdExt.is_bound())
 || single_value->field_payload.is_bound();
}

boolean ASP__IPA__Unitdata_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_streamId.is_value()
 && (single_value->field_streamIdExt.is_omit() || single_value->field_streamIdExt.is_value())
 && single_value->field_payload.is_value();
}

void ASP__IPA__Unitdata_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;
}

ASP__IPA__Unitdata ASP__IPA__Unitdata_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 @IPA_Emulation.ASP_IPA_Unitdata.");
ASP__IPA__Unitdata ret_val;
if (single_value->field_streamId.is_bound()) {
ret_val.streamId() = single_value->field_streamId.valueof();
}
if (single_value->field_streamIdExt.is_omit()) ret_val.streamIdExt() = OMIT_VALUE;
else if (single_value->field_streamIdExt.is_bound()) {
ret_val.streamIdExt() = single_value->field_streamIdExt.valueof();
}
if (single_value->field_payload.is_bound()) {
ret_val.payload() = single_value->field_payload.valueof();
}
return ret_val;
}

void ASP__IPA__Unitdata_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 @IPA_Emulation.ASP_IPA_Unitdata.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new ASP__IPA__Unitdata_template[list_length];
}

ASP__IPA__Unitdata_template& ASP__IPA__Unitdata_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 @IPA_Emulation.ASP_IPA_Unitdata.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @IPA_Emulation.ASP_IPA_Unitdata.");
return value_list.list_value[list_index];
}

IPA__Types::IpaStreamId_template& ASP__IPA__Unitdata_template::streamId()
{
set_specific();
return single_value->field_streamId;
}

const IPA__Types::IpaStreamId_template& ASP__IPA__Unitdata_template::streamId() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field streamId of a non-specific template of type @IPA_Emulation.ASP_IPA_Unitdata.");
return single_value->field_streamId;
}

IPA__Types::IpaExtStreamId_template& ASP__IPA__Unitdata_template::streamIdExt()
{
set_specific();
return single_value->field_streamIdExt;
}

const IPA__Types::IpaExtStreamId_template& ASP__IPA__Unitdata_template::streamIdExt() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field streamIdExt of a non-specific template of type @IPA_Emulation.ASP_IPA_Unitdata.");
return single_value->field_streamIdExt;
}

OCTETSTRING_template& ASP__IPA__Unitdata_template::payload()
{
set_specific();
return single_value->field_payload;
}

const OCTETSTRING_template& ASP__IPA__Unitdata_template::payload() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field payload of a non-specific template of type @IPA_Emulation.ASP_IPA_Unitdata.");
return single_value->field_payload;
}

int ASP__IPA__Unitdata_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Unitdata which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 2;
      if (single_value->field_streamIdExt.is_present()) ret_val++;
      return ret_val;
    }
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Unitdata 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 @IPA_Emulation.ASP_IPA_Unitdata containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Unitdata containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Unitdata containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Unitdata containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Unitdata containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Unitdata containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Unitdata containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @IPA_Emulation.ASP_IPA_Unitdata.");
  }
  return 0;
}

void ASP__IPA__Unitdata_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ streamId := ");
single_value->field_streamId.log();
TTCN_Logger::log_event_str(", streamIdExt := ");
single_value->field_streamIdExt.log();
TTCN_Logger::log_event_str(", payload := ");
single_value->field_payload.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 ASP__IPA__Unitdata_template::log_match(const ASP__IPA__Unitdata& 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_streamId.match(match_value.streamId(), legacy)){
TTCN_Logger::log_logmatch_info(".streamId");
single_value->field_streamId.log_match(match_value.streamId(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.streamIdExt().ispresent()){
if(!single_value->field_streamIdExt.match(match_value.streamIdExt(), legacy)){
TTCN_Logger::log_logmatch_info(".streamIdExt");
single_value->field_streamIdExt.log_match(match_value.streamIdExt(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_streamIdExt.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".streamIdExt := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_streamIdExt.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if(!single_value->field_payload.match(match_value.payload(), legacy)){
TTCN_Logger::log_logmatch_info(".payload");
single_value->field_payload.log_match(match_value.payload(), 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("{ streamId := ");
single_value->field_streamId.log_match(match_value.streamId(), legacy);
TTCN_Logger::log_event_str(", streamIdExt := ");
if (match_value.streamIdExt().ispresent()) {
single_value->field_streamIdExt.log_match(match_value.streamIdExt(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_streamIdExt.log();
if (single_value->field_streamIdExt.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", payload := ");
single_value->field_payload.log_match(match_value.payload(), 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 ASP__IPA__Unitdata_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_streamId.encode_text(text_buf);
single_value->field_streamIdExt.encode_text(text_buf);
single_value->field_payload.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 @IPA_Emulation.ASP_IPA_Unitdata.");
}
}

void ASP__IPA__Unitdata_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_streamId.decode_text(text_buf);
single_value->field_streamIdExt.decode_text(text_buf);
single_value->field_payload.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 ASP__IPA__Unitdata_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 @IPA_Emulation.ASP_IPA_Unitdata.");
}
}

void ASP__IPA__Unitdata_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: {
    ASP__IPA__Unitdata_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 (3<param.get_size()) {
      param.error("record template of type @IPA_Emulation.ASP_IPA_Unitdata has 3 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) streamId().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) streamIdExt().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(2));
    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(), "streamId")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          streamId().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(), "streamIdExt")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          streamIdExt().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(), "payload")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          payload().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 @IPA_Emulation.ASP_IPA_Unitdata: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    ASP__IPA__Unitdata_template* precondition = new ASP__IPA__Unitdata_template;
    precondition->set_param(*param.get_elem(0));
    ASP__IPA__Unitdata_template* implied_template = new ASP__IPA__Unitdata_template;
    implied_template->set_param(*param.get_elem(1));
    *this = ASP__IPA__Unitdata_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@IPA_Emulation.ASP_IPA_Unitdata");
  }
  is_ifpresent = param.get_ifpresent();
}

void ASP__IPA__Unitdata_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_streamId.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.ASP_IPA_Unitdata");
single_value->field_streamIdExt.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.ASP_IPA_Unitdata");
single_value->field_payload.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.ASP_IPA_Unitdata");
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 : "@IPA_Emulation.ASP_IPA_Unitdata");
}

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

boolean ASP__IPA__Unitdata_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;
}

ASP__IPA__EventType::ASP__IPA__EventType()
{
enum_value = UNBOUND_VALUE;
}

ASP__IPA__EventType::ASP__IPA__EventType(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @IPA_Emulation.ASP_IPA_EventType with invalid numeric value %d.", other_value);
enum_value = (enum_type)other_value;
}

ASP__IPA__EventType::ASP__IPA__EventType(enum_type other_value)
{
enum_value = other_value;
}

ASP__IPA__EventType::ASP__IPA__EventType(const ASP__IPA__EventType& other_value)
: Base_Type()
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
enum_value = other_value.enum_value;
}

ASP__IPA__EventType& ASP__IPA__EventType::operator=(int other_value)
{
if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @IPA_Emulation.ASP_IPA_EventType.", other_value);
enum_value = (enum_type)other_value;
return *this;
}

ASP__IPA__EventType& ASP__IPA__EventType::operator=(enum_type other_value)
{
enum_value = other_value;
return *this;
}

ASP__IPA__EventType& ASP__IPA__EventType::operator=(const ASP__IPA__EventType& other_value)
{
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
enum_value = other_value.enum_value;
return *this;
}

boolean ASP__IPA__EventType::operator==(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
return enum_value == other_value;
}

boolean ASP__IPA__EventType::operator==(const ASP__IPA__EventType& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
return enum_value == other_value.enum_value;
}

boolean ASP__IPA__EventType::operator<(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
return enum_value < other_value;
}

boolean ASP__IPA__EventType::operator<(const ASP__IPA__EventType& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
return enum_value < other_value.enum_value;
}

boolean ASP__IPA__EventType::operator>(enum_type other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
return enum_value > other_value;
}

boolean ASP__IPA__EventType::operator>(const ASP__IPA__EventType& other_value) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
return enum_value > other_value.enum_value;
}

const char *ASP__IPA__EventType::enum_to_str(enum_type enum_par)
{
switch (enum_par) {
case ASP__IPA__EVENT__DOWN: return "ASP_IPA_EVENT_DOWN";
case ASP__IPA__EVENT__UP: return "ASP_IPA_EVENT_UP";
case ASP__IPA__EVENT__ID__RESP: return "ASP_IPA_EVENT_ID_RESP";
case ASP__IPA__EVENT__ID__ACK: return "ASP_IPA_EVENT_ID_ACK";
default: return "<unknown>";
}
}

ASP__IPA__EventType::enum_type ASP__IPA__EventType::str_to_enum(const char *str_par)
{
if (!strcmp(str_par, "ASP_IPA_EVENT_DOWN")) return ASP__IPA__EVENT__DOWN;
else if (!strcmp(str_par, "ASP_IPA_EVENT_UP")) return ASP__IPA__EVENT__UP;
else if (!strcmp(str_par, "ASP_IPA_EVENT_ID_RESP")) return ASP__IPA__EVENT__ID__RESP;
else if (!strcmp(str_par, "ASP_IPA_EVENT_ID_ACK")) return ASP__IPA__EVENT__ID__ACK;
else return UNKNOWN_VALUE;
}

boolean ASP__IPA__EventType::is_valid_enum(int int_par)
{
switch (int_par) {
case 0:
case 1:
case 2:
case 3:
return TRUE;
default:
return FALSE;
}
}

int ASP__IPA__EventType::enum2int(enum_type enum_par)
{
if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @IPA_Emulation.ASP_IPA_EventType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par;
}

int ASP__IPA__EventType::enum2int(const ASP__IPA__EventType& enum_par)
{
if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @IPA_Emulation.ASP_IPA_EventType.", enum_par==UNBOUND_VALUE?"unbound":"invalid");
return enum_par.enum_value;
}

void ASP__IPA__EventType::int2enum(int int_val)
{
if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @IPA_Emulation.ASP_IPA_EventType.", int_val);
enum_value = (enum_type)int_val;
}

ASP__IPA__EventType::operator ASP__IPA__EventType::enum_type() const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
return enum_value;
}

void ASP__IPA__EventType::log() const
{
if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value);
else TTCN_Logger::log_event_unbound();
}

void ASP__IPA__EventType::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_VALUE, "enumerated value");
  if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@IPA_Emulation.ASP_IPA_EventType");
  enum_value = str_to_enum(param.get_enumerated());
  if (!is_valid_enum(enum_value)) {
    param.error("Invalid enumerated value for type @IPA_Emulation.ASP_IPA_EventType.");
  }
}

void ASP__IPA__EventType::encode_text(Text_Buf& text_buf) const
{
if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
text_buf.push_int(enum_value);
}

void ASP__IPA__EventType::decode_text(Text_Buf& text_buf)
{
enum_value = (enum_type)text_buf.pull_int().get_val();
if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @IPA_Emulation.ASP_IPA_EventType.", enum_value);
}

void ASP__IPA__EventType_template::copy_template(const ASP__IPA__EventType_template& other_value)
{
set_selection(other_value);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = other_value.single_value;
break;
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 ASP__IPA__EventType_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 ASP__IPA__EventType_template(*other_value.implication_.precondition);
implication_.implied_template = new ASP__IPA__EventType_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 enumerated type @IPA_Emulation.ASP_IPA_EventType.");
}
}

ASP__IPA__EventType_template::ASP__IPA__EventType_template()
{
}

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

ASP__IPA__EventType_template::ASP__IPA__EventType_template(int other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (!ASP__IPA__EventType::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @IPA_Emulation.ASP_IPA_EventType with unknown numeric value %d.", other_value);
single_value = (ASP__IPA__EventType::enum_type)other_value;
}

ASP__IPA__EventType_template::ASP__IPA__EventType_template(ASP__IPA__EventType::enum_type other_value)
 : Base_Template(SPECIFIC_VALUE)
{
single_value = other_value;
}

ASP__IPA__EventType_template::ASP__IPA__EventType_template(const ASP__IPA__EventType& other_value)
 : Base_Template(SPECIFIC_VALUE)
{
if (other_value.enum_value == ASP__IPA__EventType::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
single_value = other_value.enum_value;
}

ASP__IPA__EventType_template::ASP__IPA__EventType_template(const OPTIONAL<ASP__IPA__EventType>& other_value)
{
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (ASP__IPA__EventType::enum_type)(const ASP__IPA__EventType&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Creating a template of enumerated type @IPA_Emulation.ASP_IPA_EventType from an unbound optional field.");
}
}

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

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

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

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

boolean ASP__IPA__EventType_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
return TRUE;
}

boolean ASP__IPA__EventType_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value != ASP__IPA__EventType::UNBOUND_VALUE;
}

void ASP__IPA__EventType_template::clean_up()
{
switch (template_selection) {
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;
}

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

ASP__IPA__EventType_template& ASP__IPA__EventType_template::operator=(int other_value)
{
if (!ASP__IPA__EventType::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @IPA_Emulation.ASP_IPA_EventType.", other_value);
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = (ASP__IPA__EventType::enum_type)other_value;
return *this;
}

ASP__IPA__EventType_template& ASP__IPA__EventType_template::operator=(ASP__IPA__EventType::enum_type other_value)
{
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value;
return *this;
}

ASP__IPA__EventType_template& ASP__IPA__EventType_template::operator=(const ASP__IPA__EventType& other_value)
{
if (other_value.enum_value == ASP__IPA__EventType::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @IPA_Emulation.ASP_IPA_EventType to a template.");
clean_up();
set_selection(SPECIFIC_VALUE);
single_value = other_value.enum_value;
return *this;
}

ASP__IPA__EventType_template& ASP__IPA__EventType_template::operator=(const OPTIONAL<ASP__IPA__EventType>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
set_selection(SPECIFIC_VALUE);
single_value = (ASP__IPA__EventType::enum_type)(const ASP__IPA__EventType&)other_value;
break;
case OPTIONAL_OMIT:
set_selection(OMIT_VALUE);
break;
default:
TTCN_error("Assignment of an unbound optional field to a template of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
}
return *this;
}

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

boolean ASP__IPA__EventType_template::match(ASP__IPA__EventType::enum_type other_value, boolean) const
{
switch (template_selection) {
case SPECIFIC_VALUE:
return single_value == other_value;
case OMIT_VALUE:
return FALSE;
case ANY_VALUE:
case ANY_OR_OMIT:
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)) 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 enumerated type @IPA_Emulation.ASP_IPA_EventType.");
}
return FALSE;
}

boolean ASP__IPA__EventType_template::match(const ASP__IPA__EventType& other_value, boolean) const
{
if (other_value.enum_value == ASP__IPA__EventType::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @IPA_Emulation.ASP_IPA_EventType with an unbound value.");
return match(other_value.enum_value);
}

ASP__IPA__EventType::enum_type ASP__IPA__EventType_template::valueof() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
return single_value;
}

void ASP__IPA__EventType_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 type for a template of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new ASP__IPA__EventType_template[list_length];
}

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

void ASP__IPA__EventType_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_enum(ASP__IPA__EventType::enum_to_str(single_value), single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++) {
if (elem_count > 0) TTCN_Logger::log_event_str(", ");
value_list.list_value[elem_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 ASP__IPA__EventType_template::log_match(const ASP__IPA__EventType& match_value, boolean) const
{
match_value.log();
TTCN_Logger::log_event_str(" with ");
log();
if (match(match_value)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}

void ASP__IPA__EventType_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
text_buf.push_int(single_value);
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 elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].encode_text(text_buf);
break;
default:
TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
}
}

void ASP__IPA__EventType_template::decode_text(Text_Buf& text_buf)
{
clean_up();
decode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value = (ASP__IPA__EventType::enum_type)text_buf.pull_int().get_val();
if (!ASP__IPA__EventType::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @IPA_Emulation.ASP_IPA_EventType.", single_value);
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 ASP__IPA__EventType_template[value_list.n_values];
for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++)
value_list.list_value[elem_count].decode_text(text_buf);
break;
default:
TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @IPA_Emulation.ASP_IPA_EventType.");
}
}

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

boolean ASP__IPA__EventType_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 i=0; i<value_list.n_values; i++)
if (value_list.list_value[i].match_omit())
return template_selection==VALUE_LIST;
return template_selection==COMPLEMENTED_LIST;
} // else fall through
default:
return FALSE;
}
return FALSE;
}

void ASP__IPA__EventType_template::set_param(Module_Param& param)
{
  param.basic_check(Module_Param::BC_TEMPLATE, "enumerated template");
  Module_Param_Ptr m_p = &param;
  switch (m_p->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: {
    ASP__IPA__EventType_template new_temp;
    new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size());
    for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {
      new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));
    }
    *this = new_temp;
    break; }
  case Module_Param::MP_Enumerated: {
    ASP__IPA__EventType::enum_type enum_val = ASP__IPA__EventType::str_to_enum(m_p->get_enumerated());
    if (!ASP__IPA__EventType::is_valid_enum(enum_val)) {
      param.error("Invalid enumerated value for type @IPA_Emulation.ASP_IPA_EventType.");
    }
    *this = enum_val;
  } break;
  case Module_Param::MP_Implication_Template: {
    ASP__IPA__EventType_template* precondition = new ASP__IPA__EventType_template;
    precondition->set_param(*m_p->get_elem(0));
    ASP__IPA__EventType_template* implied_template = new ASP__IPA__EventType_template;
    implied_template->set_param(*m_p->get_elem(1));
    *this = ASP__IPA__EventType_template(precondition, implied_template);
  } break;
  default:
    param.type_error("enumerated template", "@IPA_Emulation.ASP_IPA_EventType");
  }
  is_ifpresent = param.get_ifpresent();
}

void ASP__IPA__EventType_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_VALUE:
if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return;
break;
case TR_OMIT:
if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return;
break;
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 : "@IPA_Emulation.ASP_IPA_EventType");
}

ASP__IPA__Event::ASP__IPA__Event()
{
}

ASP__IPA__Event::ASP__IPA__Event(const ASP__IPA__EventType& par_ev__type,
    const INTEGER& par_conn__id,
    const OPTIONAL< IPA__Types::IpaCcmIdResp >& par_id__resp)
  :   field_ev__type(par_ev__type),
  field_conn__id(par_conn__id),
  field_id__resp(par_id__resp)
{
}

ASP__IPA__Event::ASP__IPA__Event(const ASP__IPA__Event& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @IPA_Emulation.ASP_IPA_Event.");
if (other_value.ev__type().is_bound()) field_ev__type = other_value.ev__type();
else field_ev__type.clean_up();
if (other_value.conn__id().is_bound()) field_conn__id = other_value.conn__id();
else field_conn__id.clean_up();
if (other_value.id__resp().is_bound()) field_id__resp = other_value.id__resp();
else field_id__resp.clean_up();
}

void ASP__IPA__Event::clean_up()
{
field_ev__type.clean_up();
field_conn__id.clean_up();
field_id__resp.clean_up();
}

const TTCN_Typedescriptor_t* ASP__IPA__Event::get_descriptor() const { return &ASP__IPA__Event_descr_; }
ASP__IPA__Event& ASP__IPA__Event::operator=(const ASP__IPA__Event& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @IPA_Emulation.ASP_IPA_Event.");
  if (other_value.ev__type().is_bound()) field_ev__type = other_value.ev__type();
  else field_ev__type.clean_up();
  if (other_value.conn__id().is_bound()) field_conn__id = other_value.conn__id();
  else field_conn__id.clean_up();
  if (other_value.id__resp().is_bound()) field_id__resp = other_value.id__resp();
  else field_id__resp.clean_up();
}
return *this;
}

boolean ASP__IPA__Event::operator==(const ASP__IPA__Event& other_value) const
{
return field_ev__type==other_value.field_ev__type
  && field_conn__id==other_value.field_conn__id
  && field_id__resp==other_value.field_id__resp;
}

boolean ASP__IPA__Event::is_bound() const
{
return (field_ev__type.is_bound())
  || (field_conn__id.is_bound())
  || (OPTIONAL_OMIT == field_id__resp.get_selection() || field_id__resp.is_bound());
}
boolean ASP__IPA__Event::is_value() const
{
return field_ev__type.is_value()
  && field_conn__id.is_value()
  && (OPTIONAL_OMIT == field_id__resp.get_selection() || field_id__resp.is_value());
}
int ASP__IPA__Event::size_of() const
{
  int ret_val = 2;
  if (field_id__resp.ispresent()) ret_val++;
  return ret_val;
}

void ASP__IPA__Event::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ev_type := ");
field_ev__type.log();
TTCN_Logger::log_event_str(", conn_id := ");
field_conn__id.log();
TTCN_Logger::log_event_str(", id_resp := ");
field_id__resp.log();
TTCN_Logger::log_event_str(" }");
}

void ASP__IPA__Event::set_implicit_omit()
{
if (ev__type().is_bound()) ev__type().set_implicit_omit();
if (conn__id().is_bound()) conn__id().set_implicit_omit();
if (!id__resp().is_bound()) id__resp() = OMIT_VALUE;
else id__resp().set_implicit_omit();
}

void ASP__IPA__Event::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 (3<param.get_size()) {
      param.error("record value of type @IPA_Emulation.ASP_IPA_Event has 3 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) ev__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) conn__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) id__resp().set_param(*param.get_elem(2));
    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(), "ev_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ev__type().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(), "conn_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          conn__id().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(), "id_resp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          id__resp().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 @IPA_Emulation.ASP_IPA_Event: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@IPA_Emulation.ASP_IPA_Event");
  }
}

void ASP__IPA__Event::encode_text(Text_Buf& text_buf) const
{
field_ev__type.encode_text(text_buf);
field_conn__id.encode_text(text_buf);
field_id__resp.encode_text(text_buf);
}

void ASP__IPA__Event::decode_text(Text_Buf& text_buf)
{
field_ev__type.decode_text(text_buf);
field_conn__id.decode_text(text_buf);
field_id__resp.decode_text(text_buf);
}

struct ASP__IPA__Event_template::single_value_struct {
ASP__IPA__EventType_template field_ev__type;
INTEGER_template field_conn__id;
IPA__Types::IpaCcmIdResp_template field_id__resp;
};

void ASP__IPA__Event_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_ev__type = ANY_VALUE;
single_value->field_conn__id = ANY_VALUE;
single_value->field_id__resp = ANY_OR_OMIT;
}
}
}

void ASP__IPA__Event_template::copy_value(const ASP__IPA__Event& other_value)
{
single_value = new single_value_struct;
if (other_value.ev__type().is_bound()) {
  single_value->field_ev__type = other_value.ev__type();
} else {
  single_value->field_ev__type.clean_up();
}
if (other_value.conn__id().is_bound()) {
  single_value->field_conn__id = other_value.conn__id();
} else {
  single_value->field_conn__id.clean_up();
}
if (other_value.id__resp().is_bound()) {
  if (other_value.id__resp().ispresent()) single_value->field_id__resp = other_value.id__resp()();
  else single_value->field_id__resp = OMIT_VALUE;
} else {
  single_value->field_id__resp.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void ASP__IPA__Event_template::copy_template(const ASP__IPA__Event_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ev__type().get_selection()) {
single_value->field_ev__type = other_value.ev__type();
} else {
single_value->field_ev__type.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.conn__id().get_selection()) {
single_value->field_conn__id = other_value.conn__id();
} else {
single_value->field_conn__id.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.id__resp().get_selection()) {
single_value->field_id__resp = other_value.id__resp();
} else {
single_value->field_id__resp.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 ASP__IPA__Event_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 ASP__IPA__Event_template(*other_value.implication_.precondition);
implication_.implied_template = new ASP__IPA__Event_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 @IPA_Emulation.ASP_IPA_Event.");
break;
}
set_selection(other_value);
}

ASP__IPA__Event_template::ASP__IPA__Event_template()
{
}

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

ASP__IPA__Event_template::ASP__IPA__Event_template(const ASP__IPA__Event& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

ASP__IPA__Event_template& ASP__IPA__Event_template::operator=(const OPTIONAL<ASP__IPA__Event>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const ASP__IPA__Event&)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 @IPA_Emulation.ASP_IPA_Event.");
}
return *this;
}

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

boolean ASP__IPA__Event_template::match(const ASP__IPA__Event& 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.ev__type().is_bound()) return FALSE;
if(!single_value->field_ev__type.match(other_value.ev__type(), legacy))return FALSE;
if(!other_value.conn__id().is_bound()) return FALSE;
if(!single_value->field_conn__id.match(other_value.conn__id(), legacy))return FALSE;
if(!other_value.id__resp().is_bound()) return FALSE;
if((other_value.id__resp().ispresent() ? !single_value->field_id__resp.match((const IPA__Types::IpaCcmIdResp&)other_value.id__resp(), legacy) : !single_value->field_id__resp.match_omit(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 @IPA_Emulation.ASP_IPA_Event.");
}
return FALSE;
}

boolean ASP__IPA__Event_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return single_value->field_ev__type.is_bound()
 || single_value->field_conn__id.is_bound()
 || (single_value->field_id__resp.is_omit() || single_value->field_id__resp.is_bound());
}

boolean ASP__IPA__Event_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return single_value->field_ev__type.is_value()
 && single_value->field_conn__id.is_value()
 && (single_value->field_id__resp.is_omit() || single_value->field_id__resp.is_value());
}

void ASP__IPA__Event_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;
}

ASP__IPA__Event ASP__IPA__Event_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 @IPA_Emulation.ASP_IPA_Event.");
ASP__IPA__Event ret_val;
if (single_value->field_ev__type.is_bound()) {
ret_val.ev__type() = single_value->field_ev__type.valueof();
}
if (single_value->field_conn__id.is_bound()) {
ret_val.conn__id() = single_value->field_conn__id.valueof();
}
if (single_value->field_id__resp.is_omit()) ret_val.id__resp() = OMIT_VALUE;
else if (single_value->field_id__resp.is_bound()) {
ret_val.id__resp() = single_value->field_id__resp.valueof();
}
return ret_val;
}

void ASP__IPA__Event_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 @IPA_Emulation.ASP_IPA_Event.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new ASP__IPA__Event_template[list_length];
}

ASP__IPA__Event_template& ASP__IPA__Event_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 @IPA_Emulation.ASP_IPA_Event.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @IPA_Emulation.ASP_IPA_Event.");
return value_list.list_value[list_index];
}

ASP__IPA__EventType_template& ASP__IPA__Event_template::ev__type()
{
set_specific();
return single_value->field_ev__type;
}

const ASP__IPA__EventType_template& ASP__IPA__Event_template::ev__type() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ev_type of a non-specific template of type @IPA_Emulation.ASP_IPA_Event.");
return single_value->field_ev__type;
}

INTEGER_template& ASP__IPA__Event_template::conn__id()
{
set_specific();
return single_value->field_conn__id;
}

const INTEGER_template& ASP__IPA__Event_template::conn__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field conn_id of a non-specific template of type @IPA_Emulation.ASP_IPA_Event.");
return single_value->field_conn__id;
}

IPA__Types::IpaCcmIdResp_template& ASP__IPA__Event_template::id__resp()
{
set_specific();
return single_value->field_id__resp;
}

const IPA__Types::IpaCcmIdResp_template& ASP__IPA__Event_template::id__resp() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field id_resp of a non-specific template of type @IPA_Emulation.ASP_IPA_Event.");
return single_value->field_id__resp;
}

int ASP__IPA__Event_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Event which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 2;
      if (single_value->field_id__resp.is_present()) ret_val++;
      return ret_val;
    }
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Event 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 @IPA_Emulation.ASP_IPA_Event containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Event containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Event containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Event containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Event containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Event containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.ASP_IPA_Event containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @IPA_Emulation.ASP_IPA_Event.");
  }
  return 0;
}

void ASP__IPA__Event_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ev_type := ");
single_value->field_ev__type.log();
TTCN_Logger::log_event_str(", conn_id := ");
single_value->field_conn__id.log();
TTCN_Logger::log_event_str(", id_resp := ");
single_value->field_id__resp.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 ASP__IPA__Event_template::log_match(const ASP__IPA__Event& 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_ev__type.match(match_value.ev__type(), legacy)){
TTCN_Logger::log_logmatch_info(".ev_type");
single_value->field_ev__type.log_match(match_value.ev__type(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if(!single_value->field_conn__id.match(match_value.conn__id(), legacy)){
TTCN_Logger::log_logmatch_info(".conn_id");
single_value->field_conn__id.log_match(match_value.conn__id(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
if (match_value.id__resp().ispresent()){
if(!single_value->field_id__resp.match(match_value.id__resp(), legacy)){
TTCN_Logger::log_logmatch_info(".id_resp");
single_value->field_id__resp.log_match(match_value.id__resp(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_id__resp.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".id_resp := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_id__resp.log();
TTCN_Logger::log_event_str(" unmatched");
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("{ ev_type := ");
single_value->field_ev__type.log_match(match_value.ev__type(), legacy);
TTCN_Logger::log_event_str(", conn_id := ");
single_value->field_conn__id.log_match(match_value.conn__id(), legacy);
TTCN_Logger::log_event_str(", id_resp := ");
if (match_value.id__resp().ispresent()) {
single_value->field_id__resp.log_match(match_value.id__resp(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_id__resp.log();
if (single_value->field_id__resp.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
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 ASP__IPA__Event_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ev__type.encode_text(text_buf);
single_value->field_conn__id.encode_text(text_buf);
single_value->field_id__resp.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 @IPA_Emulation.ASP_IPA_Event.");
}
}

void ASP__IPA__Event_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_ev__type.decode_text(text_buf);
single_value->field_conn__id.decode_text(text_buf);
single_value->field_id__resp.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 ASP__IPA__Event_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 @IPA_Emulation.ASP_IPA_Event.");
}
}

void ASP__IPA__Event_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: {
    ASP__IPA__Event_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 (3<param.get_size()) {
      param.error("record template of type @IPA_Emulation.ASP_IPA_Event has 3 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) ev__type().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) conn__id().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) id__resp().set_param(*param.get_elem(2));
    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(), "ev_type")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ev__type().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(), "conn_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          conn__id().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(), "id_resp")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          id__resp().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 @IPA_Emulation.ASP_IPA_Event: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    ASP__IPA__Event_template* precondition = new ASP__IPA__Event_template;
    precondition->set_param(*param.get_elem(0));
    ASP__IPA__Event_template* implied_template = new ASP__IPA__Event_template;
    implied_template->set_param(*param.get_elem(1));
    *this = ASP__IPA__Event_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@IPA_Emulation.ASP_IPA_Event");
  }
  is_ifpresent = param.get_ifpresent();
}

void ASP__IPA__Event_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_ev__type.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.ASP_IPA_Event");
single_value->field_conn__id.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.ASP_IPA_Event");
single_value->field_id__resp.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.ASP_IPA_Event");
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 : "@IPA_Emulation.ASP_IPA_Event");
}

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

boolean ASP__IPA__Event_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 IPA__SP__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;
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 IPA__SP__PT::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}

IPA__SP__PT::IPA__SP__PT(const char *par_port_name)
 : PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}

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

void IPA__SP__PT::send(const ASP__IPA__Unitdata& 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(" @IPA_Emulation.ASP_IPA_Unitdata : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@IPA_Emulation.ASP_IPA_Unitdata");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void IPA__SP__PT::send(const ASP__IPA__Unitdata& send_par, FLOAT* timestamp_redirect)
{
send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void IPA__SP__PT::send(const ASP__IPA__Unitdata_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const ASP__IPA__Unitdata& send_par_value = ASP__IPA__Unitdata(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void IPA__SP__PT::send(const ASP__IPA__Unitdata_template& send_par, FLOAT* timestamp_redirect)
{
const ASP__IPA__Unitdata& send_par_value = ASP__IPA__Unitdata(send_par.valueof());
send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect);
}

void IPA__SP__PT::send(const ASP__IPA__Event& 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(" @IPA_Emulation.ASP_IPA_Event : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@IPA_Emulation.ASP_IPA_Event");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void IPA__SP__PT::send(const ASP__IPA__Event& send_par, FLOAT* timestamp_redirect)
{
send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void IPA__SP__PT::send(const ASP__IPA__Event_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const ASP__IPA__Event& send_par_value = ASP__IPA__Event(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void IPA__SP__PT::send(const ASP__IPA__Event_template& send_par, FLOAT* timestamp_redirect)
{
const ASP__IPA__Event& send_par_value = ASP__IPA__Event(send_par.valueof());
send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect);
}

alt_status IPA__SP__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(": @IPA_Emulation.ASP_IPA_Unitdata: "),
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(": @IPA_Emulation.ASP_IPA_Event: "),
my_head->message_1->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 IPA__SP__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(": @IPA_Emulation.ASP_IPA_Unitdata: "),
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(": @IPA_Emulation.ASP_IPA_Event: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}

alt_status IPA__SP__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(": @IPA_Emulation.ASP_IPA_Unitdata: "),
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(": @IPA_Emulation.ASP_IPA_Event: "),
my_head->message_1->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 IPA__SP__PT::receive(const ASP__IPA__Unitdata_template& value_template, ASP__IPA__Unitdata *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 @IPA_Emulation.ASP_IPA_Unitdata.", 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(": @IPA_Emulation.ASP_IPA_Unitdata : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status IPA__SP__PT::check_receive(const ASP__IPA__Unitdata_template& value_template, ASP__IPA__Unitdata *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 @IPA_Emulation.ASP_IPA_Unitdata.", 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(": @IPA_Emulation.ASP_IPA_Unitdata : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status IPA__SP__PT::trigger(const ASP__IPA__Unitdata_template& value_template, ASP__IPA__Unitdata *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 @IPA_Emulation.ASP_IPA_Unitdata.", 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(": @IPA_Emulation.ASP_IPA_Unitdata : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status IPA__SP__PT::receive(const ASP__IPA__Event_template& value_template, ASP__IPA__Event *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 @IPA_Emulation.ASP_IPA_Event.", 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(": @IPA_Emulation.ASP_IPA_Event : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status IPA__SP__PT::check_receive(const ASP__IPA__Event_template& value_template, ASP__IPA__Event *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 @IPA_Emulation.ASP_IPA_Event.", 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(": @IPA_Emulation.ASP_IPA_Event : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status IPA__SP__PT::trigger(const ASP__IPA__Event_template& value_template, ASP__IPA__Event *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 @IPA_Emulation.ASP_IPA_Event.", 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(": @IPA_Emulation.ASP_IPA_Event : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

void IPA__SP__PT::incoming_message(const ASP__IPA__Unitdata& 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(" @IPA_Emulation.ASP_IPA_Unitdata : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new ASP__IPA__Unitdata(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void IPA__SP__PT::incoming_message(const ASP__IPA__Event& 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(" @IPA_Emulation.ASP_IPA_Event : "), 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 ASP__IPA__Event(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

boolean IPA__SP__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@IPA_Emulation.ASP_IPA_Unitdata")) {
ASP__IPA__Unitdata incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@IPA_Emulation.ASP_IPA_Event")) {
ASP__IPA__Event incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}

void IPA__CTRL__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;
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 IPA__CTRL__PT::clear_queue()
{
while (msg_queue_head != NULL) remove_msg_queue_head();
}

IPA__CTRL__PT::IPA__CTRL__PT(const char *par_port_name)
 : PORT(par_port_name)
{
msg_queue_head = NULL;
msg_queue_tail = NULL;
}

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

void IPA__CTRL__PT::send(const Osmocom__CTRL__Types::CtrlMessage& 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(" @Osmocom_CTRL_Types.CtrlMessage : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@Osmocom_CTRL_Types.CtrlMessage");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void IPA__CTRL__PT::send(const Osmocom__CTRL__Types::CtrlMessage& send_par, FLOAT* timestamp_redirect)
{
send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void IPA__CTRL__PT::send(const Osmocom__CTRL__Types::CtrlMessage_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const Osmocom__CTRL__Types::CtrlMessage& send_par_value = Osmocom__CTRL__Types::CtrlMessage(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void IPA__CTRL__PT::send(const Osmocom__CTRL__Types::CtrlMessage_template& send_par, FLOAT* timestamp_redirect)
{
const Osmocom__CTRL__Types::CtrlMessage& send_par_value = Osmocom__CTRL__Types::CtrlMessage(send_par.valueof());
send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect);
}

void IPA__CTRL__PT::send(const ASP__IPA__Event& 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(" @IPA_Emulation.ASP_IPA_Event : "),
send_par.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Message cannot be sent to system on internal port %s.", port_name);
else {
Text_Buf text_buf;
prepare_message(text_buf, "@IPA_Emulation.ASP_IPA_Event");
send_par.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void IPA__CTRL__PT::send(const ASP__IPA__Event& send_par, FLOAT* timestamp_redirect)
{
send(send_par, COMPONENT(get_default_destination()), timestamp_redirect);
}

void IPA__CTRL__PT::send(const ASP__IPA__Event_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
const ASP__IPA__Event& send_par_value = ASP__IPA__Event(send_par.valueof());
send(send_par_value, destination_component, timestamp_redirect);
}

void IPA__CTRL__PT::send(const ASP__IPA__Event_template& send_par, FLOAT* timestamp_redirect)
{
const ASP__IPA__Event& send_par_value = ASP__IPA__Event(send_par.valueof());
send(send_par_value, COMPONENT(get_default_destination()), timestamp_redirect);
}

alt_status IPA__CTRL__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(": @Osmocom_CTRL_Types.CtrlMessage: "),
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(": @IPA_Emulation.ASP_IPA_Event: "),
my_head->message_1->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 IPA__CTRL__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(": @Osmocom_CTRL_Types.CtrlMessage: "),
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(": @IPA_Emulation.ASP_IPA_Event: "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1);
break;
default:
TTCN_error("Internal error: unknown message");
}
}
return ALT_YES;
}
}

alt_status IPA__CTRL__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(": @Osmocom_CTRL_Types.CtrlMessage: "),
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(": @IPA_Emulation.ASP_IPA_Event: "),
my_head->message_1->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 IPA__CTRL__PT::receive(const Osmocom__CTRL__Types::CtrlMessage_template& value_template, Osmocom__CTRL__Types::CtrlMessage *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 @Osmocom_CTRL_Types.CtrlMessage.", 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(": @Osmocom_CTRL_Types.CtrlMessage : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status IPA__CTRL__PT::check_receive(const Osmocom__CTRL__Types::CtrlMessage_template& value_template, Osmocom__CTRL__Types::CtrlMessage *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 @Osmocom_CTRL_Types.CtrlMessage.", 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(": @Osmocom_CTRL_Types.CtrlMessage : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status IPA__CTRL__PT::trigger(const Osmocom__CTRL__Types::CtrlMessage_template& value_template, Osmocom__CTRL__Types::CtrlMessage *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 @Osmocom_CTRL_Types.CtrlMessage.", 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(": @Osmocom_CTRL_Types.CtrlMessage : "),
my_head->message_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status IPA__CTRL__PT::receive(const ASP__IPA__Event_template& value_template, ASP__IPA__Event *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 @IPA_Emulation.ASP_IPA_Event.", 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(": @IPA_Emulation.ASP_IPA_Event : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

alt_status IPA__CTRL__PT::check_receive(const ASP__IPA__Event_template& value_template, ASP__IPA__Event *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 @IPA_Emulation.ASP_IPA_Event.", 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(": @IPA_Emulation.ASP_IPA_Event : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status IPA__CTRL__PT::trigger(const ASP__IPA__Event_template& value_template, ASP__IPA__Event *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 @IPA_Emulation.ASP_IPA_Event.", 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(": @IPA_Emulation.ASP_IPA_Event : "),
my_head->message_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_msg_queue_head();
return ALT_YES;
}
}

void IPA__CTRL__PT::incoming_message(const Osmocom__CTRL__Types::CtrlMessage& 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(" @Osmocom_CTRL_Types.CtrlMessage : "), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
msg_queue_item *new_item = new msg_queue_item;
new_item->item_selection = MESSAGE_0;
new_item->message_0 = new Osmocom__CTRL__Types::CtrlMessage(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

void IPA__CTRL__PT::incoming_message(const ASP__IPA__Event& 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(" @IPA_Emulation.ASP_IPA_Event : "), 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 ASP__IPA__Event(incoming_par);
new_item->sender_component = sender_component;
append_to_msg_queue(new_item);
}

boolean IPA__CTRL__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&)
{
if (!strcmp(message_type, "@Osmocom_CTRL_Types.CtrlMessage")) {
Osmocom__CTRL__Types::CtrlMessage incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(message_type, "@IPA_Emulation.ASP_IPA_Event")) {
ASP__IPA__Event incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_message(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}

IPA__CCM__Parameters::IPA__CCM__Parameters()
{
}

IPA__CCM__Parameters::IPA__CCM__Parameters(const OPTIONAL< CHARSTRING >& par_ser__nr,
    const OPTIONAL< CHARSTRING >& par_name,
    const OPTIONAL< CHARSTRING >& par_location1,
    const OPTIONAL< CHARSTRING >& par_location2,
    const OPTIONAL< CHARSTRING >& par_equip__version,
    const OPTIONAL< CHARSTRING >& par_sw__version,
    const OPTIONAL< CHARSTRING >& par_ip__addr,
    const OPTIONAL< CHARSTRING >& par_mac__addr,
    const OPTIONAL< CHARSTRING >& par_unit__id,
    const OPTIONAL< CHARSTRING >& par_osmo__rand)
  :   field_ser__nr(par_ser__nr),
  field_name(par_name),
  field_location1(par_location1),
  field_location2(par_location2),
  field_equip__version(par_equip__version),
  field_sw__version(par_sw__version),
  field_ip__addr(par_ip__addr),
  field_mac__addr(par_mac__addr),
  field_unit__id(par_unit__id),
  field_osmo__rand(par_osmo__rand)
{
}

IPA__CCM__Parameters::IPA__CCM__Parameters(const IPA__CCM__Parameters& other_value)
{
if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @IPA_Emulation.IPA_CCM_Parameters.");
if (other_value.ser__nr().is_bound()) field_ser__nr = other_value.ser__nr();
else field_ser__nr.clean_up();
if (other_value.name().is_bound()) field_name = other_value.name();
else field_name.clean_up();
if (other_value.location1().is_bound()) field_location1 = other_value.location1();
else field_location1.clean_up();
if (other_value.location2().is_bound()) field_location2 = other_value.location2();
else field_location2.clean_up();
if (other_value.equip__version().is_bound()) field_equip__version = other_value.equip__version();
else field_equip__version.clean_up();
if (other_value.sw__version().is_bound()) field_sw__version = other_value.sw__version();
else field_sw__version.clean_up();
if (other_value.ip__addr().is_bound()) field_ip__addr = other_value.ip__addr();
else field_ip__addr.clean_up();
if (other_value.mac__addr().is_bound()) field_mac__addr = other_value.mac__addr();
else field_mac__addr.clean_up();
if (other_value.unit__id().is_bound()) field_unit__id = other_value.unit__id();
else field_unit__id.clean_up();
if (other_value.osmo__rand().is_bound()) field_osmo__rand = other_value.osmo__rand();
else field_osmo__rand.clean_up();
}

void IPA__CCM__Parameters::clean_up()
{
field_ser__nr.clean_up();
field_name.clean_up();
field_location1.clean_up();
field_location2.clean_up();
field_equip__version.clean_up();
field_sw__version.clean_up();
field_ip__addr.clean_up();
field_mac__addr.clean_up();
field_unit__id.clean_up();
field_osmo__rand.clean_up();
}

const TTCN_Typedescriptor_t* IPA__CCM__Parameters::get_descriptor() const { return &IPA__CCM__Parameters_descr_; }
IPA__CCM__Parameters& IPA__CCM__Parameters::operator=(const IPA__CCM__Parameters& other_value)
{
if (this != &other_value) {
  if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @IPA_Emulation.IPA_CCM_Parameters.");
  if (other_value.ser__nr().is_bound()) field_ser__nr = other_value.ser__nr();
  else field_ser__nr.clean_up();
  if (other_value.name().is_bound()) field_name = other_value.name();
  else field_name.clean_up();
  if (other_value.location1().is_bound()) field_location1 = other_value.location1();
  else field_location1.clean_up();
  if (other_value.location2().is_bound()) field_location2 = other_value.location2();
  else field_location2.clean_up();
  if (other_value.equip__version().is_bound()) field_equip__version = other_value.equip__version();
  else field_equip__version.clean_up();
  if (other_value.sw__version().is_bound()) field_sw__version = other_value.sw__version();
  else field_sw__version.clean_up();
  if (other_value.ip__addr().is_bound()) field_ip__addr = other_value.ip__addr();
  else field_ip__addr.clean_up();
  if (other_value.mac__addr().is_bound()) field_mac__addr = other_value.mac__addr();
  else field_mac__addr.clean_up();
  if (other_value.unit__id().is_bound()) field_unit__id = other_value.unit__id();
  else field_unit__id.clean_up();
  if (other_value.osmo__rand().is_bound()) field_osmo__rand = other_value.osmo__rand();
  else field_osmo__rand.clean_up();
}
return *this;
}

boolean IPA__CCM__Parameters::operator==(const IPA__CCM__Parameters& other_value) const
{
return field_ser__nr==other_value.field_ser__nr
  && field_name==other_value.field_name
  && field_location1==other_value.field_location1
  && field_location2==other_value.field_location2
  && field_equip__version==other_value.field_equip__version
  && field_sw__version==other_value.field_sw__version
  && field_ip__addr==other_value.field_ip__addr
  && field_mac__addr==other_value.field_mac__addr
  && field_unit__id==other_value.field_unit__id
  && field_osmo__rand==other_value.field_osmo__rand;
}

boolean IPA__CCM__Parameters::is_bound() const
{
return (OPTIONAL_OMIT == field_ser__nr.get_selection() || field_ser__nr.is_bound())
  || (OPTIONAL_OMIT == field_name.get_selection() || field_name.is_bound())
  || (OPTIONAL_OMIT == field_location1.get_selection() || field_location1.is_bound())
  || (OPTIONAL_OMIT == field_location2.get_selection() || field_location2.is_bound())
  || (OPTIONAL_OMIT == field_equip__version.get_selection() || field_equip__version.is_bound())
  || (OPTIONAL_OMIT == field_sw__version.get_selection() || field_sw__version.is_bound())
  || (OPTIONAL_OMIT == field_ip__addr.get_selection() || field_ip__addr.is_bound())
  || (OPTIONAL_OMIT == field_mac__addr.get_selection() || field_mac__addr.is_bound())
  || (OPTIONAL_OMIT == field_unit__id.get_selection() || field_unit__id.is_bound())
  || (OPTIONAL_OMIT == field_osmo__rand.get_selection() || field_osmo__rand.is_bound());
}
boolean IPA__CCM__Parameters::is_value() const
{
return (OPTIONAL_OMIT == field_ser__nr.get_selection() || field_ser__nr.is_value())
  && (OPTIONAL_OMIT == field_name.get_selection() || field_name.is_value())
  && (OPTIONAL_OMIT == field_location1.get_selection() || field_location1.is_value())
  && (OPTIONAL_OMIT == field_location2.get_selection() || field_location2.is_value())
  && (OPTIONAL_OMIT == field_equip__version.get_selection() || field_equip__version.is_value())
  && (OPTIONAL_OMIT == field_sw__version.get_selection() || field_sw__version.is_value())
  && (OPTIONAL_OMIT == field_ip__addr.get_selection() || field_ip__addr.is_value())
  && (OPTIONAL_OMIT == field_mac__addr.get_selection() || field_mac__addr.is_value())
  && (OPTIONAL_OMIT == field_unit__id.get_selection() || field_unit__id.is_value())
  && (OPTIONAL_OMIT == field_osmo__rand.get_selection() || field_osmo__rand.is_value());
}
int IPA__CCM__Parameters::size_of() const
{
  int ret_val = 0;
  if (field_ser__nr.ispresent()) ret_val++;
  if (field_name.ispresent()) ret_val++;
  if (field_location1.ispresent()) ret_val++;
  if (field_location2.ispresent()) ret_val++;
  if (field_equip__version.ispresent()) ret_val++;
  if (field_sw__version.ispresent()) ret_val++;
  if (field_ip__addr.ispresent()) ret_val++;
  if (field_mac__addr.ispresent()) ret_val++;
  if (field_unit__id.ispresent()) ret_val++;
  if (field_osmo__rand.ispresent()) ret_val++;
  return ret_val;
}

void IPA__CCM__Parameters::log() const
{
if (!is_bound()) {
TTCN_Logger::log_event_unbound();
return;
}
TTCN_Logger::log_event_str("{ ser_nr := ");
field_ser__nr.log();
TTCN_Logger::log_event_str(", name := ");
field_name.log();
TTCN_Logger::log_event_str(", location1 := ");
field_location1.log();
TTCN_Logger::log_event_str(", location2 := ");
field_location2.log();
TTCN_Logger::log_event_str(", equip_version := ");
field_equip__version.log();
TTCN_Logger::log_event_str(", sw_version := ");
field_sw__version.log();
TTCN_Logger::log_event_str(", ip_addr := ");
field_ip__addr.log();
TTCN_Logger::log_event_str(", mac_addr := ");
field_mac__addr.log();
TTCN_Logger::log_event_str(", unit_id := ");
field_unit__id.log();
TTCN_Logger::log_event_str(", osmo_rand := ");
field_osmo__rand.log();
TTCN_Logger::log_event_str(" }");
}

void IPA__CCM__Parameters::set_implicit_omit()
{
if (!ser__nr().is_bound()) ser__nr() = OMIT_VALUE;
else ser__nr().set_implicit_omit();
if (!name().is_bound()) name() = OMIT_VALUE;
else name().set_implicit_omit();
if (!location1().is_bound()) location1() = OMIT_VALUE;
else location1().set_implicit_omit();
if (!location2().is_bound()) location2() = OMIT_VALUE;
else location2().set_implicit_omit();
if (!equip__version().is_bound()) equip__version() = OMIT_VALUE;
else equip__version().set_implicit_omit();
if (!sw__version().is_bound()) sw__version() = OMIT_VALUE;
else sw__version().set_implicit_omit();
if (!ip__addr().is_bound()) ip__addr() = OMIT_VALUE;
else ip__addr().set_implicit_omit();
if (!mac__addr().is_bound()) mac__addr() = OMIT_VALUE;
else mac__addr().set_implicit_omit();
if (!unit__id().is_bound()) unit__id() = OMIT_VALUE;
else unit__id().set_implicit_omit();
if (!osmo__rand().is_bound()) osmo__rand() = OMIT_VALUE;
else osmo__rand().set_implicit_omit();
}

void IPA__CCM__Parameters::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 (10<param.get_size()) {
      param.error("record value of type @IPA_Emulation.IPA_CCM_Parameters has 10 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) ser__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) name().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) location1().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) location2().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) equip__version().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) sw__version().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) ip__addr().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) mac__addr().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) unit__id().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) osmo__rand().set_param(*param.get_elem(9));
    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(), "ser_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ser__nr().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(), "name")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          name().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(), "location1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          location1().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(), "location2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          location2().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(), "equip_version")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          equip__version().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(), "sw_version")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sw__version().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(), "ip_addr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ip__addr().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(), "mac_addr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__addr().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(), "unit_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          unit__id().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(), "osmo_rand")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          osmo__rand().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 @IPA_Emulation.IPA_CCM_Parameters: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  default:
    param.type_error("record value", "@IPA_Emulation.IPA_CCM_Parameters");
  }
}

void IPA__CCM__Parameters::encode_text(Text_Buf& text_buf) const
{
field_ser__nr.encode_text(text_buf);
field_name.encode_text(text_buf);
field_location1.encode_text(text_buf);
field_location2.encode_text(text_buf);
field_equip__version.encode_text(text_buf);
field_sw__version.encode_text(text_buf);
field_ip__addr.encode_text(text_buf);
field_mac__addr.encode_text(text_buf);
field_unit__id.encode_text(text_buf);
field_osmo__rand.encode_text(text_buf);
}

void IPA__CCM__Parameters::decode_text(Text_Buf& text_buf)
{
field_ser__nr.decode_text(text_buf);
field_name.decode_text(text_buf);
field_location1.decode_text(text_buf);
field_location2.decode_text(text_buf);
field_equip__version.decode_text(text_buf);
field_sw__version.decode_text(text_buf);
field_ip__addr.decode_text(text_buf);
field_mac__addr.decode_text(text_buf);
field_unit__id.decode_text(text_buf);
field_osmo__rand.decode_text(text_buf);
}

struct IPA__CCM__Parameters_template::single_value_struct {
CHARSTRING_template field_ser__nr;
CHARSTRING_template field_name;
CHARSTRING_template field_location1;
CHARSTRING_template field_location2;
CHARSTRING_template field_equip__version;
CHARSTRING_template field_sw__version;
CHARSTRING_template field_ip__addr;
CHARSTRING_template field_mac__addr;
CHARSTRING_template field_unit__id;
CHARSTRING_template field_osmo__rand;
};

void IPA__CCM__Parameters_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_ser__nr = ANY_OR_OMIT;
single_value->field_name = ANY_OR_OMIT;
single_value->field_location1 = ANY_OR_OMIT;
single_value->field_location2 = ANY_OR_OMIT;
single_value->field_equip__version = ANY_OR_OMIT;
single_value->field_sw__version = ANY_OR_OMIT;
single_value->field_ip__addr = ANY_OR_OMIT;
single_value->field_mac__addr = ANY_OR_OMIT;
single_value->field_unit__id = ANY_OR_OMIT;
single_value->field_osmo__rand = ANY_OR_OMIT;
}
}
}

void IPA__CCM__Parameters_template::copy_value(const IPA__CCM__Parameters& other_value)
{
single_value = new single_value_struct;
if (other_value.ser__nr().is_bound()) {
  if (other_value.ser__nr().ispresent()) single_value->field_ser__nr = other_value.ser__nr()();
  else single_value->field_ser__nr = OMIT_VALUE;
} else {
  single_value->field_ser__nr.clean_up();
}
if (other_value.name().is_bound()) {
  if (other_value.name().ispresent()) single_value->field_name = other_value.name()();
  else single_value->field_name = OMIT_VALUE;
} else {
  single_value->field_name.clean_up();
}
if (other_value.location1().is_bound()) {
  if (other_value.location1().ispresent()) single_value->field_location1 = other_value.location1()();
  else single_value->field_location1 = OMIT_VALUE;
} else {
  single_value->field_location1.clean_up();
}
if (other_value.location2().is_bound()) {
  if (other_value.location2().ispresent()) single_value->field_location2 = other_value.location2()();
  else single_value->field_location2 = OMIT_VALUE;
} else {
  single_value->field_location2.clean_up();
}
if (other_value.equip__version().is_bound()) {
  if (other_value.equip__version().ispresent()) single_value->field_equip__version = other_value.equip__version()();
  else single_value->field_equip__version = OMIT_VALUE;
} else {
  single_value->field_equip__version.clean_up();
}
if (other_value.sw__version().is_bound()) {
  if (other_value.sw__version().ispresent()) single_value->field_sw__version = other_value.sw__version()();
  else single_value->field_sw__version = OMIT_VALUE;
} else {
  single_value->field_sw__version.clean_up();
}
if (other_value.ip__addr().is_bound()) {
  if (other_value.ip__addr().ispresent()) single_value->field_ip__addr = other_value.ip__addr()();
  else single_value->field_ip__addr = OMIT_VALUE;
} else {
  single_value->field_ip__addr.clean_up();
}
if (other_value.mac__addr().is_bound()) {
  if (other_value.mac__addr().ispresent()) single_value->field_mac__addr = other_value.mac__addr()();
  else single_value->field_mac__addr = OMIT_VALUE;
} else {
  single_value->field_mac__addr.clean_up();
}
if (other_value.unit__id().is_bound()) {
  if (other_value.unit__id().ispresent()) single_value->field_unit__id = other_value.unit__id()();
  else single_value->field_unit__id = OMIT_VALUE;
} else {
  single_value->field_unit__id.clean_up();
}
if (other_value.osmo__rand().is_bound()) {
  if (other_value.osmo__rand().ispresent()) single_value->field_osmo__rand = other_value.osmo__rand()();
  else single_value->field_osmo__rand = OMIT_VALUE;
} else {
  single_value->field_osmo__rand.clean_up();
}
set_selection(SPECIFIC_VALUE);
}

void IPA__CCM__Parameters_template::copy_template(const IPA__CCM__Parameters_template& other_value)
{
switch (other_value.template_selection) {
case SPECIFIC_VALUE:
single_value = new single_value_struct;
if (UNINITIALIZED_TEMPLATE != other_value.ser__nr().get_selection()) {
single_value->field_ser__nr = other_value.ser__nr();
} else {
single_value->field_ser__nr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.name().get_selection()) {
single_value->field_name = other_value.name();
} else {
single_value->field_name.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.location1().get_selection()) {
single_value->field_location1 = other_value.location1();
} else {
single_value->field_location1.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.location2().get_selection()) {
single_value->field_location2 = other_value.location2();
} else {
single_value->field_location2.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.equip__version().get_selection()) {
single_value->field_equip__version = other_value.equip__version();
} else {
single_value->field_equip__version.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.sw__version().get_selection()) {
single_value->field_sw__version = other_value.sw__version();
} else {
single_value->field_sw__version.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.ip__addr().get_selection()) {
single_value->field_ip__addr = other_value.ip__addr();
} else {
single_value->field_ip__addr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.mac__addr().get_selection()) {
single_value->field_mac__addr = other_value.mac__addr();
} else {
single_value->field_mac__addr.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.unit__id().get_selection()) {
single_value->field_unit__id = other_value.unit__id();
} else {
single_value->field_unit__id.clean_up();
}
if (UNINITIALIZED_TEMPLATE != other_value.osmo__rand().get_selection()) {
single_value->field_osmo__rand = other_value.osmo__rand();
} else {
single_value->field_osmo__rand.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 IPA__CCM__Parameters_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 IPA__CCM__Parameters_template(*other_value.implication_.precondition);
implication_.implied_template = new IPA__CCM__Parameters_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 @IPA_Emulation.IPA_CCM_Parameters.");
break;
}
set_selection(other_value);
}

IPA__CCM__Parameters_template::IPA__CCM__Parameters_template()
{
}

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

IPA__CCM__Parameters_template::IPA__CCM__Parameters_template(const IPA__CCM__Parameters& other_value)
{
copy_value(other_value);
}

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

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

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

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

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

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

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

IPA__CCM__Parameters_template& IPA__CCM__Parameters_template::operator=(const OPTIONAL<IPA__CCM__Parameters>& other_value)
{
clean_up();
switch (other_value.get_selection()) {
case OPTIONAL_PRESENT:
copy_value((const IPA__CCM__Parameters&)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 @IPA_Emulation.IPA_CCM_Parameters.");
}
return *this;
}

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

boolean IPA__CCM__Parameters_template::match(const IPA__CCM__Parameters& 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.ser__nr().is_bound()) return FALSE;
if((other_value.ser__nr().ispresent() ? !single_value->field_ser__nr.match((const CHARSTRING&)other_value.ser__nr(), legacy) : !single_value->field_ser__nr.match_omit(legacy)))return FALSE;
if(!other_value.name().is_bound()) return FALSE;
if((other_value.name().ispresent() ? !single_value->field_name.match((const CHARSTRING&)other_value.name(), legacy) : !single_value->field_name.match_omit(legacy)))return FALSE;
if(!other_value.location1().is_bound()) return FALSE;
if((other_value.location1().ispresent() ? !single_value->field_location1.match((const CHARSTRING&)other_value.location1(), legacy) : !single_value->field_location1.match_omit(legacy)))return FALSE;
if(!other_value.location2().is_bound()) return FALSE;
if((other_value.location2().ispresent() ? !single_value->field_location2.match((const CHARSTRING&)other_value.location2(), legacy) : !single_value->field_location2.match_omit(legacy)))return FALSE;
if(!other_value.equip__version().is_bound()) return FALSE;
if((other_value.equip__version().ispresent() ? !single_value->field_equip__version.match((const CHARSTRING&)other_value.equip__version(), legacy) : !single_value->field_equip__version.match_omit(legacy)))return FALSE;
if(!other_value.sw__version().is_bound()) return FALSE;
if((other_value.sw__version().ispresent() ? !single_value->field_sw__version.match((const CHARSTRING&)other_value.sw__version(), legacy) : !single_value->field_sw__version.match_omit(legacy)))return FALSE;
if(!other_value.ip__addr().is_bound()) return FALSE;
if((other_value.ip__addr().ispresent() ? !single_value->field_ip__addr.match((const CHARSTRING&)other_value.ip__addr(), legacy) : !single_value->field_ip__addr.match_omit(legacy)))return FALSE;
if(!other_value.mac__addr().is_bound()) return FALSE;
if((other_value.mac__addr().ispresent() ? !single_value->field_mac__addr.match((const CHARSTRING&)other_value.mac__addr(), legacy) : !single_value->field_mac__addr.match_omit(legacy)))return FALSE;
if(!other_value.unit__id().is_bound()) return FALSE;
if((other_value.unit__id().ispresent() ? !single_value->field_unit__id.match((const CHARSTRING&)other_value.unit__id(), legacy) : !single_value->field_unit__id.match_omit(legacy)))return FALSE;
if(!other_value.osmo__rand().is_bound()) return FALSE;
if((other_value.osmo__rand().ispresent() ? !single_value->field_osmo__rand.match((const CHARSTRING&)other_value.osmo__rand(), legacy) : !single_value->field_osmo__rand.match_omit(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 @IPA_Emulation.IPA_CCM_Parameters.");
}
return FALSE;
}

boolean IPA__CCM__Parameters_template::is_bound() const
{
if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE;
if (template_selection != SPECIFIC_VALUE) return TRUE;
return (single_value->field_ser__nr.is_omit() || single_value->field_ser__nr.is_bound())
 || (single_value->field_name.is_omit() || single_value->field_name.is_bound())
 || (single_value->field_location1.is_omit() || single_value->field_location1.is_bound())
 || (single_value->field_location2.is_omit() || single_value->field_location2.is_bound())
 || (single_value->field_equip__version.is_omit() || single_value->field_equip__version.is_bound())
 || (single_value->field_sw__version.is_omit() || single_value->field_sw__version.is_bound())
 || (single_value->field_ip__addr.is_omit() || single_value->field_ip__addr.is_bound())
 || (single_value->field_mac__addr.is_omit() || single_value->field_mac__addr.is_bound())
 || (single_value->field_unit__id.is_omit() || single_value->field_unit__id.is_bound())
 || (single_value->field_osmo__rand.is_omit() || single_value->field_osmo__rand.is_bound());
}

boolean IPA__CCM__Parameters_template::is_value() const
{
if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE;
return (single_value->field_ser__nr.is_omit() || single_value->field_ser__nr.is_value())
 && (single_value->field_name.is_omit() || single_value->field_name.is_value())
 && (single_value->field_location1.is_omit() || single_value->field_location1.is_value())
 && (single_value->field_location2.is_omit() || single_value->field_location2.is_value())
 && (single_value->field_equip__version.is_omit() || single_value->field_equip__version.is_value())
 && (single_value->field_sw__version.is_omit() || single_value->field_sw__version.is_value())
 && (single_value->field_ip__addr.is_omit() || single_value->field_ip__addr.is_value())
 && (single_value->field_mac__addr.is_omit() || single_value->field_mac__addr.is_value())
 && (single_value->field_unit__id.is_omit() || single_value->field_unit__id.is_value())
 && (single_value->field_osmo__rand.is_omit() || single_value->field_osmo__rand.is_value());
}

void IPA__CCM__Parameters_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;
}

IPA__CCM__Parameters IPA__CCM__Parameters_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 @IPA_Emulation.IPA_CCM_Parameters.");
IPA__CCM__Parameters ret_val;
if (single_value->field_ser__nr.is_omit()) ret_val.ser__nr() = OMIT_VALUE;
else if (single_value->field_ser__nr.is_bound()) {
ret_val.ser__nr() = single_value->field_ser__nr.valueof();
}
if (single_value->field_name.is_omit()) ret_val.name() = OMIT_VALUE;
else if (single_value->field_name.is_bound()) {
ret_val.name() = single_value->field_name.valueof();
}
if (single_value->field_location1.is_omit()) ret_val.location1() = OMIT_VALUE;
else if (single_value->field_location1.is_bound()) {
ret_val.location1() = single_value->field_location1.valueof();
}
if (single_value->field_location2.is_omit()) ret_val.location2() = OMIT_VALUE;
else if (single_value->field_location2.is_bound()) {
ret_val.location2() = single_value->field_location2.valueof();
}
if (single_value->field_equip__version.is_omit()) ret_val.equip__version() = OMIT_VALUE;
else if (single_value->field_equip__version.is_bound()) {
ret_val.equip__version() = single_value->field_equip__version.valueof();
}
if (single_value->field_sw__version.is_omit()) ret_val.sw__version() = OMIT_VALUE;
else if (single_value->field_sw__version.is_bound()) {
ret_val.sw__version() = single_value->field_sw__version.valueof();
}
if (single_value->field_ip__addr.is_omit()) ret_val.ip__addr() = OMIT_VALUE;
else if (single_value->field_ip__addr.is_bound()) {
ret_val.ip__addr() = single_value->field_ip__addr.valueof();
}
if (single_value->field_mac__addr.is_omit()) ret_val.mac__addr() = OMIT_VALUE;
else if (single_value->field_mac__addr.is_bound()) {
ret_val.mac__addr() = single_value->field_mac__addr.valueof();
}
if (single_value->field_unit__id.is_omit()) ret_val.unit__id() = OMIT_VALUE;
else if (single_value->field_unit__id.is_bound()) {
ret_val.unit__id() = single_value->field_unit__id.valueof();
}
if (single_value->field_osmo__rand.is_omit()) ret_val.osmo__rand() = OMIT_VALUE;
else if (single_value->field_osmo__rand.is_bound()) {
ret_val.osmo__rand() = single_value->field_osmo__rand.valueof();
}
return ret_val;
}

void IPA__CCM__Parameters_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 @IPA_Emulation.IPA_CCM_Parameters.");
clean_up();
set_selection(template_type);
value_list.n_values = list_length;
value_list.list_value = new IPA__CCM__Parameters_template[list_length];
}

IPA__CCM__Parameters_template& IPA__CCM__Parameters_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 @IPA_Emulation.IPA_CCM_Parameters.");
if (list_index >= value_list.n_values)
TTCN_error("Index overflow in a value list template of type @IPA_Emulation.IPA_CCM_Parameters.");
return value_list.list_value[list_index];
}

CHARSTRING_template& IPA__CCM__Parameters_template::ser__nr()
{
set_specific();
return single_value->field_ser__nr;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::ser__nr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ser_nr of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_ser__nr;
}

CHARSTRING_template& IPA__CCM__Parameters_template::name()
{
set_specific();
return single_value->field_name;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::name() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field name of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_name;
}

CHARSTRING_template& IPA__CCM__Parameters_template::location1()
{
set_specific();
return single_value->field_location1;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::location1() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field location1 of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_location1;
}

CHARSTRING_template& IPA__CCM__Parameters_template::location2()
{
set_specific();
return single_value->field_location2;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::location2() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field location2 of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_location2;
}

CHARSTRING_template& IPA__CCM__Parameters_template::equip__version()
{
set_specific();
return single_value->field_equip__version;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::equip__version() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field equip_version of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_equip__version;
}

CHARSTRING_template& IPA__CCM__Parameters_template::sw__version()
{
set_specific();
return single_value->field_sw__version;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::sw__version() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field sw_version of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_sw__version;
}

CHARSTRING_template& IPA__CCM__Parameters_template::ip__addr()
{
set_specific();
return single_value->field_ip__addr;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::ip__addr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field ip_addr of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_ip__addr;
}

CHARSTRING_template& IPA__CCM__Parameters_template::mac__addr()
{
set_specific();
return single_value->field_mac__addr;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::mac__addr() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field mac_addr of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_mac__addr;
}

CHARSTRING_template& IPA__CCM__Parameters_template::unit__id()
{
set_specific();
return single_value->field_unit__id;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::unit__id() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field unit_id of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_unit__id;
}

CHARSTRING_template& IPA__CCM__Parameters_template::osmo__rand()
{
set_specific();
return single_value->field_osmo__rand;
}

const CHARSTRING_template& IPA__CCM__Parameters_template::osmo__rand() const
{
if (template_selection != SPECIFIC_VALUE)
TTCN_error("Accessing field osmo_rand of a non-specific template of type @IPA_Emulation.IPA_CCM_Parameters.");
return single_value->field_osmo__rand;
}

int IPA__CCM__Parameters_template::size_of() const
{
  if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.IPA_CCM_Parameters which has an ifpresent attribute.");
  switch (template_selection)
  {
  case SPECIFIC_VALUE:
  {    int ret_val = 0;
      if (single_value->field_ser__nr.is_present()) ret_val++;
      if (single_value->field_name.is_present()) ret_val++;
      if (single_value->field_location1.is_present()) ret_val++;
      if (single_value->field_location2.is_present()) ret_val++;
      if (single_value->field_equip__version.is_present()) ret_val++;
      if (single_value->field_sw__version.is_present()) ret_val++;
      if (single_value->field_ip__addr.is_present()) ret_val++;
      if (single_value->field_mac__addr.is_present()) ret_val++;
      if (single_value->field_unit__id.is_present()) ret_val++;
      if (single_value->field_osmo__rand.is_present()) ret_val++;
      return ret_val;
    }
  case VALUE_LIST:
   {
     if (value_list.n_values<1)
       TTCN_error("Internal error: Performing sizeof() operation on a template of type @IPA_Emulation.IPA_CCM_Parameters 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 @IPA_Emulation.IPA_CCM_Parameters containing a value list with different sizes.");
      }
      return item_size;
    }
  case OMIT_VALUE:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.IPA_CCM_Parameters containing omit value.");
  case ANY_VALUE:
  case ANY_OR_OMIT:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.IPA_CCM_Parameters containing */? value.");
  case COMPLEMENTED_LIST:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.IPA_CCM_Parameters containing complemented list.");
  case CONJUNCTION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.IPA_CCM_Parameters containing a conjunction list match.");
  case IMPLICATION_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.IPA_CCM_Parameters containing an implication match.");
  case DYNAMIC_MATCH:
    TTCN_error("Performing sizeof() operation on a template of type @IPA_Emulation.IPA_CCM_Parameters containing a dynamic match.");
  default:
    TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @IPA_Emulation.IPA_CCM_Parameters.");
  }
  return 0;
}

void IPA__CCM__Parameters_template::log() const
{
switch (template_selection) {
case SPECIFIC_VALUE:
TTCN_Logger::log_event_str("{ ser_nr := ");
single_value->field_ser__nr.log();
TTCN_Logger::log_event_str(", name := ");
single_value->field_name.log();
TTCN_Logger::log_event_str(", location1 := ");
single_value->field_location1.log();
TTCN_Logger::log_event_str(", location2 := ");
single_value->field_location2.log();
TTCN_Logger::log_event_str(", equip_version := ");
single_value->field_equip__version.log();
TTCN_Logger::log_event_str(", sw_version := ");
single_value->field_sw__version.log();
TTCN_Logger::log_event_str(", ip_addr := ");
single_value->field_ip__addr.log();
TTCN_Logger::log_event_str(", mac_addr := ");
single_value->field_mac__addr.log();
TTCN_Logger::log_event_str(", unit_id := ");
single_value->field_unit__id.log();
TTCN_Logger::log_event_str(", osmo_rand := ");
single_value->field_osmo__rand.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 IPA__CCM__Parameters_template::log_match(const IPA__CCM__Parameters& 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 (match_value.ser__nr().ispresent()){
if(!single_value->field_ser__nr.match(match_value.ser__nr(), legacy)){
TTCN_Logger::log_logmatch_info(".ser_nr");
single_value->field_ser__nr.log_match(match_value.ser__nr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ser__nr.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ser_nr := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ser__nr.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.name().ispresent()){
if(!single_value->field_name.match(match_value.name(), legacy)){
TTCN_Logger::log_logmatch_info(".name");
single_value->field_name.log_match(match_value.name(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_name.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".name := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_name.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.location1().ispresent()){
if(!single_value->field_location1.match(match_value.location1(), legacy)){
TTCN_Logger::log_logmatch_info(".location1");
single_value->field_location1.log_match(match_value.location1(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_location1.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".location1 := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_location1.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.location2().ispresent()){
if(!single_value->field_location2.match(match_value.location2(), legacy)){
TTCN_Logger::log_logmatch_info(".location2");
single_value->field_location2.log_match(match_value.location2(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_location2.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".location2 := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_location2.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.equip__version().ispresent()){
if(!single_value->field_equip__version.match(match_value.equip__version(), legacy)){
TTCN_Logger::log_logmatch_info(".equip_version");
single_value->field_equip__version.log_match(match_value.equip__version(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_equip__version.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".equip_version := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_equip__version.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.sw__version().ispresent()){
if(!single_value->field_sw__version.match(match_value.sw__version(), legacy)){
TTCN_Logger::log_logmatch_info(".sw_version");
single_value->field_sw__version.log_match(match_value.sw__version(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_sw__version.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".sw_version := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_sw__version.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.ip__addr().ispresent()){
if(!single_value->field_ip__addr.match(match_value.ip__addr(), legacy)){
TTCN_Logger::log_logmatch_info(".ip_addr");
single_value->field_ip__addr.log_match(match_value.ip__addr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_ip__addr.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".ip_addr := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_ip__addr.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.mac__addr().ispresent()){
if(!single_value->field_mac__addr.match(match_value.mac__addr(), legacy)){
TTCN_Logger::log_logmatch_info(".mac_addr");
single_value->field_mac__addr.log_match(match_value.mac__addr(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_mac__addr.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".mac_addr := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_mac__addr.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.unit__id().ispresent()){
if(!single_value->field_unit__id.match(match_value.unit__id(), legacy)){
TTCN_Logger::log_logmatch_info(".unit_id");
single_value->field_unit__id.log_match(match_value.unit__id(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_unit__id.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".unit_id := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_unit__id.log();
TTCN_Logger::log_event_str(" unmatched");
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
}
if (match_value.osmo__rand().ispresent()){
if(!single_value->field_osmo__rand.match(match_value.osmo__rand(), legacy)){
TTCN_Logger::log_logmatch_info(".osmo_rand");
single_value->field_osmo__rand.log_match(match_value.osmo__rand(), legacy);
TTCN_Logger::set_logmatch_buffer_len(previous_size);
}
} else {
if (!single_value->field_osmo__rand.match_omit(legacy)){
 TTCN_Logger::log_logmatch_info(".osmo_rand := omit with ");
TTCN_Logger::print_logmatch_buffer();
single_value->field_osmo__rand.log();
TTCN_Logger::log_event_str(" unmatched");
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("{ ser_nr := ");
if (match_value.ser__nr().ispresent()) {
single_value->field_ser__nr.log_match(match_value.ser__nr(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ser__nr.log();
if (single_value->field_ser__nr.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", name := ");
if (match_value.name().ispresent()) {
single_value->field_name.log_match(match_value.name(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_name.log();
if (single_value->field_name.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", location1 := ");
if (match_value.location1().ispresent()) {
single_value->field_location1.log_match(match_value.location1(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_location1.log();
if (single_value->field_location1.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", location2 := ");
if (match_value.location2().ispresent()) {
single_value->field_location2.log_match(match_value.location2(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_location2.log();
if (single_value->field_location2.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", equip_version := ");
if (match_value.equip__version().ispresent()) {
single_value->field_equip__version.log_match(match_value.equip__version(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_equip__version.log();
if (single_value->field_equip__version.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", sw_version := ");
if (match_value.sw__version().ispresent()) {
single_value->field_sw__version.log_match(match_value.sw__version(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_sw__version.log();
if (single_value->field_sw__version.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", ip_addr := ");
if (match_value.ip__addr().ispresent()) {
single_value->field_ip__addr.log_match(match_value.ip__addr(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_ip__addr.log();
if (single_value->field_ip__addr.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", mac_addr := ");
if (match_value.mac__addr().ispresent()) {
single_value->field_mac__addr.log_match(match_value.mac__addr(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_mac__addr.log();
if (single_value->field_mac__addr.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", unit_id := ");
if (match_value.unit__id().ispresent()) {
single_value->field_unit__id.log_match(match_value.unit__id(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_unit__id.log();
if (single_value->field_unit__id.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
TTCN_Logger::log_event_str(", osmo_rand := ");
if (match_value.osmo__rand().ispresent()) {
single_value->field_osmo__rand.log_match(match_value.osmo__rand(), legacy);
} else {
TTCN_Logger::log_event_str("omit with ");
single_value->field_osmo__rand.log();
if (single_value->field_osmo__rand.match_omit(legacy)) TTCN_Logger::log_event_str(" matched");
else TTCN_Logger::log_event_str(" unmatched");
}
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 IPA__CCM__Parameters_template::encode_text(Text_Buf& text_buf) const
{
encode_text_base(text_buf);
switch (template_selection) {
case SPECIFIC_VALUE:
single_value->field_ser__nr.encode_text(text_buf);
single_value->field_name.encode_text(text_buf);
single_value->field_location1.encode_text(text_buf);
single_value->field_location2.encode_text(text_buf);
single_value->field_equip__version.encode_text(text_buf);
single_value->field_sw__version.encode_text(text_buf);
single_value->field_ip__addr.encode_text(text_buf);
single_value->field_mac__addr.encode_text(text_buf);
single_value->field_unit__id.encode_text(text_buf);
single_value->field_osmo__rand.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 @IPA_Emulation.IPA_CCM_Parameters.");
}
}

void IPA__CCM__Parameters_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_ser__nr.decode_text(text_buf);
single_value->field_name.decode_text(text_buf);
single_value->field_location1.decode_text(text_buf);
single_value->field_location2.decode_text(text_buf);
single_value->field_equip__version.decode_text(text_buf);
single_value->field_sw__version.decode_text(text_buf);
single_value->field_ip__addr.decode_text(text_buf);
single_value->field_mac__addr.decode_text(text_buf);
single_value->field_unit__id.decode_text(text_buf);
single_value->field_osmo__rand.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 IPA__CCM__Parameters_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 @IPA_Emulation.IPA_CCM_Parameters.");
}
}

void IPA__CCM__Parameters_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: {
    IPA__CCM__Parameters_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 (10<param.get_size()) {
      param.error("record template of type @IPA_Emulation.IPA_CCM_Parameters has 10 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) ser__nr().set_param(*param.get_elem(0));
    if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) name().set_param(*param.get_elem(1));
    if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) location1().set_param(*param.get_elem(2));
    if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) location2().set_param(*param.get_elem(3));
    if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) equip__version().set_param(*param.get_elem(4));
    if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) sw__version().set_param(*param.get_elem(5));
    if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) ip__addr().set_param(*param.get_elem(6));
    if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) mac__addr().set_param(*param.get_elem(7));
    if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) unit__id().set_param(*param.get_elem(8));
    if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) osmo__rand().set_param(*param.get_elem(9));
    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(), "ser_nr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ser__nr().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(), "name")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          name().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(), "location1")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          location1().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(), "location2")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          location2().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(), "equip_version")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          equip__version().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(), "sw_version")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          sw__version().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(), "ip_addr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          ip__addr().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(), "mac_addr")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          mac__addr().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(), "unit_id")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          unit__id().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(), "osmo_rand")) {
        if (curr_param->get_type()!=Module_Param::MP_NotUsed) {
          osmo__rand().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 @IPA_Emulation.IPA_CCM_Parameters: %s", curr_param->get_id()->get_name());
      break;
    }
  } break;
  case Module_Param::MP_Implication_Template: {
    IPA__CCM__Parameters_template* precondition = new IPA__CCM__Parameters_template;
    precondition->set_param(*param.get_elem(0));
    IPA__CCM__Parameters_template* implied_template = new IPA__CCM__Parameters_template;
    implied_template->set_param(*param.get_elem(1));
    *this = IPA__CCM__Parameters_template(precondition, implied_template);
  } break;
  default:
    param.type_error("record template", "@IPA_Emulation.IPA_CCM_Parameters");
  }
  is_ifpresent = param.get_ifpresent();
}

void IPA__CCM__Parameters_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_ser__nr.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
single_value->field_name.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
single_value->field_location1.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
single_value->field_location2.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
single_value->field_equip__version.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
single_value->field_sw__version.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
single_value->field_ip__addr.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
single_value->field_mac__addr.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
single_value->field_unit__id.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
single_value->field_osmo__rand.check_restriction(t_res, t_name ? t_name : "@IPA_Emulation.IPA_CCM_Parameters");
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 : "@IPA_Emulation.IPA_CCM_Parameters");
}

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

boolean IPA__CCM__Parameters_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 IPA__CFG__disconnect_call::encode_text(Text_Buf& text_buf) const
{
param_res.encode_text(text_buf);
}

void IPA__CFG__disconnect_call::decode_text(Text_Buf& text_buf)
{
param_res.decode_text(text_buf);
}

void IPA__CFG__disconnect_call::log() const
{
TTCN_Logger::log_event_str("@IPA_Emulation.IPA_CFG_disconnect : { ");
TTCN_Logger::log_event_str("res := ");
param_res.log();
TTCN_Logger::log_event_str(" }");
}

void IPA__CFG__disconnect_call_redirect::set_parameters(const IPA__CFG__disconnect_call& call_par) const
{
if (ptr_res != NULL) *ptr_res = call_par.res();
}

void IPA__CFG__disconnect_reply::encode_text(Text_Buf& text_buf) const
{
param_res.encode_text(text_buf);
}

void IPA__CFG__disconnect_reply::decode_text(Text_Buf& text_buf)
{
param_res.decode_text(text_buf);
}

void IPA__CFG__disconnect_reply::log() const
{
TTCN_Logger::log_event_str("@IPA_Emulation.IPA_CFG_disconnect : { ");
TTCN_Logger::log_event_str("res := ");
param_res.log();
TTCN_Logger::log_event_str(" }");
}

void IPA__CFG__disconnect_reply_redirect::set_parameters(const IPA__CFG__disconnect_reply& reply_par) const
{
if (ptr_res != NULL) *ptr_res = reply_par.res();
}

IPA__CFG__disconnect_template::IPA__CFG__disconnect_template()
 : param_res(ANY_VALUE)
{
}

IPA__CFG__disconnect_call IPA__CFG__disconnect_template::create_call() const
{
IPA__CFG__disconnect_call ret_val;
ret_val.res() = param_res.valueof();
return ret_val;
}

IPA__CFG__disconnect_reply IPA__CFG__disconnect_template::create_reply() const
{
IPA__CFG__disconnect_reply ret_val;
ret_val.res() = param_res.valueof();
return ret_val;
}

boolean IPA__CFG__disconnect_template::match_call(const IPA__CFG__disconnect_call& match_value, boolean legacy) const
{
return param_res.match(match_value.res(), legacy);
}

boolean IPA__CFG__disconnect_template::match_reply(const IPA__CFG__disconnect_reply& match_value, boolean legacy) const
{
return param_res.match(match_value.res(), legacy);
}

void IPA__CFG__disconnect_template::log() const
{
TTCN_Logger::log_event_str("{ res := ");
param_res.log();
TTCN_Logger::log_event_str(" }");
}

void IPA__CFG__disconnect_template::log_match_call(const IPA__CFG__disconnect_call& match_value, boolean legacy) const
{
TTCN_Logger::log_event_str("{ res := ");
param_res.log_match(match_value.res(), legacy);
TTCN_Logger::log_event_str(" }");
}

void IPA__CFG__disconnect_template::log_match_reply(const IPA__CFG__disconnect_reply& match_value, boolean legacy) const
{
TTCN_Logger::log_event_str("{ res := ");
param_res.log_match(match_value.res(), legacy);
TTCN_Logger::log_event_str(" }");
}

void IPA__CFG__disconnect_template::encode_text(Text_Buf& text_buf) const
{
param_res.encode_text(text_buf);
}

void IPA__CFG__disconnect_template::decode_text(Text_Buf& text_buf)
{
param_res.decode_text(text_buf);
}

void IPA__CFG__chg__ccm__enabled_call::encode_text(Text_Buf& text_buf) const
{
param_res.encode_text(text_buf);
}

void IPA__CFG__chg__ccm__enabled_call::decode_text(Text_Buf& text_buf)
{
param_res.decode_text(text_buf);
}

void IPA__CFG__chg__ccm__enabled_call::log() const
{
TTCN_Logger::log_event_str("@IPA_Emulation.IPA_CFG_chg_ccm_enabled : { ");
TTCN_Logger::log_event_str("res := ");
param_res.log();
TTCN_Logger::log_event_str(" }");
}

void IPA__CFG__chg__ccm__enabled_call_redirect::set_parameters(const IPA__CFG__chg__ccm__enabled_call& call_par) const
{
if (ptr_res != NULL) *ptr_res = call_par.res();
}

void IPA__CFG__chg__ccm__enabled_reply::log() const
{
TTCN_Logger::log_event_str("@IPA_Emulation.IPA_CFG_chg_ccm_enabled : { }");
}

IPA__CFG__chg__ccm__enabled_template::IPA__CFG__chg__ccm__enabled_template()
 : param_res(ANY_VALUE)
{
}

IPA__CFG__chg__ccm__enabled_call IPA__CFG__chg__ccm__enabled_template::create_call() const
{
IPA__CFG__chg__ccm__enabled_call ret_val;
ret_val.res() = param_res.valueof();
return ret_val;
}

boolean IPA__CFG__chg__ccm__enabled_template::match_call(const IPA__CFG__chg__ccm__enabled_call& match_value, boolean legacy) const
{
return param_res.match(match_value.res(), legacy);
}

void IPA__CFG__chg__ccm__enabled_template::log() const
{
TTCN_Logger::log_event_str("{ res := ");
param_res.log();
TTCN_Logger::log_event_str(" }");
}

void IPA__CFG__chg__ccm__enabled_template::log_match_call(const IPA__CFG__chg__ccm__enabled_call& match_value, boolean legacy) const
{
TTCN_Logger::log_event_str("{ res := ");
param_res.log_match(match_value.res(), legacy);
TTCN_Logger::log_event_str(" }");
}

void IPA__CFG__chg__ccm__enabled_template::log_match_reply(const IPA__CFG__chg__ccm__enabled_reply& , boolean) const
{
TTCN_Logger::log_event_str("{ } with { } matched");
}

void IPA__CFG__chg__ccm__enabled_template::encode_text(Text_Buf& text_buf) const
{
param_res.encode_text(text_buf);
}

void IPA__CFG__chg__ccm__enabled_template::decode_text(Text_Buf& text_buf)
{
param_res.decode_text(text_buf);
}

void IPA__CFG__PT::append_to_proc_queue(proc_queue_item *new_item)
{
new_item->next_item = NULL;
if (proc_queue_tail != NULL) proc_queue_tail->next_item = new_item;
else proc_queue_head = new_item;
proc_queue_tail = new_item;
}

void IPA__CFG__PT::remove_proc_queue_head()
{
switch (proc_queue_head->item_selection) {
case CALL_0:
delete proc_queue_head->call_0;
break;
case CALL_1:
delete proc_queue_head->call_1;
break;
case REPLY_0:
delete proc_queue_head->reply_0;
break;
case REPLY_1:
delete proc_queue_head->reply_1;
break;
default:
TTCN_error("Internal error: Invalid signature selector in the queue of port %s.", port_name);
}
proc_queue_item *next_item = proc_queue_head->next_item;
delete proc_queue_head;
proc_queue_head = next_item;
if (next_item == NULL) proc_queue_tail = NULL;
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__op, port_name, 0, ++proc_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));}

void IPA__CFG__PT::clear_queue()
{
while (proc_queue_head != NULL) remove_proc_queue_head();
}

IPA__CFG__PT::IPA__CFG__PT(const char *par_port_name)
 : PORT(par_port_name)
{
proc_queue_head = NULL;
proc_queue_tail = NULL;
}

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

void IPA__CFG__PT::call(const IPA__CFG__disconnect_template& call_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Calling a signature on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of call operation.");
const IPA__CFG__disconnect_call& call_tmp = call_template.create_call();
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_send(port_name,TitanLoggerApiSimple::Port__oper::call__op, destination_component,
CHARSTRING(0,NULL),(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), call_tmp.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send call to system.", port_name);
else {
Text_Buf text_buf;
prepare_call(text_buf, "@IPA_Emulation.IPA_CFG_disconnect");
call_tmp.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void IPA__CFG__PT::call(const IPA__CFG__disconnect_template& call_template, FLOAT* timestamp_redirect)
{
call(call_template, COMPONENT(get_default_destination()), timestamp_redirect);
}

void IPA__CFG__PT::call(const IPA__CFG__chg__ccm__enabled_template& call_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Calling a signature on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of call operation.");
const IPA__CFG__chg__ccm__enabled_call& call_tmp = call_template.create_call();
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_send(port_name,TitanLoggerApiSimple::Port__oper::call__op, destination_component,
CHARSTRING(0,NULL),(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), call_tmp.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send call to system.", port_name);
else {
Text_Buf text_buf;
prepare_call(text_buf, "@IPA_Emulation.IPA_CFG_chg_ccm_enabled");
call_tmp.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void IPA__CFG__PT::call(const IPA__CFG__chg__ccm__enabled_template& call_template, FLOAT* timestamp_redirect)
{
call(call_template, COMPONENT(get_default_destination()), timestamp_redirect);
}

void IPA__CFG__PT::reply(const IPA__CFG__disconnect_template& reply_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Replying to a signature on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of reply operation.");
const IPA__CFG__disconnect_reply& reply_tmp = reply_template.create_reply();
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_send(port_name, TitanLoggerApiSimple::Port__oper::reply__op, destination_component,
 CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), reply_tmp.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send reply to system.", port_name);
else {
Text_Buf text_buf;
prepare_reply(text_buf, "@IPA_Emulation.IPA_CFG_disconnect");
reply_tmp.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void IPA__CFG__PT::reply(const IPA__CFG__disconnect_template& reply_template, FLOAT* timestamp_redirect)
{
reply(reply_template, COMPONENT(get_default_destination()), timestamp_redirect);
}

void IPA__CFG__PT::reply(const IPA__CFG__chg__ccm__enabled_template& reply_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect)
{
if (!is_started) TTCN_error("Replying to a signature on port %s, which is not started.", port_name);
if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of reply operation.");
const IPA__CFG__chg__ccm__enabled_reply& reply_tmp = reply_template.create_reply();
const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_send(port_name, TitanLoggerApiSimple::Port__oper::reply__op, destination_component,
 CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), reply_tmp.log(), TTCN_Logger::end_event_log2str()));
}
if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send reply to system.", port_name);
else {
Text_Buf text_buf;
prepare_reply(text_buf, "@IPA_Emulation.IPA_CFG_chg_ccm_enabled");
reply_tmp.encode_text(text_buf);
send_data(text_buf, destination_component);
}
}

void IPA__CFG__PT::reply(const IPA__CFG__chg__ccm__enabled_template& reply_template, FLOAT* timestamp_redirect)
{
reply(reply_template, COMPONENT(get_default_destination()), timestamp_redirect);
}

alt_status IPA__CFG__PT::getcall(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC;
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 entity in the queue does not match the from clause: ", port_name);
sender_template.log_match(proc_queue_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else switch (proc_queue_head->item_selection) {
case CALL_0:
case CALL_1:
{
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component,
FALSE, CHARSTRING(0, NULL), msg_head_count+1);
}
remove_proc_queue_head();
return ALT_YES;
}
default:
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: First entity in the queue is not a call.", port_name);
return ALT_NO;
}
}

alt_status IPA__CFG__PT::check_getcall(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC;
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 entity in the queue does not match the from clause: ", port_name);
sender_template.log_match(proc_queue_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else switch (proc_queue_head->item_selection) {
case CALL_0:
case CALL_1:
{
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component,
TRUE, CHARSTRING(0, NULL), msg_head_count+1);
}
return ALT_YES;
}
default:
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: First entity in the queue is not a call.", port_name);
return ALT_NO;
}
}

alt_status IPA__CFG__PT::getcall(const IPA__CFG__disconnect_template& getcall_template, const COMPONENT_template& sender_template, const IPA__CFG__disconnect_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause,
(TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component),  TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else if (proc_queue_head->item_selection != CALL_0) {
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @IPA_Emulation.IPA_CFG_disconnect.", port_name);
return ALT_NO;
} else if (!getcall_template.match_call(*proc_queue_head->call_0)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_0), TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
param_ref.set_parameters(*proc_queue_head->call_0);
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name);
getcall_template.log_match_call(*proc_queue_head->call_0);
TTCN_Logger::end_event();
}
log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, FALSE,
(TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_proc_queue_head();
return ALT_YES;
}
}

alt_status IPA__CFG__PT::check_getcall(const IPA__CFG__disconnect_template& getcall_template, const COMPONENT_template& sender_template, const IPA__CFG__disconnect_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause,
(TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component),  TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else if (proc_queue_head->item_selection != CALL_0) {
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @IPA_Emulation.IPA_CFG_disconnect.", port_name);
return ALT_NO;
} else if (!getcall_template.match_call(*proc_queue_head->call_0)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_0), TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
param_ref.set_parameters(*proc_queue_head->call_0);
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name);
getcall_template.log_match_call(*proc_queue_head->call_0);
TTCN_Logger::end_event();
}
log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, TRUE,
(TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status IPA__CFG__PT::getcall(const IPA__CFG__chg__ccm__enabled_template& getcall_template, const COMPONENT_template& sender_template, const IPA__CFG__chg__ccm__enabled_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause,
(TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component),  TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else if (proc_queue_head->item_selection != CALL_1) {
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @IPA_Emulation.IPA_CFG_chg_ccm_enabled.", port_name);
return ALT_NO;
} else if (!getcall_template.match_call(*proc_queue_head->call_1)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_1), TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
param_ref.set_parameters(*proc_queue_head->call_1);
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name);
getcall_template.log_match_call(*proc_queue_head->call_1);
TTCN_Logger::end_event();
}
log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, FALSE,
(TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_proc_queue_head();
return ALT_YES;
}
}

alt_status IPA__CFG__PT::check_getcall(const IPA__CFG__chg__ccm__enabled_template& getcall_template, const COMPONENT_template& sender_template, const IPA__CFG__chg__ccm__enabled_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause,
(TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component),  TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else if (proc_queue_head->item_selection != CALL_1) {
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @IPA_Emulation.IPA_CFG_chg_ccm_enabled.", port_name);
return ALT_NO;
} else if (!getcall_template.match_call(*proc_queue_head->call_1)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_1), TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
param_ref.set_parameters(*proc_queue_head->call_1);
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name);
getcall_template.log_match_call(*proc_queue_head->call_1);
TTCN_Logger::end_event();
}
log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, TRUE,
(TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status IPA__CFG__PT::getreply(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC;
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 entity in the queue does not match the from clause: ", port_name);
sender_template.log_match(proc_queue_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else switch (proc_queue_head->item_selection) {
case REPLY_0:
case REPLY_1:
{
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component,
FALSE, CHARSTRING(0, NULL), msg_head_count+1);
}
remove_proc_queue_head();
return ALT_YES;
}
default:
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: First entity in the queue is not a reply.", port_name);
return ALT_NO;
}
}

alt_status IPA__CFG__PT::check_getreply(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC;
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 entity in the queue does not match the from clause: ", port_name);
sender_template.log_match(proc_queue_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else switch (proc_queue_head->item_selection) {
case REPLY_0:
case REPLY_1:
{
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS, "Matching on port %s succeeded.", port_name);
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component,
TRUE, CHARSTRING(0, NULL), msg_head_count+1);
}
return ALT_YES;
}
default:
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: First entity in the queue is not a reply.", port_name);
return ALT_NO;
}
}

alt_status IPA__CFG__PT::getreply(const IPA__CFG__disconnect_template& getreply_template, const COMPONENT_template& sender_template, const IPA__CFG__disconnect_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC;
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 entity in the queue does not match the from clause: ", port_name);
sender_template.log_match(proc_queue_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (proc_queue_head->item_selection != REPLY_0) {
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @IPA_Emulation.IPA_CFG_disconnect.", port_name);
return ALT_NO;
} else if (!getreply_template.match_reply(*proc_queue_head->reply_0)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_0), TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
param_ref.set_parameters(*proc_queue_head->reply_0);
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name);
getreply_template.log_match_reply(*proc_queue_head->reply_0);
TTCN_Logger::end_event();
}
log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, FALSE,
(TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_proc_queue_head();
return ALT_YES;
}
}

alt_status IPA__CFG__PT::check_getreply(const IPA__CFG__disconnect_template& getreply_template, const COMPONENT_template& sender_template, const IPA__CFG__disconnect_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC;
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 entity in the queue does not match the from clause: ", port_name);
sender_template.log_match(proc_queue_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (proc_queue_head->item_selection != REPLY_0) {
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @IPA_Emulation.IPA_CFG_disconnect.", port_name);
return ALT_NO;
} else if (!getreply_template.match_reply(*proc_queue_head->reply_0)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_0), TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
param_ref.set_parameters(*proc_queue_head->reply_0);
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name);
getreply_template.log_match_reply(*proc_queue_head->reply_0);
TTCN_Logger::end_event();
}
log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, TRUE,
(TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_0->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

alt_status IPA__CFG__PT::getreply(const IPA__CFG__chg__ccm__enabled_template& getreply_template, const COMPONENT_template& sender_template, const IPA__CFG__chg__ccm__enabled_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC;
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 entity in the queue does not match the from clause: ", port_name);
sender_template.log_match(proc_queue_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (proc_queue_head->item_selection != REPLY_1) {
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @IPA_Emulation.IPA_CFG_chg_ccm_enabled.", port_name);
return ALT_NO;
} else if (!getreply_template.match_reply(*proc_queue_head->reply_1)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_1), TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
param_ref.set_parameters(*proc_queue_head->reply_1);
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name);
getreply_template.log_match_reply(*proc_queue_head->reply_1);
TTCN_Logger::end_event();
}
log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, FALSE,
(TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
remove_proc_queue_head();
return ALT_YES;
}
}

alt_status IPA__CFG__PT::check_getreply(const IPA__CFG__chg__ccm__enabled_template& getreply_template, const COMPONENT_template& sender_template, const IPA__CFG__chg__ccm__enabled_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)
{
if (proc_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(proc_queue_head->sender_component)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC;
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 entity in the queue does not match the from clause: ", port_name);
sender_template.log_match(proc_queue_head->sender_component);
TTCN_Logger::end_event();
}
return ALT_NO;
} else if (proc_queue_head->item_selection != REPLY_1) {
TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @IPA_Emulation.IPA_CFG_chg_ccm_enabled.", port_name);
return ALT_NO;
} else if (!getreply_template.match_reply(*proc_queue_head->reply_1)) {
const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__,
port_name, proc_queue_head->sender_component,
TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template,
(TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_1), TTCN_Logger::end_event_log2str()));
}
return ALT_NO;
} else {
param_ref.set_parameters(*proc_queue_head->reply_1);
if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component;
TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::begin_event(log_sev);
TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name);
getreply_template.log_match_reply(*proc_queue_head->reply_1);
TTCN_Logger::end_event();
}
log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN;
if (TTCN_Logger::log_this_event(log_sev)) {
TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, TRUE,
(TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_1->log(), TTCN_Logger::end_event_log2str()),
msg_head_count+1);
}
return ALT_YES;
}
}

void IPA__CFG__PT::incoming_call(const IPA__CFG__disconnect_call& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A call 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 call has arrived on it.", port_name);
}
}
proc_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__call, port_name, sender_component, proc_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
proc_queue_item *new_item = new proc_queue_item;
new_item->item_selection = CALL_0;
new_item->call_0 = new IPA__CFG__disconnect_call(incoming_par);
new_item->sender_component = sender_component;
append_to_proc_queue(new_item);
}

void IPA__CFG__PT::incoming_call(const IPA__CFG__chg__ccm__enabled_call& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A call 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 call has arrived on it.", port_name);
}
}
proc_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__call, port_name, sender_component, proc_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
proc_queue_item *new_item = new proc_queue_item;
new_item->item_selection = CALL_1;
new_item->call_1 = new IPA__CFG__chg__ccm__enabled_call(incoming_par);
new_item->sender_component = sender_component;
append_to_proc_queue(new_item);
}

void IPA__CFG__PT::incoming_reply(const IPA__CFG__disconnect_reply& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A reply 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 reply has arrived on it.", port_name);
}
}
proc_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__reply, port_name, sender_component, proc_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
proc_queue_item *new_item = new proc_queue_item;
new_item->item_selection = REPLY_0;
new_item->reply_0 = new IPA__CFG__disconnect_reply(incoming_par);
new_item->sender_component = sender_component;
append_to_proc_queue(new_item);
}

void IPA__CFG__PT::incoming_reply(const IPA__CFG__chg__ccm__enabled_reply& incoming_par, component sender_component)
{
if (!is_started) {
if (is_halted) {
TTCN_warning("A reply 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 reply has arrived on it.", port_name);
}
}
proc_tail_count++;
if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) {
TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__reply, port_name, sender_component, proc_tail_count,
CHARSTRING(0, NULL),
(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str()));
}
proc_queue_item *new_item = new proc_queue_item;
new_item->item_selection = REPLY_1;
new_item->reply_1 = new IPA__CFG__chg__ccm__enabled_reply(incoming_par);
new_item->sender_component = sender_component;
append_to_proc_queue(new_item);
}

boolean IPA__CFG__PT::process_call(const char *signature_name, Text_Buf& incoming_buf, component sender_component)
{
if (!strcmp(signature_name, "@IPA_Emulation.IPA_CFG_disconnect")) {
IPA__CFG__disconnect_call incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_call(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(signature_name, "@IPA_Emulation.IPA_CFG_chg_ccm_enabled")) {
IPA__CFG__chg__ccm__enabled_call incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_call(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}

boolean IPA__CFG__PT::process_reply(const char *signature_name, Text_Buf& incoming_buf, component sender_component)
{
if (!strcmp(signature_name, "@IPA_Emulation.IPA_CFG_disconnect")) {
IPA__CFG__disconnect_reply incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_reply(incoming_par, sender_component);
return TRUE;
} else if (!strcmp(signature_name, "@IPA_Emulation.IPA_CFG_chg_ccm_enabled")) {
IPA__CFG__chg__ccm__enabled_reply incoming_par;
incoming_par.decode_text(incoming_buf);
incoming_reply(incoming_par, sender_component);
return TRUE;
} else return FALSE;
}


/* Bodies of functions, altsteps and testcases */

ASP__IPA__Event_template ts__ASP__IPA__EV(const ASP__IPA__EventType& ev__type, const INTEGER& conn__id, const IPA__Types::IpaCcmIdResp_template& id__resp)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 105, TTCN_Location::LOCATION_TEMPLATE, "ts_ASP_IPA_EV");
ASP__IPA__Event_template ret_val;
ret_val.ev__type() = ev__type;
ret_val.conn__id() = conn__id;
ret_val.id__resp() = id__resp;
return ret_val;
}

ASP__IPA__Event_template tr__ASP__IPA__EV(const ASP__IPA__EventType_template& ev__type, const INTEGER_template& conn__id, const IPA__Types::IpaCcmIdResp_template& id__resp)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 112, TTCN_Location::LOCATION_TEMPLATE, "tr_ASP_IPA_EV");
ASP__IPA__Event_template ret_val;
ret_val.ev__type() = ev__type;
ret_val.conn__id() = conn__id;
ret_val.id__resp() = id__resp;
return ret_val;
}

ASP__IPA__Unitdata_template t__ASP__IPA__UD(const IPA__Types::IpaStreamId& sid, const OCTETSTRING& pl, const IPA__Types::IpaExtStreamId_template& esid)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 120, TTCN_Location::LOCATION_TEMPLATE, "t_ASP_IPA_UD");
ASP__IPA__Unitdata_template ret_val;
ret_val.streamId() = sid;
ret_val.streamIdExt() = esid;
ret_val.payload() = pl;
return ret_val;
}

void f__ipa__cfg__disconnect(IPA__CFG__PT& pt, Socket__API__Definitions::Result& res)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 314, TTCN_Location::LOCATION_FUNCTION, "f_ipa_cfg_disconnect");
current_location.update_lineno(315);
/* IPA_Emulation.ttcnpp, line 315 */
{
IPA__CFG__disconnect_template tmp_0;
tmp_0.res() = res;
pt.call(tmp_0, NULL);
}
{
alt_status tmp_1_alt_flag_0 = ALT_MAYBE;
current_location.update_lineno(315);
/* IPA_Emulation.ttcnpp, line 315 */
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_1_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(316);
/* IPA_Emulation.ttcnpp, line 316 */
{
IPA__CFG__disconnect_template tmp_2;
tmp_2.res() = ANY_VALUE;
tmp_1_alt_flag_0 = pt.getreply(tmp_2, any_compref, IPA__CFG__disconnect_reply_redirect(&(res)), NULL, NULL, NULL);
}
if (tmp_1_alt_flag_0 == ALT_YES) break;
}
current_location.update_lineno(315);
/* IPA_Emulation.ttcnpp, line 315 */
if (tmp_1_alt_flag_0 == ALT_NO) TTCN_error("None of the branches can be chosen in the response and exception handling part of call statement in file IPA_Emulation.ttcnpp between lines 315 and 317.");
TTCN_Snapshot::take_new(TRUE);
}
}
}

void f__ipa__cfg__chg__ccm__enabled(IPA__CFG__PT& pt, const BOOLEAN& ccm__enabled)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 319, TTCN_Location::LOCATION_FUNCTION, "f_ipa_cfg_chg_ccm_enabled");
current_location.update_lineno(320);
/* IPA_Emulation.ttcnpp, line 320 */
{
IPA__CFG__chg__ccm__enabled_template tmp_3;
tmp_3.res() = ccm__enabled;
pt.call(tmp_3, NULL);
}
{
alt_status tmp_4_alt_flag_0 = ALT_MAYBE;
current_location.update_lineno(320);
/* IPA_Emulation.ttcnpp, line 320 */
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_4_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(321);
/* IPA_Emulation.ttcnpp, line 321 */
{
IPA__CFG__chg__ccm__enabled_template tmp_5;
tmp_5.res() = ccm__enabled;
tmp_4_alt_flag_0 = pt.getreply(tmp_5, any_compref, IPA__CFG__chg__ccm__enabled_reply_redirect(), NULL, NULL, NULL);
}
if (tmp_4_alt_flag_0 == ALT_YES) break;
}
current_location.update_lineno(320);
/* IPA_Emulation.ttcnpp, line 320 */
if (tmp_4_alt_flag_0 == ALT_NO) TTCN_error("None of the branches can be chosen in the response and exception handling part of call statement in file IPA_Emulation.ttcnpp between lines 320 and 322.");
TTCN_Snapshot::take_new(TRUE);
}
}
}

void f__connect(const CHARSTRING& remote__host, const INTEGER& remote__port, const CHARSTRING& local__host, const INTEGER& local__port, const IPA__CCM__Parameters& ccm__pars)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 326, TTCN_Location::LOCATION_FUNCTION, "f_connect");
current_location.update_lineno(329);
/* IPA_Emulation.ttcnpp, line 329 */
Socket__API__Definitions::Result res;
current_location.update_lineno(330);
/* IPA_Emulation.ttcnpp, line 330 */
{
Socket__API__Definitions::ProtoTuple tmp_7;
tmp_7.tcp() = NULL_VALUE;
res = IPA__CodecPort__CtrlFunct::f__IPL4__connect(IPA__Emulation__CT_component_IPA__PORT, remote__host, remote__port, local__host, local__port, 0, tmp_7, IPA__CodecPort__CtrlFunct::f__IPL4__connect_options_defval);
}
current_location.update_lineno(332);
/* IPA_Emulation.ttcnpp, line 332 */
{
boolean tmp_11;
{
boolean tmp_8 = res.is_bound();
if(tmp_8) {
const OPTIONAL< INTEGER >& tmp_9 = res.connId();
switch (tmp_9.get_selection()) {
case OPTIONAL_UNBOUND:
tmp_8 = FALSE;
break;
case OPTIONAL_OMIT:
tmp_8 = FALSE;
break;
default:
{
const INTEGER& tmp_10 = (const INTEGER&) tmp_9;
tmp_8 = tmp_10.is_present();
break;}
}
}
tmp_11 = (!(tmp_8));
}
if (tmp_11) {
current_location.update_lineno(333);
/* IPA_Emulation.ttcnpp, line 333 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Could not connect IPA socket from "),local__host.log(),TTCN_Logger::log_event_str(" port "),local__port.log(),TTCN_Logger::log_event_str(" to "),remote__host.log(),TTCN_Logger::log_event_str(" port "),remote__port.log(),TTCN_Logger::log_event_str("; check your configuration"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(335);
/* IPA_Emulation.ttcnpp, line 335 */
TTCN_Runtime::stop_component(MTC_COMPREF);
}
}
current_location.update_lineno(337);
/* IPA_Emulation.ttcnpp, line 337 */
IPA__Emulation__CT_component_g__self__conn__id = const_cast< const Socket__API__Definitions::Result&>(res).connId();
current_location.update_lineno(338);
/* IPA_Emulation.ttcnpp, line 338 */
IPA__Emulation__CT_component_g__ccm__pars = ccm__pars;
current_location.update_lineno(339);
/* IPA_Emulation.ttcnpp, line 339 */
IPA__Emulation__CT_component_g__is__bsc__mgw = TRUE;
}

void start_f__connect(const COMPONENT& component_reference, const CHARSTRING& remote__host, const INTEGER& remote__port, const CHARSTRING& local__host, const INTEGER& local__port, const IPA__CCM__Parameters& ccm__pars)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_connect(");
remote__host.log();
TTCN_Logger::log_event_str(", ");
remote__port.log();
TTCN_Logger::log_event_str(", ");
local__host.log();
TTCN_Logger::log_event_str(", ");
local__port.log();
TTCN_Logger::log_event_str(", ");
ccm__pars.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_connect", text_buf);
remote__host.encode_text(text_buf);
remote__port.encode_text(text_buf);
local__host.encode_text(text_buf);
local__port.encode_text(text_buf);
ccm__pars.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__bind(const CHARSTRING& local__host, const INTEGER& local__port, const IPA__CCM__Parameters& ccm__pars)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 343, TTCN_Location::LOCATION_FUNCTION, "f_bind");
current_location.update_lineno(345);
/* IPA_Emulation.ttcnpp, line 345 */
Socket__API__Definitions::Result res;
current_location.update_lineno(346);
/* IPA_Emulation.ttcnpp, line 346 */
{
Socket__API__Definitions::ProtoTuple tmp_16;
tmp_16.tcp() = NULL_VALUE;
res = IPA__CodecPort__CtrlFunct::f__IPL4__listen(IPA__Emulation__CT_component_IPA__PORT, local__host, local__port, tmp_16, IPA__CodecPort__CtrlFunct::f__IPL4__listen_options_defval);
}
current_location.update_lineno(348);
/* IPA_Emulation.ttcnpp, line 348 */
{
boolean tmp_20;
{
boolean tmp_17 = res.is_bound();
if(tmp_17) {
const OPTIONAL< INTEGER >& tmp_18 = res.connId();
switch (tmp_18.get_selection()) {
case OPTIONAL_UNBOUND:
tmp_17 = FALSE;
break;
case OPTIONAL_OMIT:
tmp_17 = FALSE;
break;
default:
{
const INTEGER& tmp_19 = (const INTEGER&) tmp_18;
tmp_17 = tmp_19.is_present();
break;}
}
}
tmp_20 = (!(tmp_17));
}
if (tmp_20) {
current_location.update_lineno(349);
/* IPA_Emulation.ttcnpp, line 349 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Could not listen IPA socket "),local__host.log(),TTCN_Logger::log_char(':'),local__port.log(),TTCN_Logger::log_event_str(", check your configuration"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(350);
/* IPA_Emulation.ttcnpp, line 350 */
TTCN_Runtime::stop_component(MTC_COMPREF);
}
}
current_location.update_lineno(352);
/* IPA_Emulation.ttcnpp, line 352 */
IPA__Emulation__CT_component_g__self__conn__id = const_cast< const Socket__API__Definitions::Result&>(res).connId();
current_location.update_lineno(353);
/* IPA_Emulation.ttcnpp, line 353 */
IPA__Emulation__CT_component_g__ccm__pars = ccm__pars;
current_location.update_lineno(354);
/* IPA_Emulation.ttcnpp, line 354 */
IPA__Emulation__CT_component_g__is__bsc__mgw = FALSE;
}

void start_f__bind(const COMPONENT& component_reference, const CHARSTRING& local__host, const INTEGER& local__port, const IPA__CCM__Parameters& ccm__pars)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_bind(");
local__host.log();
TTCN_Logger::log_event_str(", ");
local__port.log();
TTCN_Logger::log_event_str(", ");
ccm__pars.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_bind", text_buf);
local__host.encode_text(text_buf);
local__port.encode_text(text_buf);
ccm__pars.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

Socket__API__Definitions::Result f__close()
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 357, TTCN_Location::LOCATION_FUNCTION, "f_close");
current_location.update_lineno(358);
/* IPA_Emulation.ttcnpp, line 358 */
Socket__API__Definitions::Result res;
{
const IpaMode &tmp_25 = IPA__Emulation__CT_component_g__mode;
current_location.update_lineno(360);
/* IPA_Emulation.ttcnpp, line 360 */
if(tmp_25 == IpaMode::IPA__MODE__CLIENT) goto tmp_24_0;
current_location.update_lineno(364);
/* IPA_Emulation.ttcnpp, line 364 */
if(tmp_25 == IpaMode::IPA__MODE__SERVER) goto tmp_24_1;
goto tmp_24_2;
tmp_24_0:
{
current_location.update_lineno(361);
/* IPA_Emulation.ttcnpp, line 361 */
{
Socket__API__Definitions::ProtoTuple tmp_27;
tmp_27.tcp() = NULL_VALUE;
res = IPA__CodecPort__CtrlFunct::f__IPL4__close(IPA__Emulation__CT_component_IPA__PORT, IPA__Emulation__CT_component_g__self__conn__id, tmp_27);
}
current_location.update_lineno(362);
/* IPA_Emulation.ttcnpp, line 362 */
IPA__Emulation__CT_component_g__self__conn__id = -1;
goto tmp_24_end;
}
tmp_24_1:
{
current_location.update_lineno(365);
/* IPA_Emulation.ttcnpp, line 365 */
{
Socket__API__Definitions::ProtoTuple tmp_30;
tmp_30.tcp() = NULL_VALUE;
res = IPA__CodecPort__CtrlFunct::f__IPL4__close(IPA__Emulation__CT_component_IPA__PORT, IPA__Emulation__CT_component_g__last__conn__id, tmp_30);
}
current_location.update_lineno(366);
/* IPA_Emulation.ttcnpp, line 366 */
IPA__Emulation__CT_component_g__last__conn__id = -1;
goto tmp_24_end;
}
tmp_24_2:
{
current_location.update_lineno(369);
/* IPA_Emulation.ttcnpp, line 369 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unknown mode"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(370);
/* IPA_Emulation.ttcnpp, line 370 */
TTCN_Runtime::stop_component(MTC_COMPREF);
}
tmp_24_end: /* empty */;
}
current_location.update_lineno(373);
/* IPA_Emulation.ttcnpp, line 373 */
return res;
}

void start_f__close(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_close(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_close", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

IPA__Types::IpaCcmRespPart_template t__IdRespPart(const IPA__Types::IpaCcmIdTag& tag, const CHARSTRING& payload)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 387, TTCN_Location::LOCATION_TEMPLATE, "t_IdRespPart");
IPA__Types::IpaCcmRespPart_template ret_val;
ret_val.len() = 0;
ret_val.tag() = tag;
ret_val.data() = (char2oct(payload) + os_0);
return ret_val;
}

void f__send__IPA__EVT(const ASP__IPA__Event_template& evt)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 393, TTCN_Location::LOCATION_FUNCTION, "f_send_IPA_EVT");
current_location.update_lineno(394);
/* IPA_Emulation.ttcnpp, line 394 */
if (IPA__Emulation__CT_component_IPA__SP__PORT.check_port_state(cs_3)) {
current_location.update_lineno(395);
/* IPA_Emulation.ttcnpp, line 395 */
IPA__Emulation__CT_component_IPA__SP__PORT.send(evt, NULL);
}
current_location.update_lineno(408);
/* IPA_Emulation.ttcnpp, line 408 */
if (IPA__Emulation__CT_component_IPA__CTRL__PORT.check_port_state(cs_3)) {
current_location.update_lineno(409);
/* IPA_Emulation.ttcnpp, line 409 */
IPA__Emulation__CT_component_IPA__CTRL__PORT.send(evt, NULL);
}
}

void start_f__send__IPA__EVT(const COMPONENT& component_reference, const ASP__IPA__Event_template& evt)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_send_IPA_EVT(");
evt.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_send_IPA_EVT", text_buf);
evt.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

IPA__Types::PDU__IPA__CCM f__ccm__make__id__resp(const IPA__Types::PDU__IPA__CCM& get)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 436, TTCN_Location::LOCATION_FUNCTION, "f_ccm_make_id_resp");
current_location.update_lineno(437);
/* IPA_Emulation.ttcnpp, line 437 */
INTEGER i;
current_location.update_lineno(438);
/* IPA_Emulation.ttcnpp, line 438 */
IPA__Types::PDU__IPA__CCM resp;
resp.msg__type() = IPA__Types::IpaCcmMsgtype::IPAC__MSGT__ID__RESP;
resp.u()().resp() = NULL_VALUE;
current_location.update_lineno(446);
/* IPA_Emulation.ttcnpp, line 446 */
{
boolean tmp_35;
{
boolean tmp_32 = get.is_bound();
if(tmp_32) {
const OPTIONAL< IPA__Types::IpaCcmUnion >& tmp_33 = get.u();
switch (tmp_33.get_selection()) {
case OPTIONAL_UNBOUND:
tmp_32 = FALSE;
break;
case OPTIONAL_OMIT:
tmp_32 = FALSE;
break;
default:
{
const IPA__Types::IpaCcmUnion& tmp_34 = (const IPA__Types::IpaCcmUnion&) tmp_33;
tmp_32 = tmp_34.is_present();
break;}
}
}
tmp_35 = (!(tmp_32));
}
if (tmp_35) {
current_location.update_lineno(447);
/* IPA_Emulation.ttcnpp, line 447 */
return resp;
}
}
current_location.update_lineno(450);
/* IPA_Emulation.ttcnpp, line 450 */
i = 0;
current_location.update_lineno(450);
/* IPA_Emulation.ttcnpp, line 450 */
for ( ; ; ) {
current_location.update_lineno(450);
/* IPA_Emulation.ttcnpp, line 450 */
if (!(i < const_cast< const IPA__Types::PDU__IPA__CCM&>(get).u()().get().size_of())) break;
current_location.update_lineno(451);
/* IPA_Emulation.ttcnpp, line 451 */
IPA__Types::IpaCcmIdTag tag(const_cast< const IPA__Types::PDU__IPA__CCM&>(get).u()().get()[i].tag());
current_location.update_lineno(452);
/* IPA_Emulation.ttcnpp, line 452 */
CHARSTRING foo;
{
const IPA__Types::IpaCcmIdTag &tmp_38 = tag;
current_location.update_lineno(454);
/* IPA_Emulation.ttcnpp, line 454 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__SERNR) goto tmp_37_0;
current_location.update_lineno(457);
/* IPA_Emulation.ttcnpp, line 457 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__UNITNAME) goto tmp_37_1;
current_location.update_lineno(460);
/* IPA_Emulation.ttcnpp, line 460 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__LOCATION1) goto tmp_37_2;
current_location.update_lineno(463);
/* IPA_Emulation.ttcnpp, line 463 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__LOCATION2) goto tmp_37_3;
current_location.update_lineno(466);
/* IPA_Emulation.ttcnpp, line 466 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__EQUIPVERS) goto tmp_37_4;
current_location.update_lineno(469);
/* IPA_Emulation.ttcnpp, line 469 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__SWVERSION) goto tmp_37_5;
current_location.update_lineno(472);
/* IPA_Emulation.ttcnpp, line 472 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__IPADDR) goto tmp_37_6;
current_location.update_lineno(475);
/* IPA_Emulation.ttcnpp, line 475 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__MACADDR) goto tmp_37_7;
current_location.update_lineno(478);
/* IPA_Emulation.ttcnpp, line 478 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__UNITID) goto tmp_37_8;
current_location.update_lineno(481);
/* IPA_Emulation.ttcnpp, line 481 */
if(tmp_38 == IPA__Types::IpaCcmIdTag::IPAC__IDTAG__OSMO__RAND) goto tmp_37_9;
goto tmp_37_10;
tmp_37_0:
{
current_location.update_lineno(455);
/* IPA_Emulation.ttcnpp, line 455 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).ser__nr();
goto tmp_37_end;
}
tmp_37_1:
{
current_location.update_lineno(458);
/* IPA_Emulation.ttcnpp, line 458 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).name();
goto tmp_37_end;
}
tmp_37_2:
{
current_location.update_lineno(461);
/* IPA_Emulation.ttcnpp, line 461 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).location1();
goto tmp_37_end;
}
tmp_37_3:
{
current_location.update_lineno(464);
/* IPA_Emulation.ttcnpp, line 464 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).location2();
goto tmp_37_end;
}
tmp_37_4:
{
current_location.update_lineno(467);
/* IPA_Emulation.ttcnpp, line 467 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).equip__version();
goto tmp_37_end;
}
tmp_37_5:
{
current_location.update_lineno(470);
/* IPA_Emulation.ttcnpp, line 470 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).sw__version();
goto tmp_37_end;
}
tmp_37_6:
{
current_location.update_lineno(473);
/* IPA_Emulation.ttcnpp, line 473 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).ip__addr();
goto tmp_37_end;
}
tmp_37_7:
{
current_location.update_lineno(476);
/* IPA_Emulation.ttcnpp, line 476 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).mac__addr();
goto tmp_37_end;
}
tmp_37_8:
{
current_location.update_lineno(479);
/* IPA_Emulation.ttcnpp, line 479 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).unit__id();
goto tmp_37_end;
}
tmp_37_9:
{
current_location.update_lineno(482);
/* IPA_Emulation.ttcnpp, line 482 */
foo = const_cast< const IPA__CCM__Parameters&>(IPA__Emulation__CT_component_g__ccm__pars).osmo__rand();
goto tmp_37_end;
}
tmp_37_10:
{
current_location.update_lineno(485);
/* IPA_Emulation.ttcnpp, line 485 */
foo = cs_4;
goto tmp_37_end;
}
tmp_37_end: /* empty */;
}
current_location.update_lineno(488);
/* IPA_Emulation.ttcnpp, line 488 */
resp.u()().resp()[const_cast< const IPA__Types::PDU__IPA__CCM&>(resp).u()().resp().size_of()] = t__IdRespPart(tag, foo).valueof();
current_location.update_lineno(450);
/* IPA_Emulation.ttcnpp, line 450 */
{
INTEGER tmp_51;
++i;
}
}
current_location.update_lineno(491);
/* IPA_Emulation.ttcnpp, line 491 */
return resp;
}

void start_f__ccm__make__id__resp(const COMPONENT& component_reference, const IPA__Types::PDU__IPA__CCM& get)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ccm_make_id_resp(");
get.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_ccm_make_id_resp", text_buf);
get.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__ccm__tx(const IPA__Types::PDU__IPA__CCM& ccm, const INTEGER& conn__id)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 495, TTCN_Location::LOCATION_FUNCTION, "f_ccm_tx");
current_location.update_lineno(497);
/* IPA_Emulation.ttcnpp, line 497 */
IPA__CodecPort::IPA__Send ipa__tx(IPA__CodecPort::t__IPA__Send(conn__id, IPA__Types::IpaStreamId::IPAC__PROTO__CCM, IPA__Types::enc__PDU__IPA__CCM(ccm), IPA__CodecPort::t__IPA__Send_stream__id__ext_defval).valueof());
current_location.update_lineno(498);
/* IPA_Emulation.ttcnpp, line 498 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("CCM Tx:");
ccm.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(499);
/* IPA_Emulation.ttcnpp, line 499 */
IPA__Emulation__CT_component_IPA__PORT.send(ipa__tx, NULL);
}

void start_f__ccm__tx(const COMPONENT& component_reference, const IPA__Types::PDU__IPA__CCM& ccm, const INTEGER& conn__id)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ccm_tx(");
ccm.log();
TTCN_Logger::log_event_str(", ");
conn__id.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_ccm_tx", text_buf);
ccm.encode_text(text_buf);
conn__id.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__ccm__rx__client(const IPA__Types::PDU__IPA__CCM& ccm)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 533, TTCN_Location::LOCATION_FUNCTION, "f_ccm_rx_client");
{
const IPA__Types::IpaCcmMsgtype &tmp_59 = const_cast< const IPA__Types::PDU__IPA__CCM&>(ccm).msg__type();
current_location.update_lineno(535);
/* IPA_Emulation.ttcnpp, line 535 */
if(tmp_59 == IPA__Types::IpaCcmMsgtype::IPAC__MSGT__PING) goto tmp_58_0;
current_location.update_lineno(538);
/* IPA_Emulation.ttcnpp, line 538 */
if(tmp_59 == IPA__Types::IpaCcmMsgtype::IPAC__MSGT__ID__ACK) goto tmp_58_1;
current_location.update_lineno(541);
/* IPA_Emulation.ttcnpp, line 541 */
if(tmp_59 == IPA__Types::IpaCcmMsgtype::IPAC__MSGT__ID__GET) goto tmp_58_2;
goto tmp_58_3;
tmp_58_0:
{
current_location.update_lineno(536);
/* IPA_Emulation.ttcnpp, line 536 */
f__ccm__tx(ts__IPA__PONG.valueof(), INTEGER(IPA__Emulation__CT_component_g__self__conn__id));
goto tmp_58_end;
}
tmp_58_1:
{
current_location.update_lineno(539);
/* IPA_Emulation.ttcnpp, line 539 */
f__send__IPA__EVT(ts__ASP__IPA__EV(ASP__IPA__EventType::ASP__IPA__EVENT__ID__ACK, IPA__Emulation__CT_component_g__self__conn__id, ts__ASP__IPA__EV_id__resp_defval));
goto tmp_58_end;
}
tmp_58_2:
{
current_location.update_lineno(542);
/* IPA_Emulation.ttcnpp, line 542 */
f__ccm__tx(f__ccm__make__id__resp(ccm), INTEGER(IPA__Emulation__CT_component_g__self__conn__id));
goto tmp_58_end;
}
tmp_58_3:
{
current_location.update_lineno(545);
/* IPA_Emulation.ttcnpp, line 545 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Unknown/unsupported IPA CCM message type");
ccm.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
goto tmp_58_end;
}
tmp_58_end: /* empty */;
}
}

void start_f__ccm__rx__client(const COMPONENT& component_reference, const IPA__Types::PDU__IPA__CCM& ccm)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ccm_rx_client(");
ccm.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_ccm_rx_client", text_buf);
ccm.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__ccm__rx__server(const IPA__Types::PDU__IPA__CCM& ccm, const INTEGER& conn__id)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 550, TTCN_Location::LOCATION_FUNCTION, "f_ccm_rx_server");
{
const IPA__Types::IpaCcmMsgtype &tmp_61 = const_cast< const IPA__Types::PDU__IPA__CCM&>(ccm).msg__type();
current_location.update_lineno(553);
/* IPA_Emulation.ttcnpp, line 553 */
if(tmp_61 == IPA__Types::IpaCcmMsgtype::IPAC__MSGT__PING) goto tmp_60_0;
current_location.update_lineno(556);
/* IPA_Emulation.ttcnpp, line 556 */
if(tmp_61 == IPA__Types::IpaCcmMsgtype::IPAC__MSGT__ID__ACK) goto tmp_60_1;
current_location.update_lineno(564);
/* IPA_Emulation.ttcnpp, line 564 */
if(tmp_61 == IPA__Types::IpaCcmMsgtype::IPAC__MSGT__ID__RESP) goto tmp_60_2;
goto tmp_60_3;
tmp_60_0:
{
current_location.update_lineno(554);
/* IPA_Emulation.ttcnpp, line 554 */
f__ccm__tx(ts__IPA__PONG.valueof(), conn__id);
goto tmp_60_end;
}
tmp_60_1:
{
current_location.update_lineno(562);
/* IPA_Emulation.ttcnpp, line 562 */
f__send__IPA__EVT(ts__ASP__IPA__EV(ASP__IPA__EventType::ASP__IPA__EVENT__ID__ACK, conn__id, ts__ASP__IPA__EV_id__resp_defval));
goto tmp_60_end;
}
tmp_60_2:
{
current_location.update_lineno(565);
/* IPA_Emulation.ttcnpp, line 565 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("IPA ID RESP: ");
const_cast< const IPA__Types::PDU__IPA__CCM&>(ccm).u()().resp().log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(568);
/* IPA_Emulation.ttcnpp, line 568 */
if ((!(tr__IPA__ID__RESP.match(ccm)))) {
current_location.update_lineno(569);
/* IPA_Emulation.ttcnpp, line 569 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("IPA identity response ");
const_cast< const IPA__Types::PDU__IPA__CCM&>(ccm).u()().resp().log();
TTCN_Logger::log_event_str(" mismatch");
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(570);
/* IPA_Emulation.ttcnpp, line 570 */
return;
}
current_location.update_lineno(574);
/* IPA_Emulation.ttcnpp, line 574 */
f__send__IPA__EVT(ts__ASP__IPA__EV(ASP__IPA__EventType::ASP__IPA__EVENT__ID__RESP, conn__id, IPA__Types::IpaCcmIdResp_template(const_cast< const IPA__Types::PDU__IPA__CCM&>(ccm).u()().resp())));
current_location.update_lineno(576);
/* IPA_Emulation.ttcnpp, line 576 */
f__ccm__tx(ts__IPA__ACK.valueof(), conn__id);
goto tmp_60_end;
}
tmp_60_3:
{
current_location.update_lineno(579);
/* IPA_Emulation.ttcnpp, line 579 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Unknown/unsupported IPA CCM message type");
ccm.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
goto tmp_60_end;
}
tmp_60_end: /* empty */;
}
}

void start_f__ccm__rx__server(const COMPONENT& component_reference, const IPA__Types::PDU__IPA__CCM& ccm, const INTEGER& conn__id)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ccm_rx_server(");
ccm.log();
TTCN_Logger::log_event_str(", ");
conn__id.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_ccm_rx_server", text_buf);
ccm.encode_text(text_buf);
conn__id.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

ASP__IPA__Unitdata f__to__asp(const IPA__CodecPort::IPA__RecvFrom& ipa__rx)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 584, TTCN_Location::LOCATION_FUNCTION, "f_to_asp");
current_location.update_lineno(585);
/* IPA_Emulation.ttcnpp, line 585 */
ASP__IPA__Unitdata ret;
ret.streamId() = const_cast< const IPA__CodecPort::IPA__RecvFrom&>(ipa__rx).streamId();
ret.streamIdExt() = const_cast< const IPA__CodecPort::IPA__RecvFrom&>(ipa__rx).streamIdExt();
ret.payload() = const_cast< const IPA__CodecPort::IPA__RecvFrom&>(ipa__rx).msg();
current_location.update_lineno(590);
/* IPA_Emulation.ttcnpp, line 590 */
return ret;
}

IPA__CodecPort::IPA__Send f__from__asp(const INTEGER& connId, const ASP__IPA__Unitdata& ipa__tx)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 593, TTCN_Location::LOCATION_FUNCTION, "f_from_asp");
current_location.update_lineno(594);
/* IPA_Emulation.ttcnpp, line 594 */
IPA__CodecPort::IPA__Send ret(IPA__CodecPort::t__IPA__Send(connId, const_cast< const ASP__IPA__Unitdata&>(ipa__tx).streamId(), const_cast< const ASP__IPA__Unitdata&>(ipa__tx).payload(), IPA__Types::IpaExtStreamId_template(const_cast< const ASP__IPA__Unitdata&>(ipa__tx).streamIdExt())).valueof());
current_location.update_lineno(596);
/* IPA_Emulation.ttcnpp, line 596 */
return ret;
}

void main__client(const CHARSTRING& remote__host, const INTEGER& remote__port, const CHARSTRING& local__host, const INTEGER& local__port, const IPA__CCM__Parameters& ccm__pars, const BOOLEAN& ccm__enabled)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 621, TTCN_Location::LOCATION_FUNCTION, "main_client");
current_location.update_lineno(625);
/* IPA_Emulation.ttcnpp, line 625 */
IPA__Emulation__CT_component_g__mode = IpaMode::IPA__MODE__CLIENT;
current_location.update_lineno(626);
/* IPA_Emulation.ttcnpp, line 626 */
IPA__Emulation__CT_component_g__ccm__enabled = ccm__enabled;
current_location.update_lineno(627);
/* IPA_Emulation.ttcnpp, line 627 */
f__connect(remote__host, remote__port, local__host, local__port, ccm__pars);
current_location.update_lineno(628);
/* IPA_Emulation.ttcnpp, line 628 */
if (IPA__Emulation__CT_component_g__ccm__enabled) {
current_location.update_lineno(630);
/* IPA_Emulation.ttcnpp, line 630 */
f__ccm__tx(ts__IPA__ACK.valueof(), INTEGER(IPA__Emulation__CT_component_g__self__conn__id));
}
current_location.update_lineno(632);
/* IPA_Emulation.ttcnpp, line 632 */
f__send__IPA__EVT(ts__ASP__IPA__EV(ASP__IPA__EventType::ASP__IPA__EVENT__UP, IPA__Emulation__CT_component_g__self__conn__id, ts__ASP__IPA__EV_id__resp_defval));
current_location.update_lineno(633);
/* IPA_Emulation.ttcnpp, line 633 */
ScanEvents();
}

void start_main__client(const COMPONENT& component_reference, const CHARSTRING& remote__host, const INTEGER& remote__port, const CHARSTRING& local__host, const INTEGER& local__port, const IPA__CCM__Parameters& ccm__pars, const BOOLEAN& ccm__enabled)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function main_client(");
remote__host.log();
TTCN_Logger::log_event_str(", ");
remote__port.log();
TTCN_Logger::log_event_str(", ");
local__host.log();
TTCN_Logger::log_event_str(", ");
local__port.log();
TTCN_Logger::log_event_str(", ");
ccm__pars.log();
TTCN_Logger::log_event_str(", ");
ccm__enabled.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "main_client", text_buf);
remote__host.encode_text(text_buf);
remote__port.encode_text(text_buf);
local__host.encode_text(text_buf);
local__port.encode_text(text_buf);
ccm__pars.encode_text(text_buf);
ccm__enabled.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void main__server(const CHARSTRING& local__host, const INTEGER& local__port, const BOOLEAN& ccm__enabled, const IpaInitBehavior& init__behavior, const BOOLEAN& server__stop__on__ipa__ev__down)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 637, TTCN_Location::LOCATION_FUNCTION, "main_server");
current_location.update_lineno(642);
/* IPA_Emulation.ttcnpp, line 642 */
IPA__Emulation__CT_component_g__mode = IpaMode::IPA__MODE__SERVER;
current_location.update_lineno(643);
/* IPA_Emulation.ttcnpp, line 643 */
IPA__Emulation__CT_component_g__ccm__enabled = ccm__enabled;
current_location.update_lineno(644);
/* IPA_Emulation.ttcnpp, line 644 */
IPA__Emulation__CT_component_g__init__behavior = init__behavior;
current_location.update_lineno(645);
/* IPA_Emulation.ttcnpp, line 645 */
IPA__Emulation__CT_component_g__server__stop__on__ipa__ev__down = server__stop__on__ipa__ev__down;
current_location.update_lineno(646);
/* IPA_Emulation.ttcnpp, line 646 */
f__bind(local__host, local__port, f__bind_ccm__pars_defval);
current_location.update_lineno(647);
/* IPA_Emulation.ttcnpp, line 647 */
ScanEvents();
}

void start_main__server(const COMPONENT& component_reference, const CHARSTRING& local__host, const INTEGER& local__port, const BOOLEAN& ccm__enabled, const IpaInitBehavior& init__behavior, const BOOLEAN& server__stop__on__ipa__ev__down)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function main_server(");
local__host.log();
TTCN_Logger::log_event_str(", ");
local__port.log();
TTCN_Logger::log_event_str(", ");
ccm__enabled.log();
TTCN_Logger::log_event_str(", ");
init__behavior.log();
TTCN_Logger::log_event_str(", ");
server__stop__on__ipa__ev__down.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "main_server", text_buf);
local__host.encode_text(text_buf);
local__port.encode_text(text_buf);
ccm__enabled.encode_text(text_buf);
init__behavior.encode_text(text_buf);
server__stop__on__ipa__ev__down.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void f__ctrl__to__user(const OCTETSTRING& msg)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 651, TTCN_Location::LOCATION_FUNCTION, "f_ctrl_to_user");
current_location.update_lineno(652);
/* IPA_Emulation.ttcnpp, line 652 */
CHARSTRING msg__ch(oct2char(msg));
current_location.update_lineno(653);
/* IPA_Emulation.ttcnpp, line 653 */
IPA__Emulation__CT_component_IPA__CTRL__PORT.send(Osmocom__CTRL__Types::dec__CtrlMessage(msg__ch), NULL);
}

void start_f__ctrl__to__user(const COMPONENT& component_reference, const OCTETSTRING& msg)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ctrl_to_user(");
msg.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_ctrl_to_user", text_buf);
msg.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

INTEGER f__ipa__conn__id()
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 708, TTCN_Location::LOCATION_FUNCTION, "f_ipa_conn_id");
current_location.update_lineno(710);
/* IPA_Emulation.ttcnpp, line 710 */
INTEGER conn__id;
{
const IpaMode &tmp_69 = IPA__Emulation__CT_component_g__mode;
current_location.update_lineno(713);
/* IPA_Emulation.ttcnpp, line 713 */
if(tmp_69 == IpaMode::IPA__MODE__CLIENT) goto tmp_68_0;
current_location.update_lineno(714);
/* IPA_Emulation.ttcnpp, line 714 */
if(tmp_69 == IpaMode::IPA__MODE__SERVER) goto tmp_68_1;
goto tmp_68_2;
tmp_68_0:
{
current_location.update_lineno(713);
/* IPA_Emulation.ttcnpp, line 713 */
conn__id = IPA__Emulation__CT_component_g__self__conn__id;
goto tmp_68_end;
}
tmp_68_1:
{
current_location.update_lineno(714);
/* IPA_Emulation.ttcnpp, line 714 */
conn__id = IPA__Emulation__CT_component_g__last__conn__id;
goto tmp_68_end;
}
tmp_68_2:
{
current_location.update_lineno(716);
/* IPA_Emulation.ttcnpp, line 716 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unknown mode"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(717);
/* IPA_Emulation.ttcnpp, line 717 */
TTCN_Runtime::stop_component(MTC_COMPREF);
}
tmp_68_end: /* empty */;
}
current_location.update_lineno(721);
/* IPA_Emulation.ttcnpp, line 721 */
if ((conn__id == -1)) {
current_location.update_lineno(722);
/* IPA_Emulation.ttcnpp, line 722 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Connection is not established"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(723);
/* IPA_Emulation.ttcnpp, line 723 */
TTCN_Runtime::stop_component(MTC_COMPREF);
}
current_location.update_lineno(726);
/* IPA_Emulation.ttcnpp, line 726 */
return conn__id;
}

void start_f__ipa__conn__id(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ipa_conn_id(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "f_ipa_conn_id", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void ScanEvents()
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 730, TTCN_Location::LOCATION_FUNCTION, "ScanEvents");
current_location.update_lineno(731);
/* IPA_Emulation.ttcnpp, line 731 */
IPA__CodecPort::IPA__RecvFrom ipa__rx;
current_location.update_lineno(732);
/* IPA_Emulation.ttcnpp, line 732 */
Socket__API__Definitions::PortEvent asp__evt;
current_location.update_lineno(733);
/* IPA_Emulation.ttcnpp, line 733 */
Socket__API__Definitions::PortEvent port__evt;
current_location.update_lineno(734);
/* IPA_Emulation.ttcnpp, line 734 */
OCTETSTRING payload;
current_location.update_lineno(735);
/* IPA_Emulation.ttcnpp, line 735 */
ASP__IPA__Unitdata ipa__ud;
current_location.update_lineno(736);
/* IPA_Emulation.ttcnpp, line 736 */
Socket__API__Definitions::Result res;
current_location.update_lineno(737);
/* IPA_Emulation.ttcnpp, line 737 */
BOOLEAN cfg__chg__ccm__enabled;
current_location.update_lineno(739);
/* IPA_Emulation.ttcnpp, line 739 */
Osmocom__CTRL__Types::CtrlMessage ctrl__msg;
current_location.update_lineno(768);
/* IPA_Emulation.ttcnpp, line 768 */
Socket__API__Definitions::f__getMsgLen vl__f(&IPL4asp__PortType::f__IPL4__fixedMsgLen);
current_location.update_lineno(769);
/* IPA_Emulation.ttcnpp, line 769 */
{
Socket__API__Definitions::ro__integer tmp_72;
tmp_72.set_size(5);
tmp_72[0] = 0;
tmp_72[1] = 2;
tmp_72[2] = 3;
tmp_72[3] = 1;
tmp_72[4] = 0;
IPA__CodecPort__CtrlFunct::f__IPL4__setGetMsgLen(IPA__Emulation__CT_component_IPA__PORT, IPA__Emulation__CT_component_g__self__conn__id, vl__f, tmp_72);
}
for ( ; ; ) {
current_location.update_lineno(772);
/* IPA_Emulation.ttcnpp, line 772 */
{
tmp_73:
alt_status tmp_73_alt_flag_0 = ALT_UNCHECKED;
alt_status tmp_73_alt_flag_1 = ALT_MAYBE;
alt_status tmp_73_alt_flag_2 = ALT_MAYBE;
alt_status tmp_73_alt_flag_3 = ALT_MAYBE;
alt_status tmp_73_alt_flag_4 = ALT_MAYBE;
alt_status tmp_73_alt_flag_5 = ALT_MAYBE;
alt_status tmp_73_alt_flag_6 = ALT_MAYBE;
alt_status tmp_73_alt_flag_7 = ALT_MAYBE;
alt_status tmp_73_alt_flag_8 = ALT_MAYBE;
alt_status tmp_73_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_73_alt_flag_0 == ALT_UNCHECKED) {
current_location.update_lineno(774);
/* IPA_Emulation.ttcnpp, line 774 */
if (IPA__Emulation__CT_component_g__ccm__enabled) tmp_73_alt_flag_0 = ALT_MAYBE;
else tmp_73_alt_flag_0 = ALT_NO;
}
if (tmp_73_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(774);
/* IPA_Emulation.ttcnpp, line 774 */
{
IPA__CodecPort::IPA__RecvFrom_template tmp_74;
tmp_74.connId() = ANY_VALUE;
tmp_74.streamId() = IPA__Types::IpaStreamId::IPAC__PROTO__CCM;
tmp_74.streamIdExt() = OMIT_VALUE;
tmp_74.msg() = ANY_VALUE;
tmp_73_alt_flag_0 = IPA__Emulation__CT_component_IPA__PORT.receive(tmp_74, &(ipa__rx), any_compref, NULL, NULL, NULL);
}
if (tmp_73_alt_flag_0 == ALT_YES) {
current_location.update_lineno(775);
/* IPA_Emulation.ttcnpp, line 775 */
IPA__Types::PDU__IPA__CCM ccm(IPA__Types::dec__PDU__IPA__CCM(const_cast< const IPA__CodecPort::IPA__RecvFrom&>(ipa__rx).msg()));
current_location.update_lineno(776);
/* IPA_Emulation.ttcnpp, line 776 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("CCM Rx:");
ccm.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
{
const IpaMode &tmp_76 = IPA__Emulation__CT_component_g__mode;
current_location.update_lineno(778);
/* IPA_Emulation.ttcnpp, line 778 */
if(tmp_76 == IpaMode::IPA__MODE__CLIENT) goto tmp_75_0;
current_location.update_lineno(781);
/* IPA_Emulation.ttcnpp, line 781 */
if(tmp_76 == IpaMode::IPA__MODE__SERVER) goto tmp_75_1;
goto tmp_75_2;
tmp_75_0:
{
current_location.update_lineno(779);
/* IPA_Emulation.ttcnpp, line 779 */
f__ccm__rx__client(ccm);
goto tmp_75_end;
}
tmp_75_1:
{
current_location.update_lineno(782);
/* IPA_Emulation.ttcnpp, line 782 */
f__ccm__rx__server(ccm, const_cast< const IPA__CodecPort::IPA__RecvFrom&>(ipa__rx).connId());
goto tmp_75_end;
}
tmp_75_2:
{
current_location.update_lineno(785);
/* IPA_Emulation.ttcnpp, line 785 */
TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unknown mode"),TTCN_Logger::end_event_log2str()));
current_location.update_lineno(786);
/* IPA_Emulation.ttcnpp, line 786 */
TTCN_Runtime::stop_component(MTC_COMPREF);
}
tmp_75_end: /* empty */;
}
break;
}
}
if (tmp_73_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(790);
/* IPA_Emulation.ttcnpp, line 790 */
tmp_73_alt_flag_1 = IPA__Emulation__CT_component_IPA__PORT.receive(IPA__CodecPort::IPA__RecvFrom_template(ANY_VALUE), &(ipa__rx), any_compref, NULL, NULL, NULL);
if (tmp_73_alt_flag_1 == ALT_YES) {
{
const IPA__Types::IpaStreamId &tmp_78 = const_cast< const IPA__CodecPort::IPA__RecvFrom&>(ipa__rx).streamId();
current_location.update_lineno(820);
/* IPA_Emulation.ttcnpp, line 820 */
if(tmp_78 == IPA__Types::IpaStreamId::IPAC__PROTO__OSMO) goto tmp_77_0;
goto tmp_77_1;
tmp_77_0:
{
{
const IPA__Types::IpaExtStreamId &tmp_80 = const_cast< const IPA__CodecPort::IPA__RecvFrom&>(ipa__rx).streamIdExt()();
current_location.update_lineno(828);
/* IPA_Emulation.ttcnpp, line 828 */
if(tmp_80 == IPA__Types::IpaExtStreamId::IPAC__PROTO__EXT__CTRL) goto tmp_79_0;
goto tmp_79_1;
tmp_79_0:
{
current_location.update_lineno(829);
/* IPA_Emulation.ttcnpp, line 829 */
f__ctrl__to__user(const_cast< const IPA__CodecPort::IPA__RecvFrom&>(ipa__rx).msg());
goto tmp_79_end;
}
tmp_79_1:
{
current_location.update_lineno(853);
/* IPA_Emulation.ttcnpp, line 853 */
IPA__Emulation__CT_component_IPA__SP__PORT.send(f__to__asp(ipa__rx), NULL);
goto tmp_79_end;
}
tmp_79_end: /* empty */;
}
goto tmp_77_end;
}
tmp_77_1:
{
current_location.update_lineno(858);
/* IPA_Emulation.ttcnpp, line 858 */
IPA__Emulation__CT_component_IPA__SP__PORT.send(f__to__asp(ipa__rx), NULL);
goto tmp_77_end;
}
tmp_77_end: /* empty */;
}
break;
}
}
if (tmp_73_alt_flag_2 == ALT_MAYBE) {
current_location.update_lineno(864);
/* IPA_Emulation.ttcnpp, line 864 */
{
Socket__API__Definitions::PortEvent_template tmp_81;
tmp_81.connOpened() = ANY_VALUE;
tmp_73_alt_flag_2 = IPA__Emulation__CT_component_IPA__PORT.receive(tmp_81, &(asp__evt), any_compref, NULL, NULL, NULL);
}
if (tmp_73_alt_flag_2 == ALT_YES) {
current_location.update_lineno(865);
/* IPA_Emulation.ttcnpp, line 865 */
IPA__Emulation__CT_component_g__last__conn__id = const_cast< const Socket__API__Definitions::PortEvent&>(asp__evt).connOpened().connId();
current_location.update_lineno(866);
/* IPA_Emulation.ttcnpp, line 866 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("Established a new IPA connection (conn_id=");
IPA__Emulation__CT_component_g__last__conn__id.log();
TTCN_Logger::log_char(')');
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(868);
/* IPA_Emulation.ttcnpp, line 868 */
f__send__IPA__EVT(ts__ASP__IPA__EV(ASP__IPA__EventType::ASP__IPA__EVENT__UP, IPA__Emulation__CT_component_g__last__conn__id, ts__ASP__IPA__EV_id__resp_defval));
current_location.update_lineno(869);
/* IPA_Emulation.ttcnpp, line 869 */
if (((IPA__Emulation__CT_component_g__mode == IpaMode::IPA__MODE__SERVER) && IPA__Emulation__CT_component_g__ccm__enabled)) {
{
const IpaInitBehavior &tmp_84 = IPA__Emulation__CT_component_g__init__behavior;
current_location.update_lineno(871);
/* IPA_Emulation.ttcnpp, line 871 */
if(tmp_84 == IpaInitBehavior::IPA__INIT__SEND__IPA__ID__GET) goto tmp_83_0;
current_location.update_lineno(874);
/* IPA_Emulation.ttcnpp, line 874 */
if(tmp_84 == IpaInitBehavior::IPA__INIT__SEND__IPA__ID__ACK) goto tmp_83_1;
goto tmp_83_end;
tmp_83_0:
{
current_location.update_lineno(872);
/* IPA_Emulation.ttcnpp, line 872 */
f__ccm__tx(ts__IPA__ID__GET.valueof(), INTEGER(IPA__Emulation__CT_component_g__last__conn__id));
goto tmp_83_end;
}
tmp_83_1:
{
current_location.update_lineno(875);
/* IPA_Emulation.ttcnpp, line 875 */
f__ccm__tx(ts__IPA__ACK.valueof(), INTEGER(IPA__Emulation__CT_component_g__last__conn__id));
goto tmp_83_end;
}
tmp_83_end: /* empty */;
}
}
break;
}
}
if (tmp_73_alt_flag_3 == ALT_MAYBE) {
current_location.update_lineno(881);
/* IPA_Emulation.ttcnpp, line 881 */
{
Socket__API__Definitions::PortEvent_template tmp_85;
tmp_85.connClosed() = ANY_VALUE;
tmp_73_alt_flag_3 = IPA__Emulation__CT_component_IPA__PORT.receive(tmp_85, &(asp__evt), any_compref, NULL, NULL, NULL);
}
if (tmp_73_alt_flag_3 == ALT_YES) {
current_location.update_lineno(882);
/* IPA_Emulation.ttcnpp, line 882 */
TTCN_Logger::log_str(TTCN_USER, "IPA: Closed");
current_location.update_lineno(883);
/* IPA_Emulation.ttcnpp, line 883 */
IPA__Emulation__CT_component_g__self__conn__id = -1;
current_location.update_lineno(884);
/* IPA_Emulation.ttcnpp, line 884 */
f__send__IPA__EVT(ts__ASP__IPA__EV(ASP__IPA__EventType::ASP__IPA__EVENT__DOWN, const_cast< const Socket__API__Definitions::PortEvent&>(asp__evt).connClosed().connId(), ts__ASP__IPA__EV_id__resp_defval));
current_location.update_lineno(885);
/* IPA_Emulation.ttcnpp, line 885 */
if (((IPA__Emulation__CT_component_g__mode != IpaMode::IPA__MODE__SERVER) || IPA__Emulation__CT_component_g__server__stop__on__ipa__ev__down)) {
current_location.update_lineno(886);
/* IPA_Emulation.ttcnpp, line 886 */
TTCN_Runtime::stop_execution();
}
break;
}
}
if (tmp_73_alt_flag_4 == ALT_MAYBE) {
current_location.update_lineno(890);
/* IPA_Emulation.ttcnpp, line 890 */
{
Socket__API__Definitions::PortEvent_template tmp_87;
{
Socket__API__Definitions::Result_template& tmp_88 = tmp_87.result();
tmp_88.errorCode() = Socket__API__Definitions::PortError::ERROR__SOCKET;
tmp_88.connId() = ANY_VALUE;
tmp_88.os__error__code() = ANY_VALUE;
tmp_88.os__error__text() = ANY_VALUE;
}
tmp_73_alt_flag_4 = IPA__Emulation__CT_component_IPA__PORT.receive(tmp_87, &(port__evt), any_compref, NULL, NULL, NULL);
}
if (tmp_73_alt_flag_4 == ALT_YES) {
current_location.update_lineno(891);
/* IPA_Emulation.ttcnpp, line 891 */
try {
TTCN_Logger::begin_event(TTCN_USER);
TTCN_Logger::log_event_str("PortEvent: ERROR_SOCKET: ");
port__evt.log();
TTCN_Logger::end_event();
} catch (...) {
TTCN_Logger::finish_event();
throw;
}
current_location.update_lineno(892);
/* IPA_Emulation.ttcnpp, line 892 */
IPA__Emulation__CT_component_g__self__conn__id = -1;
current_location.update_lineno(893);
/* IPA_Emulation.ttcnpp, line 893 */
f__send__IPA__EVT(ts__ASP__IPA__EV(ASP__IPA__EventType::ASP__IPA__EVENT__DOWN, const_cast< const Socket__API__Definitions::PortEvent&>(port__evt).result().connId(), ts__ASP__IPA__EV_id__resp_defval));
current_location.update_lineno(894);
/* IPA_Emulation.ttcnpp, line 894 */
TTCN_Runtime::stop_execution();
}
}
if (tmp_73_alt_flag_5 == ALT_MAYBE) {
current_location.update_lineno(921);
/* IPA_Emulation.ttcnpp, line 921 */
tmp_73_alt_flag_5 = IPA__Emulation__CT_component_IPA__CTRL__PORT.receive(Osmocom__CTRL__Types::CtrlMessage_template(ANY_VALUE), &(ctrl__msg), any_compref, NULL, NULL, NULL);
if (tmp_73_alt_flag_5 == ALT_YES) {
current_location.update_lineno(922);
/* IPA_Emulation.ttcnpp, line 922 */
payload = char2oct(Osmocom__CTRL__Types::enc__CtrlMessage(ctrl__msg));
current_location.update_lineno(923);
/* IPA_Emulation.ttcnpp, line 923 */
ipa__ud = t__ASP__IPA__UD(IPA__Types::IpaStreamId::IPAC__PROTO__OSMO, payload, IPA__Types::IpaExtStreamId_template(IPA__Types::IpaExtStreamId::IPAC__PROTO__EXT__CTRL)).valueof();
current_location.update_lineno(924);
/* IPA_Emulation.ttcnpp, line 924 */
IPA__Emulation__CT_component_IPA__PORT.send(f__from__asp(f__ipa__conn__id(), ipa__ud), NULL);
break;
}
}
if (tmp_73_alt_flag_6 == ALT_MAYBE) {
current_location.update_lineno(977);
/* IPA_Emulation.ttcnpp, line 977 */
tmp_73_alt_flag_6 = IPA__Emulation__CT_component_IPA__SP__PORT.receive(ASP__IPA__Unitdata_template(ANY_VALUE), &(ipa__ud), any_compref, NULL, NULL, NULL);
if (tmp_73_alt_flag_6 == ALT_YES) {
current_location.update_lineno(978);
/* IPA_Emulation.ttcnpp, line 978 */
IPA__Emulation__CT_component_IPA__PORT.send(f__from__asp(f__ipa__conn__id(), ipa__ud), NULL);
break;
}
}
if (tmp_73_alt_flag_7 == ALT_MAYBE) {
current_location.update_lineno(982);
/* IPA_Emulation.ttcnpp, line 982 */
{
IPA__CFG__disconnect_template tmp_92;
tmp_92.res() = ANY_VALUE;
tmp_73_alt_flag_7 = IPA__Emulation__CT_component_CFG__PORT.getcall(tmp_92, any_compref, IPA__CFG__disconnect_call_redirect(), NULL, NULL, NULL);
}
if (tmp_73_alt_flag_7 == ALT_YES) {
current_location.update_lineno(983);
/* IPA_Emulation.ttcnpp, line 983 */
res = f__close();
current_location.update_lineno(984);
/* IPA_Emulation.ttcnpp, line 984 */
{
IPA__CFG__disconnect_template tmp_94;
tmp_94.res() = res;
IPA__Emulation__CT_component_CFG__PORT.reply(tmp_94, NULL);
}
break;
}
}
if (tmp_73_alt_flag_8 == ALT_MAYBE) {
current_location.update_lineno(987);
/* IPA_Emulation.ttcnpp, line 987 */
{
IPA__CFG__chg__ccm__enabled_template tmp_95;
tmp_95.res() = ANY_VALUE;
tmp_73_alt_flag_8 = IPA__Emulation__CT_component_CFG__PORT.getcall(tmp_95, any_compref, IPA__CFG__chg__ccm__enabled_call_redirect(&(cfg__chg__ccm__enabled)), NULL, NULL, NULL);
}
if (tmp_73_alt_flag_8 == ALT_YES) {
current_location.update_lineno(988);
/* IPA_Emulation.ttcnpp, line 988 */
IPA__Emulation__CT_component_g__ccm__enabled = cfg__chg__ccm__enabled;
current_location.update_lineno(989);
/* IPA_Emulation.ttcnpp, line 989 */
{
IPA__CFG__chg__ccm__enabled_template tmp_97;
tmp_97.res() = cfg__chg__ccm__enabled;
IPA__Emulation__CT_component_CFG__PORT.reply(tmp_97, NULL);
}
break;
}
}
if (tmp_73_default_flag == ALT_MAYBE) {
tmp_73_default_flag = TTCN_Default::try_altsteps();
if (tmp_73_default_flag == ALT_YES || tmp_73_default_flag == ALT_BREAK) break;
else if (tmp_73_default_flag == ALT_REPEAT) goto tmp_73;
}
current_location.update_lineno(772);
/* IPA_Emulation.ttcnpp, line 772 */
if (tmp_73_alt_flag_0 == ALT_NO && tmp_73_alt_flag_1 == ALT_NO && tmp_73_alt_flag_2 == ALT_NO && tmp_73_alt_flag_3 == ALT_NO && tmp_73_alt_flag_4 == ALT_NO && tmp_73_alt_flag_5 == ALT_NO && tmp_73_alt_flag_6 == ALT_NO && tmp_73_alt_flag_7 == ALT_NO && tmp_73_alt_flag_8 == ALT_NO && tmp_73_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file IPA_Emulation.ttcnpp between lines 772 and 992.");
TTCN_Snapshot::take_new(TRUE);
}
}
}
}

void start_ScanEvents(const COMPONENT& component_reference)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function ScanEvents(");
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "ScanEvents", text_buf);
TTCN_Runtime::send_start_component(text_buf);
}

void waiter__main(const ASP__IPA__Event_template& wait__for)
{
TTCN_Location current_location("IPA_Emulation.ttcnpp", 1004, TTCN_Location::LOCATION_FUNCTION, "waiter_main");
current_location.update_lineno(1007);
/* IPA_Emulation.ttcnpp, line 1007 */
{
tmp_98:
alt_status tmp_98_alt_flag_0 = ALT_MAYBE;
alt_status tmp_98_alt_flag_1 = ALT_MAYBE;
alt_status tmp_98_default_flag = ALT_MAYBE;
TTCN_Snapshot::take_new(FALSE);
for ( ; ; ) {
if (tmp_98_alt_flag_0 == ALT_MAYBE) {
current_location.update_lineno(1008);
/* IPA_Emulation.ttcnpp, line 1008 */
tmp_98_alt_flag_0 = IPA__EventWaiter__CT_component_IPA__SP__PORT.receive(wait__for, NULL, any_compref, NULL, NULL, NULL);
if (tmp_98_alt_flag_0 == ALT_YES) {
current_location.update_lineno(1009);
/* IPA_Emulation.ttcnpp, line 1009 */
TTCN_Runtime::setverdict(PASS);
break;
}
}
if (tmp_98_alt_flag_1 == ALT_MAYBE) {
current_location.update_lineno(1011);
/* IPA_Emulation.ttcnpp, line 1011 */
tmp_98_alt_flag_1 = IPA__EventWaiter__CT_component_IPA__SP__PORT.receive(any_compref, NULL, NULL, NULL);
if (tmp_98_alt_flag_1 == ALT_YES) {
current_location.update_lineno(1011);
/* IPA_Emulation.ttcnpp, line 1011 */
goto tmp_98;
}
}
if (tmp_98_default_flag == ALT_MAYBE) {
tmp_98_default_flag = TTCN_Default::try_altsteps();
if (tmp_98_default_flag == ALT_YES || tmp_98_default_flag == ALT_BREAK) break;
else if (tmp_98_default_flag == ALT_REPEAT) goto tmp_98;
}
current_location.update_lineno(1007);
/* IPA_Emulation.ttcnpp, line 1007 */
if (tmp_98_alt_flag_0 == ALT_NO && tmp_98_alt_flag_1 == ALT_NO && tmp_98_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file IPA_Emulation.ttcnpp between lines 1007 and 1012.");
TTCN_Snapshot::take_new(TRUE);
}
}
}

void start_waiter__main(const COMPONENT& component_reference, const ASP__IPA__Event_template& wait__for)
{
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function waiter_main(");
wait__for.log();
TTCN_Logger::log_event_str(") on component ");
component_reference.log();
TTCN_Logger::log_char('.');
TTCN_Logger::end_event();
Text_Buf text_buf;
TTCN_Runtime::prepare_start_component(component_reference, "IPA_Emulation", "waiter_main", text_buf);
wait__for.encode_text(text_buf);
TTCN_Runtime::send_start_component(text_buf);
}


/* Bodies of static functions */

void pre_init_module()
{
TTCN_Location current_location("IPA_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "IPA_Emulation");
IPA__CodecPort__CtrlFunct::module_object.pre_init_module();
Osmocom__CTRL__Types::module_object.pre_init_module();
current_location.update_lineno(69);
/* IPA_Emulation.ttcnpp, line 69 */
modulepar_mp__ipa__mgcp__uses__osmo__ext = TRUE;
module_object.add_modulepar("mp_ipa_mgcp_uses_osmo_ext");
current_location.update_lineno(294);
/* IPA_Emulation.ttcnpp, line 294 */
const_c__IPA__default__ccm__pars.ser__nr() = cs_0;
const_c__IPA__default__ccm__pars.name() = cs_1;
const_c__IPA__default__ccm__pars.location1() = cs_0;
const_c__IPA__default__ccm__pars.location2() = cs_0;
const_c__IPA__default__ccm__pars.equip__version() = cs_0;
const_c__IPA__default__ccm__pars.sw__version() = cs_0;
const_c__IPA__default__ccm__pars.ip__addr() = cs_0;
const_c__IPA__default__ccm__pars.mac__addr() = cs_0;
const_c__IPA__default__ccm__pars.unit__id() = cs_2;
const_c__IPA__default__ccm__pars.osmo__rand() = cs_0;
module_object.add_function("f_ipa_cfg_disconnect", (genericfunc_t)&f__ipa__cfg__disconnect, NULL);
module_object.add_function("f_ipa_cfg_chg_ccm_enabled", (genericfunc_t)&f__ipa__cfg__chg__ccm__enabled, NULL);
module_object.add_function("f_connect", (genericfunc_t)&f__connect, (genericfunc_t)&start_f__connect);
module_object.add_function("f_bind", (genericfunc_t)&f__bind, (genericfunc_t)&start_f__bind);
module_object.add_function("f_close", (genericfunc_t)&f__close, (genericfunc_t)&start_f__close);
module_object.add_function("f_send_IPA_EVT", (genericfunc_t)&f__send__IPA__EVT, (genericfunc_t)&start_f__send__IPA__EVT);
module_object.add_function("f_ccm_make_id_resp", (genericfunc_t)&f__ccm__make__id__resp, (genericfunc_t)&start_f__ccm__make__id__resp);
module_object.add_function("f_ccm_tx", (genericfunc_t)&f__ccm__tx, (genericfunc_t)&start_f__ccm__tx);
module_object.add_function("f_ccm_rx_client", (genericfunc_t)&f__ccm__rx__client, (genericfunc_t)&start_f__ccm__rx__client);
module_object.add_function("f_ccm_rx_server", (genericfunc_t)&f__ccm__rx__server, (genericfunc_t)&start_f__ccm__rx__server);
module_object.add_function("f_to_asp", (genericfunc_t)&f__to__asp, NULL);
module_object.add_function("f_from_asp", (genericfunc_t)&f__from__asp, NULL);
module_object.add_function("main_client", (genericfunc_t)&main__client, (genericfunc_t)&start_main__client);
module_object.add_function("main_server", (genericfunc_t)&main__server, (genericfunc_t)&start_main__server);
module_object.add_function("f_ctrl_to_user", (genericfunc_t)&f__ctrl__to__user, (genericfunc_t)&start_f__ctrl__to__user);
module_object.add_function("f_ipa_conn_id", (genericfunc_t)&f__ipa__conn__id, (genericfunc_t)&start_f__ipa__conn__id);
module_object.add_function("ScanEvents", (genericfunc_t)&ScanEvents, (genericfunc_t)&start_ScanEvents);
module_object.add_function("waiter_main", (genericfunc_t)&waiter__main, (genericfunc_t)&start_waiter__main);
}

void post_init_module()
{
TTCN_Location current_location("IPA_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "IPA_Emulation");
IPA__CodecPort__CtrlFunct::module_object.post_init_module();
Osmocom__CTRL__Types::module_object.post_init_module();
current_location.update_lineno(106);
/* IPA_Emulation.ttcnpp, line 106 */
template_ts__ASP__IPA__EV_id__resp_defval = OMIT_VALUE;
current_location.update_lineno(113);
/* IPA_Emulation.ttcnpp, line 113 */
template_tr__ASP__IPA__EV_conn__id_defval = ANY_VALUE;
current_location.update_lineno(114);
/* IPA_Emulation.ttcnpp, line 114 */
template_tr__ASP__IPA__EV_id__resp_defval = ANY_OR_OMIT;
current_location.update_lineno(121);
/* IPA_Emulation.ttcnpp, line 121 */
template_t__ASP__IPA__UD_esid_defval = OMIT_VALUE;
current_location.update_lineno(328);
/* IPA_Emulation.ttcnpp, line 328 */
const_f__connect_ccm__pars_defval = c__IPA__default__ccm__pars;
current_location.update_lineno(344);
/* IPA_Emulation.ttcnpp, line 344 */
const_f__bind_ccm__pars_defval = c__IPA__default__ccm__pars;
current_location.update_lineno(502);
/* IPA_Emulation.ttcnpp, line 502 */
template_ts__IPA__PONG.msg__type() = IPA__Types::IpaCcmMsgtype::IPAC__MSGT__PONG;
template_ts__IPA__PONG.u() = OMIT_VALUE;
current_location.update_lineno(507);
/* IPA_Emulation.ttcnpp, line 507 */
template_ts__IPA__ACK.msg__type() = IPA__Types::IpaCcmMsgtype::IPAC__MSGT__ID__ACK;
template_ts__IPA__ACK.u() = OMIT_VALUE;
current_location.update_lineno(512);
/* IPA_Emulation.ttcnpp, line 512 */
template_ts__IPA__ID__GET.msg__type() = IPA__Types::IpaCcmMsgtype::IPAC__MSGT__ID__GET;
{
IPA__Types::IpaCcmIdGet_template& tmp_52 = template_ts__IPA__ID__GET.u().get();
tmp_52.set_size(2);
{
IPA__Types::IpaCcmGetPart_template& tmp_53 = tmp_52[0];
tmp_53.len() = 1;
tmp_53.tag() = IPA__Types::IpaCcmIdTag::IPAC__IDTAG__UNITNAME;
}
{
IPA__Types::IpaCcmGetPart_template& tmp_54 = tmp_52[1];
tmp_54.len() = 1;
tmp_54.tag() = IPA__Types::IpaCcmIdTag::IPAC__IDTAG__UNITID;
}
}
current_location.update_lineno(522);
/* IPA_Emulation.ttcnpp, line 522 */
template_tr__IPA__ID__RESP.msg__type() = IPA__Types::IpaCcmMsgtype::IPAC__MSGT__ID__RESP;
{
IPA__Types::IpaCcmIdResp_template& tmp_55 = template_tr__IPA__ID__RESP.u().resp();
tmp_55.set_size(2);
{
IPA__Types::IpaCcmRespPart_template& tmp_56 = tmp_55[0];
tmp_56.len() = ANY_VALUE;
tmp_56.tag() = IPA__Types::IpaCcmIdTag::IPAC__IDTAG__UNITNAME;
tmp_56.data() = ANY_VALUE;
}
{
IPA__Types::IpaCcmRespPart_template& tmp_57 = tmp_55[1];
tmp_57.len() = ANY_VALUE;
tmp_57.tag() = IPA__Types::IpaCcmIdTag::IPAC__IDTAG__UNITID;
tmp_57.data() = ANY_VALUE;
}
}
current_location.update_lineno(623);
/* IPA_Emulation.ttcnpp, line 623 */
const_main__client_ccm__pars_defval = c__IPA__default__ccm__pars;
current_location.update_lineno(624);
/* IPA_Emulation.ttcnpp, line 624 */
const_main__client_ccm__enabled_defval = TRUE;
current_location.update_lineno(638);
/* IPA_Emulation.ttcnpp, line 638 */
const_main__server_ccm__enabled_defval = TRUE;
current_location.update_lineno(639);
/* IPA_Emulation.ttcnpp, line 639 */
const_main__server_init__behavior_defval = IpaInitBehavior::IPA__INIT__SEND__IPA__ID__GET;
current_location.update_lineno(640);
/* IPA_Emulation.ttcnpp, line 640 */
const_main__server_server__stop__on__ipa__ev__down_defval = TRUE;
current_location.update_lineno(1004);
/* IPA_Emulation.ttcnpp, line 1004 */
template_waiter__main_wait__for_defval = tr__ASP__IPA__EV(ASP__IPA__EventType_template(ASP__IPA__EventType::ASP__IPA__EVENT__ID__ACK), tr__ASP__IPA__EV_conn__id_defval, tr__ASP__IPA__EV_id__resp_defval);
}

boolean set_module_param(Module_Param& param)
{
const char* const par_name = param.get_id()->get_current_name();
if (!strcmp(par_name, "mp_ipa_mgcp_uses_osmo_ext")) {
modulepar_mp__ipa__mgcp__uses__osmo__ext.set_param(param);
return TRUE;
} else return FALSE;
}

void log_module_param()
{
TTCN_Logger::log_event_str("mp_ipa_mgcp_uses_osmo_ext := ");
mp__ipa__mgcp__uses__osmo__ext.log();
}

boolean init_comp_type(const char *component_type, boolean init_base_comps)
{
(void)init_base_comps;
if (!strcmp(component_type, "IPA_Emulation_CT")) {
IPA__Emulation__CT_component_IPA__PORT.activate_port();
IPA__Emulation__CT_component_CFG__PORT.activate_port();
IPA__Emulation__CT_component_IPA__CTRL__PORT.activate_port();
IPA__Emulation__CT_component_IPA__SP__PORT.activate_port();
IPA__Emulation__CT_component_g__initialized = FALSE;
IPA__Emulation__CT_component_g__is__bsc__mgw.clean_up();
IPA__Emulation__CT_component_g__self__conn__id = -1;
IPA__Emulation__CT_component_g__last__conn__id = -1;
IPA__Emulation__CT_component_g__mode.clean_up();
IPA__Emulation__CT_component_g__ccm__enabled.clean_up();
IPA__Emulation__CT_component_g__init__behavior.clean_up();
IPA__Emulation__CT_component_g__server__stop__on__ipa__ev__down = TRUE;
IPA__Emulation__CT_component_g__ccm__pars = c__IPA__default__ccm__pars;
return TRUE;
} else if (!strcmp(component_type, "IPA_EventWaiter_CT")) {
IPA__EventWaiter__CT_component_IPA__SP__PORT.activate_port();
return TRUE;
} else return FALSE;
}

boolean init_system_port(const char* component_type, const char* port_name)
{
if (!strcmp(component_type, "IPA_Emulation_CT")) {
if (!strcmp(port_name, "CFG_PORT")) {
IPA__Emulation__CT_component_CFG__PORT.safe_start();
return TRUE;
}
if (!strcmp(port_name, "IPA_CTRL_PORT")) {
IPA__Emulation__CT_component_IPA__CTRL__PORT.safe_start();
return TRUE;
}
if (!strcmp(port_name, "IPA_PORT")) {
IPA__Emulation__CT_component_IPA__PORT.safe_start();
return TRUE;
}
if (!strcmp(port_name, "IPA_SP_PORT")) {
IPA__Emulation__CT_component_IPA__SP__PORT.safe_start();
return TRUE;
}
}
else if (!strcmp(component_type, "IPA_EventWaiter_CT")) {
if (!strcmp(port_name, "IPA_SP_PORT")) {
IPA__EventWaiter__CT_component_IPA__SP__PORT.safe_start();
return TRUE;
}
}
return FALSE;
}

boolean start_ptc_function(const char *function_name, Text_Buf& function_arguments)
{
if (!strcmp(function_name, "f_connect")) {
CHARSTRING remote__host;
INTEGER remote__port;
CHARSTRING local__host;
INTEGER local__port;
IPA__CCM__Parameters ccm__pars;
remote__host.decode_text(function_arguments);
remote__port.decode_text(function_arguments);
local__host.decode_text(function_arguments);
local__port.decode_text(function_arguments);
ccm__pars.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_connect(");
remote__host.log();
TTCN_Logger::log_event_str(", ");
remote__port.log();
TTCN_Logger::log_event_str(", ");
local__host.log();
TTCN_Logger::log_event_str(", ");
local__port.log();
TTCN_Logger::log_event_str(", ");
ccm__pars.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__connect(remote__host, remote__port, local__host, local__port, ccm__pars);
TTCN_Runtime::function_finished("f_connect");
return TRUE;
} else if (!strcmp(function_name, "f_bind")) {
CHARSTRING local__host;
INTEGER local__port;
IPA__CCM__Parameters ccm__pars;
local__host.decode_text(function_arguments);
local__port.decode_text(function_arguments);
ccm__pars.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_bind(");
local__host.log();
TTCN_Logger::log_event_str(", ");
local__port.log();
TTCN_Logger::log_event_str(", ");
ccm__pars.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__bind(local__host, local__port, ccm__pars);
TTCN_Runtime::function_finished("f_bind");
return TRUE;
} else if (!strcmp(function_name, "f_close")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_close().");
TTCN_Runtime::function_started(function_arguments);
f__close();
TTCN_Runtime::function_finished("f_close");
return TRUE;
} else if (!strcmp(function_name, "f_send_IPA_EVT")) {
ASP__IPA__Event_template evt;
evt.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_send_IPA_EVT(");
evt.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__send__IPA__EVT(evt);
TTCN_Runtime::function_finished("f_send_IPA_EVT");
return TRUE;
} else if (!strcmp(function_name, "f_ccm_make_id_resp")) {
IPA__Types::PDU__IPA__CCM get;
get.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ccm_make_id_resp(");
get.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ccm__make__id__resp(get);
TTCN_Runtime::function_finished("f_ccm_make_id_resp");
return TRUE;
} else if (!strcmp(function_name, "f_ccm_tx")) {
IPA__Types::PDU__IPA__CCM ccm;
INTEGER conn__id;
ccm.decode_text(function_arguments);
conn__id.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ccm_tx(");
ccm.log();
TTCN_Logger::log_event_str(", ");
conn__id.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ccm__tx(ccm, conn__id);
TTCN_Runtime::function_finished("f_ccm_tx");
return TRUE;
} else if (!strcmp(function_name, "f_ccm_rx_client")) {
IPA__Types::PDU__IPA__CCM ccm;
ccm.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ccm_rx_client(");
ccm.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ccm__rx__client(ccm);
TTCN_Runtime::function_finished("f_ccm_rx_client");
return TRUE;
} else if (!strcmp(function_name, "f_ccm_rx_server")) {
IPA__Types::PDU__IPA__CCM ccm;
INTEGER conn__id;
ccm.decode_text(function_arguments);
conn__id.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ccm_rx_server(");
ccm.log();
TTCN_Logger::log_event_str(", ");
conn__id.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ccm__rx__server(ccm, conn__id);
TTCN_Runtime::function_finished("f_ccm_rx_server");
return TRUE;
} else if (!strcmp(function_name, "main_client")) {
CHARSTRING remote__host;
INTEGER remote__port;
CHARSTRING local__host;
INTEGER local__port;
IPA__CCM__Parameters ccm__pars;
BOOLEAN ccm__enabled;
remote__host.decode_text(function_arguments);
remote__port.decode_text(function_arguments);
local__host.decode_text(function_arguments);
local__port.decode_text(function_arguments);
ccm__pars.decode_text(function_arguments);
ccm__enabled.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function main_client(");
remote__host.log();
TTCN_Logger::log_event_str(", ");
remote__port.log();
TTCN_Logger::log_event_str(", ");
local__host.log();
TTCN_Logger::log_event_str(", ");
local__port.log();
TTCN_Logger::log_event_str(", ");
ccm__pars.log();
TTCN_Logger::log_event_str(", ");
ccm__enabled.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
main__client(remote__host, remote__port, local__host, local__port, ccm__pars, ccm__enabled);
TTCN_Runtime::function_finished("main_client");
return TRUE;
} else if (!strcmp(function_name, "main_server")) {
CHARSTRING local__host;
INTEGER local__port;
BOOLEAN ccm__enabled;
IpaInitBehavior init__behavior;
BOOLEAN server__stop__on__ipa__ev__down;
local__host.decode_text(function_arguments);
local__port.decode_text(function_arguments);
ccm__enabled.decode_text(function_arguments);
init__behavior.decode_text(function_arguments);
server__stop__on__ipa__ev__down.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function main_server(");
local__host.log();
TTCN_Logger::log_event_str(", ");
local__port.log();
TTCN_Logger::log_event_str(", ");
ccm__enabled.log();
TTCN_Logger::log_event_str(", ");
init__behavior.log();
TTCN_Logger::log_event_str(", ");
server__stop__on__ipa__ev__down.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
main__server(local__host, local__port, ccm__enabled, init__behavior, server__stop__on__ipa__ev__down);
TTCN_Runtime::function_finished("main_server");
return TRUE;
} else if (!strcmp(function_name, "f_ctrl_to_user")) {
OCTETSTRING msg;
msg.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function f_ctrl_to_user(");
msg.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
f__ctrl__to__user(msg);
TTCN_Runtime::function_finished("f_ctrl_to_user");
return TRUE;
} else if (!strcmp(function_name, "f_ipa_conn_id")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_ipa_conn_id().");
TTCN_Runtime::function_started(function_arguments);
f__ipa__conn__id();
TTCN_Runtime::function_finished("f_ipa_conn_id");
return TRUE;
} else if (!strcmp(function_name, "ScanEvents")) {
TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function ScanEvents().");
TTCN_Runtime::function_started(function_arguments);
ScanEvents();
TTCN_Runtime::function_finished("ScanEvents");
return TRUE;
} else if (!strcmp(function_name, "waiter_main")) {
ASP__IPA__Event_template wait__for;
wait__for.decode_text(function_arguments);
TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC);
TTCN_Logger::log_event_str("Starting function waiter_main(");
wait__for.log();
TTCN_Logger::log_event_str(").");
TTCN_Logger::end_event();
TTCN_Runtime::function_started(function_arguments);
waiter__main(wait__for);
TTCN_Runtime::function_finished("waiter_main");
return TRUE;
} else return FALSE;
}


} /* end of namespace */
