// This C++ source file was generated by the TTCN-3 compiler // of the TTCN-3 Test Executor version 11.1.0 // The generation of user and time information were disabled by the -D flag. // Copyright (c) 2000-2025 Ericsson Telecom AB // Do not edit this file unless you know what you are doing. /* Including header files */ #include "Iuh_Emulation.hh" namespace Iuh__Emulation { /* Literal string constants */ extern const CHARSTRING cs_0(125, "/home/osmocom-build/jenkins/workspace/ttcn3-hnbgw-test-asan/_cache/podman/titan-11.1.0-debian-trixie/hnbgw/Iuh_Emulation.ttcn"), cs_2(9, "Connected"), cs_1(29, "Connection is not established"), cs_3(54, "Could not connect Iuh socket, check your configuration"); const unsigned char module_checksum[] = { 0xc3, 0xc2, 0x4e, 0xea, 0x64, 0x55, 0x3e, 0x7d, 0xac, 0x50, 0x9e, 0x43, 0xb1, 0xc1, 0xcc, 0xc5 }; /* Global variable definitions */ const TTCN_Typedescriptor_t& Iuh__ConnHdlr_descr_ = COMPONENT_descr_; HNBAP__PT Iuh__ConnHdlr_component_HNBAP("HNBAP"); RUA__PT Iuh__ConnHdlr_component_RUA("RUA"); // No XER for IUHEM__EventUpDown const TTCN_Typedescriptor_t IUHEM__EventUpDown_descr_ = { "@Iuh_Emulation.IUHEM_EventUpDown", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for IUHEM__Event const TTCN_Typedescriptor_t IUHEM__Event_descr_ = { "@Iuh_Emulation.IUHEM_Event", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const TTCN_Typedescriptor_t& Iuh__Emulation__CT_descr_ = COMPONENT_descr_; Iuh__CodecPort::Iuh__CODEC__PT Iuh__Emulation__CT_component_Iuh("Iuh"); HNBAP__PT Iuh__Emulation__CT_component_HNBAP("HNBAP"); RUA__PT Iuh__Emulation__CT_component_RUA("RUA"); const XERdescriptor_t Iuh__conn__parameters_remote__ip_xer_ = { {"remote_ip>\n", "remote_ip>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t Iuh__conn__parameters_remote__ip_descr_ = { "@Iuh_Emulation.Iuh_conn_parameters.remote_ip", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &Iuh__conn__parameters_remote__ip_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t Iuh__conn__parameters_remote__sctp__port_xer_ = { {"remote_sctp_port>\n", "remote_sctp_port>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t Iuh__conn__parameters_remote__sctp__port_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t Iuh__conn__parameters_remote__sctp__port_descr_ = { "@Iuh_Emulation.Iuh_conn_parameters.remote_sctp_port", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &Iuh__conn__parameters_remote__sctp__port_xer_, &INTEGER_json_, &Iuh__conn__parameters_remote__sctp__port_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t Iuh__conn__parameters_local__ip_xer_ = { {"local_ip>\n", "local_ip>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t Iuh__conn__parameters_local__ip_descr_ = { "@Iuh_Emulation.Iuh_conn_parameters.local_ip", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &Iuh__conn__parameters_local__ip_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t Iuh__conn__parameters_local__sctp__port_xer_ = { {"local_sctp_port>\n", "local_sctp_port>\n"}, {17, 17}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t Iuh__conn__parameters_local__sctp__port_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t Iuh__conn__parameters_local__sctp__port_descr_ = { "@Iuh_Emulation.Iuh_conn_parameters.local_sctp_port", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &Iuh__conn__parameters_local__sctp__port_xer_, &INTEGER_json_, &Iuh__conn__parameters_local__sctp__port_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for Iuh__conn__parameters const TTCN_Typedescriptor_t Iuh__conn__parameters_descr_ = { "@Iuh_Emulation.Iuh_conn_parameters", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; Iuh__conn__parameters Iuh__Emulation__CT_component_g__pars; CHARSTRING Iuh__Emulation__CT_component_g__Iuh__id; INTEGER Iuh__Emulation__CT_component_g__self__conn__id; INTEGER Iuh__Emulation__CT_component_g__last__conn__id; TTCN_Module module_object("Iuh_Emulation", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, init_comp_type, init_system_port, start_ptc_function, NULL); const RuntimeVersionChecker ver_checker( current_runtime_version.requires_major_version_11, current_runtime_version.requires_minor_version_1, current_runtime_version.requires_patch_level_0, current_runtime_version.requires_runtime_1); /* Member functions of C++ classes */ IUHEM__EventUpDown::IUHEM__EventUpDown() { enum_value = UNBOUND_VALUE; } IUHEM__EventUpDown::IUHEM__EventUpDown(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @Iuh_Emulation.IUHEM_EventUpDown with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } IUHEM__EventUpDown::IUHEM__EventUpDown(enum_type other_value) { enum_value = other_value; } IUHEM__EventUpDown::IUHEM__EventUpDown(const IUHEM__EventUpDown& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); enum_value = other_value.enum_value; } IUHEM__EventUpDown& IUHEM__EventUpDown::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @Iuh_Emulation.IUHEM_EventUpDown.", other_value); enum_value = (enum_type)other_value; return *this; } IUHEM__EventUpDown& IUHEM__EventUpDown::operator=(enum_type other_value) { enum_value = other_value; return *this; } IUHEM__EventUpDown& IUHEM__EventUpDown::operator=(const IUHEM__EventUpDown& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); enum_value = other_value.enum_value; return *this; } boolean IUHEM__EventUpDown::operator==(int other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @Iuh_Emulation.IUHEM_EventUpDown comparison is an unknown numeric value %d", other_value); return enum_value == other_value; } boolean IUHEM__EventUpDown::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 @Iuh_Emulation.IUHEM_EventUpDown."); return enum_value == other_value; } boolean IUHEM__EventUpDown::operator==(const IUHEM__EventUpDown& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); return enum_value == other_value.enum_value; } boolean IUHEM__EventUpDown::operator<(int other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @Iuh_Emulation.IUHEM_EventUpDown comparison is an unknown numeric value %d", other_value); return enum_value < other_value; } boolean IUHEM__EventUpDown::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 @Iuh_Emulation.IUHEM_EventUpDown."); return enum_value < other_value; } boolean IUHEM__EventUpDown::operator<(const IUHEM__EventUpDown& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); return enum_value < other_value.enum_value; } boolean IUHEM__EventUpDown::operator>(int other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @Iuh_Emulation.IUHEM_EventUpDown comparison is an unknown numeric value %d", other_value); return enum_value > other_value; } boolean IUHEM__EventUpDown::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 @Iuh_Emulation.IUHEM_EventUpDown."); return enum_value > other_value; } boolean IUHEM__EventUpDown::operator>(const IUHEM__EventUpDown& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); return enum_value > other_value.enum_value; } const char *IUHEM__EventUpDown::enum_to_str(enum_type enum_par) { switch (enum_par) { case IUHEM__EVENT__DOWN: return "IUHEM_EVENT_DOWN"; case IUHEM__EVENT__UP: return "IUHEM_EVENT_UP"; default: return ""; } } IUHEM__EventUpDown::enum_type IUHEM__EventUpDown::str_to_enum(const char *str_par, const int* int_par, const int* int_par2) { if (int_par == NULL && int_par2 == NULL) { if (!strcmp(str_par, "IUHEM_EVENT_DOWN")) return IUHEM__EVENT__DOWN; if (!strcmp(str_par, "IUHEM_EVENT_UP")) return IUHEM__EVENT__UP; } return UNKNOWN_VALUE; } boolean IUHEM__EventUpDown::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int IUHEM__EventUpDown::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 @Iuh_Emulation.IUHEM_EventUpDown.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int IUHEM__EventUpDown::enum2int(const IUHEM__EventUpDown& 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 @Iuh_Emulation.IUHEM_EventUpDown.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void IUHEM__EventUpDown::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @Iuh_Emulation.IUHEM_EventUpDown.", int_val); enum_value = (enum_type)int_val; } IUHEM__EventUpDown::operator IUHEM__EventUpDown::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); return enum_value; } void IUHEM__EventUpDown::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 IUHEM__EventUpDown::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", "@Iuh_Emulation.IUHEM_EventUpDown"); enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @Iuh_Emulation.IUHEM_EventUpDown."); } } void IUHEM__EventUpDown::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); text_buf.push_int(enum_value); } void IUHEM__EventUpDown::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 @Iuh_Emulation.IUHEM_EventUpDown.", enum_value); } void IUHEM__EventUpDown_template::copy_template(const IUHEM__EventUpDown_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 IUHEM__EventUpDown_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 IUHEM__EventUpDown_template(*other_value.implication_.precondition); implication_.implied_template = new IUHEM__EventUpDown_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 @Iuh_Emulation.IUHEM_EventUpDown."); } } IUHEM__EventUpDown_template::IUHEM__EventUpDown_template() { } IUHEM__EventUpDown_template::IUHEM__EventUpDown_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IUHEM__EventUpDown_template::IUHEM__EventUpDown_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!IUHEM__EventUpDown::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @Iuh_Emulation.IUHEM_EventUpDown with unknown numeric value %d.", other_value); single_value = (IUHEM__EventUpDown::enum_type)other_value; } IUHEM__EventUpDown_template::IUHEM__EventUpDown_template(IUHEM__EventUpDown::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } IUHEM__EventUpDown_template::IUHEM__EventUpDown_template(const IUHEM__EventUpDown& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == IUHEM__EventUpDown::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); single_value = other_value.enum_value; } IUHEM__EventUpDown_template::IUHEM__EventUpDown_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (IUHEM__EventUpDown::enum_type)(const IUHEM__EventUpDown&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @Iuh_Emulation.IUHEM_EventUpDown from an unbound optional field."); } } IUHEM__EventUpDown_template::IUHEM__EventUpDown_template(IUHEM__EventUpDown_template* p_precondition, IUHEM__EventUpDown_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IUHEM__EventUpDown_template::IUHEM__EventUpDown_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } IUHEM__EventUpDown_template::IUHEM__EventUpDown_template(const IUHEM__EventUpDown_template& other_value) : Base_Template() { copy_template(other_value); } IUHEM__EventUpDown_template::~IUHEM__EventUpDown_template() { clean_up(); } boolean IUHEM__EventUpDown_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean IUHEM__EventUpDown_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != IUHEM__EventUpDown::UNBOUND_VALUE; } void IUHEM__EventUpDown_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; } IUHEM__EventUpDown_template& IUHEM__EventUpDown_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IUHEM__EventUpDown_template& IUHEM__EventUpDown_template::operator=(int other_value) { if (!IUHEM__EventUpDown::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @Iuh_Emulation.IUHEM_EventUpDown.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (IUHEM__EventUpDown::enum_type)other_value; return *this; } IUHEM__EventUpDown_template& IUHEM__EventUpDown_template::operator=(IUHEM__EventUpDown::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } IUHEM__EventUpDown_template& IUHEM__EventUpDown_template::operator=(const IUHEM__EventUpDown& other_value) { if (other_value.enum_value == IUHEM__EventUpDown::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @Iuh_Emulation.IUHEM_EventUpDown to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } IUHEM__EventUpDown_template& IUHEM__EventUpDown_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (IUHEM__EventUpDown::enum_type)(const IUHEM__EventUpDown&)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 @Iuh_Emulation.IUHEM_EventUpDown."); } return *this; } IUHEM__EventUpDown_template& IUHEM__EventUpDown_template::operator=(const IUHEM__EventUpDown_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IUHEM__EventUpDown_template::match(IUHEM__EventUpDown::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 @Iuh_Emulation.IUHEM_EventUpDown."); } return FALSE; } boolean IUHEM__EventUpDown_template::match(const IUHEM__EventUpDown& other_value, boolean) const { if (other_value.enum_value == IUHEM__EventUpDown::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @Iuh_Emulation.IUHEM_EventUpDown with an unbound value."); return match(other_value.enum_value); } IUHEM__EventUpDown::enum_type IUHEM__EventUpDown_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 @Iuh_Emulation.IUHEM_EventUpDown."); return single_value; } void IUHEM__EventUpDown_template::set_type(template_sel template_type, unsigned int list_length) { clean_up(); switch (template_type) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new IUHEM__EventUpDown_template[list_length]; break; default: TTCN_error("Setting an invalid type for a template of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); } } IUHEM__EventUpDown_template& IUHEM__EventUpDown_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 @Iuh_Emulation.IUHEM_EventUpDown."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @Iuh_Emulation.IUHEM_EventUpDown."); return value_list.list_value[list_index]; } void IUHEM__EventUpDown_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(IUHEM__EventUpDown::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 IUHEM__EventUpDown_template::log_match(const IUHEM__EventUpDown& 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 IUHEM__EventUpDown_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 @Iuh_Emulation.IUHEM_EventUpDown."); } } void IUHEM__EventUpDown_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (IUHEM__EventUpDown::enum_type)text_buf.pull_int().get_val(); if (!IUHEM__EventUpDown::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @Iuh_Emulation.IUHEM_EventUpDown.", 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 IUHEM__EventUpDown_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 @Iuh_Emulation.IUHEM_EventUpDown."); } } boolean IUHEM__EventUpDown_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IUHEM__EventUpDown_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; iget_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: { IUHEM__EventUpDown_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_iget_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: { IUHEM__EventUpDown::enum_type enum_val = IUHEM__EventUpDown::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value()); if (!IUHEM__EventUpDown::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @Iuh_Emulation.IUHEM_EventUpDown."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { IUHEM__EventUpDown_template* precondition = new IUHEM__EventUpDown_template; precondition->set_param(*m_p->get_elem(0)); IUHEM__EventUpDown_template* implied_template = new IUHEM__EventUpDown_template; implied_template->set_param(*m_p->get_elem(1)); *this = IUHEM__EventUpDown_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@Iuh_Emulation.IUHEM_EventUpDown"); } is_ifpresent = param.get_ifpresent(); } void IUHEM__EventUpDown_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 : "@Iuh_Emulation.IUHEM_EventUpDown"); } void IUHEM__Event::copy_value(const IUHEM__Event& other_value) { switch (other_value.union_selection) { case ALT_up__down: field_up__down = new IUHEM__EventUpDown(*other_value.field_up__down); break; default: TTCN_error("Assignment of an unbound union value of type @Iuh_Emulation.IUHEM_Event."); } union_selection = other_value.union_selection; } IUHEM__Event::IUHEM__Event() { union_selection = UNBOUND_VALUE; } IUHEM__Event::IUHEM__Event(const IUHEM__Event& other_value) : Base_Type(){ copy_value(other_value); } IUHEM__Event::~IUHEM__Event() { clean_up(); } IUHEM__Event& IUHEM__Event::operator=(const IUHEM__Event& other_value) { if (this != &other_value) { clean_up(); copy_value(other_value); } return *this; } boolean IUHEM__Event::operator==(const IUHEM__Event& other_value) const { if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @Iuh_Emulation.IUHEM_Event."); if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @Iuh_Emulation.IUHEM_Event."); if (union_selection != other_value.union_selection) return FALSE; switch (union_selection) { case ALT_up__down: return *field_up__down == *other_value.field_up__down; default: return FALSE; } } IUHEM__EventUpDown& IUHEM__Event::up__down() { if (union_selection != ALT_up__down) { clean_up(); field_up__down = new IUHEM__EventUpDown; union_selection = ALT_up__down; } return *field_up__down; } const IUHEM__EventUpDown& IUHEM__Event::up__down() const { if (union_selection != ALT_up__down) TTCN_error("Using non-selected field up_down in a value of union type @Iuh_Emulation.IUHEM_Event."); return *field_up__down; } boolean IUHEM__Event::ischosen(union_selection_type checked_selection) const { if (checked_selection == UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @Iuh_Emulation.IUHEM_Event."); return union_selection == checked_selection; } boolean IUHEM__Event::is_bound() const { return union_selection != UNBOUND_VALUE; } boolean IUHEM__Event::is_value() const { switch (union_selection) { case UNBOUND_VALUE: return FALSE; case ALT_up__down: return field_up__down->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void IUHEM__Event::clean_up() { switch (union_selection) { case ALT_up__down: delete field_up__down; break; default: break; } union_selection = UNBOUND_VALUE; } void IUHEM__Event::log() const { switch (union_selection) { case ALT_up__down: TTCN_Logger::log_event_str("{ up_down := "); field_up__down->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void IUHEM__Event::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "union value"); Module_Param_Ptr m_p = ¶m; if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return; if (m_p->get_type()!=Module_Param::MP_Assignment_List) { param.error("union value with field name was expected"); } Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1); char* last_name = mp_last->get_id()->get_name(); if (!strcmp(last_name, "up_down")) { up__down().set_param(*mp_last); if (!up__down().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @Iuh_Emulation.IUHEM_Event.", last_name); } void IUHEM__Event::set_implicit_omit() { switch (union_selection) { case ALT_up__down: field_up__down->set_implicit_omit(); break; default: break; } } void IUHEM__Event::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_up__down: field_up__down->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @Iuh_Emulation.IUHEM_Event."); } } void IUHEM__Event::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_up__down: up__down().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @Iuh_Emulation.IUHEM_Event."); } } void IUHEM__Event_template::copy_value(const IUHEM__Event& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: single_value.field_up__down = new IUHEM__EventUpDown_template(other_value.up__down()); break; default: TTCN_error("Initializing a template with an unbound value of type @Iuh_Emulation.IUHEM_Event."); } set_selection(SPECIFIC_VALUE); } void IUHEM__Event_template::copy_template(const IUHEM__Event_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value.union_selection = other_value.single_value.union_selection; switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: single_value.field_up__down = new IUHEM__EventUpDown_template(*other_value.single_value.field_up__down); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @Iuh_Emulation.IUHEM_Event."); } 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 IUHEM__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 IUHEM__Event_template(*other_value.implication_.precondition); implication_.implied_template = new IUHEM__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 template of union type @Iuh_Emulation.IUHEM_Event."); } set_selection(other_value); } IUHEM__Event_template::IUHEM__Event_template() { } IUHEM__Event_template::IUHEM__Event_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IUHEM__Event_template::IUHEM__Event_template(const IUHEM__Event& other_value) { copy_value(other_value); } IUHEM__Event_template::IUHEM__Event_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IUHEM__Event&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @Iuh_Emulation.IUHEM_Event from an unbound optional field."); } } IUHEM__Event_template::IUHEM__Event_template(IUHEM__Event_template* p_precondition, IUHEM__Event_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IUHEM__Event_template::IUHEM__Event_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } IUHEM__Event_template::IUHEM__Event_template(const IUHEM__Event_template& other_value) : Base_Template(){ copy_template(other_value); } IUHEM__Event_template::~IUHEM__Event_template() { clean_up(); } void IUHEM__Event_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: delete single_value.field_up__down; default: break; } 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; } IUHEM__Event_template& IUHEM__Event_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IUHEM__Event_template& IUHEM__Event_template::operator=(const IUHEM__Event& other_value) { clean_up(); copy_value(other_value); return *this; } IUHEM__Event_template& IUHEM__Event_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IUHEM__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 union type @Iuh_Emulation.IUHEM_Event."); } return *this; } IUHEM__Event_template& IUHEM__Event_template::operator=(const IUHEM__Event_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IUHEM__Event_template::match(const IUHEM__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: { IUHEM__Event::union_selection_type value_selection = other_value.get_selection(); if (value_selection == IUHEM__Event::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case IUHEM__Event::ALT_up__down: return single_value.field_up__down->match(other_value.up__down(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @Iuh_Emulation.IUHEM_Event."); } } 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 template of union type @Iuh_Emulation.IUHEM_Event."); } return FALSE; } boolean IUHEM__Event_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: return single_value.field_up__down->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @Iuh_Emulation.IUHEM_Event."); } } IUHEM__Event IUHEM__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 union type @Iuh_Emulation.IUHEM_Event."); IUHEM__Event ret_val; switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: ret_val.up__down() = single_value.field_up__down->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @Iuh_Emulation.IUHEM_Event."); } return ret_val; } IUHEM__Event_template& IUHEM__Event_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @Iuh_Emulation.IUHEM_Event."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @Iuh_Emulation.IUHEM_Event."); return value_list.list_value[list_index]; } void IUHEM__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 ("Internal error: Setting an invalid list for a template of union type @Iuh_Emulation.IUHEM_Event."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new IUHEM__Event_template[list_length]; } IUHEM__EventUpDown_template& IUHEM__Event_template::up__down() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != IUHEM__Event::ALT_up__down) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_up__down = new IUHEM__EventUpDown_template(ANY_VALUE); else single_value.field_up__down = new IUHEM__EventUpDown_template; single_value.union_selection = IUHEM__Event::ALT_up__down; set_selection(SPECIFIC_VALUE); } return *single_value.field_up__down; } const IUHEM__EventUpDown_template& IUHEM__Event_template::up__down() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field up_down in a non-specific template of union type @Iuh_Emulation.IUHEM_Event."); if (single_value.union_selection != IUHEM__Event::ALT_up__down) TTCN_error("Accessing non-selected field up_down in a template of union type @Iuh_Emulation.IUHEM_Event."); return *single_value.field_up__down; } boolean IUHEM__Event_template::ischosen(IUHEM__Event::union_selection_type checked_selection) const { if (checked_selection == IUHEM__Event::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @Iuh_Emulation.IUHEM_Event."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == IUHEM__Event::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @Iuh_Emulation.IUHEM_Event."); return single_value.union_selection == checked_selection; case VALUE_LIST: { if (value_list.n_values < 1) TTCN_error("Internal error: Performing ischosen() operation on a template of union type @Iuh_Emulation.IUHEM_Event containing an empty list."); boolean ret_val = value_list.list_value[0].ischosen(checked_selection); for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) { ret_val = value_list.list_value[list_count].ischosen(checked_selection); } return ret_val; } default: return FALSE; } return FALSE; } void IUHEM__Event_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: TTCN_Logger::log_event_str("{ up_down := "); single_value.field_up__down->log(); TTCN_Logger::log_event_str(" }"); break; default: 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 IUHEM__Event_template::log_match(const IUHEM__Event& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); return; } if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".up_down"); single_value.field_up__down->log_match(match_value.up__down(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ up_down := "); single_value.field_up__down->log_match(match_value.up__down(), legacy); TTCN_Logger::log_event_str(" }"); } break; default: TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(""); } } else { TTCN_Logger::print_logmatch_buffer(); 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 IUHEM__Event_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: single_value.field_up__down->set_implicit_omit(); break; default: break; } } void IUHEM__Event_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.union_selection); switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: single_value.field_up__down->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @Iuh_Emulation.IUHEM_Event."); } 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 template of type @Iuh_Emulation.IUHEM_Event."); } } void IUHEM__Event_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = IUHEM__Event::UNBOUND_VALUE; IUHEM__Event::union_selection_type new_selection = (IUHEM__Event::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case IUHEM__Event::ALT_up__down: single_value.field_up__down = new IUHEM__EventUpDown_template; single_value.field_up__down->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @Iuh_Emulation.IUHEM_Event."); } single_value.union_selection = new_selection; } 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 IUHEM__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: Unrecognized selector was received in a template of type @Iuh_Emulation.IUHEM_Event."); } } boolean IUHEM__Event_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IUHEM__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 v_idx=0; v_idx(param.get_id()) != NULL && param.get_id()->next_name()) { char* param_field = param.get_id()->get_current_name(); if (param_field[0] >= '0' && param_field[0] <= '9') { param.error("Unexpected array index in module parameter, expected a valid field" " name for union template type `@Iuh_Emulation.IUHEM_Event'"); } if (strcmp("up_down", param_field) == 0) { up__down().set_param(param); return; } else param.error("Field `%s' not found in union template type `@Iuh_Emulation.IUHEM_Event'", param_field); } param.basic_check(Module_Param::BC_TEMPLATE, "union template"); Module_Param_Ptr m_p = ¶m; 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: { IUHEM__Event_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_iget_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_Value_List: if (m_p->get_size()==0) break; param.type_error("union template", "@Iuh_Emulation.IUHEM_Event"); break; case Module_Param::MP_Assignment_List: { Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1); char* last_name = mp_last->get_id()->get_name(); if (!strcmp(last_name, "up_down")) { up__down().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @Iuh_Emulation.IUHEM_Event.", last_name); } break; case Module_Param::MP_Implication_Template: { IUHEM__Event_template* precondition = new IUHEM__Event_template; precondition->set_param(*m_p->get_elem(0)); IUHEM__Event_template* implied_template = new IUHEM__Event_template; implied_template->set_param(*m_p->get_elem(1)); *this = IUHEM__Event_template(precondition, implied_template); } break; default: param.type_error("union template", "@Iuh_Emulation.IUHEM_Event"); } is_ifpresent = param.get_ifpresent(); } void IUHEM__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; switch (single_value.union_selection) { case IUHEM__Event::ALT_up__down: single_value.field_up__down->check_restriction(t_res, t_name ? t_name : "@Iuh_Emulation.IUHEM_Event"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @Iuh_Emulation.IUHEM_Event."); } 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 : "@Iuh_Emulation.IUHEM_Event"); } void HNBAP__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 HNBAP__PT::clear_queue() { while (msg_queue_head != NULL) remove_msg_queue_head(); } HNBAP__PT::HNBAP__PT(const char *par_port_name) : PORT(par_port_name) { msg_queue_head = NULL; msg_queue_tail = NULL; } HNBAP__PT::~HNBAP__PT() { clear_queue(); } void HNBAP__PT::send(const HNBAP__PDU__Descriptions::HNBAP__PDU& 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(" @HNBAP-PDU-Descriptions.HNBAP-PDU : "), 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, "@HNBAP-PDU-Descriptions.HNBAP-PDU"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void HNBAP__PT::send(const HNBAP__PDU__Descriptions::HNBAP__PDU& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect); } void HNBAP__PT::send(const HNBAP__PDU__Descriptions::HNBAP__PDU& send_par, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_message(text_buf, "@HNBAP-PDU-Descriptions.HNBAP-PDU"); send_par.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE), TTCN_Logger::log_event_str(" @HNBAP-PDU-Descriptions.HNBAP-PDU : "), send_par.log(), TTCN_Logger::end_event_log2str())); } else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void HNBAP__PT::send(const HNBAP__PDU__Descriptions::HNBAP__PDU_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const HNBAP__PDU__Descriptions::HNBAP__PDU& send_par_value = HNBAP__PDU__Descriptions::HNBAP__PDU(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void HNBAP__PT::send(const HNBAP__PDU__Descriptions::HNBAP__PDU_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { const HNBAP__PDU__Descriptions::HNBAP__PDU& send_par_value = HNBAP__PDU__Descriptions::HNBAP__PDU(send_par.valueof()); send(send_par_value, nof_components, destination_components, timestamp_redirect); } void HNBAP__PT::send(const HNBAP__PDU__Descriptions::HNBAP__PDU_template& send_par, boolean broadcast, FLOAT* timestamp_redirect) { const HNBAP__PDU__Descriptions::HNBAP__PDU& send_par_value = HNBAP__PDU__Descriptions::HNBAP__PDU(send_par.valueof()); send(send_par_value, broadcast, timestamp_redirect); } void HNBAP__PT::send(const IUHEM__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(" @Iuh_Emulation.IUHEM_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, "@Iuh_Emulation.IUHEM_Event"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void HNBAP__PT::send(const IUHEM__Event& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect); } void HNBAP__PT::send(const IUHEM__Event& send_par, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_message(text_buf, "@Iuh_Emulation.IUHEM_Event"); send_par.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE), TTCN_Logger::log_event_str(" @Iuh_Emulation.IUHEM_Event : "), send_par.log(), TTCN_Logger::end_event_log2str())); } else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void HNBAP__PT::send(const IUHEM__Event_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const IUHEM__Event& send_par_value = IUHEM__Event(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void HNBAP__PT::send(const IUHEM__Event_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { const IUHEM__Event& send_par_value = IUHEM__Event(send_par.valueof()); send(send_par_value, nof_components, destination_components, timestamp_redirect); } void HNBAP__PT::send(const IUHEM__Event_template& send_par, boolean broadcast, FLOAT* timestamp_redirect) { const IUHEM__Event& send_par_value = IUHEM__Event(send_par.valueof()); send(send_par_value, broadcast, timestamp_redirect); } alt_status HNBAP__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(": @HNBAP-PDU-Descriptions.HNBAP-PDU: "), 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(": @Iuh_Emulation.IUHEM_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 HNBAP__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(": @HNBAP-PDU-Descriptions.HNBAP-PDU: "), 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(": @Iuh_Emulation.IUHEM_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 HNBAP__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(": @HNBAP-PDU-Descriptions.HNBAP-PDU: "), 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(": @Iuh_Emulation.IUHEM_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 HNBAP__PT::receive(const HNBAP__PDU__Descriptions::HNBAP__PDU_template& value_template, HNBAP__PDU__Descriptions::HNBAP__PDU *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 @HNBAP-PDU-Descriptions.HNBAP-PDU.", 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(": @HNBAP-PDU-Descriptions.HNBAP-PDU : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status HNBAP__PT::check_receive(const HNBAP__PDU__Descriptions::HNBAP__PDU_template& value_template, HNBAP__PDU__Descriptions::HNBAP__PDU *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 @HNBAP-PDU-Descriptions.HNBAP-PDU.", 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(": @HNBAP-PDU-Descriptions.HNBAP-PDU : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status HNBAP__PT::trigger(const HNBAP__PDU__Descriptions::HNBAP__PDU_template& value_template, HNBAP__PDU__Descriptions::HNBAP__PDU *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 @HNBAP-PDU-Descriptions.HNBAP-PDU.", 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(": @HNBAP-PDU-Descriptions.HNBAP-PDU : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status HNBAP__PT::receive(const IUHEM__Event_template& value_template, IUHEM__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 @Iuh_Emulation.IUHEM_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(": @Iuh_Emulation.IUHEM_Event : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status HNBAP__PT::check_receive(const IUHEM__Event_template& value_template, IUHEM__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 @Iuh_Emulation.IUHEM_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(": @Iuh_Emulation.IUHEM_Event : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status HNBAP__PT::trigger(const IUHEM__Event_template& value_template, IUHEM__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 @Iuh_Emulation.IUHEM_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(": @Iuh_Emulation.IUHEM_Event : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } void HNBAP__PT::incoming_message(const HNBAP__PDU__Descriptions::HNBAP__PDU& 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(" @HNBAP-PDU-Descriptions.HNBAP-PDU : "), 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 HNBAP__PDU__Descriptions::HNBAP__PDU(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } void HNBAP__PT::incoming_message(const IUHEM__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(" @Iuh_Emulation.IUHEM_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 IUHEM__Event(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } boolean HNBAP__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&) { if (!strcmp(message_type, "@HNBAP-PDU-Descriptions.HNBAP-PDU")) { HNBAP__PDU__Descriptions::HNBAP__PDU incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else if (!strcmp(message_type, "@Iuh_Emulation.IUHEM_Event")) { IUHEM__Event incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else return FALSE; } void RUA__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 RUA__PT::clear_queue() { while (msg_queue_head != NULL) remove_msg_queue_head(); } RUA__PT::RUA__PT(const char *par_port_name) : PORT(par_port_name) { msg_queue_head = NULL; msg_queue_tail = NULL; } RUA__PT::~RUA__PT() { clear_queue(); } void RUA__PT::send(const RUA__PDU__Descriptions::RUA__PDU& 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(" @RUA-PDU-Descriptions.RUA-PDU : "), 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, "@RUA-PDU-Descriptions.RUA-PDU"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void RUA__PT::send(const RUA__PDU__Descriptions::RUA__PDU& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect); } void RUA__PT::send(const RUA__PDU__Descriptions::RUA__PDU& send_par, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_message(text_buf, "@RUA-PDU-Descriptions.RUA-PDU"); send_par.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE), TTCN_Logger::log_event_str(" @RUA-PDU-Descriptions.RUA-PDU : "), send_par.log(), TTCN_Logger::end_event_log2str())); } else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void RUA__PT::send(const RUA__PDU__Descriptions::RUA__PDU_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const RUA__PDU__Descriptions::RUA__PDU& send_par_value = RUA__PDU__Descriptions::RUA__PDU(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void RUA__PT::send(const RUA__PDU__Descriptions::RUA__PDU_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { const RUA__PDU__Descriptions::RUA__PDU& send_par_value = RUA__PDU__Descriptions::RUA__PDU(send_par.valueof()); send(send_par_value, nof_components, destination_components, timestamp_redirect); } void RUA__PT::send(const RUA__PDU__Descriptions::RUA__PDU_template& send_par, boolean broadcast, FLOAT* timestamp_redirect) { const RUA__PDU__Descriptions::RUA__PDU& send_par_value = RUA__PDU__Descriptions::RUA__PDU(send_par.valueof()); send(send_par_value, broadcast, timestamp_redirect); } void RUA__PT::send(const IUHEM__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(" @Iuh_Emulation.IUHEM_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, "@Iuh_Emulation.IUHEM_Event"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void RUA__PT::send(const IUHEM__Event& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) send(send_par, destination_components[i], timestamp_redirect); } void RUA__PT::send(const IUHEM__Event& send_par, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Sending a message on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_message(text_buf, "@Iuh_Emulation.IUHEM_Event"); send_par.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_SEND, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_MCSEND, TRUE), TTCN_Logger::log_event_str(" @Iuh_Emulation.IUHEM_Event : "), send_par.log(), TTCN_Logger::end_event_log2str())); } else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void RUA__PT::send(const IUHEM__Event_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const IUHEM__Event& send_par_value = IUHEM__Event(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void RUA__PT::send(const IUHEM__Event_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { const IUHEM__Event& send_par_value = IUHEM__Event(send_par.valueof()); send(send_par_value, nof_components, destination_components, timestamp_redirect); } void RUA__PT::send(const IUHEM__Event_template& send_par, boolean broadcast, FLOAT* timestamp_redirect) { const IUHEM__Event& send_par_value = IUHEM__Event(send_par.valueof()); send(send_par_value, broadcast, timestamp_redirect); } alt_status RUA__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(": @RUA-PDU-Descriptions.RUA-PDU: "), 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(": @Iuh_Emulation.IUHEM_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 RUA__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(": @RUA-PDU-Descriptions.RUA-PDU: "), 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(": @Iuh_Emulation.IUHEM_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 RUA__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(": @RUA-PDU-Descriptions.RUA-PDU: "), 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(": @Iuh_Emulation.IUHEM_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 RUA__PT::receive(const RUA__PDU__Descriptions::RUA__PDU_template& value_template, RUA__PDU__Descriptions::RUA__PDU *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 @RUA-PDU-Descriptions.RUA-PDU.", 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(": @RUA-PDU-Descriptions.RUA-PDU : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status RUA__PT::check_receive(const RUA__PDU__Descriptions::RUA__PDU_template& value_template, RUA__PDU__Descriptions::RUA__PDU *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 @RUA-PDU-Descriptions.RUA-PDU.", 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(": @RUA-PDU-Descriptions.RUA-PDU : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status RUA__PT::trigger(const RUA__PDU__Descriptions::RUA__PDU_template& value_template, RUA__PDU__Descriptions::RUA__PDU *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 @RUA-PDU-Descriptions.RUA-PDU.", 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(": @RUA-PDU-Descriptions.RUA-PDU : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status RUA__PT::receive(const IUHEM__Event_template& value_template, IUHEM__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 @Iuh_Emulation.IUHEM_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(": @Iuh_Emulation.IUHEM_Event : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status RUA__PT::check_receive(const IUHEM__Event_template& value_template, IUHEM__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 @Iuh_Emulation.IUHEM_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(": @Iuh_Emulation.IUHEM_Event : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status RUA__PT::trigger(const IUHEM__Event_template& value_template, IUHEM__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 @Iuh_Emulation.IUHEM_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(": @Iuh_Emulation.IUHEM_Event : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } void RUA__PT::incoming_message(const RUA__PDU__Descriptions::RUA__PDU& 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(" @RUA-PDU-Descriptions.RUA-PDU : "), 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 RUA__PDU__Descriptions::RUA__PDU(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } void RUA__PT::incoming_message(const IUHEM__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(" @Iuh_Emulation.IUHEM_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 IUHEM__Event(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } boolean RUA__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&) { if (!strcmp(message_type, "@RUA-PDU-Descriptions.RUA-PDU")) { RUA__PDU__Descriptions::RUA__PDU incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else if (!strcmp(message_type, "@Iuh_Emulation.IUHEM_Event")) { IUHEM__Event incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else return FALSE; } Iuh__conn__parameters::Iuh__conn__parameters() { } Iuh__conn__parameters::Iuh__conn__parameters(const CHARSTRING& par_remote__ip, const INTEGER& par_remote__sctp__port, const CHARSTRING& par_local__ip, const INTEGER& par_local__sctp__port) : field_remote__ip(par_remote__ip), field_remote__sctp__port(par_remote__sctp__port), field_local__ip(par_local__ip), field_local__sctp__port(par_local__sctp__port) { } Iuh__conn__parameters::Iuh__conn__parameters(const Iuh__conn__parameters& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @Iuh_Emulation.Iuh_conn_parameters."); if (other_value.remote__ip().is_bound()) field_remote__ip = other_value.remote__ip(); else field_remote__ip.clean_up(); if (other_value.remote__sctp__port().is_bound()) field_remote__sctp__port = other_value.remote__sctp__port(); else field_remote__sctp__port.clean_up(); if (other_value.local__ip().is_bound()) field_local__ip = other_value.local__ip(); else field_local__ip.clean_up(); if (other_value.local__sctp__port().is_bound()) field_local__sctp__port = other_value.local__sctp__port(); else field_local__sctp__port.clean_up(); } void Iuh__conn__parameters::clean_up() { field_remote__ip.clean_up(); field_remote__sctp__port.clean_up(); field_local__ip.clean_up(); field_local__sctp__port.clean_up(); } const TTCN_Typedescriptor_t* Iuh__conn__parameters::get_descriptor() const { return &Iuh__conn__parameters_descr_; } Iuh__conn__parameters& Iuh__conn__parameters::operator=(const Iuh__conn__parameters& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @Iuh_Emulation.Iuh_conn_parameters."); if (other_value.remote__ip().is_bound()) field_remote__ip = other_value.remote__ip(); else field_remote__ip.clean_up(); if (other_value.remote__sctp__port().is_bound()) field_remote__sctp__port = other_value.remote__sctp__port(); else field_remote__sctp__port.clean_up(); if (other_value.local__ip().is_bound()) field_local__ip = other_value.local__ip(); else field_local__ip.clean_up(); if (other_value.local__sctp__port().is_bound()) field_local__sctp__port = other_value.local__sctp__port(); else field_local__sctp__port.clean_up(); } return *this; } boolean Iuh__conn__parameters::operator==(const Iuh__conn__parameters& other_value) const { return field_remote__ip==other_value.field_remote__ip && field_remote__sctp__port==other_value.field_remote__sctp__port && field_local__ip==other_value.field_local__ip && field_local__sctp__port==other_value.field_local__sctp__port; } boolean Iuh__conn__parameters::is_bound() const { return (field_remote__ip.is_bound()) || (field_remote__sctp__port.is_bound()) || (field_local__ip.is_bound()) || (field_local__sctp__port.is_bound()); } boolean Iuh__conn__parameters::is_value() const { return field_remote__ip.is_value() && field_remote__sctp__port.is_value() && field_local__ip.is_value() && field_local__sctp__port.is_value(); } void Iuh__conn__parameters::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ remote_ip := "); field_remote__ip.log(); TTCN_Logger::log_event_str(", remote_sctp_port := "); field_remote__sctp__port.log(); TTCN_Logger::log_event_str(", local_ip := "); field_local__ip.log(); TTCN_Logger::log_event_str(", local_sctp_port := "); field_local__sctp__port.log(); TTCN_Logger::log_event_str(" }"); } void Iuh__conn__parameters::set_implicit_omit() { if (remote__ip().is_bound()) remote__ip().set_implicit_omit(); if (remote__sctp__port().is_bound()) remote__sctp__port().set_implicit_omit(); if (local__ip().is_bound()) local__ip().set_implicit_omit(); if (local__sctp__port().is_bound()) local__sctp__port().set_implicit_omit(); } void Iuh__conn__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 (40 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) remote__ip().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) remote__sctp__port().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) local__ip().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) local__sctp__port().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "remote_ip")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { remote__ip().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "remote_sctp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { remote__sctp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "local_ip")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__ip().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "local_sctp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__sctp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @Iuh_Emulation.Iuh_conn_parameters: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@Iuh_Emulation.Iuh_conn_parameters"); } } void Iuh__conn__parameters::encode_text(Text_Buf& text_buf) const { field_remote__ip.encode_text(text_buf); field_remote__sctp__port.encode_text(text_buf); field_local__ip.encode_text(text_buf); field_local__sctp__port.encode_text(text_buf); } void Iuh__conn__parameters::decode_text(Text_Buf& text_buf) { field_remote__ip.decode_text(text_buf); field_remote__sctp__port.decode_text(text_buf); field_local__ip.decode_text(text_buf); field_local__sctp__port.decode_text(text_buf); } struct Iuh__conn__parameters_template::single_value_struct { CHARSTRING_template field_remote__ip; INTEGER_template field_remote__sctp__port; CHARSTRING_template field_local__ip; INTEGER_template field_local__sctp__port; }; void Iuh__conn__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_remote__ip = ANY_VALUE; single_value->field_remote__sctp__port = ANY_VALUE; single_value->field_local__ip = ANY_VALUE; single_value->field_local__sctp__port = ANY_VALUE; } } } void Iuh__conn__parameters_template::copy_value(const Iuh__conn__parameters& other_value) { single_value = new single_value_struct; if (other_value.remote__ip().is_bound()) { single_value->field_remote__ip = other_value.remote__ip(); } else { single_value->field_remote__ip.clean_up(); } if (other_value.remote__sctp__port().is_bound()) { single_value->field_remote__sctp__port = other_value.remote__sctp__port(); } else { single_value->field_remote__sctp__port.clean_up(); } if (other_value.local__ip().is_bound()) { single_value->field_local__ip = other_value.local__ip(); } else { single_value->field_local__ip.clean_up(); } if (other_value.local__sctp__port().is_bound()) { single_value->field_local__sctp__port = other_value.local__sctp__port(); } else { single_value->field_local__sctp__port.clean_up(); } set_selection(SPECIFIC_VALUE); } void Iuh__conn__parameters_template::copy_template(const Iuh__conn__parameters_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.remote__ip().get_selection()) { single_value->field_remote__ip = other_value.remote__ip(); } else { single_value->field_remote__ip.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.remote__sctp__port().get_selection()) { single_value->field_remote__sctp__port = other_value.remote__sctp__port(); } else { single_value->field_remote__sctp__port.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.local__ip().get_selection()) { single_value->field_local__ip = other_value.local__ip(); } else { single_value->field_local__ip.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.local__sctp__port().get_selection()) { single_value->field_local__sctp__port = other_value.local__sctp__port(); } else { single_value->field_local__sctp__port.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 Iuh__conn__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 Iuh__conn__parameters_template(*other_value.implication_.precondition); implication_.implied_template = new Iuh__conn__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 @Iuh_Emulation.Iuh_conn_parameters."); break; } set_selection(other_value); } Iuh__conn__parameters_template::Iuh__conn__parameters_template() { } Iuh__conn__parameters_template::Iuh__conn__parameters_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Iuh__conn__parameters_template::Iuh__conn__parameters_template(const Iuh__conn__parameters& other_value) { copy_value(other_value); } Iuh__conn__parameters_template::Iuh__conn__parameters_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Iuh__conn__parameters&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @Iuh_Emulation.Iuh_conn_parameters from an unbound optional field."); } } Iuh__conn__parameters_template::Iuh__conn__parameters_template(Iuh__conn__parameters_template* p_precondition, Iuh__conn__parameters_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Iuh__conn__parameters_template::Iuh__conn__parameters_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } Iuh__conn__parameters_template::Iuh__conn__parameters_template(const Iuh__conn__parameters_template& other_value) : Base_Template() { copy_template(other_value); } Iuh__conn__parameters_template::~Iuh__conn__parameters_template() { clean_up(); } Iuh__conn__parameters_template& Iuh__conn__parameters_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Iuh__conn__parameters_template& Iuh__conn__parameters_template::operator=(const Iuh__conn__parameters& other_value) { clean_up(); copy_value(other_value); return *this; } Iuh__conn__parameters_template& Iuh__conn__parameters_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Iuh__conn__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 @Iuh_Emulation.Iuh_conn_parameters."); } return *this; } Iuh__conn__parameters_template& Iuh__conn__parameters_template::operator=(const Iuh__conn__parameters_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Iuh__conn__parameters_template::match(const Iuh__conn__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.remote__ip().is_bound()) return FALSE; if(!single_value->field_remote__ip.match(other_value.remote__ip(), legacy))return FALSE; if(!other_value.remote__sctp__port().is_bound()) return FALSE; if(!single_value->field_remote__sctp__port.match(other_value.remote__sctp__port(), legacy))return FALSE; if(!other_value.local__ip().is_bound()) return FALSE; if(!single_value->field_local__ip.match(other_value.local__ip(), legacy))return FALSE; if(!other_value.local__sctp__port().is_bound()) return FALSE; if(!single_value->field_local__sctp__port.match(other_value.local__sctp__port(), 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 @Iuh_Emulation.Iuh_conn_parameters."); } return FALSE; } boolean Iuh__conn__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_remote__ip.is_bound() || single_value->field_remote__sctp__port.is_bound() || single_value->field_local__ip.is_bound() || single_value->field_local__sctp__port.is_bound(); } boolean Iuh__conn__parameters_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_remote__ip.is_value() && single_value->field_remote__sctp__port.is_value() && single_value->field_local__ip.is_value() && single_value->field_local__sctp__port.is_value(); } void Iuh__conn__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; } Iuh__conn__parameters Iuh__conn__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 @Iuh_Emulation.Iuh_conn_parameters."); Iuh__conn__parameters ret_val; if (single_value->field_remote__ip.is_bound()) { ret_val.remote__ip() = single_value->field_remote__ip.valueof(); } if (single_value->field_remote__sctp__port.is_bound()) { ret_val.remote__sctp__port() = single_value->field_remote__sctp__port.valueof(); } if (single_value->field_local__ip.is_bound()) { ret_val.local__ip() = single_value->field_local__ip.valueof(); } if (single_value->field_local__sctp__port.is_bound()) { ret_val.local__sctp__port() = single_value->field_local__sctp__port.valueof(); } return ret_val; } void Iuh__conn__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 @Iuh_Emulation.Iuh_conn_parameters."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Iuh__conn__parameters_template[list_length]; } Iuh__conn__parameters_template& Iuh__conn__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 @Iuh_Emulation.Iuh_conn_parameters."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @Iuh_Emulation.Iuh_conn_parameters."); return value_list.list_value[list_index]; } CHARSTRING_template& Iuh__conn__parameters_template::remote__ip() { set_specific(); return single_value->field_remote__ip; } const CHARSTRING_template& Iuh__conn__parameters_template::remote__ip() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field remote_ip of a non-specific template of type @Iuh_Emulation.Iuh_conn_parameters."); return single_value->field_remote__ip; } INTEGER_template& Iuh__conn__parameters_template::remote__sctp__port() { set_specific(); return single_value->field_remote__sctp__port; } const INTEGER_template& Iuh__conn__parameters_template::remote__sctp__port() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field remote_sctp_port of a non-specific template of type @Iuh_Emulation.Iuh_conn_parameters."); return single_value->field_remote__sctp__port; } CHARSTRING_template& Iuh__conn__parameters_template::local__ip() { set_specific(); return single_value->field_local__ip; } const CHARSTRING_template& Iuh__conn__parameters_template::local__ip() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field local_ip of a non-specific template of type @Iuh_Emulation.Iuh_conn_parameters."); return single_value->field_local__ip; } INTEGER_template& Iuh__conn__parameters_template::local__sctp__port() { set_specific(); return single_value->field_local__sctp__port; } const INTEGER_template& Iuh__conn__parameters_template::local__sctp__port() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field local_sctp_port of a non-specific template of type @Iuh_Emulation.Iuh_conn_parameters."); return single_value->field_local__sctp__port; } int Iuh__conn__parameters_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @Iuh_Emulation.Iuh_conn_parameters which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 4; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @Iuh_Emulation.Iuh_conn_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 @Iuh_Emulation.Iuh_conn_parameters containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @Iuh_Emulation.Iuh_conn_parameters containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @Iuh_Emulation.Iuh_conn_parameters containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @Iuh_Emulation.Iuh_conn_parameters containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @Iuh_Emulation.Iuh_conn_parameters containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @Iuh_Emulation.Iuh_conn_parameters containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @Iuh_Emulation.Iuh_conn_parameters containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @Iuh_Emulation.Iuh_conn_parameters."); } return 0; } void Iuh__conn__parameters_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ remote_ip := "); single_value->field_remote__ip.log(); TTCN_Logger::log_event_str(", remote_sctp_port := "); single_value->field_remote__sctp__port.log(); TTCN_Logger::log_event_str(", local_ip := "); single_value->field_local__ip.log(); TTCN_Logger::log_event_str(", local_sctp_port := "); single_value->field_local__sctp__port.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 Iuh__conn__parameters_template::log_match(const Iuh__conn__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(!single_value->field_remote__ip.match(match_value.remote__ip(), legacy)){ TTCN_Logger::log_logmatch_info(".remote_ip"); single_value->field_remote__ip.log_match(match_value.remote__ip(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_remote__sctp__port.match(match_value.remote__sctp__port(), legacy)){ TTCN_Logger::log_logmatch_info(".remote_sctp_port"); single_value->field_remote__sctp__port.log_match(match_value.remote__sctp__port(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_local__ip.match(match_value.local__ip(), legacy)){ TTCN_Logger::log_logmatch_info(".local_ip"); single_value->field_local__ip.log_match(match_value.local__ip(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_local__sctp__port.match(match_value.local__sctp__port(), legacy)){ TTCN_Logger::log_logmatch_info(".local_sctp_port"); single_value->field_local__sctp__port.log_match(match_value.local__sctp__port(), 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("{ remote_ip := "); single_value->field_remote__ip.log_match(match_value.remote__ip(), legacy); TTCN_Logger::log_event_str(", remote_sctp_port := "); single_value->field_remote__sctp__port.log_match(match_value.remote__sctp__port(), legacy); TTCN_Logger::log_event_str(", local_ip := "); single_value->field_local__ip.log_match(match_value.local__ip(), legacy); TTCN_Logger::log_event_str(", local_sctp_port := "); single_value->field_local__sctp__port.log_match(match_value.local__sctp__port(), 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 Iuh__conn__parameters_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (remote__ip().is_bound()) remote__ip().set_implicit_omit(); if (remote__sctp__port().is_bound()) remote__sctp__port().set_implicit_omit(); if (local__ip().is_bound()) local__ip().set_implicit_omit(); if (local__sctp__port().is_bound()) local__sctp__port().set_implicit_omit(); } void Iuh__conn__parameters_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_remote__ip.encode_text(text_buf); single_value->field_remote__sctp__port.encode_text(text_buf); single_value->field_local__ip.encode_text(text_buf); single_value->field_local__sctp__port.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 @Iuh_Emulation.Iuh_conn_parameters."); } } void Iuh__conn__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_remote__ip.decode_text(text_buf); single_value->field_remote__sctp__port.decode_text(text_buf); single_value->field_local__ip.decode_text(text_buf); single_value->field_local__sctp__port.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 Iuh__conn__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 @Iuh_Emulation.Iuh_conn_parameters."); } } void Iuh__conn__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: { Iuh__conn__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_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) remote__ip().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) remote__sctp__port().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) local__ip().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) local__sctp__port().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "remote_ip")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { remote__ip().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "remote_sctp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { remote__sctp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "local_ip")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__ip().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "local_sctp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__sctp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @Iuh_Emulation.Iuh_conn_parameters: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Iuh__conn__parameters_template* precondition = new Iuh__conn__parameters_template; precondition->set_param(*param.get_elem(0)); Iuh__conn__parameters_template* implied_template = new Iuh__conn__parameters_template; implied_template->set_param(*param.get_elem(1)); *this = Iuh__conn__parameters_template(precondition, implied_template); } break; default: param.type_error("record template", "@Iuh_Emulation.Iuh_conn_parameters"); } is_ifpresent = param.get_ifpresent(); } void Iuh__conn__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_remote__ip.check_restriction(t_res, t_name ? t_name : "@Iuh_Emulation.Iuh_conn_parameters"); single_value->field_remote__sctp__port.check_restriction(t_res, t_name ? t_name : "@Iuh_Emulation.Iuh_conn_parameters"); single_value->field_local__ip.check_restriction(t_res, t_name ? t_name : "@Iuh_Emulation.Iuh_conn_parameters"); single_value->field_local__sctp__port.check_restriction(t_res, t_name ? t_name : "@Iuh_Emulation.Iuh_conn_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 : "@Iuh_Emulation.Iuh_conn_parameters"); } boolean Iuh__conn__parameters_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Iuh__conn__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(Iuh__Emulation__CT_component_g__pars).remote__sctp__port() == -1); } void start_emu__is__server(const COMPONENT& component_reference) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function emu_is_server("); 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, "Iuh_Emulation", "emu_is_server", text_buf); TTCN_Runtime::send_start_component(text_buf); } INTEGER f__iuh__conn__id() { TTCN_Location current_location("Iuh_Emulation.ttcn", 104, TTCN_Location::LOCATION_FUNCTION, "f_iuh_conn_id"); current_location.update_lineno(106); /* Iuh_Emulation.ttcn, line 106 */ INTEGER conn__id; current_location.update_lineno(108); /* Iuh_Emulation.ttcn, line 108 */ if ((!(emu__is__server()))) { current_location.update_lineno(109); /* Iuh_Emulation.ttcn, line 109 */ conn__id = Iuh__Emulation__CT_component_g__self__conn__id; } else { current_location.update_lineno(111); /* Iuh_Emulation.ttcn, line 111 */ conn__id = Iuh__Emulation__CT_component_g__last__conn__id; } current_location.update_lineno(114); /* Iuh_Emulation.ttcn, line 114 */ if ((conn__id == -1)) { current_location.update_lineno(115); /* Iuh_Emulation.ttcn, line 115 */ Misc__Helpers::f__shutdown(cs_0, 115, FAIL, cs_1); } current_location.update_lineno(118); /* Iuh_Emulation.ttcn, line 118 */ return conn__id; } void start_f__iuh__conn__id(const COMPONENT& component_reference) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_iuh_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, "Iuh_Emulation", "f_iuh_conn_id", text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__send__IUHEM__Event(const IUHEM__Event_template& evt) { TTCN_Location current_location("Iuh_Emulation.ttcn", 121, TTCN_Location::LOCATION_FUNCTION, "f_send_IUHEM_Event"); current_location.update_lineno(122); /* Iuh_Emulation.ttcn, line 122 */ if (Iuh__Emulation__CT_component_HNBAP.check_port_state(cs_2)) { current_location.update_lineno(123); /* Iuh_Emulation.ttcn, line 123 */ Iuh__Emulation__CT_component_HNBAP.send(evt, FALSE, NULL); } } void start_f__send__IUHEM__Event(const COMPONENT& component_reference, const IUHEM__Event_template& evt) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_send_IUHEM_Event("); 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, "Iuh_Emulation", "f_send_IUHEM_Event", text_buf); evt.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void main_(const Iuh__conn__parameters& p, const CHARSTRING& id) { TTCN_Location current_location("Iuh_Emulation.ttcn", 127, TTCN_Location::LOCATION_FUNCTION, "main"); current_location.update_lineno(128); /* Iuh_Emulation.ttcn, line 128 */ Socket__API__Definitions::Result res; current_location.update_lineno(129); /* Iuh_Emulation.ttcn, line 129 */ Iuh__Emulation__CT_component_g__pars = p; current_location.update_lineno(130); /* Iuh_Emulation.ttcn, line 130 */ Iuh__Emulation__CT_component_g__Iuh__id = id; current_location.update_lineno(132); /* Iuh_Emulation.ttcn, line 132 */ { Map_Params tmp_4(0); TTCN_Runtime::map_port(self, Iuh__Emulation__CT_component_Iuh.get_name(), SYSTEM_COMPREF, "Iuh_CODEC_PT", tmp_4); } current_location.update_lineno(133); /* Iuh_Emulation.ttcn, line 133 */ if (emu__is__server()) { current_location.update_lineno(134); /* Iuh_Emulation.ttcn, line 134 */ Socket__API__Definitions::ProtoTuple tmp_6; tmp_6.sctp() = SCTP__Templates::ts__SctpTuple(SCTP__Templates::ts__SctpTuple_ppid_defval, SCTP__Templates::ts__SctpTuple_assoc__id_defval).valueof(); res = Iuh__CodecPort__CtrlFunct::f__IPL4__listen(Iuh__Emulation__CT_component_Iuh, const_cast< const Iuh__conn__parameters&>(p).local__ip(), const_cast< const Iuh__conn__parameters&>(p).local__sctp__port(), tmp_6, Iuh__CodecPort__CtrlFunct::f__IPL4__listen_options_defval); } else { current_location.update_lineno(137); /* Iuh_Emulation.ttcn, line 137 */ Socket__API__Definitions::ProtoTuple tmp_8; tmp_8.sctp() = SCTP__Templates::ts__SctpTuple(SCTP__Templates::ts__SctpTuple_ppid_defval, SCTP__Templates::ts__SctpTuple_assoc__id_defval).valueof(); res = Iuh__CodecPort__CtrlFunct::f__IPL4__connect(Iuh__Emulation__CT_component_Iuh, const_cast< const Iuh__conn__parameters&>(p).remote__ip(), const_cast< const Iuh__conn__parameters&>(p).remote__sctp__port(), const_cast< const Iuh__conn__parameters&>(p).local__ip(), const_cast< const Iuh__conn__parameters&>(p).local__sctp__port(), -1, tmp_8, Iuh__CodecPort__CtrlFunct::f__IPL4__connect_options_defval); } current_location.update_lineno(141); /* Iuh_Emulation.ttcn, line 141 */ { boolean tmp_12; { boolean tmp_9 = res.is_bound(); if(tmp_9) { const OPTIONAL< INTEGER >& tmp_10 = res.connId(); switch (tmp_10.get_selection()) { case OPTIONAL_UNBOUND: tmp_9 = FALSE; break; case OPTIONAL_OMIT: tmp_9 = FALSE; break; default: { const INTEGER& tmp_11 = (const INTEGER&) tmp_10; tmp_9 = tmp_11.is_present(); break;} } } tmp_12 = (!(tmp_9)); } if (tmp_12) { current_location.update_lineno(142); /* Iuh_Emulation.ttcn, line 142 */ Misc__Helpers::f__shutdown(cs_0, 142, FAIL, cs_3); } } current_location.update_lineno(144); /* Iuh_Emulation.ttcn, line 144 */ Iuh__Emulation__CT_component_g__self__conn__id = const_cast< const Socket__API__Definitions::Result&>(res).connId(); current_location.update_lineno(147); /* Iuh_Emulation.ttcn, line 147 */ if ((const_cast< const Iuh__conn__parameters&>(p).remote__sctp__port() != -1)) { current_location.update_lineno(148); /* Iuh_Emulation.ttcn, line 148 */ { IUHEM__Event_template tmp_14; tmp_14.up__down() = IUHEM__EventUpDown::IUHEM__EVENT__UP; f__send__IUHEM__Event(tmp_14); } } for ( ; ; ) { current_location.update_lineno(152); /* Iuh_Emulation.ttcn, line 152 */ Iuh__CodecPort::Iuh__RecvFrom mrf; current_location.update_lineno(153); /* Iuh_Emulation.ttcn, line 153 */ HNBAP__PDU__Descriptions::HNBAP__PDU hnbap__msg; current_location.update_lineno(154); /* Iuh_Emulation.ttcn, line 154 */ RUA__PDU__Descriptions::RUA__PDU rua__msg; current_location.update_lineno(155); /* Iuh_Emulation.ttcn, line 155 */ Socket__API__Definitions::PortEvent asp__evt; current_location.update_lineno(157); /* Iuh_Emulation.ttcn, line 157 */ { tmp_15: alt_status tmp_15_alt_flag_0 = ALT_MAYBE; alt_status tmp_15_alt_flag_1 = ALT_MAYBE; alt_status tmp_15_alt_flag_2 = ALT_MAYBE; alt_status tmp_15_alt_flag_3 = ALT_MAYBE; alt_status tmp_15_alt_flag_4 = ALT_MAYBE; alt_status tmp_15_alt_flag_5 = ALT_MAYBE; alt_status tmp_15_alt_flag_6 = ALT_MAYBE; alt_status tmp_15_default_flag = ALT_MAYBE; boolean first_run = TRUE; TTCN_Snapshot::take_new(FALSE); for ( ; ; ) { if (tmp_15_alt_flag_0 == ALT_MAYBE) { current_location.update_lineno(159); /* Iuh_Emulation.ttcn, line 159 */ tmp_15_alt_flag_0 = Iuh__Emulation__CT_component_HNBAP.receive(HNBAP__PDU__Descriptions::HNBAP__PDU_template(ANY_VALUE), &(hnbap__msg), any_compref, NULL, NULL, NULL); if (tmp_15_alt_flag_0 == ALT_YES) { current_location.update_lineno(161); /* Iuh_Emulation.ttcn, line 161 */ Iuh__Emulation__CT_component_Iuh.send(Iuh__CodecPort::t__Iuh__Send__HNBAP(INTEGER_template(f__iuh__conn__id()), HNBAP__PDU__Descriptions::HNBAP__PDU_template(hnbap__msg)), FALSE, NULL); break; } } if (tmp_15_alt_flag_1 == ALT_MAYBE) { current_location.update_lineno(164); /* Iuh_Emulation.ttcn, line 164 */ tmp_15_alt_flag_1 = Iuh__Emulation__CT_component_RUA.receive(RUA__PDU__Descriptions::RUA__PDU_template(ANY_VALUE), &(rua__msg), any_compref, NULL, NULL, NULL); if (tmp_15_alt_flag_1 == ALT_YES) { current_location.update_lineno(166); /* Iuh_Emulation.ttcn, line 166 */ Iuh__Emulation__CT_component_Iuh.send(Iuh__CodecPort::t__Iuh__Send__RUA(INTEGER_template(f__iuh__conn__id()), RUA__PDU__Descriptions::RUA__PDU_template(rua__msg)), FALSE, NULL); break; } } if (tmp_15_alt_flag_2 == ALT_MAYBE) { current_location.update_lineno(170); /* Iuh_Emulation.ttcn, line 170 */ tmp_15_alt_flag_2 = Iuh__Emulation__CT_component_Iuh.receive(tr__Iuh__RecvFrom__R(Iuh__Types::Iuh__PDU_template(ANY_VALUE)), &(mrf), any_compref, NULL, NULL, NULL); if (tmp_15_alt_flag_2 == ALT_YES) { current_location.update_lineno(171); /* Iuh_Emulation.ttcn, line 171 */ if ((!(INTEGER_template(f__iuh__conn__id()).match(const_cast< const Iuh__CodecPort::Iuh__RecvFrom&>(mrf).connId())))) { current_location.update_lineno(172); /* Iuh_Emulation.ttcn, line 172 */ Misc__Helpers::f__shutdown(cs_0, 172, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Received message from unexpected conn_id!"),mrf.log(),TTCN_Logger::end_event_log2str())); } current_location.update_lineno(175); /* Iuh_Emulation.ttcn, line 175 */ if (Iuh__CodecPort::t__Iuh__RecvFrom__HNBAP(HNBAP__PDU__Descriptions::HNBAP__PDU_template(ANY_VALUE)).match(mrf)) { current_location.update_lineno(176); /* Iuh_Emulation.ttcn, line 176 */ Iuh__Emulation__CT_component_HNBAP.send(const_cast< const Iuh__CodecPort::Iuh__RecvFrom&>(mrf).msg().hnbap(), FALSE, NULL); } else { current_location.update_lineno(177); /* Iuh_Emulation.ttcn, line 177 */ if (Iuh__CodecPort::t__Iuh__RecvFrom__RUA(RUA__PDU__Descriptions::RUA__PDU_template(ANY_VALUE)).match(mrf)) { current_location.update_lineno(178); /* Iuh_Emulation.ttcn, line 178 */ Iuh__Emulation__CT_component_RUA.send(const_cast< const Iuh__CodecPort::Iuh__RecvFrom&>(mrf).msg().rua(), FALSE, NULL); } else { current_location.update_lineno(181); /* Iuh_Emulation.ttcn, line 181 */ Misc__Helpers::f__shutdown(cs_0, 181, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("UNEXPECTED MESSAGE RECEIVED!"),mrf.log(),TTCN_Logger::end_event_log2str())); } } break; } } if (tmp_15_alt_flag_3 == ALT_MAYBE) { current_location.update_lineno(184); /* Iuh_Emulation.ttcn, line 184 */ tmp_15_alt_flag_3 = Iuh__Emulation__CT_component_Iuh.receive(SCTP__Templates::tr__SctpAssocChange(SCTP__Templates::tr__SctpAssocChange_state_defval, SCTP__Templates::tr__SctpAssocChange_conn__id_defval, SCTP__Templates::tr__SctpAssocChange_sctp_defval), NULL, any_compref, NULL, NULL, NULL); if (tmp_15_alt_flag_3 == ALT_YES) break; } if (tmp_15_alt_flag_4 == ALT_MAYBE) { current_location.update_lineno(185); /* Iuh_Emulation.ttcn, line 185 */ tmp_15_alt_flag_4 = Iuh__Emulation__CT_component_Iuh.receive(SCTP__Templates::tr__SctpPeerAddrChange(SCTP__Templates::tr__SctpPeerAddrChange_state_defval, SCTP__Templates::tr__SctpPeerAddrChange_conn__id_defval), NULL, any_compref, NULL, NULL, NULL); if (tmp_15_alt_flag_4 == ALT_YES) break; } if (tmp_15_alt_flag_5 == ALT_MAYBE) { current_location.update_lineno(188); /* Iuh_Emulation.ttcn, line 188 */ { Socket__API__Definitions::PortEvent_template tmp_16; tmp_16.connOpened() = ANY_VALUE; tmp_15_alt_flag_5 = Iuh__Emulation__CT_component_Iuh.receive(tmp_16, &(asp__evt), any_compref, NULL, NULL, NULL); } if (tmp_15_alt_flag_5 == ALT_YES) { current_location.update_lineno(189); /* Iuh_Emulation.ttcn, line 189 */ if ((!(emu__is__server()))) { current_location.update_lineno(190); /* Iuh_Emulation.ttcn, line 190 */ Misc__Helpers::f__shutdown(cs_0, 190, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unexpected event receiver in client mode"),asp__evt.log(),TTCN_Logger::end_event_log2str())); } current_location.update_lineno(192); /* Iuh_Emulation.ttcn, line 192 */ Iuh__Emulation__CT_component_g__last__conn__id = const_cast< const Socket__API__Definitions::PortEvent&>(asp__evt).connOpened().connId(); current_location.update_lineno(193); /* Iuh_Emulation.ttcn, line 193 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Established a new Iuh connection (conn_id="); Iuh__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(195); /* Iuh_Emulation.ttcn, line 195 */ { IUHEM__Event_template tmp_18; tmp_18.up__down() = IUHEM__EventUpDown::IUHEM__EVENT__UP; f__send__IUHEM__Event(tmp_18); } break; } } if (tmp_15_alt_flag_6 == ALT_MAYBE) { current_location.update_lineno(198); /* Iuh_Emulation.ttcn, line 198 */ { Socket__API__Definitions::PortEvent_template tmp_19; tmp_19.connClosed() = ANY_VALUE; tmp_15_alt_flag_6 = Iuh__Emulation__CT_component_Iuh.receive(tmp_19, &(asp__evt), any_compref, NULL, NULL, NULL); } if (tmp_15_alt_flag_6 == ALT_YES) { current_location.update_lineno(199); /* Iuh_Emulation.ttcn, line 199 */ TTCN_Logger::log_str(TTCN_USER, "Iuh: Closed"); current_location.update_lineno(200); /* Iuh_Emulation.ttcn, line 200 */ Iuh__Emulation__CT_component_g__self__conn__id = -1; current_location.update_lineno(201); /* Iuh_Emulation.ttcn, line 201 */ { IUHEM__Event_template tmp_21; tmp_21.up__down() = IUHEM__EventUpDown::IUHEM__EVENT__DOWN; f__send__IUHEM__Event(tmp_21); } current_location.update_lineno(202); /* Iuh_Emulation.ttcn, line 202 */ if ((!(emu__is__server()))) { current_location.update_lineno(203); /* Iuh_Emulation.ttcn, line 203 */ TTCN_Runtime::stop_execution(); } break; } } if (tmp_15_default_flag == ALT_MAYBE) { tmp_15_default_flag = TTCN_Default::try_altsteps(first_run); if (tmp_15_default_flag == ALT_YES || tmp_15_default_flag == ALT_BREAK) break; else if (tmp_15_default_flag == ALT_REPEAT) goto tmp_15; } current_location.update_lineno(157); /* Iuh_Emulation.ttcn, line 157 */ if (tmp_15_alt_flag_0 == ALT_NO && tmp_15_alt_flag_1 == ALT_NO && tmp_15_alt_flag_2 == ALT_NO && tmp_15_alt_flag_3 == ALT_NO && tmp_15_alt_flag_4 == ALT_NO && tmp_15_alt_flag_5 == ALT_NO && tmp_15_alt_flag_6 == ALT_NO && tmp_15_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file Iuh_Emulation.ttcn between lines 157 and 206."); TTCN_Snapshot::take_new(TRUE); first_run = FALSE; } } } } void start_main_(const COMPONENT& component_reference, const Iuh__conn__parameters& p, const CHARSTRING& id) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function main("); p.log(); TTCN_Logger::log_event_str(", "); 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, "Iuh_Emulation", "main", text_buf); p.encode_text(text_buf); id.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("Iuh_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "Iuh_Emulation"); Iuh__CodecPort__CtrlFunct::module_object.pre_init_module(); HNBAP__Templates::module_object.pre_init_module(); RUA__Templates::module_object.pre_init_module(); SCTP__Templates::module_object.pre_init_module(); Misc__Helpers::module_object.pre_init_module(); DNS__Helpers::module_object.pre_init_module(); module_object.add_function("tr_Iuh_RecvFrom_R", (genericfunc_t)&tr__Iuh__RecvFrom__R, (genericfunc_t)&start_tr__Iuh__RecvFrom__R); module_object.add_function("emu_is_server", (genericfunc_t)&emu__is__server, (genericfunc_t)&start_emu__is__server); module_object.add_function("f_iuh_conn_id", (genericfunc_t)&f__iuh__conn__id, (genericfunc_t)&start_f__iuh__conn__id); module_object.add_function("f_send_IUHEM_Event", (genericfunc_t)&f__send__IUHEM__Event, (genericfunc_t)&start_f__send__IUHEM__Event); module_object.add_function("main", (genericfunc_t)&main_, (genericfunc_t)&start_main_); } void post_init_module() { TTCN_Location current_location("Iuh_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "Iuh_Emulation"); Iuh__CodecPort__CtrlFunct::module_object.post_init_module(); HNBAP__Templates::module_object.post_init_module(); RUA__Templates::module_object.post_init_module(); SCTP__Templates::module_object.post_init_module(); Misc__Helpers::module_object.post_init_module(); DNS__Helpers::module_object.post_init_module(); } boolean init_comp_type(const char *component_type, boolean init_base_comps) { (void)init_base_comps; if (!strcmp(component_type, "Iuh_ConnHdlr")) { Iuh__ConnHdlr_component_HNBAP.activate_port(); Iuh__ConnHdlr_component_RUA.activate_port(); return TRUE; } else if (!strcmp(component_type, "Iuh_Emulation_CT")) { Iuh__Emulation__CT_component_Iuh.activate_port(); Iuh__Emulation__CT_component_HNBAP.activate_port(); Iuh__Emulation__CT_component_RUA.activate_port(); Iuh__Emulation__CT_component_g__pars.clean_up(); Iuh__Emulation__CT_component_g__Iuh__id.clean_up(); Iuh__Emulation__CT_component_g__self__conn__id = -1; Iuh__Emulation__CT_component_g__last__conn__id = -1; return TRUE; } else return FALSE; } boolean init_system_port(const char* component_type, const char* port_name) { if (!strcmp(component_type, "Iuh_ConnHdlr")) { if (!strcmp(port_name, "HNBAP")) { Iuh__ConnHdlr_component_HNBAP.safe_start(); return TRUE; } if (!strcmp(port_name, "RUA")) { Iuh__ConnHdlr_component_RUA.safe_start(); return TRUE; } } else if (!strcmp(component_type, "Iuh_Emulation_CT")) { if (!strcmp(port_name, "HNBAP")) { Iuh__Emulation__CT_component_HNBAP.safe_start(); return TRUE; } if (!strcmp(port_name, "Iuh")) { Iuh__Emulation__CT_component_Iuh.safe_start(); return TRUE; } if (!strcmp(port_name, "RUA")) { Iuh__Emulation__CT_component_RUA.safe_start(); return TRUE; } } return FALSE; } boolean start_ptc_function(const char *function_name, Text_Buf& function_arguments) { if (!strcmp(function_name, "tr_Iuh_RecvFrom_R")) { Iuh__Types::Iuh__PDU_template msg; msg.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function tr_Iuh_RecvFrom_R("); msg.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); tr__Iuh__RecvFrom__R(msg); TTCN_Runtime::function_finished("tr_Iuh_RecvFrom_R"); return TRUE; } else if (!strcmp(function_name, "emu_is_server")) { TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function emu_is_server()."); TTCN_Runtime::function_started(function_arguments); emu__is__server(); TTCN_Runtime::function_finished("emu_is_server"); return TRUE; } else if (!strcmp(function_name, "f_iuh_conn_id")) { TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_iuh_conn_id()."); TTCN_Runtime::function_started(function_arguments); f__iuh__conn__id(); TTCN_Runtime::function_finished("f_iuh_conn_id"); return TRUE; } else if (!strcmp(function_name, "f_send_IUHEM_Event")) { IUHEM__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_IUHEM_Event("); evt.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__send__IUHEM__Event(evt); TTCN_Runtime::function_finished("f_send_IUHEM_Event"); return TRUE; } else if (!strcmp(function_name, "main")) { Iuh__conn__parameters p; CHARSTRING id; p.decode_text(function_arguments); id.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function main("); p.log(); TTCN_Logger::log_event_str(", "); id.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); main_(p, id); TTCN_Runtime::function_finished("main"); return TRUE; } else return FALSE; } } /* end of namespace */