// 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 "MGCP_Emulation.hh" namespace MGCP__Emulation { /* Literal string constants */ extern const CHARSTRING cs_13(0, NULL), cs_11(3, "AMR"), cs_12(6, "AMR-WB"), cs_4(4, "CRCX"), cs_3(9, "Connected"), cs_7(3, "GSM"), cs_9(7, "GSM-EFR"), cs_10(9, "GSM-HR-08"), cs_1(25, "MGCP Endpoint Table full!"), cs_0(19, "MGCP_Emulation.ttcn"), cs_5(32, "No space left in MgcpExpectTable"), cs_8(4, "PCMA"), cs_6(4, "PCMU"), cs_2('Z'); const unsigned char module_checksum[] = { 0xc9, 0x13, 0xfa, 0x83, 0x3b, 0x95, 0xbe, 0xab, 0x98, 0xd8, 0x8d, 0xe4, 0xb4, 0xd8, 0x0f, 0x80 }; /* Global variable definitions */ const TTCN_Typedescriptor_t& MGCP__ConnHdlr_descr_ = COMPONENT_descr_; MGCP__Conn__PT MGCP__ConnHdlr_component_MGCP("MGCP"); MGCP__Conn__Multi__PT MGCP__ConnHdlr_component_MGCP__MULTI("MGCP_MULTI"); MGCPEM__PROC__PT MGCP__ConnHdlr_component_MGCP__PROC("MGCP_PROC"); // No XER for EndpointData const TTCN_Typedescriptor_t EndpointData_descr_ = { "@MGCP_Emulation.EndpointData", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t EndpointData_endpoint_xer_ = { {"endpoint>\n", "endpoint>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t EndpointData_endpoint_descr_ = { "@MGCP_Emulation.EndpointData.endpoint", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &EndpointData_endpoint_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING EndpointData_endpoint_default_coding("TEXT"); // No XER for MgcpTransIds const TTCN_Typedescriptor_t MgcpTransIds_descr_ = { "@MGCP_Emulation.MgcpTransIds", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &MGCP__Types::MgcpTransId_descr_, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t MgcpTransIds_0_xer_ = { {"MgcpTransId>\n", "MgcpTransId>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t MgcpTransIds_0_descr_ = { "@MGCP_Emulation.MgcpTransIds.", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &MgcpTransIds_0_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING MgcpTransIds_0_default_coding("TEXT"); const TTCN_Typedescriptor_t& MGCP__Emulation__CT_descr_ = COMPONENT_descr_; MGCP__CodecPort::MGCP__CODEC__PT MGCP__Emulation__CT_component_MGCP("MGCP"); MGCP__Conn__PT MGCP__Emulation__CT_component_MGCP__CLIENT("MGCP_CLIENT"); MGCP__Conn__Multi__PT MGCP__Emulation__CT_component_MGCP__CLIENT__MULTI("MGCP_CLIENT_MULTI"); VALUE_ARRAY MGCP__Emulation__CT_component_MgcpEndpointTable; MgcpTransIds MGCP__Emulation__CT_component_MgcpPendingTrans; // No XER for ExpectData const TTCN_Typedescriptor_t ExpectData_descr_ = { "@MGCP_Emulation.ExpectData", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for ExpectCriteria const TTCN_Typedescriptor_t ExpectCriteria_descr_ = { "@MGCP_Emulation.ExpectCriteria", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ExpectCriteria_connid_xer_ = { {"connid>\n", "connid>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ExpectCriteria_connid_descr_ = { "@MGCP_Emulation.ExpectCriteria.connid", NULL, &HEXSTRING_raw_, NULL, &ExpectCriteria_connid_xer_, &HEXSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t ExpectCriteria_endpoint_xer_ = { {"endpoint>\n", "endpoint>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ExpectCriteria_endpoint_descr_ = { "@MGCP_Emulation.ExpectCriteria.endpoint", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &ExpectCriteria_endpoint_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ExpectCriteria_endpoint_default_coding("TEXT"); const XERdescriptor_t ExpectCriteria_transid_xer_ = { {"transid>\n", "transid>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t ExpectCriteria_transid_descr_ = { "@MGCP_Emulation.ExpectCriteria.transid", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &ExpectCriteria_transid_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ExpectCriteria_transid_default_coding("TEXT"); VALUE_ARRAY MGCP__Emulation__CT_component_MgcpExpectTable; MGCPEM__PROC__PT MGCP__Emulation__CT_component_MGCP__PROC("MGCP_PROC"); CHARSTRING MGCP__Emulation__CT_component_g__mgcp__id; INTEGER MGCP__Emulation__CT_component_g__mgcp__conn__id; const XERdescriptor_t MGCP__conn__parameters_callagent__ip_xer_ = { {"callagent_ip>\n", "callagent_ip>\n"}, {14, 14}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t MGCP__conn__parameters_callagent__ip_descr_ = { "@MGCP_Emulation.MGCP_conn_parameters.callagent_ip", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &MGCP__conn__parameters_callagent__ip_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t MGCP__conn__parameters_callagent__udp__port_xer_ = { {"callagent_udp_port>\n", "callagent_udp_port>\n"}, {20, 20}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t MGCP__conn__parameters_callagent__udp__port_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t MGCP__conn__parameters_callagent__udp__port_descr_ = { "@MGCP_Emulation.MGCP_conn_parameters.callagent_udp_port", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &MGCP__conn__parameters_callagent__udp__port_xer_, &INTEGER_json_, &MGCP__conn__parameters_callagent__udp__port_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t MGCP__conn__parameters_mgw__ip_xer_ = { {"mgw_ip>\n", "mgw_ip>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t MGCP__conn__parameters_mgw__ip_descr_ = { "@MGCP_Emulation.MGCP_conn_parameters.mgw_ip", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &MGCP__conn__parameters_mgw__ip_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t MGCP__conn__parameters_mgw__udp__port_xer_ = { {"mgw_udp_port>\n", "mgw_udp_port>\n"}, {14, 14}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t MGCP__conn__parameters_mgw__udp__port_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t MGCP__conn__parameters_mgw__udp__port_descr_ = { "@MGCP_Emulation.MGCP_conn_parameters.mgw_udp_port", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &MGCP__conn__parameters_mgw__udp__port_xer_, &INTEGER_json_, &MGCP__conn__parameters_mgw__udp__port_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t MGCP__conn__parameters_multi__conn__mode_xer_ = { {"multi_conn_mode>\n", "multi_conn_mode>\n"}, {17, 17}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int MGCP__conn__parameters_multi__conn__mode_oer_ext_arr_[0] = {}; const int MGCP__conn__parameters_multi__conn__mode_oer_p_[0] = {}; const TTCN_OERdescriptor_t MGCP__conn__parameters_multi__conn__mode_oer_ = { -1, TRUE, -1, FALSE, 0, 0, MGCP__conn__parameters_multi__conn__mode_oer_ext_arr_, 0, MGCP__conn__parameters_multi__conn__mode_oer_p_}; const TTCN_Typedescriptor_t MGCP__conn__parameters_multi__conn__mode_descr_ = { "@MGCP_Emulation.MGCP_conn_parameters.multi_conn_mode", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &MGCP__conn__parameters_multi__conn__mode_xer_, &BOOLEAN_json_, &MGCP__conn__parameters_multi__conn__mode_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for MGCP__conn__parameters const TTCN_Typedescriptor_t MGCP__conn__parameters_descr_ = { "@MGCP_Emulation.MGCP_conn_parameters", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; MGCP__conn__parameters MGCP__Emulation__CT_component_g__pars; // No XER for MGCPCreateCallback const TTCN_Typedescriptor_t MGCPCreateCallback_descr_ = { "@MGCP_Emulation.MGCPCreateCallback", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for MGCPUnitdataCallback const TTCN_Typedescriptor_t MGCPUnitdataCallback_descr_ = { "@MGCP_Emulation.MGCPUnitdataCallback", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for MGCPOps const TTCN_Typedescriptor_t MGCPOps_descr_ = { "@MGCP_Emulation.MGCPOps", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; TTCN_Module module_object("MGCP_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 */ void MGCP__Conn__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 MGCP__Conn__PT::clear_queue() { while (msg_queue_head != NULL) remove_msg_queue_head(); } MGCP__Conn__PT::MGCP__Conn__PT(const char *par_port_name) : PORT(par_port_name) { msg_queue_head = NULL; msg_queue_tail = NULL; } MGCP__Conn__PT::~MGCP__Conn__PT() { clear_queue(); } void MGCP__Conn__PT::send(const MGCP__Types::MgcpCommand& 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(" @MGCP_Types.MgcpCommand : "), 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, "@MGCP_Types.MgcpCommand"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCP__Conn__PT::send(const MGCP__Types::MgcpCommand& 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 MGCP__Conn__PT::send(const MGCP__Types::MgcpCommand& 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, "@MGCP_Types.MgcpCommand"); 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(" @MGCP_Types.MgcpCommand : "), send_par.log(), TTCN_Logger::end_event_log2str())); } else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void MGCP__Conn__PT::send(const MGCP__Types::MgcpCommand_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const MGCP__Types::MgcpCommand& send_par_value = MGCP__Types::MgcpCommand(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void MGCP__Conn__PT::send(const MGCP__Types::MgcpCommand_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { const MGCP__Types::MgcpCommand& send_par_value = MGCP__Types::MgcpCommand(send_par.valueof()); send(send_par_value, nof_components, destination_components, timestamp_redirect); } void MGCP__Conn__PT::send(const MGCP__Types::MgcpCommand_template& send_par, boolean broadcast, FLOAT* timestamp_redirect) { const MGCP__Types::MgcpCommand& send_par_value = MGCP__Types::MgcpCommand(send_par.valueof()); send(send_par_value, broadcast, timestamp_redirect); } void MGCP__Conn__PT::send(const MGCP__Types::MgcpResponse& 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(" @MGCP_Types.MgcpResponse : "), 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, "@MGCP_Types.MgcpResponse"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCP__Conn__PT::send(const MGCP__Types::MgcpResponse& 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 MGCP__Conn__PT::send(const MGCP__Types::MgcpResponse& 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, "@MGCP_Types.MgcpResponse"); 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(" @MGCP_Types.MgcpResponse : "), send_par.log(), TTCN_Logger::end_event_log2str())); } else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void MGCP__Conn__PT::send(const MGCP__Types::MgcpResponse_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const MGCP__Types::MgcpResponse& send_par_value = MGCP__Types::MgcpResponse(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void MGCP__Conn__PT::send(const MGCP__Types::MgcpResponse_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { const MGCP__Types::MgcpResponse& send_par_value = MGCP__Types::MgcpResponse(send_par.valueof()); send(send_par_value, nof_components, destination_components, timestamp_redirect); } void MGCP__Conn__PT::send(const MGCP__Types::MgcpResponse_template& send_par, boolean broadcast, FLOAT* timestamp_redirect) { const MGCP__Types::MgcpResponse& send_par_value = MGCP__Types::MgcpResponse(send_par.valueof()); send(send_par_value, broadcast, timestamp_redirect); } alt_status MGCP__Conn__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(": @MGCP_Types.MgcpCommand: "), 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(": @MGCP_Types.MgcpResponse: "), 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 MGCP__Conn__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(": @MGCP_Types.MgcpCommand: "), 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(": @MGCP_Types.MgcpResponse: "), 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 MGCP__Conn__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(": @MGCP_Types.MgcpCommand: "), 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(": @MGCP_Types.MgcpResponse: "), 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 MGCP__Conn__PT::receive(const MGCP__Types::MgcpCommand_template& value_template, MGCP__Types::MgcpCommand *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 @MGCP_Types.MgcpCommand.", 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(": @MGCP_Types.MgcpCommand : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status MGCP__Conn__PT::check_receive(const MGCP__Types::MgcpCommand_template& value_template, MGCP__Types::MgcpCommand *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 @MGCP_Types.MgcpCommand.", 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(": @MGCP_Types.MgcpCommand : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MGCP__Conn__PT::trigger(const MGCP__Types::MgcpCommand_template& value_template, MGCP__Types::MgcpCommand *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 @MGCP_Types.MgcpCommand.", 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(": @MGCP_Types.MgcpCommand : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status MGCP__Conn__PT::receive(const MGCP__Types::MgcpResponse_template& value_template, MGCP__Types::MgcpResponse *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 @MGCP_Types.MgcpResponse.", 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(": @MGCP_Types.MgcpResponse : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status MGCP__Conn__PT::check_receive(const MGCP__Types::MgcpResponse_template& value_template, MGCP__Types::MgcpResponse *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 @MGCP_Types.MgcpResponse.", 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(": @MGCP_Types.MgcpResponse : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MGCP__Conn__PT::trigger(const MGCP__Types::MgcpResponse_template& value_template, MGCP__Types::MgcpResponse *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 @MGCP_Types.MgcpResponse.", 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(": @MGCP_Types.MgcpResponse : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } void MGCP__Conn__PT::incoming_message(const MGCP__Types::MgcpCommand& 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(" @MGCP_Types.MgcpCommand : "), 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 MGCP__Types::MgcpCommand(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } void MGCP__Conn__PT::incoming_message(const MGCP__Types::MgcpResponse& 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(" @MGCP_Types.MgcpResponse : "), 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 MGCP__Types::MgcpResponse(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } boolean MGCP__Conn__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&) { if (!strcmp(message_type, "@MGCP_Types.MgcpCommand")) { MGCP__Types::MgcpCommand incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else if (!strcmp(message_type, "@MGCP_Types.MgcpResponse")) { MGCP__Types::MgcpResponse incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else return FALSE; } void MGCP__Conn__Multi__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 MGCP__Conn__Multi__PT::clear_queue() { while (msg_queue_head != NULL) remove_msg_queue_head(); } MGCP__Conn__Multi__PT::MGCP__Conn__Multi__PT(const char *par_port_name) : PORT(par_port_name) { msg_queue_head = NULL; msg_queue_tail = NULL; } MGCP__Conn__Multi__PT::~MGCP__Conn__Multi__PT() { clear_queue(); } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__RecvFrom& 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(" @MGCP_CodecPort.MGCP_RecvFrom : "), 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, "@MGCP_CodecPort.MGCP_RecvFrom"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__RecvFrom& 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 MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__RecvFrom& 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, "@MGCP_CodecPort.MGCP_RecvFrom"); 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(" @MGCP_CodecPort.MGCP_RecvFrom : "), send_par.log(), TTCN_Logger::end_event_log2str())); } else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__RecvFrom_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const MGCP__CodecPort::MGCP__RecvFrom& send_par_value = MGCP__CodecPort::MGCP__RecvFrom(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__RecvFrom_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { const MGCP__CodecPort::MGCP__RecvFrom& send_par_value = MGCP__CodecPort::MGCP__RecvFrom(send_par.valueof()); send(send_par_value, nof_components, destination_components, timestamp_redirect); } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__RecvFrom_template& send_par, boolean broadcast, FLOAT* timestamp_redirect) { const MGCP__CodecPort::MGCP__RecvFrom& send_par_value = MGCP__CodecPort::MGCP__RecvFrom(send_par.valueof()); send(send_par_value, broadcast, timestamp_redirect); } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__SendTo& 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(" @MGCP_CodecPort.MGCP_SendTo : "), 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, "@MGCP_CodecPort.MGCP_SendTo"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__SendTo& 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 MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__SendTo& 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, "@MGCP_CodecPort.MGCP_SendTo"); 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(" @MGCP_CodecPort.MGCP_SendTo : "), send_par.log(), TTCN_Logger::end_event_log2str())); } else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__SendTo_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const MGCP__CodecPort::MGCP__SendTo& send_par_value = MGCP__CodecPort::MGCP__SendTo(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__SendTo_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { const MGCP__CodecPort::MGCP__SendTo& send_par_value = MGCP__CodecPort::MGCP__SendTo(send_par.valueof()); send(send_par_value, nof_components, destination_components, timestamp_redirect); } void MGCP__Conn__Multi__PT::send(const MGCP__CodecPort::MGCP__SendTo_template& send_par, boolean broadcast, FLOAT* timestamp_redirect) { const MGCP__CodecPort::MGCP__SendTo& send_par_value = MGCP__CodecPort::MGCP__SendTo(send_par.valueof()); send(send_par_value, broadcast, timestamp_redirect); } alt_status MGCP__Conn__Multi__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(": @MGCP_CodecPort.MGCP_RecvFrom: "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; case MESSAGE_1: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @MGCP_CodecPort.MGCP_SendTo: "), 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 MGCP__Conn__Multi__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(": @MGCP_CodecPort.MGCP_RecvFrom: "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; case MESSAGE_1: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @MGCP_CodecPort.MGCP_SendTo: "), 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 MGCP__Conn__Multi__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(": @MGCP_CodecPort.MGCP_RecvFrom: "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; case MESSAGE_1: TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @MGCP_CodecPort.MGCP_SendTo: "), 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 MGCP__Conn__Multi__PT::receive(const MGCP__CodecPort::MGCP__RecvFrom_template& value_template, MGCP__CodecPort::MGCP__RecvFrom *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Receive operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (my_head->item_selection != MESSAGE_0) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @MGCP_CodecPort.MGCP_RecvFrom.", port_name); return ALT_NO; } else if (!value_template.match(*my_head->message_0)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_0; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @MGCP_CodecPort.MGCP_RecvFrom : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status MGCP__Conn__Multi__PT::check_receive(const MGCP__CodecPort::MGCP__RecvFrom_template& value_template, MGCP__CodecPort::MGCP__RecvFrom *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Check-receive operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (my_head->item_selection != MESSAGE_0) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s failed: Type of the first message in the queue is not @MGCP_CodecPort.MGCP_RecvFrom.", port_name); return ALT_NO; } else if (!value_template.match(*my_head->message_0)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_0; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::check__receive__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @MGCP_CodecPort.MGCP_RecvFrom : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MGCP__Conn__Multi__PT::trigger(const MGCP__CodecPort::MGCP__RecvFrom_template& value_template, MGCP__CodecPort::MGCP__RecvFrom *value_redirect, const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (value_template.get_selection() == ANY_OR_OMIT) TTCN_error("Trigger operation using '*' as matching template"); msg_queue_item *my_head = (msg_queue_item*)msg_queue_head; if (msg_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(my_head->sender_component)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s will drop a message: Sender of the first message in the queue does not match the from clause: ", port_name); sender_template.log_match(my_head->sender_component); TTCN_Logger::end_event(); } remove_msg_queue_head(); return ALT_REPEAT; } else if (my_head->item_selection != MESSAGE_0) { TTCN_Logger::log(my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMUNSUCC:TTCN_Logger::MATCHING_MCUNSUCC, "Matching on port %s will drop a message: Type of the first message in the queue is not @MGCP_CodecPort.MGCP_RecvFrom.", port_name); remove_msg_queue_head(); return ALT_REPEAT; } else if (!value_template.match(*my_head->message_0)) { const TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_MMUNSUCC : TTCN_Logger::MATCHING_MCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::message__does__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } remove_msg_queue_head(); return ALT_REPEAT; } else { if (value_redirect != NULL) { *value_redirect = *my_head->message_0; } if (sender_ptr != NULL) *sender_ptr = my_head->sender_component; TTCN_Logger::Severity log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_MMSUCCESS:TTCN_Logger::MATCHING_MCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_success(TitanLoggerApiSimple::PortType::message__, port_name, my_head->sender_component, (TTCN_Logger::begin_event(log_sev, TRUE), value_template.log_match(*my_head->message_0), TTCN_Logger::end_event_log2str())); } log_sev = my_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_MMRECV:TTCN_Logger::PORTEVENT_MCRECV; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_msgport_recv(port_name, TitanLoggerApiSimple::Msg__port__recv_operation::trigger__op, my_head->sender_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(log_sev,TRUE), TTCN_Logger::log_event_str(": @MGCP_CodecPort.MGCP_RecvFrom : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status MGCP__Conn__Multi__PT::receive(const MGCP__CodecPort::MGCP__SendTo_template& value_template, MGCP__CodecPort::MGCP__SendTo *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 @MGCP_CodecPort.MGCP_SendTo.", 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(": @MGCP_CodecPort.MGCP_SendTo : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status MGCP__Conn__Multi__PT::check_receive(const MGCP__CodecPort::MGCP__SendTo_template& value_template, MGCP__CodecPort::MGCP__SendTo *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 @MGCP_CodecPort.MGCP_SendTo.", 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(": @MGCP_CodecPort.MGCP_SendTo : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MGCP__Conn__Multi__PT::trigger(const MGCP__CodecPort::MGCP__SendTo_template& value_template, MGCP__CodecPort::MGCP__SendTo *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 @MGCP_CodecPort.MGCP_SendTo.", 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(": @MGCP_CodecPort.MGCP_SendTo : "), my_head->message_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } void MGCP__Conn__Multi__PT::incoming_message(const MGCP__CodecPort::MGCP__RecvFrom& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A message that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a message has arrived on it.", port_name); } } 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(" @MGCP_CodecPort.MGCP_RecvFrom : "), 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 MGCP__CodecPort::MGCP__RecvFrom(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } void MGCP__Conn__Multi__PT::incoming_message(const MGCP__CodecPort::MGCP__SendTo& 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(" @MGCP_CodecPort.MGCP_SendTo : "), 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 MGCP__CodecPort::MGCP__SendTo(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } boolean MGCP__Conn__Multi__PT::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&) { if (!strcmp(message_type, "@MGCP_CodecPort.MGCP_RecvFrom")) { MGCP__CodecPort::MGCP__RecvFrom incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else if (!strcmp(message_type, "@MGCP_CodecPort.MGCP_SendTo")) { MGCP__CodecPort::MGCP__SendTo incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else return FALSE; } EndpointData::EndpointData() { } EndpointData::EndpointData(const COMPONENT& par_comp__ref, const OPTIONAL< CHARSTRING >& par_endpoint) : field_comp__ref(par_comp__ref), field_endpoint(par_endpoint) { } EndpointData::EndpointData(const EndpointData& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @MGCP_Emulation.EndpointData."); if (other_value.comp__ref().is_bound()) field_comp__ref = other_value.comp__ref(); else field_comp__ref.clean_up(); if (other_value.endpoint().is_bound()) field_endpoint = other_value.endpoint(); else field_endpoint.clean_up(); } void EndpointData::clean_up() { field_comp__ref.clean_up(); field_endpoint.clean_up(); } const TTCN_Typedescriptor_t* EndpointData::get_descriptor() const { return &EndpointData_descr_; } EndpointData& EndpointData::operator=(const EndpointData& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @MGCP_Emulation.EndpointData."); if (other_value.comp__ref().is_bound()) field_comp__ref = other_value.comp__ref(); else field_comp__ref.clean_up(); if (other_value.endpoint().is_bound()) field_endpoint = other_value.endpoint(); else field_endpoint.clean_up(); } return *this; } boolean EndpointData::operator==(const EndpointData& other_value) const { return field_comp__ref==other_value.field_comp__ref && field_endpoint==other_value.field_endpoint; } boolean EndpointData::is_bound() const { return (field_comp__ref.is_bound()) || (OPTIONAL_OMIT == field_endpoint.get_selection() || field_endpoint.is_bound()); } boolean EndpointData::is_value() const { return field_comp__ref.is_value() && (OPTIONAL_OMIT == field_endpoint.get_selection() || field_endpoint.is_value()); } int EndpointData::size_of() const { int ret_val = 1; if (field_endpoint.ispresent()) ret_val++; return ret_val; } void EndpointData::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ comp_ref := "); field_comp__ref.log(); TTCN_Logger::log_event_str(", endpoint := "); field_endpoint.log(); TTCN_Logger::log_event_str(" }"); } void EndpointData::set_implicit_omit() { if (comp__ref().is_bound()) comp__ref().set_implicit_omit(); if (!endpoint().is_bound()) endpoint() = OMIT_VALUE; else endpoint().set_implicit_omit(); } void EndpointData::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 (20 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) comp__ref().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) endpoint().set_param(*param.get_elem(1)); 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(), "comp_ref")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { comp__ref().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "endpoint")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { endpoint().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.EndpointData: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@MGCP_Emulation.EndpointData"); } } void EndpointData::encode_text(Text_Buf& text_buf) const { field_comp__ref.encode_text(text_buf); field_endpoint.encode_text(text_buf); } void EndpointData::decode_text(Text_Buf& text_buf) { field_comp__ref.decode_text(text_buf); field_endpoint.decode_text(text_buf); } struct EndpointData_template::single_value_struct { COMPONENT_template field_comp__ref; CHARSTRING_template field_endpoint; }; void EndpointData_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_comp__ref = ANY_VALUE; single_value->field_endpoint = ANY_OR_OMIT; } } } void EndpointData_template::copy_value(const EndpointData& other_value) { single_value = new single_value_struct; if (other_value.comp__ref().is_bound()) { single_value->field_comp__ref = other_value.comp__ref(); } else { single_value->field_comp__ref.clean_up(); } if (other_value.endpoint().is_bound()) { if (other_value.endpoint().ispresent()) single_value->field_endpoint = other_value.endpoint()(); else single_value->field_endpoint = OMIT_VALUE; } else { single_value->field_endpoint.clean_up(); } set_selection(SPECIFIC_VALUE); } void EndpointData_template::copy_template(const EndpointData_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.comp__ref().get_selection()) { single_value->field_comp__ref = other_value.comp__ref(); } else { single_value->field_comp__ref.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.endpoint().get_selection()) { single_value->field_endpoint = other_value.endpoint(); } else { single_value->field_endpoint.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 EndpointData_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 EndpointData_template(*other_value.implication_.precondition); implication_.implied_template = new EndpointData_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 @MGCP_Emulation.EndpointData."); break; } set_selection(other_value); } EndpointData_template::EndpointData_template() { } EndpointData_template::EndpointData_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EndpointData_template::EndpointData_template(const EndpointData& other_value) { copy_value(other_value); } EndpointData_template::EndpointData_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EndpointData&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @MGCP_Emulation.EndpointData from an unbound optional field."); } } EndpointData_template::EndpointData_template(EndpointData_template* p_precondition, EndpointData_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EndpointData_template::EndpointData_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; } EndpointData_template::EndpointData_template(const EndpointData_template& other_value) : Base_Template() { copy_template(other_value); } EndpointData_template::~EndpointData_template() { clean_up(); } EndpointData_template& EndpointData_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EndpointData_template& EndpointData_template::operator=(const EndpointData& other_value) { clean_up(); copy_value(other_value); return *this; } EndpointData_template& EndpointData_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EndpointData&)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 @MGCP_Emulation.EndpointData."); } return *this; } EndpointData_template& EndpointData_template::operator=(const EndpointData_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EndpointData_template::match(const EndpointData& 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.comp__ref().is_bound()) return FALSE; if(!single_value->field_comp__ref.match(other_value.comp__ref(), legacy))return FALSE; if(!other_value.endpoint().is_bound()) return FALSE; if((other_value.endpoint().ispresent() ? !single_value->field_endpoint.match((const CHARSTRING&)other_value.endpoint(), legacy) : !single_value->field_endpoint.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @MGCP_Emulation.EndpointData."); } return FALSE; } boolean EndpointData_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_comp__ref.is_bound() || (single_value->field_endpoint.is_omit() || single_value->field_endpoint.is_bound()); } boolean EndpointData_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_comp__ref.is_value() && (single_value->field_endpoint.is_omit() || single_value->field_endpoint.is_value()); } void EndpointData_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; } EndpointData EndpointData_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 @MGCP_Emulation.EndpointData."); EndpointData ret_val; if (single_value->field_comp__ref.is_bound()) { ret_val.comp__ref() = single_value->field_comp__ref.valueof(); } if (single_value->field_endpoint.is_omit()) ret_val.endpoint() = OMIT_VALUE; else if (single_value->field_endpoint.is_bound()) { ret_val.endpoint() = single_value->field_endpoint.valueof(); } return ret_val; } void EndpointData_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 @MGCP_Emulation.EndpointData."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EndpointData_template[list_length]; } EndpointData_template& EndpointData_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 @MGCP_Emulation.EndpointData."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @MGCP_Emulation.EndpointData."); return value_list.list_value[list_index]; } COMPONENT_template& EndpointData_template::comp__ref() { set_specific(); return single_value->field_comp__ref; } const COMPONENT_template& EndpointData_template::comp__ref() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field comp_ref of a non-specific template of type @MGCP_Emulation.EndpointData."); return single_value->field_comp__ref; } CHARSTRING_template& EndpointData_template::endpoint() { set_specific(); return single_value->field_endpoint; } const CHARSTRING_template& EndpointData_template::endpoint() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field endpoint of a non-specific template of type @MGCP_Emulation.EndpointData."); return single_value->field_endpoint; } int EndpointData_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.EndpointData which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_endpoint.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @MGCP_Emulation.EndpointData 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 @MGCP_Emulation.EndpointData containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.EndpointData containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.EndpointData containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.EndpointData containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.EndpointData containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.EndpointData containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.EndpointData containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @MGCP_Emulation.EndpointData."); } return 0; } void EndpointData_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ comp_ref := "); single_value->field_comp__ref.log(); TTCN_Logger::log_event_str(", endpoint := "); single_value->field_endpoint.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 EndpointData_template::log_match(const EndpointData& 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_comp__ref.match(match_value.comp__ref(), legacy)){ TTCN_Logger::log_logmatch_info(".comp_ref"); single_value->field_comp__ref.log_match(match_value.comp__ref(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.endpoint().ispresent()){ if(!single_value->field_endpoint.match(match_value.endpoint(), legacy)){ TTCN_Logger::log_logmatch_info(".endpoint"); single_value->field_endpoint.log_match(match_value.endpoint(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_endpoint.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".endpoint := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_endpoint.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ comp_ref := "); single_value->field_comp__ref.log_match(match_value.comp__ref(), legacy); TTCN_Logger::log_event_str(", endpoint := "); if (match_value.endpoint().ispresent()) { single_value->field_endpoint.log_match(match_value.endpoint(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_endpoint.log(); if (single_value->field_endpoint.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void EndpointData_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (comp__ref().is_bound()) comp__ref().set_implicit_omit(); if (!endpoint().is_bound()) endpoint() = OMIT_VALUE; else endpoint().set_implicit_omit(); } void EndpointData_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_comp__ref.encode_text(text_buf); single_value->field_endpoint.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 @MGCP_Emulation.EndpointData."); } } void EndpointData_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_comp__ref.decode_text(text_buf); single_value->field_endpoint.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 EndpointData_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 @MGCP_Emulation.EndpointData."); } } void EndpointData_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: { EndpointData_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) comp__ref().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) endpoint().set_param(*param.get_elem(1)); 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(), "comp_ref")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { comp__ref().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "endpoint")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { endpoint().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.EndpointData: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EndpointData_template* precondition = new EndpointData_template; precondition->set_param(*param.get_elem(0)); EndpointData_template* implied_template = new EndpointData_template; implied_template->set_param(*param.get_elem(1)); *this = EndpointData_template(precondition, implied_template); } break; default: param.type_error("record template", "@MGCP_Emulation.EndpointData"); } is_ifpresent = param.get_ifpresent(); } void EndpointData_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_comp__ref.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.EndpointData"); single_value->field_endpoint.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.EndpointData"); 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 : "@MGCP_Emulation.EndpointData"); } boolean EndpointData_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EndpointData_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& par_crit, const COMPONENT& par_vc__conn) : field_crit(par_crit), field_vc__conn(par_vc__conn) { } ExpectData::ExpectData(const ExpectData& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @MGCP_Emulation.ExpectData."); if (other_value.crit().is_bound()) field_crit = other_value.crit(); else field_crit.clean_up(); if (other_value.vc__conn().is_bound()) field_vc__conn = other_value.vc__conn(); else field_vc__conn.clean_up(); } void ExpectData::clean_up() { field_crit.clean_up(); field_vc__conn.clean_up(); } const TTCN_Typedescriptor_t* ExpectData::get_descriptor() const { return &ExpectData_descr_; } ExpectData& ExpectData::operator=(const ExpectData& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @MGCP_Emulation.ExpectData."); if (other_value.crit().is_bound()) field_crit = other_value.crit(); else field_crit.clean_up(); if (other_value.vc__conn().is_bound()) field_vc__conn = other_value.vc__conn(); else field_vc__conn.clean_up(); } return *this; } boolean ExpectData::operator==(const ExpectData& other_value) const { return field_crit==other_value.field_crit && field_vc__conn==other_value.field_vc__conn; } boolean ExpectData::is_bound() const { return (OPTIONAL_OMIT == field_crit.get_selection() || field_crit.is_bound()) || (field_vc__conn.is_bound()); } boolean ExpectData::is_value() const { return (OPTIONAL_OMIT == field_crit.get_selection() || field_crit.is_value()) && field_vc__conn.is_value(); } int ExpectData::size_of() const { int ret_val = 1; if (field_crit.ispresent()) ret_val++; return ret_val; } void ExpectData::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ crit := "); field_crit.log(); TTCN_Logger::log_event_str(", vc_conn := "); field_vc__conn.log(); TTCN_Logger::log_event_str(" }"); } void ExpectData::set_implicit_omit() { if (!crit().is_bound()) crit() = OMIT_VALUE; else crit().set_implicit_omit(); if (vc__conn().is_bound()) vc__conn().set_implicit_omit(); } void ExpectData::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 (20 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) crit().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) vc__conn().set_param(*param.get_elem(1)); 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(), "crit")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { crit().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vc_conn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__conn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.ExpectData: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@MGCP_Emulation.ExpectData"); } } void ExpectData::encode_text(Text_Buf& text_buf) const { field_crit.encode_text(text_buf); field_vc__conn.encode_text(text_buf); } void ExpectData::decode_text(Text_Buf& text_buf) { field_crit.decode_text(text_buf); field_vc__conn.decode_text(text_buf); } struct ExpectData_template::single_value_struct { ExpectCriteria_template field_crit; COMPONENT_template field_vc__conn; }; void ExpectData_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_crit = ANY_OR_OMIT; single_value->field_vc__conn = ANY_VALUE; } } } void ExpectData_template::copy_value(const ExpectData& other_value) { single_value = new single_value_struct; if (other_value.crit().is_bound()) { if (other_value.crit().ispresent()) single_value->field_crit = other_value.crit()(); else single_value->field_crit = OMIT_VALUE; } else { single_value->field_crit.clean_up(); } if (other_value.vc__conn().is_bound()) { single_value->field_vc__conn = other_value.vc__conn(); } else { single_value->field_vc__conn.clean_up(); } set_selection(SPECIFIC_VALUE); } void ExpectData_template::copy_template(const ExpectData_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.crit().get_selection()) { single_value->field_crit = other_value.crit(); } else { single_value->field_crit.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.vc__conn().get_selection()) { single_value->field_vc__conn = other_value.vc__conn(); } else { single_value->field_vc__conn.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 ExpectData_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 ExpectData_template(*other_value.implication_.precondition); implication_.implied_template = new ExpectData_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 @MGCP_Emulation.ExpectData."); break; } set_selection(other_value); } ExpectData_template::ExpectData_template() { } ExpectData_template::ExpectData_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ExpectData_template::ExpectData_template(const ExpectData& other_value) { copy_value(other_value); } ExpectData_template::ExpectData_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ExpectData&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @MGCP_Emulation.ExpectData from an unbound optional field."); } } ExpectData_template::ExpectData_template(ExpectData_template* p_precondition, ExpectData_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ExpectData_template::ExpectData_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; } ExpectData_template::ExpectData_template(const ExpectData_template& other_value) : Base_Template() { copy_template(other_value); } ExpectData_template::~ExpectData_template() { clean_up(); } ExpectData_template& ExpectData_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ExpectData_template& ExpectData_template::operator=(const ExpectData& other_value) { clean_up(); copy_value(other_value); return *this; } ExpectData_template& ExpectData_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ExpectData&)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 @MGCP_Emulation.ExpectData."); } return *this; } ExpectData_template& ExpectData_template::operator=(const ExpectData_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ExpectData_template::match(const ExpectData& 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.crit().is_bound()) return FALSE; if((other_value.crit().ispresent() ? !single_value->field_crit.match((const ExpectCriteria&)other_value.crit(), legacy) : !single_value->field_crit.match_omit(legacy)))return FALSE; if(!other_value.vc__conn().is_bound()) return FALSE; if(!single_value->field_vc__conn.match(other_value.vc__conn(), 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 @MGCP_Emulation.ExpectData."); } return FALSE; } boolean ExpectData_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return (single_value->field_crit.is_omit() || single_value->field_crit.is_bound()) || single_value->field_vc__conn.is_bound(); } boolean ExpectData_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return (single_value->field_crit.is_omit() || single_value->field_crit.is_value()) && single_value->field_vc__conn.is_value(); } void ExpectData_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; } ExpectData ExpectData_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 @MGCP_Emulation.ExpectData."); ExpectData ret_val; if (single_value->field_crit.is_omit()) ret_val.crit() = OMIT_VALUE; else if (single_value->field_crit.is_bound()) { ret_val.crit() = single_value->field_crit.valueof(); } if (single_value->field_vc__conn.is_bound()) { ret_val.vc__conn() = single_value->field_vc__conn.valueof(); } return ret_val; } void ExpectData_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 @MGCP_Emulation.ExpectData."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ExpectData_template[list_length]; } ExpectData_template& ExpectData_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 @MGCP_Emulation.ExpectData."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @MGCP_Emulation.ExpectData."); return value_list.list_value[list_index]; } ExpectCriteria_template& ExpectData_template::crit() { set_specific(); return single_value->field_crit; } const ExpectCriteria_template& ExpectData_template::crit() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field crit of a non-specific template of type @MGCP_Emulation.ExpectData."); return single_value->field_crit; } COMPONENT_template& ExpectData_template::vc__conn() { set_specific(); return single_value->field_vc__conn; } const COMPONENT_template& ExpectData_template::vc__conn() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field vc_conn of a non-specific template of type @MGCP_Emulation.ExpectData."); return single_value->field_vc__conn; } int ExpectData_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectData which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_crit.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectData 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 @MGCP_Emulation.ExpectData containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectData containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectData containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectData containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectData containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectData containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectData containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @MGCP_Emulation.ExpectData."); } return 0; } void ExpectData_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ crit := "); single_value->field_crit.log(); TTCN_Logger::log_event_str(", vc_conn := "); single_value->field_vc__conn.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 ExpectData_template::log_match(const ExpectData& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if (match_value.crit().ispresent()){ if(!single_value->field_crit.match(match_value.crit(), legacy)){ TTCN_Logger::log_logmatch_info(".crit"); single_value->field_crit.log_match(match_value.crit(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_crit.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".crit := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_crit.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_vc__conn.match(match_value.vc__conn(), legacy)){ TTCN_Logger::log_logmatch_info(".vc_conn"); single_value->field_vc__conn.log_match(match_value.vc__conn(), 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("{ crit := "); if (match_value.crit().ispresent()) { single_value->field_crit.log_match(match_value.crit(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_crit.log(); if (single_value->field_crit.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", vc_conn := "); single_value->field_vc__conn.log_match(match_value.vc__conn(), 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 ExpectData_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (!crit().is_bound()) crit() = OMIT_VALUE; else crit().set_implicit_omit(); if (vc__conn().is_bound()) vc__conn().set_implicit_omit(); } void ExpectData_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_crit.encode_text(text_buf); single_value->field_vc__conn.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 @MGCP_Emulation.ExpectData."); } } void ExpectData_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_crit.decode_text(text_buf); single_value->field_vc__conn.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 ExpectData_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 @MGCP_Emulation.ExpectData."); } } void ExpectData_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: { ExpectData_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) crit().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) vc__conn().set_param(*param.get_elem(1)); 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(), "crit")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { crit().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vc_conn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__conn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.ExpectData: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ExpectData_template* precondition = new ExpectData_template; precondition->set_param(*param.get_elem(0)); ExpectData_template* implied_template = new ExpectData_template; implied_template->set_param(*param.get_elem(1)); *this = ExpectData_template(precondition, implied_template); } break; default: param.type_error("record template", "@MGCP_Emulation.ExpectData"); } is_ifpresent = param.get_ifpresent(); } void ExpectData_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_crit.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.ExpectData"); single_value->field_vc__conn.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.ExpectData"); 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 : "@MGCP_Emulation.ExpectData"); } boolean ExpectData_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ExpectData_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& par_connid, const OPTIONAL< CHARSTRING >& par_endpoint, const OPTIONAL< CHARSTRING >& par_transid) : field_connid(par_connid), field_endpoint(par_endpoint), field_transid(par_transid) { } ExpectCriteria::ExpectCriteria(const ExpectCriteria& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @MGCP_Emulation.ExpectCriteria."); if (other_value.connid().is_bound()) field_connid = other_value.connid(); else field_connid.clean_up(); if (other_value.endpoint().is_bound()) field_endpoint = other_value.endpoint(); else field_endpoint.clean_up(); if (other_value.transid().is_bound()) field_transid = other_value.transid(); else field_transid.clean_up(); } void ExpectCriteria::clean_up() { field_connid.clean_up(); field_endpoint.clean_up(); field_transid.clean_up(); } const TTCN_Typedescriptor_t* ExpectCriteria::get_descriptor() const { return &ExpectCriteria_descr_; } ExpectCriteria& ExpectCriteria::operator=(const ExpectCriteria& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @MGCP_Emulation.ExpectCriteria."); if (other_value.connid().is_bound()) field_connid = other_value.connid(); else field_connid.clean_up(); if (other_value.endpoint().is_bound()) field_endpoint = other_value.endpoint(); else field_endpoint.clean_up(); if (other_value.transid().is_bound()) field_transid = other_value.transid(); else field_transid.clean_up(); } return *this; } boolean ExpectCriteria::operator==(const ExpectCriteria& other_value) const { return field_connid==other_value.field_connid && field_endpoint==other_value.field_endpoint && field_transid==other_value.field_transid; } boolean ExpectCriteria::is_bound() const { return (OPTIONAL_OMIT == field_connid.get_selection() || field_connid.is_bound()) || (OPTIONAL_OMIT == field_endpoint.get_selection() || field_endpoint.is_bound()) || (OPTIONAL_OMIT == field_transid.get_selection() || field_transid.is_bound()); } boolean ExpectCriteria::is_value() const { return (OPTIONAL_OMIT == field_connid.get_selection() || field_connid.is_value()) && (OPTIONAL_OMIT == field_endpoint.get_selection() || field_endpoint.is_value()) && (OPTIONAL_OMIT == field_transid.get_selection() || field_transid.is_value()); } int ExpectCriteria::size_of() const { int ret_val = 0; if (field_connid.ispresent()) ret_val++; if (field_endpoint.ispresent()) ret_val++; if (field_transid.ispresent()) ret_val++; return ret_val; } void ExpectCriteria::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ connid := "); field_connid.log(); TTCN_Logger::log_event_str(", endpoint := "); field_endpoint.log(); TTCN_Logger::log_event_str(", transid := "); field_transid.log(); TTCN_Logger::log_event_str(" }"); } void ExpectCriteria::set_implicit_omit() { if (!connid().is_bound()) connid() = OMIT_VALUE; else connid().set_implicit_omit(); if (!endpoint().is_bound()) endpoint() = OMIT_VALUE; else endpoint().set_implicit_omit(); if (!transid().is_bound()) transid() = OMIT_VALUE; else transid().set_implicit_omit(); } void ExpectCriteria::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 (30 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) connid().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) endpoint().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transid().set_param(*param.get_elem(2)); 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(), "connid")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { connid().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "endpoint")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { endpoint().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transid")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transid().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.ExpectCriteria: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@MGCP_Emulation.ExpectCriteria"); } } void ExpectCriteria::encode_text(Text_Buf& text_buf) const { field_connid.encode_text(text_buf); field_endpoint.encode_text(text_buf); field_transid.encode_text(text_buf); } void ExpectCriteria::decode_text(Text_Buf& text_buf) { field_connid.decode_text(text_buf); field_endpoint.decode_text(text_buf); field_transid.decode_text(text_buf); } struct ExpectCriteria_template::single_value_struct { HEXSTRING_template field_connid; CHARSTRING_template field_endpoint; CHARSTRING_template field_transid; }; void ExpectCriteria_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_connid = ANY_OR_OMIT; single_value->field_endpoint = ANY_OR_OMIT; single_value->field_transid = ANY_OR_OMIT; } } } void ExpectCriteria_template::copy_value(const ExpectCriteria& other_value) { single_value = new single_value_struct; if (other_value.connid().is_bound()) { if (other_value.connid().ispresent()) single_value->field_connid = other_value.connid()(); else single_value->field_connid = OMIT_VALUE; } else { single_value->field_connid.clean_up(); } if (other_value.endpoint().is_bound()) { if (other_value.endpoint().ispresent()) single_value->field_endpoint = other_value.endpoint()(); else single_value->field_endpoint = OMIT_VALUE; } else { single_value->field_endpoint.clean_up(); } if (other_value.transid().is_bound()) { if (other_value.transid().ispresent()) single_value->field_transid = other_value.transid()(); else single_value->field_transid = OMIT_VALUE; } else { single_value->field_transid.clean_up(); } set_selection(SPECIFIC_VALUE); } void ExpectCriteria_template::copy_template(const ExpectCriteria_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.connid().get_selection()) { single_value->field_connid = other_value.connid(); } else { single_value->field_connid.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.endpoint().get_selection()) { single_value->field_endpoint = other_value.endpoint(); } else { single_value->field_endpoint.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.transid().get_selection()) { single_value->field_transid = other_value.transid(); } else { single_value->field_transid.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 ExpectCriteria_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 ExpectCriteria_template(*other_value.implication_.precondition); implication_.implied_template = new ExpectCriteria_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 @MGCP_Emulation.ExpectCriteria."); break; } set_selection(other_value); } ExpectCriteria_template::ExpectCriteria_template() { } ExpectCriteria_template::ExpectCriteria_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ExpectCriteria_template::ExpectCriteria_template(const ExpectCriteria& other_value) { copy_value(other_value); } ExpectCriteria_template::ExpectCriteria_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ExpectCriteria&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @MGCP_Emulation.ExpectCriteria from an unbound optional field."); } } ExpectCriteria_template::ExpectCriteria_template(ExpectCriteria_template* p_precondition, ExpectCriteria_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ExpectCriteria_template::ExpectCriteria_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; } ExpectCriteria_template::ExpectCriteria_template(const ExpectCriteria_template& other_value) : Base_Template() { copy_template(other_value); } ExpectCriteria_template::~ExpectCriteria_template() { clean_up(); } ExpectCriteria_template& ExpectCriteria_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ExpectCriteria_template& ExpectCriteria_template::operator=(const ExpectCriteria& other_value) { clean_up(); copy_value(other_value); return *this; } ExpectCriteria_template& ExpectCriteria_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ExpectCriteria&)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 @MGCP_Emulation.ExpectCriteria."); } return *this; } ExpectCriteria_template& ExpectCriteria_template::operator=(const ExpectCriteria_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ExpectCriteria_template::match(const ExpectCriteria& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.connid().is_bound()) return FALSE; if((other_value.connid().ispresent() ? !single_value->field_connid.match((const HEXSTRING&)other_value.connid(), legacy) : !single_value->field_connid.match_omit(legacy)))return FALSE; if(!other_value.endpoint().is_bound()) return FALSE; if((other_value.endpoint().ispresent() ? !single_value->field_endpoint.match((const CHARSTRING&)other_value.endpoint(), legacy) : !single_value->field_endpoint.match_omit(legacy)))return FALSE; if(!other_value.transid().is_bound()) return FALSE; if((other_value.transid().ispresent() ? !single_value->field_transid.match((const CHARSTRING&)other_value.transid(), legacy) : !single_value->field_transid.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @MGCP_Emulation.ExpectCriteria."); } return FALSE; } boolean ExpectCriteria_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return (single_value->field_connid.is_omit() || single_value->field_connid.is_bound()) || (single_value->field_endpoint.is_omit() || single_value->field_endpoint.is_bound()) || (single_value->field_transid.is_omit() || single_value->field_transid.is_bound()); } boolean ExpectCriteria_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return (single_value->field_connid.is_omit() || single_value->field_connid.is_value()) && (single_value->field_endpoint.is_omit() || single_value->field_endpoint.is_value()) && (single_value->field_transid.is_omit() || single_value->field_transid.is_value()); } void ExpectCriteria_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; } ExpectCriteria ExpectCriteria_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 @MGCP_Emulation.ExpectCriteria."); ExpectCriteria ret_val; if (single_value->field_connid.is_omit()) ret_val.connid() = OMIT_VALUE; else if (single_value->field_connid.is_bound()) { ret_val.connid() = single_value->field_connid.valueof(); } if (single_value->field_endpoint.is_omit()) ret_val.endpoint() = OMIT_VALUE; else if (single_value->field_endpoint.is_bound()) { ret_val.endpoint() = single_value->field_endpoint.valueof(); } if (single_value->field_transid.is_omit()) ret_val.transid() = OMIT_VALUE; else if (single_value->field_transid.is_bound()) { ret_val.transid() = single_value->field_transid.valueof(); } return ret_val; } void ExpectCriteria_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 @MGCP_Emulation.ExpectCriteria."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ExpectCriteria_template[list_length]; } ExpectCriteria_template& ExpectCriteria_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 @MGCP_Emulation.ExpectCriteria."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @MGCP_Emulation.ExpectCriteria."); return value_list.list_value[list_index]; } HEXSTRING_template& ExpectCriteria_template::connid() { set_specific(); return single_value->field_connid; } const HEXSTRING_template& ExpectCriteria_template::connid() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field connid of a non-specific template of type @MGCP_Emulation.ExpectCriteria."); return single_value->field_connid; } CHARSTRING_template& ExpectCriteria_template::endpoint() { set_specific(); return single_value->field_endpoint; } const CHARSTRING_template& ExpectCriteria_template::endpoint() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field endpoint of a non-specific template of type @MGCP_Emulation.ExpectCriteria."); return single_value->field_endpoint; } CHARSTRING_template& ExpectCriteria_template::transid() { set_specific(); return single_value->field_transid; } const CHARSTRING_template& ExpectCriteria_template::transid() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field transid of a non-specific template of type @MGCP_Emulation.ExpectCriteria."); return single_value->field_transid; } int ExpectCriteria_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectCriteria which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 0; if (single_value->field_connid.is_present()) ret_val++; if (single_value->field_endpoint.is_present()) ret_val++; if (single_value->field_transid.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectCriteria 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 @MGCP_Emulation.ExpectCriteria containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectCriteria containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectCriteria containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectCriteria containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectCriteria containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectCriteria containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.ExpectCriteria containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @MGCP_Emulation.ExpectCriteria."); } return 0; } void ExpectCriteria_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ connid := "); single_value->field_connid.log(); TTCN_Logger::log_event_str(", endpoint := "); single_value->field_endpoint.log(); TTCN_Logger::log_event_str(", transid := "); single_value->field_transid.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 ExpectCriteria_template::log_match(const ExpectCriteria& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if (match_value.connid().ispresent()){ if(!single_value->field_connid.match(match_value.connid(), legacy)){ TTCN_Logger::log_logmatch_info(".connid"); single_value->field_connid.log_match(match_value.connid(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_connid.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".connid := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_connid.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.endpoint().ispresent()){ if(!single_value->field_endpoint.match(match_value.endpoint(), legacy)){ TTCN_Logger::log_logmatch_info(".endpoint"); single_value->field_endpoint.log_match(match_value.endpoint(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_endpoint.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".endpoint := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_endpoint.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.transid().ispresent()){ if(!single_value->field_transid.match(match_value.transid(), legacy)){ TTCN_Logger::log_logmatch_info(".transid"); single_value->field_transid.log_match(match_value.transid(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_transid.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".transid := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_transid.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ connid := "); if (match_value.connid().ispresent()) { single_value->field_connid.log_match(match_value.connid(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_connid.log(); if (single_value->field_connid.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", endpoint := "); if (match_value.endpoint().ispresent()) { single_value->field_endpoint.log_match(match_value.endpoint(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_endpoint.log(); if (single_value->field_endpoint.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", transid := "); if (match_value.transid().ispresent()) { single_value->field_transid.log_match(match_value.transid(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_transid.log(); if (single_value->field_transid.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void ExpectCriteria_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (!connid().is_bound()) connid() = OMIT_VALUE; else connid().set_implicit_omit(); if (!endpoint().is_bound()) endpoint() = OMIT_VALUE; else endpoint().set_implicit_omit(); if (!transid().is_bound()) transid() = OMIT_VALUE; else transid().set_implicit_omit(); } void ExpectCriteria_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_connid.encode_text(text_buf); single_value->field_endpoint.encode_text(text_buf); single_value->field_transid.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 @MGCP_Emulation.ExpectCriteria."); } } void ExpectCriteria_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_connid.decode_text(text_buf); single_value->field_endpoint.decode_text(text_buf); single_value->field_transid.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 ExpectCriteria_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 @MGCP_Emulation.ExpectCriteria."); } } void ExpectCriteria_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: { ExpectCriteria_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) connid().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) endpoint().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transid().set_param(*param.get_elem(2)); 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(), "connid")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { connid().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "endpoint")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { endpoint().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transid")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transid().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.ExpectCriteria: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ExpectCriteria_template* precondition = new ExpectCriteria_template; precondition->set_param(*param.get_elem(0)); ExpectCriteria_template* implied_template = new ExpectCriteria_template; implied_template->set_param(*param.get_elem(1)); *this = ExpectCriteria_template(precondition, implied_template); } break; default: param.type_error("record template", "@MGCP_Emulation.ExpectCriteria"); } is_ifpresent = param.get_ifpresent(); } void ExpectCriteria_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_connid.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.ExpectCriteria"); single_value->field_endpoint.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.ExpectCriteria"); single_value->field_transid.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.ExpectCriteria"); 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 : "@MGCP_Emulation.ExpectCriteria"); } boolean ExpectCriteria_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ExpectCriteria_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_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) callagent__ip().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) callagent__udp__port().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mgw__ip().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mgw__udp__port().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) multi__conn__mode().set_param(*param.get_elem(4)); 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(), "callagent_ip")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { callagent__ip().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "callagent_udp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { callagent__udp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mgw_ip")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mgw__ip().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mgw_udp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mgw__udp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "multi_conn_mode")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { multi__conn__mode().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.MGCP_conn_parameters: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@MGCP_Emulation.MGCP_conn_parameters"); } } void MGCP__conn__parameters::encode_text(Text_Buf& text_buf) const { field_callagent__ip.encode_text(text_buf); field_callagent__udp__port.encode_text(text_buf); field_mgw__ip.encode_text(text_buf); field_mgw__udp__port.encode_text(text_buf); field_multi__conn__mode.encode_text(text_buf); } void MGCP__conn__parameters::decode_text(Text_Buf& text_buf) { field_callagent__ip.decode_text(text_buf); field_callagent__udp__port.decode_text(text_buf); field_mgw__ip.decode_text(text_buf); field_mgw__udp__port.decode_text(text_buf); field_multi__conn__mode.decode_text(text_buf); } struct MGCP__conn__parameters_template::single_value_struct { CHARSTRING_template field_callagent__ip; INTEGER_template field_callagent__udp__port; CHARSTRING_template field_mgw__ip; INTEGER_template field_mgw__udp__port; BOOLEAN_template field_multi__conn__mode; }; void MGCP__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_callagent__ip = ANY_VALUE; single_value->field_callagent__udp__port = ANY_VALUE; single_value->field_mgw__ip = ANY_VALUE; single_value->field_mgw__udp__port = ANY_VALUE; single_value->field_multi__conn__mode = ANY_VALUE; } } } void MGCP__conn__parameters_template::copy_value(const MGCP__conn__parameters& other_value) { single_value = new single_value_struct; if (other_value.callagent__ip().is_bound()) { single_value->field_callagent__ip = other_value.callagent__ip(); } else { single_value->field_callagent__ip.clean_up(); } if (other_value.callagent__udp__port().is_bound()) { single_value->field_callagent__udp__port = other_value.callagent__udp__port(); } else { single_value->field_callagent__udp__port.clean_up(); } if (other_value.mgw__ip().is_bound()) { single_value->field_mgw__ip = other_value.mgw__ip(); } else { single_value->field_mgw__ip.clean_up(); } if (other_value.mgw__udp__port().is_bound()) { single_value->field_mgw__udp__port = other_value.mgw__udp__port(); } else { single_value->field_mgw__udp__port.clean_up(); } if (other_value.multi__conn__mode().is_bound()) { single_value->field_multi__conn__mode = other_value.multi__conn__mode(); } else { single_value->field_multi__conn__mode.clean_up(); } set_selection(SPECIFIC_VALUE); } void MGCP__conn__parameters_template::copy_template(const MGCP__conn__parameters_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.callagent__ip().get_selection()) { single_value->field_callagent__ip = other_value.callagent__ip(); } else { single_value->field_callagent__ip.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.callagent__udp__port().get_selection()) { single_value->field_callagent__udp__port = other_value.callagent__udp__port(); } else { single_value->field_callagent__udp__port.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mgw__ip().get_selection()) { single_value->field_mgw__ip = other_value.mgw__ip(); } else { single_value->field_mgw__ip.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mgw__udp__port().get_selection()) { single_value->field_mgw__udp__port = other_value.mgw__udp__port(); } else { single_value->field_mgw__udp__port.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.multi__conn__mode().get_selection()) { single_value->field_multi__conn__mode = other_value.multi__conn__mode(); } else { single_value->field_multi__conn__mode.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 MGCP__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 MGCP__conn__parameters_template(*other_value.implication_.precondition); implication_.implied_template = new MGCP__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 @MGCP_Emulation.MGCP_conn_parameters."); break; } set_selection(other_value); } MGCP__conn__parameters_template::MGCP__conn__parameters_template() { } MGCP__conn__parameters_template::MGCP__conn__parameters_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MGCP__conn__parameters_template::MGCP__conn__parameters_template(const MGCP__conn__parameters& other_value) { copy_value(other_value); } MGCP__conn__parameters_template::MGCP__conn__parameters_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MGCP__conn__parameters&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @MGCP_Emulation.MGCP_conn_parameters from an unbound optional field."); } } MGCP__conn__parameters_template::MGCP__conn__parameters_template(MGCP__conn__parameters_template* p_precondition, MGCP__conn__parameters_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MGCP__conn__parameters_template::MGCP__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; } MGCP__conn__parameters_template::MGCP__conn__parameters_template(const MGCP__conn__parameters_template& other_value) : Base_Template() { copy_template(other_value); } MGCP__conn__parameters_template::~MGCP__conn__parameters_template() { clean_up(); } MGCP__conn__parameters_template& MGCP__conn__parameters_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MGCP__conn__parameters_template& MGCP__conn__parameters_template::operator=(const MGCP__conn__parameters& other_value) { clean_up(); copy_value(other_value); return *this; } MGCP__conn__parameters_template& MGCP__conn__parameters_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MGCP__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 @MGCP_Emulation.MGCP_conn_parameters."); } return *this; } MGCP__conn__parameters_template& MGCP__conn__parameters_template::operator=(const MGCP__conn__parameters_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MGCP__conn__parameters_template::match(const MGCP__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.callagent__ip().is_bound()) return FALSE; if(!single_value->field_callagent__ip.match(other_value.callagent__ip(), legacy))return FALSE; if(!other_value.callagent__udp__port().is_bound()) return FALSE; if(!single_value->field_callagent__udp__port.match(other_value.callagent__udp__port(), legacy))return FALSE; if(!other_value.mgw__ip().is_bound()) return FALSE; if(!single_value->field_mgw__ip.match(other_value.mgw__ip(), legacy))return FALSE; if(!other_value.mgw__udp__port().is_bound()) return FALSE; if(!single_value->field_mgw__udp__port.match(other_value.mgw__udp__port(), legacy))return FALSE; if(!other_value.multi__conn__mode().is_bound()) return FALSE; if(!single_value->field_multi__conn__mode.match(other_value.multi__conn__mode(), 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 @MGCP_Emulation.MGCP_conn_parameters."); } return FALSE; } boolean MGCP__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_callagent__ip.is_bound() || single_value->field_callagent__udp__port.is_bound() || single_value->field_mgw__ip.is_bound() || single_value->field_mgw__udp__port.is_bound() || single_value->field_multi__conn__mode.is_bound(); } boolean MGCP__conn__parameters_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_callagent__ip.is_value() && single_value->field_callagent__udp__port.is_value() && single_value->field_mgw__ip.is_value() && single_value->field_mgw__udp__port.is_value() && single_value->field_multi__conn__mode.is_value(); } void MGCP__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; } MGCP__conn__parameters MGCP__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 @MGCP_Emulation.MGCP_conn_parameters."); MGCP__conn__parameters ret_val; if (single_value->field_callagent__ip.is_bound()) { ret_val.callagent__ip() = single_value->field_callagent__ip.valueof(); } if (single_value->field_callagent__udp__port.is_bound()) { ret_val.callagent__udp__port() = single_value->field_callagent__udp__port.valueof(); } if (single_value->field_mgw__ip.is_bound()) { ret_val.mgw__ip() = single_value->field_mgw__ip.valueof(); } if (single_value->field_mgw__udp__port.is_bound()) { ret_val.mgw__udp__port() = single_value->field_mgw__udp__port.valueof(); } if (single_value->field_multi__conn__mode.is_bound()) { ret_val.multi__conn__mode() = single_value->field_multi__conn__mode.valueof(); } return ret_val; } void MGCP__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 @MGCP_Emulation.MGCP_conn_parameters."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MGCP__conn__parameters_template[list_length]; } MGCP__conn__parameters_template& MGCP__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 @MGCP_Emulation.MGCP_conn_parameters."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @MGCP_Emulation.MGCP_conn_parameters."); return value_list.list_value[list_index]; } CHARSTRING_template& MGCP__conn__parameters_template::callagent__ip() { set_specific(); return single_value->field_callagent__ip; } const CHARSTRING_template& MGCP__conn__parameters_template::callagent__ip() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field callagent_ip of a non-specific template of type @MGCP_Emulation.MGCP_conn_parameters."); return single_value->field_callagent__ip; } INTEGER_template& MGCP__conn__parameters_template::callagent__udp__port() { set_specific(); return single_value->field_callagent__udp__port; } const INTEGER_template& MGCP__conn__parameters_template::callagent__udp__port() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field callagent_udp_port of a non-specific template of type @MGCP_Emulation.MGCP_conn_parameters."); return single_value->field_callagent__udp__port; } CHARSTRING_template& MGCP__conn__parameters_template::mgw__ip() { set_specific(); return single_value->field_mgw__ip; } const CHARSTRING_template& MGCP__conn__parameters_template::mgw__ip() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mgw_ip of a non-specific template of type @MGCP_Emulation.MGCP_conn_parameters."); return single_value->field_mgw__ip; } INTEGER_template& MGCP__conn__parameters_template::mgw__udp__port() { set_specific(); return single_value->field_mgw__udp__port; } const INTEGER_template& MGCP__conn__parameters_template::mgw__udp__port() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mgw_udp_port of a non-specific template of type @MGCP_Emulation.MGCP_conn_parameters."); return single_value->field_mgw__udp__port; } BOOLEAN_template& MGCP__conn__parameters_template::multi__conn__mode() { set_specific(); return single_value->field_multi__conn__mode; } const BOOLEAN_template& MGCP__conn__parameters_template::multi__conn__mode() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field multi_conn_mode of a non-specific template of type @MGCP_Emulation.MGCP_conn_parameters."); return single_value->field_multi__conn__mode; } int MGCP__conn__parameters_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCP_conn_parameters which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 5; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @MGCP_Emulation.MGCP_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 @MGCP_Emulation.MGCP_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 @MGCP_Emulation.MGCP_conn_parameters containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCP_conn_parameters containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCP_conn_parameters containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCP_conn_parameters containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCP_conn_parameters containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCP_conn_parameters containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @MGCP_Emulation.MGCP_conn_parameters."); } return 0; } void MGCP__conn__parameters_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ callagent_ip := "); single_value->field_callagent__ip.log(); TTCN_Logger::log_event_str(", callagent_udp_port := "); single_value->field_callagent__udp__port.log(); TTCN_Logger::log_event_str(", mgw_ip := "); single_value->field_mgw__ip.log(); TTCN_Logger::log_event_str(", mgw_udp_port := "); single_value->field_mgw__udp__port.log(); TTCN_Logger::log_event_str(", multi_conn_mode := "); single_value->field_multi__conn__mode.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 MGCP__conn__parameters_template::log_match(const MGCP__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_callagent__ip.match(match_value.callagent__ip(), legacy)){ TTCN_Logger::log_logmatch_info(".callagent_ip"); single_value->field_callagent__ip.log_match(match_value.callagent__ip(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_callagent__udp__port.match(match_value.callagent__udp__port(), legacy)){ TTCN_Logger::log_logmatch_info(".callagent_udp_port"); single_value->field_callagent__udp__port.log_match(match_value.callagent__udp__port(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mgw__ip.match(match_value.mgw__ip(), legacy)){ TTCN_Logger::log_logmatch_info(".mgw_ip"); single_value->field_mgw__ip.log_match(match_value.mgw__ip(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mgw__udp__port.match(match_value.mgw__udp__port(), legacy)){ TTCN_Logger::log_logmatch_info(".mgw_udp_port"); single_value->field_mgw__udp__port.log_match(match_value.mgw__udp__port(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_multi__conn__mode.match(match_value.multi__conn__mode(), legacy)){ TTCN_Logger::log_logmatch_info(".multi_conn_mode"); single_value->field_multi__conn__mode.log_match(match_value.multi__conn__mode(), 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("{ callagent_ip := "); single_value->field_callagent__ip.log_match(match_value.callagent__ip(), legacy); TTCN_Logger::log_event_str(", callagent_udp_port := "); single_value->field_callagent__udp__port.log_match(match_value.callagent__udp__port(), legacy); TTCN_Logger::log_event_str(", mgw_ip := "); single_value->field_mgw__ip.log_match(match_value.mgw__ip(), legacy); TTCN_Logger::log_event_str(", mgw_udp_port := "); single_value->field_mgw__udp__port.log_match(match_value.mgw__udp__port(), legacy); TTCN_Logger::log_event_str(", multi_conn_mode := "); single_value->field_multi__conn__mode.log_match(match_value.multi__conn__mode(), 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 MGCP__conn__parameters_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (callagent__ip().is_bound()) callagent__ip().set_implicit_omit(); if (callagent__udp__port().is_bound()) callagent__udp__port().set_implicit_omit(); if (mgw__ip().is_bound()) mgw__ip().set_implicit_omit(); if (mgw__udp__port().is_bound()) mgw__udp__port().set_implicit_omit(); if (multi__conn__mode().is_bound()) multi__conn__mode().set_implicit_omit(); } void MGCP__conn__parameters_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_callagent__ip.encode_text(text_buf); single_value->field_callagent__udp__port.encode_text(text_buf); single_value->field_mgw__ip.encode_text(text_buf); single_value->field_mgw__udp__port.encode_text(text_buf); single_value->field_multi__conn__mode.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 @MGCP_Emulation.MGCP_conn_parameters."); } } void MGCP__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_callagent__ip.decode_text(text_buf); single_value->field_callagent__udp__port.decode_text(text_buf); single_value->field_mgw__ip.decode_text(text_buf); single_value->field_mgw__udp__port.decode_text(text_buf); single_value->field_multi__conn__mode.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 MGCP__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 @MGCP_Emulation.MGCP_conn_parameters."); } } void MGCP__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: { MGCP__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) callagent__ip().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) callagent__udp__port().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mgw__ip().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mgw__udp__port().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) multi__conn__mode().set_param(*param.get_elem(4)); 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(), "callagent_ip")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { callagent__ip().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "callagent_udp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { callagent__udp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mgw_ip")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mgw__ip().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mgw_udp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mgw__udp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "multi_conn_mode")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { multi__conn__mode().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.MGCP_conn_parameters: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MGCP__conn__parameters_template* precondition = new MGCP__conn__parameters_template; precondition->set_param(*param.get_elem(0)); MGCP__conn__parameters_template* implied_template = new MGCP__conn__parameters_template; implied_template->set_param(*param.get_elem(1)); *this = MGCP__conn__parameters_template(precondition, implied_template); } break; default: param.type_error("record template", "@MGCP_Emulation.MGCP_conn_parameters"); } is_ifpresent = param.get_ifpresent(); } void MGCP__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_callagent__ip.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.MGCP_conn_parameters"); single_value->field_callagent__udp__port.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.MGCP_conn_parameters"); single_value->field_mgw__ip.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.MGCP_conn_parameters"); single_value->field_mgw__udp__port.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.MGCP_conn_parameters"); single_value->field_multi__conn__mode.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.MGCP_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 : "@MGCP_Emulation.MGCP_conn_parameters"); } boolean MGCP__conn__parameters_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MGCP__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& other_value) { if(other_value.ispresent()) { set_selection(SPECIFIC_VALUE); single_value = ((const MGCPCreateCallback&)other_value()).referred_function; } else set_selection(OMIT_VALUE); } MGCPCreateCallback_template::MGCPCreateCallback_template(const MGCPCreateCallback_template& other_value) :Base_Template() { copy_template(other_value); } MGCPCreateCallback_template::~MGCPCreateCallback_template() { clean_up(); } void MGCPCreateCallback_template::clean_up(){ if(template_selection == VALUE_LIST || template_selection == COMPLEMENTED_LIST) delete[] value_list.list_value; template_selection = UNINITIALIZED_TEMPLATE; } MGCPCreateCallback_template& MGCPCreateCallback_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MGCPCreateCallback_template& MGCPCreateCallback_template::operator=(MGCPCreateCallback::function_pointer other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this;} MGCPCreateCallback_template& MGCPCreateCallback_template::operator=(const MGCPCreateCallback& other_value) { other_value.must_bound("Assignment of an unbound @MGCP_Emulation.MGCPCreateCallback value to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.referred_function; return *this; } MGCPCreateCallback_template& MGCPCreateCallback_template::operator=(const OPTIONAL& other_value) { clean_up(); if(other_value.ispresent()) { set_selection(SPECIFIC_VALUE); single_value = ((const MGCPCreateCallback&)other_value()).referred_function; } else set_selection(OMIT_VALUE); return *this;} MGCPCreateCallback_template& MGCPCreateCallback_template::operator=(const MGCPCreateCallback_template& other_value) { if(&other_value != this) { clean_up();copy_template(other_value); } return *this; } boolean MGCPCreateCallback_template::match(MGCPCreateCallback::function_pointer 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 i = 0; i < value_list.n_values; i++) if(value_list.list_value[i].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; default: TTCN_error("Matching with an unitialized/unsupported @MGCP_Emulation.MGCPCreateCallback template."); }; return FALSE; } boolean MGCPCreateCallback_template::match(const MGCPCreateCallback& other_value, boolean) const { if (!other_value.is_bound()) return FALSE; return match(other_value.referred_function); } MGCPCreateCallback MGCPCreateCallback_template::valueof() const { if(template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific @MGCP_Emulation.MGCPCreateCallback template."); return single_value; } void MGCPCreateCallback_template::set_type(template_sel template_type, unsigned int list_length) { if(template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST) TTCN_error("Setting an invalid type for an @MGCP_Emulation.MGCPCreateCallback template."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MGCPCreateCallback_template[list_length]; } MGCPCreateCallback_template& MGCPCreateCallback_template::list_item(unsigned int list_index) const { if(template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST) TTCN_error("Accessing a list element of a non-list template of type @MGCP_Emulation.MGCPCreateCallback"); if(list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @MGCP_Emulation.MGCPCreateCallback."); return value_list.list_value[list_index]; } void MGCPCreateCallback_template::log() const { switch(template_selection) { case SPECIFIC_VALUE: Module_List::log_function((genericfunc_t)single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case VALUE_LIST: TTCN_Logger::log_char('('); for(unsigned int i = 0; i < value_list.n_values; i++) { if(i > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[i].log(); } TTCN_Logger::log_char(')'); break; default: log_generic(); } log_ifpresent(); } void MGCPCreateCallback_template::log_match(const MGCPCreateCallback& match_value, boolean legacy) const { log(); TTCN_Logger::log_event_str(" with "); match_value.log(); if(match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void MGCPCreateCallback_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch(template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case SPECIFIC_VALUE: Module_List::encode_function(text_buf, (genericfunc_t)single_value); break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for(unsigned int i = 0; i < value_list.n_values; i++) value_list.list_value[i].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @MGCP_Emulation.MGCPCreateCallback."); } } void MGCPCreateCallback_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch(template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case SPECIFIC_VALUE: Module_List::decode_function(text_buf,(genericfunc_t*)&single_value); break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new MGCPCreateCallback_template[value_list.n_values]; for(unsigned int i = 0; i < value_list.n_values; i++) value_list.list_value[i].decode_text(text_buf); default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @MGCP_Emulation.MGCPCreateCallback."); } } boolean MGCPCreateCallback_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MGCPCreateCallback_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; i& other_value) { if(other_value.ispresent()) { set_selection(SPECIFIC_VALUE); single_value = ((const MGCPUnitdataCallback&)other_value()).referred_function; } else set_selection(OMIT_VALUE); } MGCPUnitdataCallback_template::MGCPUnitdataCallback_template(const MGCPUnitdataCallback_template& other_value) :Base_Template() { copy_template(other_value); } MGCPUnitdataCallback_template::~MGCPUnitdataCallback_template() { clean_up(); } void MGCPUnitdataCallback_template::clean_up(){ if(template_selection == VALUE_LIST || template_selection == COMPLEMENTED_LIST) delete[] value_list.list_value; template_selection = UNINITIALIZED_TEMPLATE; } MGCPUnitdataCallback_template& MGCPUnitdataCallback_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MGCPUnitdataCallback_template& MGCPUnitdataCallback_template::operator=(MGCPUnitdataCallback::function_pointer other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this;} MGCPUnitdataCallback_template& MGCPUnitdataCallback_template::operator=(const MGCPUnitdataCallback& other_value) { other_value.must_bound("Assignment of an unbound @MGCP_Emulation.MGCPUnitdataCallback value to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.referred_function; return *this; } MGCPUnitdataCallback_template& MGCPUnitdataCallback_template::operator=(const OPTIONAL& other_value) { clean_up(); if(other_value.ispresent()) { set_selection(SPECIFIC_VALUE); single_value = ((const MGCPUnitdataCallback&)other_value()).referred_function; } else set_selection(OMIT_VALUE); return *this;} MGCPUnitdataCallback_template& MGCPUnitdataCallback_template::operator=(const MGCPUnitdataCallback_template& other_value) { if(&other_value != this) { clean_up();copy_template(other_value); } return *this; } boolean MGCPUnitdataCallback_template::match(MGCPUnitdataCallback::function_pointer 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 i = 0; i < value_list.n_values; i++) if(value_list.list_value[i].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; default: TTCN_error("Matching with an unitialized/unsupported @MGCP_Emulation.MGCPUnitdataCallback template."); }; return FALSE; } boolean MGCPUnitdataCallback_template::match(const MGCPUnitdataCallback& other_value, boolean) const { if (!other_value.is_bound()) return FALSE; return match(other_value.referred_function); } MGCPUnitdataCallback MGCPUnitdataCallback_template::valueof() const { if(template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific @MGCP_Emulation.MGCPUnitdataCallback template."); return single_value; } void MGCPUnitdataCallback_template::set_type(template_sel template_type, unsigned int list_length) { if(template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST) TTCN_error("Setting an invalid type for an @MGCP_Emulation.MGCPUnitdataCallback template."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MGCPUnitdataCallback_template[list_length]; } MGCPUnitdataCallback_template& MGCPUnitdataCallback_template::list_item(unsigned int list_index) const { if(template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST) TTCN_error("Accessing a list element of a non-list template of type @MGCP_Emulation.MGCPUnitdataCallback"); if(list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @MGCP_Emulation.MGCPUnitdataCallback."); return value_list.list_value[list_index]; } void MGCPUnitdataCallback_template::log() const { switch(template_selection) { case SPECIFIC_VALUE: Module_List::log_function((genericfunc_t)single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case VALUE_LIST: TTCN_Logger::log_char('('); for(unsigned int i = 0; i < value_list.n_values; i++) { if(i > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[i].log(); } TTCN_Logger::log_char(')'); break; default: log_generic(); } log_ifpresent(); } void MGCPUnitdataCallback_template::log_match(const MGCPUnitdataCallback& match_value, boolean legacy) const { log(); TTCN_Logger::log_event_str(" with "); match_value.log(); if(match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void MGCPUnitdataCallback_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch(template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case SPECIFIC_VALUE: Module_List::encode_function(text_buf, (genericfunc_t)single_value); break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for(unsigned int i = 0; i < value_list.n_values; i++) value_list.list_value[i].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @MGCP_Emulation.MGCPUnitdataCallback."); } } void MGCPUnitdataCallback_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch(template_selection) { case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case SPECIFIC_VALUE: Module_List::decode_function(text_buf,(genericfunc_t*)&single_value); break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new MGCPUnitdataCallback_template[value_list.n_values]; for(unsigned int i = 0; i < value_list.n_values; i++) value_list.list_value[i].decode_text(text_buf); default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @MGCP_Emulation.MGCPUnitdataCallback."); } } boolean MGCPUnitdataCallback_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MGCPUnitdataCallback_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) create__cb().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) unitdata__cb().set_param(*param.get_elem(1)); 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(), "create_cb")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { create__cb().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "unitdata_cb")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { unitdata__cb().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.MGCPOps: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@MGCP_Emulation.MGCPOps"); } } void MGCPOps::encode_text(Text_Buf& text_buf) const { field_create__cb.encode_text(text_buf); field_unitdata__cb.encode_text(text_buf); } void MGCPOps::decode_text(Text_Buf& text_buf) { field_create__cb.decode_text(text_buf); field_unitdata__cb.decode_text(text_buf); } struct MGCPOps_template::single_value_struct { MGCPCreateCallback_template field_create__cb; MGCPUnitdataCallback_template field_unitdata__cb; }; void MGCPOps_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_create__cb = ANY_VALUE; single_value->field_unitdata__cb = ANY_VALUE; } } } void MGCPOps_template::copy_value(const MGCPOps& other_value) { single_value = new single_value_struct; if (other_value.create__cb().is_bound()) { single_value->field_create__cb = other_value.create__cb(); } else { single_value->field_create__cb.clean_up(); } if (other_value.unitdata__cb().is_bound()) { single_value->field_unitdata__cb = other_value.unitdata__cb(); } else { single_value->field_unitdata__cb.clean_up(); } set_selection(SPECIFIC_VALUE); } void MGCPOps_template::copy_template(const MGCPOps_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.create__cb().get_selection()) { single_value->field_create__cb = other_value.create__cb(); } else { single_value->field_create__cb.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.unitdata__cb().get_selection()) { single_value->field_unitdata__cb = other_value.unitdata__cb(); } else { single_value->field_unitdata__cb.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 MGCPOps_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 MGCPOps_template(*other_value.implication_.precondition); implication_.implied_template = new MGCPOps_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 @MGCP_Emulation.MGCPOps."); break; } set_selection(other_value); } MGCPOps_template::MGCPOps_template() { } MGCPOps_template::MGCPOps_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MGCPOps_template::MGCPOps_template(const MGCPOps& other_value) { copy_value(other_value); } MGCPOps_template::MGCPOps_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MGCPOps&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @MGCP_Emulation.MGCPOps from an unbound optional field."); } } MGCPOps_template::MGCPOps_template(MGCPOps_template* p_precondition, MGCPOps_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MGCPOps_template::MGCPOps_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; } MGCPOps_template::MGCPOps_template(const MGCPOps_template& other_value) : Base_Template() { copy_template(other_value); } MGCPOps_template::~MGCPOps_template() { clean_up(); } MGCPOps_template& MGCPOps_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MGCPOps_template& MGCPOps_template::operator=(const MGCPOps& other_value) { clean_up(); copy_value(other_value); return *this; } MGCPOps_template& MGCPOps_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MGCPOps&)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 @MGCP_Emulation.MGCPOps."); } return *this; } MGCPOps_template& MGCPOps_template::operator=(const MGCPOps_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MGCPOps_template::match(const MGCPOps& 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.create__cb().is_bound()) return FALSE; if(!single_value->field_create__cb.match(other_value.create__cb(), legacy))return FALSE; if(!other_value.unitdata__cb().is_bound()) return FALSE; if(!single_value->field_unitdata__cb.match(other_value.unitdata__cb(), 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 @MGCP_Emulation.MGCPOps."); } return FALSE; } boolean MGCPOps_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_create__cb.is_bound() || single_value->field_unitdata__cb.is_bound(); } boolean MGCPOps_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_create__cb.is_value() && single_value->field_unitdata__cb.is_value(); } void MGCPOps_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; } MGCPOps MGCPOps_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 @MGCP_Emulation.MGCPOps."); MGCPOps ret_val; if (single_value->field_create__cb.is_bound()) { ret_val.create__cb() = single_value->field_create__cb.valueof(); } if (single_value->field_unitdata__cb.is_bound()) { ret_val.unitdata__cb() = single_value->field_unitdata__cb.valueof(); } return ret_val; } void MGCPOps_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 @MGCP_Emulation.MGCPOps."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MGCPOps_template[list_length]; } MGCPOps_template& MGCPOps_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 @MGCP_Emulation.MGCPOps."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @MGCP_Emulation.MGCPOps."); return value_list.list_value[list_index]; } MGCPCreateCallback_template& MGCPOps_template::create__cb() { set_specific(); return single_value->field_create__cb; } const MGCPCreateCallback_template& MGCPOps_template::create__cb() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field create_cb of a non-specific template of type @MGCP_Emulation.MGCPOps."); return single_value->field_create__cb; } MGCPUnitdataCallback_template& MGCPOps_template::unitdata__cb() { set_specific(); return single_value->field_unitdata__cb; } const MGCPUnitdataCallback_template& MGCPOps_template::unitdata__cb() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field unitdata_cb of a non-specific template of type @MGCP_Emulation.MGCPOps."); return single_value->field_unitdata__cb; } int MGCPOps_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCPOps which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @MGCP_Emulation.MGCPOps 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 @MGCP_Emulation.MGCPOps containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCPOps containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCPOps containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCPOps containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCPOps containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCPOps containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @MGCP_Emulation.MGCPOps containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @MGCP_Emulation.MGCPOps."); } return 0; } void MGCPOps_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ create_cb := "); single_value->field_create__cb.log(); TTCN_Logger::log_event_str(", unitdata_cb := "); single_value->field_unitdata__cb.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 MGCPOps_template::log_match(const MGCPOps& 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_create__cb.match(match_value.create__cb(), legacy)){ TTCN_Logger::log_logmatch_info(".create_cb"); single_value->field_create__cb.log_match(match_value.create__cb(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_unitdata__cb.match(match_value.unitdata__cb(), legacy)){ TTCN_Logger::log_logmatch_info(".unitdata_cb"); single_value->field_unitdata__cb.log_match(match_value.unitdata__cb(), 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("{ create_cb := "); single_value->field_create__cb.log_match(match_value.create__cb(), legacy); TTCN_Logger::log_event_str(", unitdata_cb := "); single_value->field_unitdata__cb.log_match(match_value.unitdata__cb(), 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 MGCPOps_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (create__cb().is_bound()) create__cb().set_implicit_omit(); if (unitdata__cb().is_bound()) unitdata__cb().set_implicit_omit(); } void MGCPOps_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_create__cb.encode_text(text_buf); single_value->field_unitdata__cb.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 @MGCP_Emulation.MGCPOps."); } } void MGCPOps_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_create__cb.decode_text(text_buf); single_value->field_unitdata__cb.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 MGCPOps_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 @MGCP_Emulation.MGCPOps."); } } void MGCPOps_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: { MGCPOps_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) create__cb().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) unitdata__cb().set_param(*param.get_elem(1)); 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(), "create_cb")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { create__cb().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "unitdata_cb")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { unitdata__cb().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @MGCP_Emulation.MGCPOps: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MGCPOps_template* precondition = new MGCPOps_template; precondition->set_param(*param.get_elem(0)); MGCPOps_template* implied_template = new MGCPOps_template; implied_template->set_param(*param.get_elem(1)); *this = MGCPOps_template(precondition, implied_template); } break; default: param.type_error("record template", "@MGCP_Emulation.MGCPOps"); } is_ifpresent = param.get_ifpresent(); } void MGCPOps_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_create__cb.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.MGCPOps"); single_value->field_unitdata__cb.check_restriction(t_res, t_name ? t_name : "@MGCP_Emulation.MGCPOps"); 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 : "@MGCP_Emulation.MGCPOps"); } boolean MGCPOps_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MGCPOps_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_idxnext_item = NULL; if (proc_queue_tail != NULL) proc_queue_tail->next_item = new_item; else proc_queue_head = new_item; proc_queue_tail = new_item; } void MGCPEM__PROC__PT::remove_proc_queue_head() { switch (proc_queue_head->item_selection) { case CALL_0: delete proc_queue_head->call_0; break; case CALL_1: delete proc_queue_head->call_1; break; case CALL_2: delete proc_queue_head->call_2; break; case REPLY_0: delete proc_queue_head->reply_0; break; case REPLY_1: delete proc_queue_head->reply_1; break; case REPLY_2: delete proc_queue_head->reply_2; break; default: TTCN_error("Internal error: Invalid signature selector in the queue of port %s.", port_name); } proc_queue_item *next_item = proc_queue_head->next_item; delete proc_queue_head; proc_queue_head = next_item; if (next_item == NULL) proc_queue_tail = NULL; TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::extract__op, port_name, 0, ++proc_head_count, CHARSTRING(0,NULL), CHARSTRING(0,NULL));} void MGCPEM__PROC__PT::clear_queue() { while (proc_queue_head != NULL) remove_proc_queue_head(); } MGCPEM__PROC__PT::MGCPEM__PROC__PT(const char *par_port_name) : PORT(par_port_name) { proc_queue_head = NULL; proc_queue_tail = NULL; } MGCPEM__PROC__PT::~MGCPEM__PROC__PT() { clear_queue(); } void MGCPEM__PROC__PT::call(const MGCPEM__register_template& call_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Calling a signature on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of call operation."); const MGCPEM__register_call& call_tmp = call_template.create_call(); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_send(port_name,TitanLoggerApiSimple::Port__oper::call__op, destination_component, CHARSTRING(0,NULL),(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), call_tmp.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send call to system.", port_name); else { Text_Buf text_buf; prepare_call(text_buf, "@MGCP_Emulation.MGCPEM_register"); call_tmp.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCPEM__PROC__PT::call(const MGCPEM__register_template& call_template, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) call(call_template, destination_components[i], timestamp_redirect); } void MGCPEM__PROC__PT::call(const MGCPEM__register_template& call_template, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Calling a signature on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_call(text_buf, "@MGCP_Emulation.MGCPEM_register"); const MGCPEM__register_call& call_tmp = call_template.create_call(); call_tmp.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_CALL, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PCOUT, TRUE), call_tmp.log(), TTCN_Logger::end_event_log2str())); } else call(call_template, COMPONENT(get_default_destination()), timestamp_redirect); } void MGCPEM__PROC__PT::call(const MGCPEM__delete__ep_template& call_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Calling a signature on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of call operation."); const MGCPEM__delete__ep_call& call_tmp = call_template.create_call(); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_send(port_name,TitanLoggerApiSimple::Port__oper::call__op, destination_component, CHARSTRING(0,NULL),(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), call_tmp.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send call to system.", port_name); else { Text_Buf text_buf; prepare_call(text_buf, "@MGCP_Emulation.MGCPEM_delete_ep"); call_tmp.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCPEM__PROC__PT::call(const MGCPEM__delete__ep_template& call_template, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) call(call_template, destination_components[i], timestamp_redirect); } void MGCPEM__PROC__PT::call(const MGCPEM__delete__ep_template& call_template, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Calling a signature on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_call(text_buf, "@MGCP_Emulation.MGCPEM_delete_ep"); const MGCPEM__delete__ep_call& call_tmp = call_template.create_call(); call_tmp.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_CALL, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PCOUT, TRUE), call_tmp.log(), TTCN_Logger::end_event_log2str())); } else call(call_template, COMPONENT(get_default_destination()), timestamp_redirect); } void MGCPEM__PROC__PT::call(const MGCPEM__change__connhdlr_template& call_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Calling a signature on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of call operation."); const MGCPEM__change__connhdlr_call& call_tmp = call_template.create_call(); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_send(port_name,TitanLoggerApiSimple::Port__oper::call__op, destination_component, CHARSTRING(0,NULL),(TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), call_tmp.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send call to system.", port_name); else { Text_Buf text_buf; prepare_call(text_buf, "@MGCP_Emulation.MGCPEM_change_connhdlr"); call_tmp.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCPEM__PROC__PT::call(const MGCPEM__change__connhdlr_template& call_template, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) call(call_template, destination_components[i], timestamp_redirect); } void MGCPEM__PROC__PT::call(const MGCPEM__change__connhdlr_template& call_template, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Calling a signature on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_call(text_buf, "@MGCP_Emulation.MGCPEM_change_connhdlr"); const MGCPEM__change__connhdlr_call& call_tmp = call_template.create_call(); call_tmp.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_CALL, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PCOUT, TRUE), call_tmp.log(), TTCN_Logger::end_event_log2str())); } else call(call_template, COMPONENT(get_default_destination()), timestamp_redirect); } void MGCPEM__PROC__PT::reply(const MGCPEM__register_template& reply_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Replying to a signature on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of reply operation."); const MGCPEM__register_reply& reply_tmp = reply_template.create_reply(); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_send(port_name, TitanLoggerApiSimple::Port__oper::reply__op, destination_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), reply_tmp.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send reply to system.", port_name); else { Text_Buf text_buf; prepare_reply(text_buf, "@MGCP_Emulation.MGCPEM_register"); reply_tmp.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCPEM__PROC__PT::reply(const MGCPEM__register_template& reply_template, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) reply(reply_template, destination_components[i], timestamp_redirect); } void MGCPEM__PROC__PT::reply(const MGCPEM__register_template& reply_template, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Replying to a call on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_reply(text_buf, "@MGCP_Emulation.MGCPEM_register"); const MGCPEM__register_reply& reply_tmp = reply_template.create_reply(); reply_tmp.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_REPLY, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PCOUT, TRUE), reply_tmp.log(), TTCN_Logger::end_event_log2str())); } else reply(reply_template, COMPONENT(get_default_destination()), timestamp_redirect); } void MGCPEM__PROC__PT::reply(const MGCPEM__delete__ep_template& reply_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Replying to a signature on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of reply operation."); const MGCPEM__delete__ep_reply& reply_tmp = reply_template.create_reply(); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_send(port_name, TitanLoggerApiSimple::Port__oper::reply__op, destination_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), reply_tmp.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send reply to system.", port_name); else { Text_Buf text_buf; prepare_reply(text_buf, "@MGCP_Emulation.MGCPEM_delete_ep"); reply_tmp.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCPEM__PROC__PT::reply(const MGCPEM__delete__ep_template& reply_template, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) reply(reply_template, destination_components[i], timestamp_redirect); } void MGCPEM__PROC__PT::reply(const MGCPEM__delete__ep_template& reply_template, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Replying to a call on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_reply(text_buf, "@MGCP_Emulation.MGCPEM_delete_ep"); const MGCPEM__delete__ep_reply& reply_tmp = reply_template.create_reply(); reply_tmp.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_REPLY, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PCOUT, TRUE), reply_tmp.log(), TTCN_Logger::end_event_log2str())); } else reply(reply_template, COMPONENT(get_default_destination()), timestamp_redirect); } void MGCPEM__PROC__PT::reply(const MGCPEM__change__connhdlr_template& reply_template, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { if (!is_started) TTCN_error("Replying to a signature on port %s, which is not started.", port_name); if (!destination_component.is_bound()) TTCN_error("Unbound component reference in the to clause of reply operation."); const MGCPEM__change__connhdlr_reply& reply_tmp = reply_template.create_reply(); const TTCN_Logger::Severity log_sev = destination_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMOUT:TTCN_Logger::PORTEVENT_PCOUT; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_send(port_name, TitanLoggerApiSimple::Port__oper::reply__op, destination_component, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PMOUT, TRUE), reply_tmp.log(), TTCN_Logger::end_event_log2str())); } if (destination_component == SYSTEM_COMPREF) TTCN_error("Internal port %s cannot send reply to system.", port_name); else { Text_Buf text_buf; prepare_reply(text_buf, "@MGCP_Emulation.MGCPEM_change_connhdlr"); reply_tmp.encode_text(text_buf); send_data(text_buf, destination_component); } } void MGCPEM__PROC__PT::reply(const MGCPEM__change__connhdlr_template& reply_template, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { for (size_t i = 0; i < nof_components; ++i) reply(reply_template, destination_components[i], timestamp_redirect); } void MGCPEM__PROC__PT::reply(const MGCPEM__change__connhdlr_template& reply_template, boolean broadcast, FLOAT* timestamp_redirect) { if (broadcast) { if (!is_started) TTCN_error("Replying to a call on port %s, which is not started.", port_name); Text_Buf text_buf; prepare_reply(text_buf, "@MGCP_Emulation.MGCPEM_change_connhdlr"); const MGCPEM__change__connhdlr_reply& reply_tmp = reply_template.create_reply(); reply_tmp.encode_text(text_buf); send_data_broadcast(text_buf, PORT::OMT_REPLY, (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PCOUT, TRUE), reply_tmp.log(), TTCN_Logger::end_event_log2str())); } else reply(reply_template, COMPONENT(get_default_destination()), timestamp_redirect); } alt_status MGCPEM__PROC__PT::getcall(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else switch (proc_queue_head->item_selection) { case CALL_0: case CALL_1: case CALL_2: { if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS, "Matching on port %s succeeded.", port_name); const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, FALSE, CHARSTRING(0, NULL), msg_head_count+1); } remove_proc_queue_head(); return ALT_YES; } default: TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: First entity in the queue is not a call.", port_name); return ALT_NO; } } alt_status MGCPEM__PROC__PT::check_getcall(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else switch (proc_queue_head->item_selection) { case CALL_0: case CALL_1: case CALL_2: { if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS, "Matching on port %s succeeded.", port_name); const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, TRUE, CHARSTRING(0, NULL), msg_head_count+1); } return ALT_YES; } default: TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: First entity in the queue is not a call.", port_name); return ALT_NO; } } alt_status MGCPEM__PROC__PT::getcall(const MGCPEM__register_template& getcall_template, const COMPONENT_template& sender_template, const MGCPEM__register_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause, (TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else if (proc_queue_head->item_selection != CALL_0) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @MGCP_Emulation.MGCPEM_register.", port_name); return ALT_NO; } else if (!getcall_template.match_call(*proc_queue_head->call_0)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_0), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->call_0); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getcall_template.log_match_call(*proc_queue_head->call_0); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, FALSE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_proc_queue_head(); return ALT_YES; } } alt_status MGCPEM__PROC__PT::check_getcall(const MGCPEM__register_template& getcall_template, const COMPONENT_template& sender_template, const MGCPEM__register_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause, (TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else if (proc_queue_head->item_selection != CALL_0) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @MGCP_Emulation.MGCPEM_register.", port_name); return ALT_NO; } else if (!getcall_template.match_call(*proc_queue_head->call_0)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_0), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->call_0); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getcall_template.log_match_call(*proc_queue_head->call_0); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, TRUE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MGCPEM__PROC__PT::getcall(const MGCPEM__delete__ep_template& getcall_template, const COMPONENT_template& sender_template, const MGCPEM__delete__ep_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause, (TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else if (proc_queue_head->item_selection != CALL_1) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @MGCP_Emulation.MGCPEM_delete_ep.", port_name); return ALT_NO; } else if (!getcall_template.match_call(*proc_queue_head->call_1)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_1), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->call_1); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getcall_template.log_match_call(*proc_queue_head->call_1); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, FALSE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_proc_queue_head(); return ALT_YES; } } alt_status MGCPEM__PROC__PT::check_getcall(const MGCPEM__delete__ep_template& getcall_template, const COMPONENT_template& sender_template, const MGCPEM__delete__ep_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause, (TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else if (proc_queue_head->item_selection != CALL_1) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @MGCP_Emulation.MGCPEM_delete_ep.", port_name); return ALT_NO; } else if (!getcall_template.match_call(*proc_queue_head->call_1)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_1), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->call_1); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getcall_template.log_match_call(*proc_queue_head->call_1); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, TRUE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MGCPEM__PROC__PT::getcall(const MGCPEM__change__connhdlr_template& getcall_template, const COMPONENT_template& sender_template, const MGCPEM__change__connhdlr_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause, (TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else if (proc_queue_head->item_selection != CALL_2) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @MGCP_Emulation.MGCPEM_change_connhdlr.", port_name); return ALT_NO; } else if (!getcall_template.match_call(*proc_queue_head->call_2)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_2), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->call_2); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getcall_template.log_match_call(*proc_queue_head->call_2); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, FALSE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_proc_queue_head(); return ALT_YES; } } alt_status MGCPEM__PROC__PT::check_getcall(const MGCPEM__change__connhdlr_template& getcall_template, const COMPONENT_template& sender_template, const MGCPEM__change__connhdlr_call_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::sender__does__not__match__from__clause, (TTCN_Logger::begin_event(log_sev, TRUE), sender_template.log_match(proc_queue_head->sender_component), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else if (proc_queue_head->item_selection != CALL_2) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a call for signature @MGCP_Emulation.MGCPEM_change_connhdlr.", port_name); return ALT_NO; } else if (!getcall_template.match_call(*proc_queue_head->call_2)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__call__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getcall_template.log_match_call(*proc_queue_head->call_2), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->call_2); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getcall_template.log_match_call(*proc_queue_head->call_2); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::call__op, proc_queue_head->sender_component, TRUE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->call_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MGCPEM__PROC__PT::getreply(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else switch (proc_queue_head->item_selection) { case REPLY_0: case REPLY_1: case REPLY_2: { if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS, "Matching on port %s succeeded.", port_name); const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, FALSE, CHARSTRING(0, NULL), msg_head_count+1); } remove_proc_queue_head(); return ALT_YES; } default: TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: First entity in the queue is not a reply.", port_name); return ALT_NO; } } alt_status MGCPEM__PROC__PT::check_getreply(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else switch (proc_queue_head->item_selection) { case REPLY_0: case REPLY_1: case REPLY_2: { if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS, "Matching on port %s succeeded.", port_name); const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, TRUE, CHARSTRING(0, NULL), msg_head_count+1); } return ALT_YES; } default: TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: First entity in the queue is not a reply.", port_name); return ALT_NO; } } alt_status MGCPEM__PROC__PT::getreply(const MGCPEM__register_template& getreply_template, const COMPONENT_template& sender_template, const MGCPEM__register_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (proc_queue_head->item_selection != REPLY_0) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @MGCP_Emulation.MGCPEM_register.", port_name); return ALT_NO; } else if (!getreply_template.match_reply(*proc_queue_head->reply_0)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_0), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->reply_0); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getreply_template.log_match_reply(*proc_queue_head->reply_0); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, FALSE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_proc_queue_head(); return ALT_YES; } } alt_status MGCPEM__PROC__PT::check_getreply(const MGCPEM__register_template& getreply_template, const COMPONENT_template& sender_template, const MGCPEM__register_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (proc_queue_head->item_selection != REPLY_0) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @MGCP_Emulation.MGCPEM_register.", port_name); return ALT_NO; } else if (!getreply_template.match_reply(*proc_queue_head->reply_0)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_0), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->reply_0); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getreply_template.log_match_reply(*proc_queue_head->reply_0); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, TRUE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MGCPEM__PROC__PT::getreply(const MGCPEM__delete__ep_template& getreply_template, const COMPONENT_template& sender_template, const MGCPEM__delete__ep_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (proc_queue_head->item_selection != REPLY_1) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @MGCP_Emulation.MGCPEM_delete_ep.", port_name); return ALT_NO; } else if (!getreply_template.match_reply(*proc_queue_head->reply_1)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_1), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->reply_1); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getreply_template.log_match_reply(*proc_queue_head->reply_1); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, FALSE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_proc_queue_head(); return ALT_YES; } } alt_status MGCPEM__PROC__PT::check_getreply(const MGCPEM__delete__ep_template& getreply_template, const COMPONENT_template& sender_template, const MGCPEM__delete__ep_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (proc_queue_head->item_selection != REPLY_1) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @MGCP_Emulation.MGCPEM_delete_ep.", port_name); return ALT_NO; } else if (!getreply_template.match_reply(*proc_queue_head->reply_1)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_1), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->reply_1); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getreply_template.log_match_reply(*proc_queue_head->reply_1); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, TRUE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_1->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MGCPEM__PROC__PT::getreply(const MGCPEM__change__connhdlr_template& getreply_template, const COMPONENT_template& sender_template, const MGCPEM__change__connhdlr_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (proc_queue_head->item_selection != REPLY_2) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @MGCP_Emulation.MGCPEM_change_connhdlr.", port_name); return ALT_NO; } else if (!getreply_template.match_reply(*proc_queue_head->reply_2)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_2), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->reply_2); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getreply_template.log_match_reply(*proc_queue_head->reply_2); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, FALSE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_proc_queue_head(); return ALT_YES; } } alt_status MGCPEM__PROC__PT::check_getreply(const MGCPEM__change__connhdlr_template& getreply_template, const COMPONENT_template& sender_template, const MGCPEM__change__connhdlr_reply_redirect& param_ref, COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { if (proc_queue_head == NULL) { if (is_started) return ALT_MAYBE; else { TTCN_Logger::log(TTCN_Logger::MATCHING_PROBLEM, "Matching on port %s failed: Port is not started and the queue is empty.", port_name); return ALT_NO; } } else if (!sender_template.match(proc_queue_head->sender_component)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s failed: Sender of the first entity in the queue does not match the from clause: ", port_name); sender_template.log_match(proc_queue_head->sender_component); TTCN_Logger::end_event(); } return ALT_NO; } else if (proc_queue_head->item_selection != REPLY_2) { TTCN_Logger::log(proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMUNSUCC:TTCN_Logger::MATCHING_PCUNSUCC, "Matching on port %s failed: The first entity in the queue is not a reply for signature @MGCP_Emulation.MGCPEM_change_connhdlr.", port_name); return ALT_NO; } else if (!getreply_template.match_reply(*proc_queue_head->reply_2)) { const TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF ? TTCN_Logger::MATCHING_PMUNSUCC : TTCN_Logger::MATCHING_PCUNSUCC; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_matching_failure(TitanLoggerApiSimple::PortType::procedure__, port_name, proc_queue_head->sender_component, TitanLoggerApiSimple::MatchingFailureType_reason::parameters__of__reply__do__not__match__template, (TTCN_Logger::begin_event(log_sev, TRUE), getreply_template.log_match_reply(*proc_queue_head->reply_2), TTCN_Logger::end_event_log2str())); } return ALT_NO; } else { param_ref.set_parameters(*proc_queue_head->reply_2); if (sender_ptr != NULL) *sender_ptr = proc_queue_head->sender_component; TTCN_Logger::Severity log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::MATCHING_PMSUCCESS:TTCN_Logger::MATCHING_PCSUCCESS; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::begin_event(log_sev); TTCN_Logger::log_event("Matching on port %s succeeded: ", port_name); getreply_template.log_match_reply(*proc_queue_head->reply_2); TTCN_Logger::end_event(); } log_sev = proc_queue_head->sender_component==SYSTEM_COMPREF?TTCN_Logger::PORTEVENT_PMIN:TTCN_Logger::PORTEVENT_PCIN; if (TTCN_Logger::log_this_event(log_sev)) { TTCN_Logger::log_procport_recv(port_name, TitanLoggerApiSimple::Port__oper::reply__op, proc_queue_head->sender_component, TRUE, (TTCN_Logger::begin_event(log_sev, TRUE), proc_queue_head->reply_2->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } void MGCPEM__PROC__PT::incoming_call(const MGCPEM__register_call& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A call that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a call has arrived on it.", port_name); } } proc_tail_count++; if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) { TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__call, port_name, sender_component, proc_tail_count, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str())); } proc_queue_item *new_item = new proc_queue_item; new_item->item_selection = CALL_0; new_item->call_0 = new MGCPEM__register_call(incoming_par); new_item->sender_component = sender_component; append_to_proc_queue(new_item); } void MGCPEM__PROC__PT::incoming_call(const MGCPEM__delete__ep_call& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A call that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a call has arrived on it.", port_name); } } proc_tail_count++; if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) { TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__call, port_name, sender_component, proc_tail_count, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str())); } proc_queue_item *new_item = new proc_queue_item; new_item->item_selection = CALL_1; new_item->call_1 = new MGCPEM__delete__ep_call(incoming_par); new_item->sender_component = sender_component; append_to_proc_queue(new_item); } void MGCPEM__PROC__PT::incoming_call(const MGCPEM__change__connhdlr_call& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A call that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a call has arrived on it.", port_name); } } proc_tail_count++; if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) { TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__call, port_name, sender_component, proc_tail_count, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str())); } proc_queue_item *new_item = new proc_queue_item; new_item->item_selection = CALL_2; new_item->call_2 = new MGCPEM__change__connhdlr_call(incoming_par); new_item->sender_component = sender_component; append_to_proc_queue(new_item); } void MGCPEM__PROC__PT::incoming_reply(const MGCPEM__register_reply& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A reply that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a reply has arrived on it.", port_name); } } proc_tail_count++; if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) { TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__reply, port_name, sender_component, proc_tail_count, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str())); } proc_queue_item *new_item = new proc_queue_item; new_item->item_selection = REPLY_0; new_item->reply_0 = new MGCPEM__register_reply(incoming_par); new_item->sender_component = sender_component; append_to_proc_queue(new_item); } void MGCPEM__PROC__PT::incoming_reply(const MGCPEM__delete__ep_reply& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A reply that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a reply has arrived on it.", port_name); } } proc_tail_count++; if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) { TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__reply, port_name, sender_component, proc_tail_count, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str())); } proc_queue_item *new_item = new proc_queue_item; new_item->item_selection = REPLY_1; new_item->reply_1 = new MGCPEM__delete__ep_reply(incoming_par); new_item->sender_component = sender_component; append_to_proc_queue(new_item); } void MGCPEM__PROC__PT::incoming_reply(const MGCPEM__change__connhdlr_reply& incoming_par, component sender_component) { if (!is_started) { if (is_halted) { TTCN_warning("A reply that arrived on port %s has been discarded, because the port is not started.", port_name); return; } else { TTCN_error("Port %s is not started but a reply has arrived on it.", port_name); } } proc_tail_count++; if (TTCN_Logger::log_this_event(TTCN_Logger::PORTEVENT_PQUEUE)) { TTCN_Logger::log_port_queue(TitanLoggerApiSimple::Port__Queue_operation::enqueue__reply, port_name, sender_component, proc_tail_count, CHARSTRING(0, NULL), (TTCN_Logger::begin_event(TTCN_Logger::PORTEVENT_PQUEUE, TRUE), TTCN_Logger::log_char(' '), incoming_par.log(), TTCN_Logger::end_event_log2str())); } proc_queue_item *new_item = new proc_queue_item; new_item->item_selection = REPLY_2; new_item->reply_2 = new MGCPEM__change__connhdlr_reply(incoming_par); new_item->sender_component = sender_component; append_to_proc_queue(new_item); } boolean MGCPEM__PROC__PT::process_call(const char *signature_name, Text_Buf& incoming_buf, component sender_component) { if (!strcmp(signature_name, "@MGCP_Emulation.MGCPEM_register")) { MGCPEM__register_call incoming_par; incoming_par.decode_text(incoming_buf); incoming_call(incoming_par, sender_component); return TRUE; } else if (!strcmp(signature_name, "@MGCP_Emulation.MGCPEM_delete_ep")) { MGCPEM__delete__ep_call incoming_par; incoming_par.decode_text(incoming_buf); incoming_call(incoming_par, sender_component); return TRUE; } else if (!strcmp(signature_name, "@MGCP_Emulation.MGCPEM_change_connhdlr")) { MGCPEM__change__connhdlr_call incoming_par; incoming_par.decode_text(incoming_buf); incoming_call(incoming_par, sender_component); return TRUE; } else return FALSE; } boolean MGCPEM__PROC__PT::process_reply(const char *signature_name, Text_Buf& incoming_buf, component sender_component) { if (!strcmp(signature_name, "@MGCP_Emulation.MGCPEM_register")) { MGCPEM__register_reply incoming_par; incoming_par.decode_text(incoming_buf); incoming_reply(incoming_par, sender_component); return TRUE; } else if (!strcmp(signature_name, "@MGCP_Emulation.MGCPEM_delete_ep")) { MGCPEM__delete__ep_reply incoming_par; incoming_par.decode_text(incoming_buf); incoming_reply(incoming_par, sender_component); return TRUE; } else if (!strcmp(signature_name, "@MGCP_Emulation.MGCPEM_change_connhdlr")) { MGCPEM__change__connhdlr_reply incoming_par; incoming_par.decode_text(incoming_buf); incoming_reply(incoming_par, sender_component); return TRUE; } else return FALSE; } /* Bodies of functions, altsteps and testcases */ MGCP__CodecPort::MGCP__RecvFrom_template tr__MGCP__RecvFrom__R(const MGCP__Types::MgcpMessage_template& msg) { TTCN_Location current_location("MGCP_Emulation.ttcn", 110, TTCN_Location::LOCATION_FUNCTION, "tr_MGCP_RecvFrom_R"); current_location.update_lineno(112); /* MGCP_Emulation.ttcn, line 112 */ MGCP__CodecPort::MGCP__RecvFrom_template mrf; mrf.connId() = MGCP__Emulation__CT_component_g__mgcp__conn__id; mrf.remName() = ANY_VALUE; mrf.remPort() = ANY_VALUE; mrf.locName() = ANY_VALUE; mrf.locPort() = ANY_VALUE; mrf.msg() = msg; current_location.update_lineno(120); /* MGCP_Emulation.ttcn, line 120 */ return mrf; } void start_tr__MGCP__RecvFrom__R(const COMPONENT& component_reference, const MGCP__Types::MgcpMessage_template& msg) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function tr_MGCP_RecvFrom_R("); msg.log(); TTCN_Logger::log_event_str(") on component "); component_reference.log(); TTCN_Logger::log_char('.'); TTCN_Logger::end_event(); Text_Buf text_buf; TTCN_Runtime::prepare_start_component(component_reference, "MGCP_Emulation", "tr_MGCP_RecvFrom_R", text_buf); msg.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } BOOLEAN f__ep__known(const CHARSTRING& ep) { TTCN_Location current_location("MGCP_Emulation.ttcn", 123, TTCN_Location::LOCATION_FUNCTION, "f_ep_known"); current_location.update_lineno(125); /* MGCP_Emulation.ttcn, line 125 */ INTEGER i; current_location.update_lineno(126); /* MGCP_Emulation.ttcn, line 126 */ i = 0; current_location.update_lineno(126); /* MGCP_Emulation.ttcn, line 126 */ for ( ; ; ) { current_location.update_lineno(126); /* MGCP_Emulation.ttcn, line 126 */ if (!(i < 16)) break; current_location.update_lineno(127); /* MGCP_Emulation.ttcn, line 127 */ if ((const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[i].endpoint() == ep)) { current_location.update_lineno(128); /* MGCP_Emulation.ttcn, line 128 */ return TRUE; } current_location.update_lineno(126); /* MGCP_Emulation.ttcn, line 126 */ { INTEGER tmp_1; ++i; } } current_location.update_lineno(131); /* MGCP_Emulation.ttcn, line 131 */ return FALSE; } void start_f__ep__known(const COMPONENT& component_reference, const CHARSTRING& ep) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_known("); ep.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, "MGCP_Emulation", "f_ep_known", text_buf); ep.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } BOOLEAN f__comp__known(const COMPONENT& client) { TTCN_Location current_location("MGCP_Emulation.ttcn", 134, TTCN_Location::LOCATION_FUNCTION, "f_comp_known"); current_location.update_lineno(136); /* MGCP_Emulation.ttcn, line 136 */ INTEGER i; current_location.update_lineno(137); /* MGCP_Emulation.ttcn, line 137 */ i = 0; current_location.update_lineno(137); /* MGCP_Emulation.ttcn, line 137 */ for ( ; ; ) { current_location.update_lineno(137); /* MGCP_Emulation.ttcn, line 137 */ if (!(i < 16)) break; current_location.update_lineno(138); /* MGCP_Emulation.ttcn, line 138 */ if ((const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[i].comp__ref() == client)) { current_location.update_lineno(139); /* MGCP_Emulation.ttcn, line 139 */ return TRUE; } current_location.update_lineno(137); /* MGCP_Emulation.ttcn, line 137 */ { INTEGER tmp_3; ++i; } } current_location.update_lineno(142); /* MGCP_Emulation.ttcn, line 142 */ return FALSE; } void start_f__comp__known(const COMPONENT& component_reference, const COMPONENT& client) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_comp_known("); client.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, "MGCP_Emulation", "f_comp_known", text_buf); client.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } COMPONENT f__comp__by__ep(const CHARSTRING& ep) { TTCN_Location current_location("MGCP_Emulation.ttcn", 145, TTCN_Location::LOCATION_FUNCTION, "f_comp_by_ep"); current_location.update_lineno(147); /* MGCP_Emulation.ttcn, line 147 */ INTEGER i; current_location.update_lineno(148); /* MGCP_Emulation.ttcn, line 148 */ i = 0; current_location.update_lineno(148); /* MGCP_Emulation.ttcn, line 148 */ for ( ; ; ) { current_location.update_lineno(148); /* MGCP_Emulation.ttcn, line 148 */ if (!(i < 16)) break; current_location.update_lineno(149); /* MGCP_Emulation.ttcn, line 149 */ if ((const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[i].endpoint() == ep)) { current_location.update_lineno(150); /* MGCP_Emulation.ttcn, line 150 */ return const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[i].comp__ref(); } current_location.update_lineno(148); /* MGCP_Emulation.ttcn, line 148 */ { INTEGER tmp_5; ++i; } } current_location.update_lineno(153); /* MGCP_Emulation.ttcn, line 153 */ Misc__Helpers::f__shutdown(cs_0, 153, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("MGCP Endpoint Table not found by Endpoint"),ep.log(),TTCN_Logger::end_event_log2str())); current_location.update_lineno(155); /* MGCP_Emulation.ttcn, line 155 */ return const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[0].comp__ref(); } void start_f__comp__by__ep(const COMPONENT& component_reference, const CHARSTRING& ep) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_comp_by_ep("); ep.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, "MGCP_Emulation", "f_comp_by_ep", text_buf); ep.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } CHARSTRING f__ep__by__comp(const COMPONENT& client) { TTCN_Location current_location("MGCP_Emulation.ttcn", 158, TTCN_Location::LOCATION_FUNCTION, "f_ep_by_comp"); current_location.update_lineno(160); /* MGCP_Emulation.ttcn, line 160 */ INTEGER i; current_location.update_lineno(161); /* MGCP_Emulation.ttcn, line 161 */ i = 0; current_location.update_lineno(161); /* MGCP_Emulation.ttcn, line 161 */ for ( ; ; ) { current_location.update_lineno(161); /* MGCP_Emulation.ttcn, line 161 */ if (!(i < 16)) break; current_location.update_lineno(162); /* MGCP_Emulation.ttcn, line 162 */ if ((const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[i].comp__ref() == client)) { current_location.update_lineno(163); /* MGCP_Emulation.ttcn, line 163 */ return const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[i].endpoint()(); } current_location.update_lineno(161); /* MGCP_Emulation.ttcn, line 161 */ { INTEGER tmp_7; ++i; } } current_location.update_lineno(166); /* MGCP_Emulation.ttcn, line 166 */ Misc__Helpers::f__shutdown(cs_0, 166, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("MGCP Endpoint Table not found by component "),client.log(),TTCN_Logger::end_event_log2str())); current_location.update_lineno(168); /* MGCP_Emulation.ttcn, line 168 */ return const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[0].endpoint()(); } void start_f__ep__by__comp(const COMPONENT& component_reference, const COMPONENT& client) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_by_comp("); client.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, "MGCP_Emulation", "f_ep_by_comp", text_buf); client.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__ep__table__add(const COMPONENT& comp__ref, const CHARSTRING& ep) { TTCN_Location current_location("MGCP_Emulation.ttcn", 171, TTCN_Location::LOCATION_FUNCTION, "f_ep_table_add"); current_location.update_lineno(173); /* MGCP_Emulation.ttcn, line 173 */ INTEGER i; current_location.update_lineno(174); /* MGCP_Emulation.ttcn, line 174 */ i = 0; current_location.update_lineno(174); /* MGCP_Emulation.ttcn, line 174 */ for ( ; ; ) { current_location.update_lineno(174); /* MGCP_Emulation.ttcn, line 174 */ if (!(i < 16)) break; current_location.update_lineno(175); /* MGCP_Emulation.ttcn, line 175 */ { boolean tmp_14; { boolean tmp_9 = MGCP__Emulation__CT_component_MgcpEndpointTable.is_bound(); if(tmp_9) { const int tmp_10 = i; tmp_9 = (tmp_10 >= 0) && (MGCP__Emulation__CT_component_MgcpEndpointTable.size_of() > tmp_10); if(tmp_9) { const EndpointData& tmp_11 = MGCP__Emulation__CT_component_MgcpEndpointTable[tmp_10]; tmp_9 = tmp_11.is_bound(); if(tmp_9) { const OPTIONAL< CHARSTRING >& tmp_12 = tmp_11.endpoint(); switch (tmp_12.get_selection()) { case OPTIONAL_UNBOUND: tmp_9 = FALSE; break; case OPTIONAL_OMIT: tmp_9 = FALSE; break; default: { const CHARSTRING& tmp_13 = (const CHARSTRING&) tmp_12; tmp_9 = tmp_13.is_value(); break;} } } } } tmp_14 = (!(tmp_9)); } if (tmp_14) { current_location.update_lineno(176); /* MGCP_Emulation.ttcn, line 176 */ MGCP__Emulation__CT_component_MgcpEndpointTable[i].endpoint() = ep; current_location.update_lineno(177); /* MGCP_Emulation.ttcn, line 177 */ MGCP__Emulation__CT_component_MgcpEndpointTable[i].comp__ref() = comp__ref; current_location.update_lineno(178); /* MGCP_Emulation.ttcn, line 178 */ return; } } current_location.update_lineno(174); /* MGCP_Emulation.ttcn, line 174 */ { INTEGER tmp_17; ++i; } } current_location.update_lineno(181); /* MGCP_Emulation.ttcn, line 181 */ Misc__Helpers::f__shutdown(cs_0, 181, FAIL, cs_1); } void start_f__ep__table__add(const COMPONENT& component_reference, const COMPONENT& comp__ref, const CHARSTRING& ep) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_table_add("); comp__ref.log(); TTCN_Logger::log_event_str(", "); ep.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, "MGCP_Emulation", "f_ep_table_add", text_buf); comp__ref.encode_text(text_buf); ep.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__ep__table__del(const COMPONENT& comp__ref, const CHARSTRING& ep) { TTCN_Location current_location("MGCP_Emulation.ttcn", 184, TTCN_Location::LOCATION_FUNCTION, "f_ep_table_del"); current_location.update_lineno(186); /* MGCP_Emulation.ttcn, line 186 */ INTEGER i; current_location.update_lineno(187); /* MGCP_Emulation.ttcn, line 187 */ i = 0; current_location.update_lineno(187); /* MGCP_Emulation.ttcn, line 187 */ for ( ; ; ) { current_location.update_lineno(187); /* MGCP_Emulation.ttcn, line 187 */ if (!(i < 16)) break; current_location.update_lineno(188); /* MGCP_Emulation.ttcn, line 188 */ { boolean tmp_19; tmp_19 = (const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[i].comp__ref() == comp__ref); if (tmp_19) tmp_19 = (const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[i].endpoint() == ep); if (tmp_19) { current_location.update_lineno(190); /* MGCP_Emulation.ttcn, line 190 */ MGCP__Emulation__CT_component_MgcpEndpointTable[i].endpoint() = OMIT_VALUE; current_location.update_lineno(191); /* MGCP_Emulation.ttcn, line 191 */ MGCP__Emulation__CT_component_MgcpEndpointTable[i].comp__ref() = NULL_COMPREF; current_location.update_lineno(192); /* MGCP_Emulation.ttcn, line 192 */ return; } } current_location.update_lineno(187); /* MGCP_Emulation.ttcn, line 187 */ { INTEGER tmp_22; ++i; } } current_location.update_lineno(195); /* MGCP_Emulation.ttcn, line 195 */ Misc__Helpers::f__shutdown(cs_0, 195, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("MGCP Endpoint Table: Couldn't find to-be-deleted entry!"),TTCN_Logger::end_event_log2str())); } void start_f__ep__table__del(const COMPONENT& component_reference, const COMPONENT& comp__ref, const CHARSTRING& ep) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_table_del("); comp__ref.log(); TTCN_Logger::log_event_str(", "); ep.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, "MGCP_Emulation", "f_ep_table_del", text_buf); comp__ref.encode_text(text_buf); ep.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__ep__table__change__connhdlr(const COMPONENT& comp__ref, const CHARSTRING& ep) { TTCN_Location current_location("MGCP_Emulation.ttcn", 199, TTCN_Location::LOCATION_FUNCTION, "f_ep_table_change_connhdlr"); current_location.update_lineno(201); /* MGCP_Emulation.ttcn, line 201 */ INTEGER i; current_location.update_lineno(202); /* MGCP_Emulation.ttcn, line 202 */ i = 0; current_location.update_lineno(202); /* MGCP_Emulation.ttcn, line 202 */ for ( ; ; ) { current_location.update_lineno(202); /* MGCP_Emulation.ttcn, line 202 */ if (!(i < 16)) break; current_location.update_lineno(203); /* MGCP_Emulation.ttcn, line 203 */ if ((const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpEndpointTable)[i].endpoint() == ep)) { current_location.update_lineno(204); /* MGCP_Emulation.ttcn, line 204 */ MGCP__Emulation__CT_component_MgcpEndpointTable[i].comp__ref() = comp__ref; current_location.update_lineno(205); /* MGCP_Emulation.ttcn, line 205 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("MGCP_Emulation_CT: MgcpEndpointTable["); i.log(); TTCN_Logger::log_event_str("] now sends to "); comp__ref.log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(206); /* MGCP_Emulation.ttcn, line 206 */ return; } current_location.update_lineno(202); /* MGCP_Emulation.ttcn, line 202 */ { INTEGER tmp_25; ++i; } } current_location.update_lineno(209); /* MGCP_Emulation.ttcn, line 209 */ Misc__Helpers::f__shutdown(cs_0, 209, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("MGCP Endpoint Table: Couldn't find entry to move to "),comp__ref.log(),TTCN_Logger::end_event_log2str())); } void start_f__ep__table__change__connhdlr(const COMPONENT& component_reference, const COMPONENT& comp__ref, const CHARSTRING& ep) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_table_change_connhdlr("); comp__ref.log(); TTCN_Logger::log_event_str(", "); ep.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, "MGCP_Emulation", "f_ep_table_change_connhdlr", text_buf); comp__ref.encode_text(text_buf); ep.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } BOOLEAN f__trans__id__was__pending(const CHARSTRING& trans__id) { TTCN_Location current_location("MGCP_Emulation.ttcn", 214, TTCN_Location::LOCATION_FUNCTION, "f_trans_id_was_pending"); { current_location.update_lineno(216); /* MGCP_Emulation.ttcn, line 216 */ INTEGER i(0); current_location.update_lineno(216); /* MGCP_Emulation.ttcn, line 216 */ for ( ; ; ) { current_location.update_lineno(216); /* MGCP_Emulation.ttcn, line 216 */ if (!(i < MGCP__Emulation__CT_component_MgcpPendingTrans.lengthof())) break; current_location.update_lineno(217); /* MGCP_Emulation.ttcn, line 217 */ if ((const_cast< const MgcpTransIds&>(MGCP__Emulation__CT_component_MgcpPendingTrans)[i] == trans__id)) { current_location.update_lineno(219); /* MGCP_Emulation.ttcn, line 219 */ MgcpTransIds OldPendingTrans(MGCP__Emulation__CT_component_MgcpPendingTrans); current_location.update_lineno(220); /* MGCP_Emulation.ttcn, line 220 */ MGCP__Emulation__CT_component_MgcpPendingTrans = NULL_VALUE; { current_location.update_lineno(221); /* MGCP_Emulation.ttcn, line 221 */ INTEGER j(0); current_location.update_lineno(221); /* MGCP_Emulation.ttcn, line 221 */ for ( ; ; ) { current_location.update_lineno(221); /* MGCP_Emulation.ttcn, line 221 */ if (!(j < OldPendingTrans.lengthof())) break; current_location.update_lineno(222); /* MGCP_Emulation.ttcn, line 222 */ if ((j != i)) { current_location.update_lineno(223); /* MGCP_Emulation.ttcn, line 223 */ { MgcpTransIds tmp_27; { MgcpTransIds tmp_28; tmp_28.set_size(1); tmp_28[0] = const_cast< const MgcpTransIds&>(OldPendingTrans)[j]; tmp_27 = (MGCP__Emulation__CT_component_MgcpPendingTrans + tmp_28); } MGCP__Emulation__CT_component_MgcpPendingTrans = tmp_27; } } current_location.update_lineno(221); /* MGCP_Emulation.ttcn, line 221 */ { INTEGER tmp_29; ++j; } } } current_location.update_lineno(226); /* MGCP_Emulation.ttcn, line 226 */ return TRUE; } current_location.update_lineno(216); /* MGCP_Emulation.ttcn, line 216 */ { INTEGER tmp_30; ++i; } } } current_location.update_lineno(229); /* MGCP_Emulation.ttcn, line 229 */ return FALSE; } void start_f__trans__id__was__pending(const COMPONENT& component_reference, const CHARSTRING& trans__id) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_trans_id_was_pending("); trans__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, "MGCP_Emulation", "f_trans_id_was_pending", text_buf); trans__id.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } CHARSTRING f__mgcp__ep(const MGCP__Types::MgcpMessage& msg) { TTCN_Location current_location("MGCP_Emulation.ttcn", 233, TTCN_Location::LOCATION_FUNCTION, "f_mgcp_ep"); current_location.update_lineno(234); /* MGCP_Emulation.ttcn, line 234 */ MGCP__Types::MgcpParameterList params; current_location.update_lineno(235); /* MGCP_Emulation.ttcn, line 235 */ INTEGER i; current_location.update_lineno(236); /* MGCP_Emulation.ttcn, line 236 */ if (msg.ischosen(MGCP__Types::MgcpMessage::ALT_command)) { current_location.update_lineno(237); /* MGCP_Emulation.ttcn, line 237 */ return const_cast< const MGCP__Types::MgcpMessage&>(msg).command().line().ep(); } else { current_location.update_lineno(239); /* MGCP_Emulation.ttcn, line 239 */ CHARSTRING ep; current_location.update_lineno(240); /* MGCP_Emulation.ttcn, line 240 */ { boolean tmp_33; { CHARSTRING tmp_31; BOOLEAN tmp_32 = MGCP__Templates::f__mgcp__find__param(msg, cs_2, tmp_31); if (tmp_31.is_bound()) ep = tmp_31; tmp_33 = (tmp_32 == FALSE); } if (tmp_33) { current_location.update_lineno(241); /* MGCP_Emulation.ttcn, line 241 */ Misc__Helpers::f__shutdown(cs_0, 241, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("No SpecificEndpointName in MGCP response"),msg.log(),TTCN_Logger::end_event_log2str())); } } current_location.update_lineno(244); /* MGCP_Emulation.ttcn, line 244 */ return ep; } } void f__ep__table__init() { TTCN_Location current_location("MGCP_Emulation.ttcn", 248, TTCN_Location::LOCATION_FUNCTION, "f_ep_table_init"); { current_location.update_lineno(250); /* MGCP_Emulation.ttcn, line 250 */ INTEGER i(0); current_location.update_lineno(250); /* MGCP_Emulation.ttcn, line 250 */ for ( ; ; ) { current_location.update_lineno(250); /* MGCP_Emulation.ttcn, line 250 */ if (!(i < 16)) break; current_location.update_lineno(251); /* MGCP_Emulation.ttcn, line 251 */ MGCP__Emulation__CT_component_MgcpEndpointTable[i].comp__ref() = NULL_COMPREF; current_location.update_lineno(252); /* MGCP_Emulation.ttcn, line 252 */ MGCP__Emulation__CT_component_MgcpEndpointTable[i].endpoint() = OMIT_VALUE; current_location.update_lineno(250); /* MGCP_Emulation.ttcn, line 250 */ { INTEGER tmp_36; ++i; } } } } void start_f__ep__table__init(const COMPONENT& component_reference) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_table_init("); 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, "MGCP_Emulation", "f_ep_table_init", text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__forward__to__client(const MGCP__CodecPort::MGCP__RecvFrom& mrf, const COMPONENT& vc__conn) { TTCN_Location current_location("MGCP_Emulation.ttcn", 256, TTCN_Location::LOCATION_FUNCTION, "f_forward_to_client"); current_location.update_lineno(257); /* MGCP_Emulation.ttcn, line 257 */ if (const_cast< const MGCP__conn__parameters&>(MGCP__Emulation__CT_component_g__pars).multi__conn__mode()) { current_location.update_lineno(258); /* MGCP_Emulation.ttcn, line 258 */ { boolean tmp_37; tmp_37 = MGCP__Emulation__CT_component_MGCP__CLIENT__MULTI.check_port_state(cs_3); if (tmp_37) tmp_37 = vc__conn.running(NULL); if (tmp_37) { current_location.update_lineno(259); /* MGCP_Emulation.ttcn, line 259 */ MGCP__Emulation__CT_component_MGCP__CLIENT__MULTI.send(mrf, COMPONENT(vc__conn), NULL); } else { current_location.update_lineno(261); /* MGCP_Emulation.ttcn, line 261 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("MGCP_CLIENT_MULTI: Discarding msg due to peer unavailable: "); mrf.log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } } else { current_location.update_lineno(264); /* MGCP_Emulation.ttcn, line 264 */ { boolean tmp_38; tmp_38 = MGCP__Emulation__CT_component_MGCP__CLIENT.check_port_state(cs_3); if (tmp_38) tmp_38 = vc__conn.running(NULL); if (tmp_38) { current_location.update_lineno(265); /* MGCP_Emulation.ttcn, line 265 */ MGCP__Emulation__CT_component_MGCP__CLIENT.send(const_cast< const MGCP__CodecPort::MGCP__RecvFrom&>(mrf).msg().command(), COMPONENT(vc__conn), NULL); } else { current_location.update_lineno(267); /* MGCP_Emulation.ttcn, line 267 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("MGCP_CLIENT: Discarding msg due to peer unavailable: "); mrf.log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } } } void start_f__forward__to__client(const COMPONENT& component_reference, const MGCP__CodecPort::MGCP__RecvFrom& mrf, const COMPONENT& vc__conn) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_forward_to_client("); mrf.log(); TTCN_Logger::log_event_str(", "); vc__conn.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, "MGCP_Emulation", "f_forward_to_client", text_buf); mrf.encode_text(text_buf); vc__conn.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void main_(const MGCPOps& ops, const MGCP__conn__parameters& p, const CHARSTRING& id) { MGCP__conn__parameters p_shadow(p); TTCN_Location current_location("MGCP_Emulation.ttcn", 272, TTCN_Location::LOCATION_FUNCTION, "main"); current_location.update_lineno(273); /* MGCP_Emulation.ttcn, line 273 */ Socket__API__Definitions::Result res; current_location.update_lineno(274); /* MGCP_Emulation.ttcn, line 274 */ MGCP__Emulation__CT_component_g__pars = p_shadow; current_location.update_lineno(275); /* MGCP_Emulation.ttcn, line 275 */ MGCP__Emulation__CT_component_g__mgcp__id = id; current_location.update_lineno(276); /* MGCP_Emulation.ttcn, line 276 */ f__ep__table__init(); current_location.update_lineno(277); /* MGCP_Emulation.ttcn, line 277 */ f__expect__table__init(); current_location.update_lineno(279); /* MGCP_Emulation.ttcn, line 279 */ { Map_Params tmp_41(0); TTCN_Runtime::map_port(self, MGCP__Emulation__CT_component_MGCP.get_name(), SYSTEM_COMPREF, "MGCP_CODEC_PT", tmp_41); } current_location.update_lineno(280); /* MGCP_Emulation.ttcn, line 280 */ { boolean tmp_42; tmp_42 = const_cast< const MGCP__conn__parameters&>(p_shadow).multi__conn__mode(); if (!tmp_42) tmp_42 = (const_cast< const MGCP__conn__parameters&>(p_shadow).callagent__udp__port() == -1); if (tmp_42) { current_location.update_lineno(281); /* MGCP_Emulation.ttcn, line 281 */ Socket__API__Definitions::ProtoTuple tmp_44; tmp_44.udp() = NULL_VALUE; res = MGCP__CodecPort__CtrlFunct::f__IPL4__listen(MGCP__Emulation__CT_component_MGCP, const_cast< const MGCP__conn__parameters&>(p_shadow).mgw__ip(), const_cast< const MGCP__conn__parameters&>(p_shadow).mgw__udp__port(), tmp_44, MGCP__CodecPort__CtrlFunct::f__IPL4__listen_options_defval); } else { current_location.update_lineno(283); /* MGCP_Emulation.ttcn, line 283 */ Socket__API__Definitions::ProtoTuple tmp_46; tmp_46.udp() = NULL_VALUE; res = MGCP__CodecPort__CtrlFunct::f__IPL4__connect(MGCP__Emulation__CT_component_MGCP, const_cast< const MGCP__conn__parameters&>(p_shadow).callagent__ip(), const_cast< const MGCP__conn__parameters&>(p_shadow).callagent__udp__port(), const_cast< const MGCP__conn__parameters&>(p_shadow).mgw__ip(), const_cast< const MGCP__conn__parameters&>(p_shadow).mgw__udp__port(), -1, tmp_46, MGCP__CodecPort__CtrlFunct::f__IPL4__connect_options_defval); } } current_location.update_lineno(285); /* MGCP_Emulation.ttcn, line 285 */ { boolean tmp_50; { boolean tmp_47 = res.is_bound(); if(tmp_47) { const OPTIONAL< INTEGER >& tmp_48 = res.connId(); switch (tmp_48.get_selection()) { case OPTIONAL_UNBOUND: tmp_47 = FALSE; break; case OPTIONAL_OMIT: tmp_47 = FALSE; break; default: { const INTEGER& tmp_49 = (const INTEGER&) tmp_48; tmp_47 = tmp_49.is_present(); break;} } } tmp_50 = (!(tmp_47)); } if (tmp_50) { current_location.update_lineno(286); /* MGCP_Emulation.ttcn, line 286 */ Misc__Helpers::f__shutdown(cs_0, 286, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Could not connect MGCP socket, check your configuration"),TTCN_Logger::end_event_log2str())); } } current_location.update_lineno(289); /* MGCP_Emulation.ttcn, line 289 */ MGCP__Emulation__CT_component_g__mgcp__conn__id = const_cast< const Socket__API__Definitions::Result&>(res).connId(); for ( ; ; ) { current_location.update_lineno(292); /* MGCP_Emulation.ttcn, line 292 */ COMPONENT vc__conn; current_location.update_lineno(293); /* MGCP_Emulation.ttcn, line 293 */ ExpectCriteria crit; current_location.update_lineno(294); /* MGCP_Emulation.ttcn, line 294 */ MGCP__CodecPort::MGCP__RecvFrom mrf; current_location.update_lineno(295); /* MGCP_Emulation.ttcn, line 295 */ MGCP__CodecPort::MGCP__SendTo mst; current_location.update_lineno(296); /* MGCP_Emulation.ttcn, line 296 */ MGCP__Types::MgcpMessage msg; current_location.update_lineno(297); /* MGCP_Emulation.ttcn, line 297 */ MGCP__Types::MgcpCommand cmd; current_location.update_lineno(298); /* MGCP_Emulation.ttcn, line 298 */ MGCP__Types::MgcpResponse resp; current_location.update_lineno(299); /* MGCP_Emulation.ttcn, line 299 */ CHARSTRING ep; current_location.update_lineno(301); /* MGCP_Emulation.ttcn, line 301 */ { tmp_52: alt_status tmp_52_alt_flag_0 = ALT_UNCHECKED; alt_status tmp_52_alt_flag_1 = ALT_UNCHECKED; alt_status tmp_52_alt_flag_2 = ALT_MAYBE; alt_status tmp_52_alt_flag_3 = ALT_MAYBE; alt_status tmp_52_alt_flag_4 = ALT_MAYBE; alt_status tmp_52_alt_flag_5 = ALT_MAYBE; alt_status tmp_52_default_flag = ALT_MAYBE; boolean first_run = TRUE; TTCN_Snapshot::take_new(FALSE); for ( ; ; ) { if (tmp_52_alt_flag_0 == ALT_UNCHECKED) { current_location.update_lineno(303); /* MGCP_Emulation.ttcn, line 303 */ if ((!(const_cast< const MGCP__conn__parameters&>(p_shadow).multi__conn__mode()))) tmp_52_alt_flag_0 = ALT_MAYBE; else tmp_52_alt_flag_0 = ALT_NO; } if (tmp_52_alt_flag_0 == ALT_MAYBE) { current_location.update_lineno(303); /* MGCP_Emulation.ttcn, line 303 */ tmp_52_alt_flag_0 = MGCP__Emulation__CT_component_MGCP__CLIENT.receive(MGCP__Types::MgcpResponse_template(ANY_VALUE), &(resp), any_compref, &(vc__conn), NULL, NULL); if (tmp_52_alt_flag_0 == ALT_YES) { current_location.update_lineno(304); /* MGCP_Emulation.ttcn, line 304 */ msg.response() = resp; current_location.update_lineno(308); /* MGCP_Emulation.ttcn, line 308 */ if (f__trans__id__was__pending(const_cast< const MGCP__Types::MgcpResponse&>(resp).line().trans__id())) { current_location.update_lineno(309); /* MGCP_Emulation.ttcn, line 309 */ f__ep__table__add(vc__conn, f__mgcp__ep(msg)); } current_location.update_lineno(313); /* MGCP_Emulation.ttcn, line 313 */ MGCP__Emulation__CT_component_MGCP.send(MGCP__CodecPort::t__MGCP__Send(INTEGER_template(MGCP__Emulation__CT_component_g__mgcp__conn__id), MGCP__Types::MgcpMessage_template(msg)), FALSE, NULL); break; } } if (tmp_52_alt_flag_1 == ALT_UNCHECKED) { current_location.update_lineno(317); /* MGCP_Emulation.ttcn, line 317 */ if (const_cast< const MGCP__conn__parameters&>(p_shadow).multi__conn__mode()) tmp_52_alt_flag_1 = ALT_MAYBE; else tmp_52_alt_flag_1 = ALT_NO; } if (tmp_52_alt_flag_1 == ALT_MAYBE) { current_location.update_lineno(317); /* MGCP_Emulation.ttcn, line 317 */ tmp_52_alt_flag_1 = MGCP__Emulation__CT_component_MGCP__CLIENT__MULTI.receive(MGCP__CodecPort::MGCP__SendTo_template(ANY_VALUE), &(mst), any_compref, &(vc__conn), NULL, NULL); if (tmp_52_alt_flag_1 == ALT_YES) { current_location.update_lineno(319); /* MGCP_Emulation.ttcn, line 319 */ if (f__trans__id__was__pending(const_cast< const MGCP__CodecPort::MGCP__SendTo&>(mst).msg().response().line().trans__id())) { current_location.update_lineno(320); /* MGCP_Emulation.ttcn, line 320 */ f__ep__table__add(vc__conn, f__mgcp__ep(const_cast< const MGCP__CodecPort::MGCP__SendTo&>(mst).msg())); } current_location.update_lineno(324); /* MGCP_Emulation.ttcn, line 324 */ MGCP__Emulation__CT_component_MGCP.send(mst, FALSE, NULL); break; } } if (tmp_52_alt_flag_2 == ALT_MAYBE) { current_location.update_lineno(326); /* MGCP_Emulation.ttcn, line 326 */ tmp_52_alt_flag_2 = MGCP__Emulation__CT_component_MGCP.receive(tr__MGCP__RecvFrom__R(MGCP__Types::MgcpMessage_template(ANY_VALUE)), &(mrf), any_compref, NULL, NULL, NULL); if (tmp_52_alt_flag_2 == ALT_YES) { current_location.update_lineno(327); /* MGCP_Emulation.ttcn, line 327 */ { boolean tmp_54; tmp_54 = (!(const_cast< const MGCP__conn__parameters&>(p_shadow).multi__conn__mode())); if (tmp_54) tmp_54 = (const_cast< const MGCP__conn__parameters&>(p_shadow).callagent__udp__port() == -1); if (tmp_54) { current_location.update_lineno(332); /* MGCP_Emulation.ttcn, line 332 */ p_shadow.callagent__udp__port() = const_cast< const MGCP__CodecPort::MGCP__RecvFrom&>(mrf).remPort(); current_location.update_lineno(333); /* MGCP_Emulation.ttcn, line 333 */ Socket__API__Definitions::ProtoTuple tmp_57; tmp_57.udp() = NULL_VALUE; res = MGCP__CodecPort__CtrlFunct::f__IPL4__connect(MGCP__Emulation__CT_component_MGCP, const_cast< const MGCP__conn__parameters&>(p_shadow).callagent__ip(), const_cast< const MGCP__conn__parameters&>(p_shadow).callagent__udp__port(), const_cast< const MGCP__conn__parameters&>(p_shadow).mgw__ip(), const_cast< const MGCP__conn__parameters&>(p_shadow).mgw__udp__port(), MGCP__Emulation__CT_component_g__mgcp__conn__id, tmp_57, MGCP__CodecPort__CtrlFunct::f__IPL4__connect_options_defval); current_location.update_lineno(334); /* MGCP_Emulation.ttcn, line 334 */ { boolean tmp_61; { boolean tmp_58 = res.is_bound(); if(tmp_58) { const OPTIONAL< INTEGER >& tmp_59 = res.connId(); switch (tmp_59.get_selection()) { case OPTIONAL_UNBOUND: tmp_58 = FALSE; break; case OPTIONAL_OMIT: tmp_58 = FALSE; break; default: { const INTEGER& tmp_60 = (const INTEGER&) tmp_59; tmp_58 = tmp_60.is_present(); break;} } } tmp_61 = (!(tmp_58)); } if (tmp_61) { current_location.update_lineno(335); /* MGCP_Emulation.ttcn, line 335 */ Misc__Helpers::f__shutdown(cs_0, 335, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Could not connect MGCP socket, check your configuration"),TTCN_Logger::end_event_log2str())); } } } } current_location.update_lineno(339); /* MGCP_Emulation.ttcn, line 339 */ { boolean tmp_65; { boolean tmp_62 = mrf.is_bound(); if(tmp_62) { const MGCP__CodecPort::MGCP__RecvFrom& tmp_63 = mrf; const MGCP__Types::MgcpMessage& tmp_64 = tmp_63.msg(); tmp_62 = tmp_64.is_bound(); if (tmp_62) { tmp_62 = tmp_64.ischosen(MGCP__Types::MgcpMessage::ALT_command); } } tmp_65 = tmp_62; } if (tmp_65) { current_location.update_lineno(340); /* MGCP_Emulation.ttcn, line 340 */ cmd = const_cast< const MGCP__CodecPort::MGCP__RecvFrom&>(mrf).msg().command(); current_location.update_lineno(341); /* MGCP_Emulation.ttcn, line 341 */ if (f__ep__known(const_cast< const MGCP__Types::MgcpCommand&>(cmd).line().ep())) { current_location.update_lineno(342); /* MGCP_Emulation.ttcn, line 342 */ vc__conn = f__comp__by__ep(const_cast< const MGCP__Types::MgcpCommand&>(cmd).line().ep()); current_location.update_lineno(343); /* MGCP_Emulation.ttcn, line 343 */ f__forward__to__client(mrf, vc__conn); } else { current_location.update_lineno(345); /* MGCP_Emulation.ttcn, line 345 */ if ((const_cast< const MGCP__Types::MgcpCommand&>(cmd).line().verb() == cs_4)) { current_location.update_lineno(346); /* MGCP_Emulation.ttcn, line 346 */ vc__conn = const_cast< const MGCPOps&>(ops).create__cb().invoke(cmd, id); current_location.update_lineno(347); /* MGCP_Emulation.ttcn, line 347 */ if ((!(MGCP__Templates::t__MGCP__EP__wildcard.match(const_cast< const MGCP__Types::MgcpCommand&>(cmd).line().ep())))) { current_location.update_lineno(349); /* MGCP_Emulation.ttcn, line 349 */ f__ep__table__add(vc__conn, const_cast< const MGCP__Types::MgcpCommand&>(cmd).line().ep()); } else { current_location.update_lineno(352); /* MGCP_Emulation.ttcn, line 352 */ { MgcpTransIds tmp_69; { MgcpTransIds tmp_70; tmp_70.set_size(1); tmp_70[0] = const_cast< const MGCP__Types::MgcpCommand&>(cmd).line().trans__id(); tmp_69 = (MGCP__Emulation__CT_component_MgcpPendingTrans + tmp_70); } MGCP__Emulation__CT_component_MgcpPendingTrans = tmp_69; } } current_location.update_lineno(354); /* MGCP_Emulation.ttcn, line 354 */ f__forward__to__client(mrf, vc__conn); } else { current_location.update_lineno(357); /* MGCP_Emulation.ttcn, line 357 */ MGCP__Types::MgcpMessage_template r(const_cast< const MGCPOps&>(ops).unitdata__cb().invoke(const_cast< const MGCP__CodecPort::MGCP__RecvFrom&>(mrf).msg())); current_location.update_lineno(358); /* MGCP_Emulation.ttcn, line 358 */ if (r.is_value()) { current_location.update_lineno(359); /* MGCP_Emulation.ttcn, line 359 */ MGCP__Emulation__CT_component_MGCP.send(MGCP__CodecPort::t__MGCP__SendToMrf(mrf, r), FALSE, NULL); } } } } else { current_location.update_lineno(364); /* MGCP_Emulation.ttcn, line 364 */ Misc__Helpers::f__shutdown(cs_0, 364, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Received unexpected MGCP response: "),const_cast< const MGCP__CodecPort::MGCP__RecvFrom&>(mrf).msg().response().log(),TTCN_Logger::end_event_log2str())); } } break; } } if (tmp_52_alt_flag_3 == ALT_MAYBE) { current_location.update_lineno(368); /* MGCP_Emulation.ttcn, line 368 */ { MGCPEM__register_template tmp_71; tmp_71.cmd() = ANY_VALUE; tmp_71.hdlr() = ANY_VALUE; tmp_52_alt_flag_3 = MGCP__Emulation__CT_component_MGCP__PROC.getcall(tmp_71, any_compref, MGCPEM__register_call_redirect(&(crit), &(vc__conn)), NULL, NULL, NULL); } if (tmp_52_alt_flag_3 == ALT_YES) { current_location.update_lineno(369); /* MGCP_Emulation.ttcn, line 369 */ f__create__expect(crit, vc__conn); current_location.update_lineno(370); /* MGCP_Emulation.ttcn, line 370 */ { MGCPEM__register_template tmp_72; tmp_72.cmd() = crit; tmp_72.hdlr() = vc__conn; MGCP__Emulation__CT_component_MGCP__PROC.reply(tmp_72, COMPONENT(vc__conn), NULL); } break; } } if (tmp_52_alt_flag_4 == ALT_MAYBE) { current_location.update_lineno(372); /* MGCP_Emulation.ttcn, line 372 */ { MGCPEM__delete__ep_template tmp_73; tmp_73.ep() = ANY_VALUE; tmp_73.hdlr() = ANY_VALUE; tmp_52_alt_flag_4 = MGCP__Emulation__CT_component_MGCP__PROC.getcall(tmp_73, any_compref, MGCPEM__delete__ep_call_redirect(&(ep), &(vc__conn)), NULL, NULL, NULL); } if (tmp_52_alt_flag_4 == ALT_YES) { current_location.update_lineno(373); /* MGCP_Emulation.ttcn, line 373 */ f__ep__table__del(vc__conn, ep); current_location.update_lineno(374); /* MGCP_Emulation.ttcn, line 374 */ { MGCPEM__delete__ep_template tmp_74; tmp_74.ep() = ep; tmp_74.hdlr() = vc__conn; MGCP__Emulation__CT_component_MGCP__PROC.reply(tmp_74, COMPONENT(vc__conn), NULL); } break; } } if (tmp_52_alt_flag_5 == ALT_MAYBE) { current_location.update_lineno(376); /* MGCP_Emulation.ttcn, line 376 */ { MGCPEM__change__connhdlr_template tmp_75; tmp_75.ep() = ANY_VALUE; tmp_75.hdlr() = ANY_VALUE; tmp_52_alt_flag_5 = MGCP__Emulation__CT_component_MGCP__PROC.getcall(tmp_75, any_compref, MGCPEM__change__connhdlr_call_redirect(&(ep), &(vc__conn)), NULL, NULL, NULL); } if (tmp_52_alt_flag_5 == ALT_YES) { current_location.update_lineno(377); /* MGCP_Emulation.ttcn, line 377 */ f__ep__table__change__connhdlr(vc__conn, ep); current_location.update_lineno(378); /* MGCP_Emulation.ttcn, line 378 */ { MGCPEM__change__connhdlr_template tmp_76; tmp_76.ep() = ep; tmp_76.hdlr() = vc__conn; MGCP__Emulation__CT_component_MGCP__PROC.reply(tmp_76, COMPONENT(vc__conn), NULL); } break; } } if (tmp_52_default_flag == ALT_MAYBE) { tmp_52_default_flag = TTCN_Default::try_altsteps(first_run); if (tmp_52_default_flag == ALT_YES || tmp_52_default_flag == ALT_BREAK) break; else if (tmp_52_default_flag == ALT_REPEAT) goto tmp_52; } current_location.update_lineno(301); /* MGCP_Emulation.ttcn, line 301 */ if (tmp_52_alt_flag_0 == ALT_NO && tmp_52_alt_flag_1 == ALT_NO && tmp_52_alt_flag_2 == ALT_NO && tmp_52_alt_flag_3 == ALT_NO && tmp_52_alt_flag_4 == ALT_NO && tmp_52_alt_flag_5 == ALT_NO && tmp_52_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file MGCP_Emulation.ttcn between lines 301 and 380."); TTCN_Snapshot::take_new(TRUE); first_run = FALSE; } } } } void start_main_(const COMPONENT& component_reference, const MGCPOps& ops, const MGCP__conn__parameters& p, const CHARSTRING& id) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function main("); ops.log(); TTCN_Logger::log_event_str(", "); 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, "MGCP_Emulation", "main", text_buf); ops.encode_text(text_buf); p.encode_text(text_buf); id.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } MGCP__Types::MgcpCommand_template f__get__mgcp__by__crit(const ExpectCriteria& crit) { TTCN_Location current_location("MGCP_Emulation.ttcn", 407, TTCN_Location::LOCATION_FUNCTION, "f_get_mgcp_by_crit"); current_location.update_lineno(409); /* MGCP_Emulation.ttcn, line 409 */ MGCP__Types::MgcpCommand_template ret; { MGCP__Types::MgcpCommandLine_template& tmp_77 = ret.line(); tmp_77.verb() = ANY_VALUE; tmp_77.trans__id() = ANY_VALUE; tmp_77.ep() = ANY_VALUE; tmp_77.ver() = ANY_VALUE; } ret.params() = ANY_OR_OMIT; ret.sdp() = ANY_OR_OMIT; current_location.update_lineno(419); /* MGCP_Emulation.ttcn, line 419 */ { boolean tmp_81; { boolean tmp_78 = crit.is_bound(); if(tmp_78) { const OPTIONAL< HEXSTRING >& tmp_79 = crit.connid(); switch (tmp_79.get_selection()) { case OPTIONAL_UNBOUND: tmp_78 = FALSE; break; case OPTIONAL_OMIT: tmp_78 = FALSE; break; default: { const HEXSTRING& tmp_80 = (const HEXSTRING&) tmp_79; tmp_78 = tmp_80.is_present(); break;} } } tmp_81 = tmp_78; } if (tmp_81) { current_location.update_lineno(420); /* MGCP_Emulation.ttcn, line 420 */ { MGCP__Types::MgcpParameterList_template& tmp_83 = ret.params(); tmp_83.set_size(3); tmp_83[0] = ANY_OR_OMIT; tmp_83[1] = MGCP__Templates::ts__MgcpParConnectionId(const_cast< const ExpectCriteria&>(crit).connid()); tmp_83[2] = ANY_OR_OMIT; } } } current_location.update_lineno(422); /* MGCP_Emulation.ttcn, line 422 */ { boolean tmp_87; { boolean tmp_84 = crit.is_bound(); if(tmp_84) { const OPTIONAL< CHARSTRING >& tmp_85 = crit.endpoint(); switch (tmp_85.get_selection()) { case OPTIONAL_UNBOUND: tmp_84 = FALSE; break; case OPTIONAL_OMIT: tmp_84 = FALSE; break; default: { const CHARSTRING& tmp_86 = (const CHARSTRING&) tmp_85; tmp_84 = tmp_86.is_present(); break;} } } tmp_87 = tmp_84; } if (tmp_87) { current_location.update_lineno(423); /* MGCP_Emulation.ttcn, line 423 */ ret.line().ep() = const_cast< const ExpectCriteria&>(crit).endpoint(); } } current_location.update_lineno(425); /* MGCP_Emulation.ttcn, line 425 */ { boolean tmp_92; { boolean tmp_89 = crit.is_bound(); if(tmp_89) { const OPTIONAL< CHARSTRING >& tmp_90 = crit.transid(); switch (tmp_90.get_selection()) { case OPTIONAL_UNBOUND: tmp_89 = FALSE; break; case OPTIONAL_OMIT: tmp_89 = FALSE; break; default: { const CHARSTRING& tmp_91 = (const CHARSTRING&) tmp_90; tmp_89 = tmp_91.is_present(); break;} } } tmp_92 = tmp_89; } if (tmp_92) { current_location.update_lineno(426); /* MGCP_Emulation.ttcn, line 426 */ ret.line().trans__id() = const_cast< const ExpectCriteria&>(crit).transid(); } } current_location.update_lineno(429); /* MGCP_Emulation.ttcn, line 429 */ return ret; } COMPONENT ExpectedCreateCallback(const MGCP__Types::MgcpCommand& cmd, const CHARSTRING& ) { TTCN_Location current_location("MGCP_Emulation.ttcn", 433, TTCN_Location::LOCATION_FUNCTION, "ExpectedCreateCallback"); current_location.update_lineno(435); /* MGCP_Emulation.ttcn, line 435 */ COMPONENT ret(NULL_COMPREF); current_location.update_lineno(436); /* MGCP_Emulation.ttcn, line 436 */ MGCP__Types::MgcpCommand_template mgcpcmd; current_location.update_lineno(437); /* MGCP_Emulation.ttcn, line 437 */ INTEGER i; current_location.update_lineno(439); /* MGCP_Emulation.ttcn, line 439 */ i = 0; current_location.update_lineno(439); /* MGCP_Emulation.ttcn, line 439 */ for ( ; ; ) { current_location.update_lineno(439); /* MGCP_Emulation.ttcn, line 439 */ if (!(i < 8)) break; { current_location.update_lineno(440); /* MGCP_Emulation.ttcn, line 440 */ { boolean tmp_101; { boolean tmp_96 = MGCP__Emulation__CT_component_MgcpExpectTable.is_bound(); if(tmp_96) { const int tmp_97 = i; tmp_96 = (tmp_97 >= 0) && (MGCP__Emulation__CT_component_MgcpExpectTable.size_of() > tmp_97); if(tmp_96) { const ExpectData& tmp_98 = MGCP__Emulation__CT_component_MgcpExpectTable[tmp_97]; tmp_96 = tmp_98.is_bound(); if(tmp_96) { const OPTIONAL< ExpectCriteria >& tmp_99 = tmp_98.crit(); switch (tmp_99.get_selection()) { case OPTIONAL_UNBOUND: tmp_96 = FALSE; break; case OPTIONAL_OMIT: tmp_96 = FALSE; break; default: { const ExpectCriteria& tmp_100 = (const ExpectCriteria&) tmp_99; tmp_96 = tmp_100.is_present(); break;} } } } } tmp_101 = (!(tmp_96)); } if (tmp_101) { current_location.update_lineno(441); /* MGCP_Emulation.ttcn, line 441 */ goto tmp_95; } } current_location.update_lineno(444); /* MGCP_Emulation.ttcn, line 444 */ mgcpcmd = f__get__mgcp__by__crit(const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpExpectTable)[i].crit()); current_location.update_lineno(445); /* MGCP_Emulation.ttcn, line 445 */ if (mgcpcmd.match(cmd)) { current_location.update_lineno(446); /* MGCP_Emulation.ttcn, line 446 */ ret = const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpExpectTable)[i].vc__conn(); current_location.update_lineno(448); /* MGCP_Emulation.ttcn, line 448 */ MGCP__Emulation__CT_component_MgcpExpectTable[i].crit() = OMIT_VALUE; current_location.update_lineno(449); /* MGCP_Emulation.ttcn, line 449 */ MGCP__Emulation__CT_component_MgcpExpectTable[i].vc__conn() = NULL_COMPREF; current_location.update_lineno(450); /* MGCP_Emulation.ttcn, line 450 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Found Expect["); i.log(); TTCN_Logger::log_event_str("] for "); cmd.log(); TTCN_Logger::log_event_str(" handled at "); ret.log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(451); /* MGCP_Emulation.ttcn, line 451 */ return ret; } } tmp_95: current_location.update_lineno(439); /* MGCP_Emulation.ttcn, line 439 */ { INTEGER tmp_106; ++i; } } current_location.update_lineno(454); /* MGCP_Emulation.ttcn, line 454 */ Misc__Helpers::f__shutdown(cs_0, 454, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Couldn't find Expect for CRCX"),cmd.log(),TTCN_Logger::end_event_log2str())); current_location.update_lineno(456); /* MGCP_Emulation.ttcn, line 456 */ return const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpExpectTable)[0].vc__conn(); } void start_ExpectedCreateCallback(const COMPONENT& component_reference, const MGCP__Types::MgcpCommand& cmd, const CHARSTRING& id) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function ExpectedCreateCallback("); cmd.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, "MGCP_Emulation", "ExpectedCreateCallback", text_buf); cmd.encode_text(text_buf); id.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__create__expect(const ExpectCriteria& crit, const COMPONENT& hdlr) { TTCN_Location current_location("MGCP_Emulation.ttcn", 459, TTCN_Location::LOCATION_FUNCTION, "f_create_expect"); current_location.update_lineno(461); /* MGCP_Emulation.ttcn, line 461 */ INTEGER i; current_location.update_lineno(464); /* MGCP_Emulation.ttcn, line 464 */ i = 0; current_location.update_lineno(464); /* MGCP_Emulation.ttcn, line 464 */ for ( ; ; ) { current_location.update_lineno(464); /* MGCP_Emulation.ttcn, line 464 */ if (!(i < 8)) break; current_location.update_lineno(465); /* MGCP_Emulation.ttcn, line 465 */ if ((crit == const_cast< const VALUE_ARRAY&>(MGCP__Emulation__CT_component_MgcpExpectTable)[i].crit())) { current_location.update_lineno(466); /* MGCP_Emulation.ttcn, line 466 */ Misc__Helpers::f__shutdown(cs_0, 466, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Crit already present"),crit.log(),TTCN_Logger::end_event_log2str())); } current_location.update_lineno(464); /* MGCP_Emulation.ttcn, line 464 */ { INTEGER tmp_108; ++i; } } current_location.update_lineno(470); /* MGCP_Emulation.ttcn, line 470 */ i = 0; current_location.update_lineno(470); /* MGCP_Emulation.ttcn, line 470 */ for ( ; ; ) { current_location.update_lineno(470); /* MGCP_Emulation.ttcn, line 470 */ if (!(i < 8)) break; current_location.update_lineno(471); /* MGCP_Emulation.ttcn, line 471 */ { boolean tmp_115; { boolean tmp_110 = MGCP__Emulation__CT_component_MgcpExpectTable.is_bound(); if(tmp_110) { const int tmp_111 = i; tmp_110 = (tmp_111 >= 0) && (MGCP__Emulation__CT_component_MgcpExpectTable.size_of() > tmp_111); if(tmp_110) { const ExpectData& tmp_112 = MGCP__Emulation__CT_component_MgcpExpectTable[tmp_111]; tmp_110 = tmp_112.is_bound(); if(tmp_110) { const OPTIONAL< ExpectCriteria >& tmp_113 = tmp_112.crit(); switch (tmp_113.get_selection()) { case OPTIONAL_UNBOUND: tmp_110 = FALSE; break; case OPTIONAL_OMIT: tmp_110 = FALSE; break; default: { const ExpectCriteria& tmp_114 = (const ExpectCriteria&) tmp_113; tmp_110 = tmp_114.is_present(); break;} } } } } tmp_115 = (!(tmp_110)); } if (tmp_115) { current_location.update_lineno(472); /* MGCP_Emulation.ttcn, line 472 */ MGCP__Emulation__CT_component_MgcpExpectTable[i].crit() = crit; current_location.update_lineno(473); /* MGCP_Emulation.ttcn, line 473 */ MGCP__Emulation__CT_component_MgcpExpectTable[i].vc__conn() = hdlr; current_location.update_lineno(474); /* MGCP_Emulation.ttcn, line 474 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Created Expect["); i.log(); TTCN_Logger::log_event_str("] for "); crit.log(); TTCN_Logger::log_event_str(" to be handled at "); hdlr.log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(475); /* MGCP_Emulation.ttcn, line 475 */ return; } } current_location.update_lineno(470); /* MGCP_Emulation.ttcn, line 470 */ { INTEGER tmp_118; ++i; } } current_location.update_lineno(478); /* MGCP_Emulation.ttcn, line 478 */ Misc__Helpers::f__shutdown(cs_0, 478, FAIL, cs_5); } void start_f__create__expect(const COMPONENT& component_reference, const ExpectCriteria& crit, const COMPONENT& hdlr) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_create_expect("); crit.log(); TTCN_Logger::log_event_str(", "); hdlr.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, "MGCP_Emulation", "f_create_expect", text_buf); crit.encode_text(text_buf); hdlr.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__create__mgcp__expect(const ExpectCriteria& dest__number) { TTCN_Location current_location("MGCP_Emulation.ttcn", 482, TTCN_Location::LOCATION_FUNCTION, "f_create_mgcp_expect"); current_location.update_lineno(483); /* MGCP_Emulation.ttcn, line 483 */ { MGCPEM__register_template tmp_119; tmp_119.cmd() = dest__number; tmp_119.hdlr() = self; MGCP__ConnHdlr_component_MGCP__PROC.call(tmp_119, FALSE, NULL); } { alt_status tmp_120_alt_flag_0 = ALT_MAYBE; current_location.update_lineno(483); /* MGCP_Emulation.ttcn, line 483 */ TTCN_Snapshot::take_new(FALSE); for ( ; ; ) { if (tmp_120_alt_flag_0 == ALT_MAYBE) { current_location.update_lineno(484); /* MGCP_Emulation.ttcn, line 484 */ { MGCPEM__register_template tmp_121; tmp_121.cmd() = ANY_VALUE; tmp_121.hdlr() = ANY_VALUE; tmp_120_alt_flag_0 = MGCP__ConnHdlr_component_MGCP__PROC.getreply(tmp_121, any_compref, MGCPEM__register_reply_redirect(), NULL, NULL, NULL); } if (tmp_120_alt_flag_0 == ALT_YES) break; } current_location.update_lineno(483); /* MGCP_Emulation.ttcn, line 483 */ if (tmp_120_alt_flag_0 == ALT_NO) TTCN_error("None of the branches can be chosen in the response and exception handling part of call statement in file MGCP_Emulation.ttcn between lines 483 and 485."); TTCN_Snapshot::take_new(TRUE); } } } void start_f__create__mgcp__expect(const COMPONENT& component_reference, const ExpectCriteria& dest__number) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_create_mgcp_expect("); dest__number.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, "MGCP_Emulation", "f_create_mgcp_expect", text_buf); dest__number.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__create__mgcp__delete__ep(const CHARSTRING& ep) { TTCN_Location current_location("MGCP_Emulation.ttcn", 489, TTCN_Location::LOCATION_FUNCTION, "f_create_mgcp_delete_ep"); current_location.update_lineno(490); /* MGCP_Emulation.ttcn, line 490 */ { MGCPEM__delete__ep_template tmp_122; tmp_122.ep() = ep; tmp_122.hdlr() = self; MGCP__ConnHdlr_component_MGCP__PROC.call(tmp_122, FALSE, NULL); } { alt_status tmp_123_alt_flag_0 = ALT_MAYBE; current_location.update_lineno(490); /* MGCP_Emulation.ttcn, line 490 */ TTCN_Snapshot::take_new(FALSE); for ( ; ; ) { if (tmp_123_alt_flag_0 == ALT_MAYBE) { current_location.update_lineno(491); /* MGCP_Emulation.ttcn, line 491 */ { MGCPEM__delete__ep_template tmp_124; tmp_124.ep() = ANY_VALUE; tmp_124.hdlr() = ANY_VALUE; tmp_123_alt_flag_0 = MGCP__ConnHdlr_component_MGCP__PROC.getreply(tmp_124, any_compref, MGCPEM__delete__ep_reply_redirect(), NULL, NULL, NULL); } if (tmp_123_alt_flag_0 == ALT_YES) break; } current_location.update_lineno(490); /* MGCP_Emulation.ttcn, line 490 */ if (tmp_123_alt_flag_0 == ALT_NO) TTCN_error("None of the branches can be chosen in the response and exception handling part of call statement in file MGCP_Emulation.ttcn between lines 490 and 492."); TTCN_Snapshot::take_new(TRUE); } } } void start_f__create__mgcp__delete__ep(const COMPONENT& component_reference, const CHARSTRING& ep) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_create_mgcp_delete_ep("); ep.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, "MGCP_Emulation", "f_create_mgcp_delete_ep", text_buf); ep.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__mgcp__change__connhdlr(const CHARSTRING& ep) { TTCN_Location current_location("MGCP_Emulation.ttcn", 496, TTCN_Location::LOCATION_FUNCTION, "f_mgcp_change_connhdlr"); current_location.update_lineno(497); /* MGCP_Emulation.ttcn, line 497 */ { MGCPEM__change__connhdlr_template tmp_125; tmp_125.ep() = ep; tmp_125.hdlr() = self; MGCP__ConnHdlr_component_MGCP__PROC.call(tmp_125, FALSE, NULL); } { alt_status tmp_126_alt_flag_0 = ALT_MAYBE; current_location.update_lineno(497); /* MGCP_Emulation.ttcn, line 497 */ TTCN_Snapshot::take_new(FALSE); for ( ; ; ) { if (tmp_126_alt_flag_0 == ALT_MAYBE) { current_location.update_lineno(498); /* MGCP_Emulation.ttcn, line 498 */ { MGCPEM__change__connhdlr_template tmp_127; tmp_127.ep() = ANY_VALUE; tmp_127.hdlr() = ANY_VALUE; tmp_126_alt_flag_0 = MGCP__ConnHdlr_component_MGCP__PROC.getreply(tmp_127, any_compref, MGCPEM__change__connhdlr_reply_redirect(), NULL, NULL, NULL); } if (tmp_126_alt_flag_0 == ALT_YES) break; } current_location.update_lineno(497); /* MGCP_Emulation.ttcn, line 497 */ if (tmp_126_alt_flag_0 == ALT_NO) TTCN_error("None of the branches can be chosen in the response and exception handling part of call statement in file MGCP_Emulation.ttcn between lines 497 and 499."); TTCN_Snapshot::take_new(TRUE); } } } void start_f__mgcp__change__connhdlr(const COMPONENT& component_reference, const CHARSTRING& ep) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_mgcp_change_connhdlr("); ep.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, "MGCP_Emulation", "f_mgcp_change_connhdlr", text_buf); ep.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__expect__table__init() { TTCN_Location current_location("MGCP_Emulation.ttcn", 503, TTCN_Location::LOCATION_FUNCTION, "f_expect_table_init"); current_location.update_lineno(505); /* MGCP_Emulation.ttcn, line 505 */ INTEGER i; current_location.update_lineno(506); /* MGCP_Emulation.ttcn, line 506 */ i = 0; current_location.update_lineno(506); /* MGCP_Emulation.ttcn, line 506 */ for ( ; ; ) { current_location.update_lineno(506); /* MGCP_Emulation.ttcn, line 506 */ if (!(i < 8)) break; current_location.update_lineno(507); /* MGCP_Emulation.ttcn, line 507 */ MGCP__Emulation__CT_component_MgcpExpectTable[i].crit() = OMIT_VALUE; current_location.update_lineno(506); /* MGCP_Emulation.ttcn, line 506 */ { INTEGER tmp_130; ++i; } } } void start_f__expect__table__init(const COMPONENT& component_reference) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_expect_table_init("); 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, "MGCP_Emulation", "f_expect_table_init", text_buf); TTCN_Runtime::send_start_component(text_buf); } MGCP__Types::MgcpMessage_template DummyUnitdataCallback(const MGCP__Types::MgcpMessage& msg) { TTCN_Location current_location("MGCP_Emulation.ttcn", 511, TTCN_Location::LOCATION_FUNCTION, "DummyUnitdataCallback"); current_location.update_lineno(513); /* MGCP_Emulation.ttcn, line 513 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Ignoring MGCP "); msg.log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(514); /* MGCP_Emulation.ttcn, line 514 */ return MGCP__Types::MgcpMessage_template(OMIT_VALUE); } void start_DummyUnitdataCallback(const COMPONENT& component_reference, const MGCP__Types::MgcpMessage& msg) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function DummyUnitdataCallback("); msg.log(); TTCN_Logger::log_event_str(") on component "); component_reference.log(); TTCN_Logger::log_char('.'); TTCN_Logger::end_event(); Text_Buf text_buf; TTCN_Runtime::prepare_start_component(component_reference, "MGCP_Emulation", "DummyUnitdataCallback", text_buf); msg.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } CHARSTRING f__encoding__name__from__pt(const MGCP__Types::SDP__FIELD__PayloadType& pt) { TTCN_Location current_location("MGCP_Emulation.ttcn", 518, TTCN_Location::LOCATION_FUNCTION, "f_encoding_name_from_pt"); current_location.update_lineno(519); /* MGCP_Emulation.ttcn, line 519 */ if ((pt == MGCP__Types::SDP__FIELD__PayloadType::PT__PCMU)) { current_location.update_lineno(520); /* MGCP_Emulation.ttcn, line 520 */ return cs_6; } else { current_location.update_lineno(521); /* MGCP_Emulation.ttcn, line 521 */ if ((pt == MGCP__Types::SDP__FIELD__PayloadType::PT__GSM)) { current_location.update_lineno(522); /* MGCP_Emulation.ttcn, line 522 */ return cs_7; } else { current_location.update_lineno(523); /* MGCP_Emulation.ttcn, line 523 */ if ((pt == MGCP__Types::SDP__FIELD__PayloadType::PT__PCMA)) { current_location.update_lineno(524); /* MGCP_Emulation.ttcn, line 524 */ return cs_8; } else { current_location.update_lineno(525); /* MGCP_Emulation.ttcn, line 525 */ if ((pt == MGCP__Types::SDP__FIELD__PayloadType::PT__GSMEFR)) { current_location.update_lineno(526); /* MGCP_Emulation.ttcn, line 526 */ return cs_9; } else { current_location.update_lineno(527); /* MGCP_Emulation.ttcn, line 527 */ if ((pt == MGCP__Types::SDP__FIELD__PayloadType::PT__GSMHR)) { current_location.update_lineno(528); /* MGCP_Emulation.ttcn, line 528 */ return cs_10; } else { current_location.update_lineno(529); /* MGCP_Emulation.ttcn, line 529 */ if ((pt == MGCP__Types::SDP__FIELD__PayloadType::PT__AMR)) { current_location.update_lineno(530); /* MGCP_Emulation.ttcn, line 530 */ return cs_11; } else { current_location.update_lineno(531); /* MGCP_Emulation.ttcn, line 531 */ if ((pt == MGCP__Types::SDP__FIELD__PayloadType::PT__AMRWB)) { current_location.update_lineno(532); /* MGCP_Emulation.ttcn, line 532 */ return cs_12; } } } } } } } current_location.update_lineno(535); /* MGCP_Emulation.ttcn, line 535 */ Misc__Helpers::f__shutdown(cs_0, 535, FAIL, (TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unknown payload type "),pt.log(),TTCN_Logger::end_event_log2str())); current_location.update_lineno(537); /* MGCP_Emulation.ttcn, line 537 */ return cs_13; } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("MGCP_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "MGCP_Emulation"); MGCP__CodecPort__CtrlFunct::module_object.pre_init_module(); MGCP__Templates::module_object.pre_init_module(); Osmocom__Types::module_object.pre_init_module(); Misc__Helpers::module_object.pre_init_module(); module_object.add_function("tr_MGCP_RecvFrom_R", (genericfunc_t)&tr__MGCP__RecvFrom__R, (genericfunc_t)&start_tr__MGCP__RecvFrom__R); module_object.add_function("f_ep_known", (genericfunc_t)&f__ep__known, (genericfunc_t)&start_f__ep__known); module_object.add_function("f_comp_known", (genericfunc_t)&f__comp__known, (genericfunc_t)&start_f__comp__known); module_object.add_function("f_comp_by_ep", (genericfunc_t)&f__comp__by__ep, (genericfunc_t)&start_f__comp__by__ep); module_object.add_function("f_ep_by_comp", (genericfunc_t)&f__ep__by__comp, (genericfunc_t)&start_f__ep__by__comp); module_object.add_function("f_ep_table_add", (genericfunc_t)&f__ep__table__add, (genericfunc_t)&start_f__ep__table__add); module_object.add_function("f_ep_table_del", (genericfunc_t)&f__ep__table__del, (genericfunc_t)&start_f__ep__table__del); module_object.add_function("f_ep_table_change_connhdlr", (genericfunc_t)&f__ep__table__change__connhdlr, (genericfunc_t)&start_f__ep__table__change__connhdlr); module_object.add_function("f_trans_id_was_pending", (genericfunc_t)&f__trans__id__was__pending, (genericfunc_t)&start_f__trans__id__was__pending); module_object.add_function("f_mgcp_ep", (genericfunc_t)&f__mgcp__ep, NULL); module_object.add_function("f_ep_table_init", (genericfunc_t)&f__ep__table__init, (genericfunc_t)&start_f__ep__table__init); module_object.add_function("f_forward_to_client", (genericfunc_t)&f__forward__to__client, (genericfunc_t)&start_f__forward__to__client); module_object.add_function("main", (genericfunc_t)&main_, (genericfunc_t)&start_main_); module_object.add_function("f_get_mgcp_by_crit", (genericfunc_t)&f__get__mgcp__by__crit, NULL); module_object.add_function("ExpectedCreateCallback", (genericfunc_t)&ExpectedCreateCallback, (genericfunc_t)&start_ExpectedCreateCallback); module_object.add_function("f_create_expect", (genericfunc_t)&f__create__expect, (genericfunc_t)&start_f__create__expect); module_object.add_function("f_create_mgcp_expect", (genericfunc_t)&f__create__mgcp__expect, (genericfunc_t)&start_f__create__mgcp__expect); module_object.add_function("f_create_mgcp_delete_ep", (genericfunc_t)&f__create__mgcp__delete__ep, (genericfunc_t)&start_f__create__mgcp__delete__ep); module_object.add_function("f_mgcp_change_connhdlr", (genericfunc_t)&f__mgcp__change__connhdlr, (genericfunc_t)&start_f__mgcp__change__connhdlr); module_object.add_function("f_expect_table_init", (genericfunc_t)&f__expect__table__init, (genericfunc_t)&start_f__expect__table__init); module_object.add_function("DummyUnitdataCallback", (genericfunc_t)&DummyUnitdataCallback, (genericfunc_t)&start_DummyUnitdataCallback); module_object.add_function("f_encoding_name_from_pt", (genericfunc_t)&f__encoding__name__from__pt, NULL); } void post_init_module() { TTCN_Location current_location("MGCP_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "MGCP_Emulation"); MGCP__CodecPort__CtrlFunct::module_object.post_init_module(); MGCP__Templates::module_object.post_init_module(); Osmocom__Types::module_object.post_init_module(); Misc__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, "MGCP_ConnHdlr")) { MGCP__ConnHdlr_component_MGCP.activate_port(); MGCP__ConnHdlr_component_MGCP__MULTI.activate_port(); MGCP__ConnHdlr_component_MGCP__PROC.activate_port(); return TRUE; } else if (!strcmp(component_type, "MGCP_Emulation_CT")) { MGCP__Emulation__CT_component_MGCP.activate_port(); MGCP__Emulation__CT_component_MGCP__CLIENT.activate_port(); MGCP__Emulation__CT_component_MGCP__CLIENT__MULTI.activate_port(); MGCP__Emulation__CT_component_MgcpEndpointTable.clean_up(); MGCP__Emulation__CT_component_MgcpPendingTrans = NULL_VALUE; MGCP__Emulation__CT_component_MgcpExpectTable.clean_up(); MGCP__Emulation__CT_component_MGCP__PROC.activate_port(); MGCP__Emulation__CT_component_g__mgcp__id.clean_up(); MGCP__Emulation__CT_component_g__mgcp__conn__id = -1; MGCP__Emulation__CT_component_g__pars.clean_up(); return TRUE; } else return FALSE; } boolean init_system_port(const char* component_type, const char* port_name) { if (!strcmp(component_type, "MGCP_ConnHdlr")) { if (!strcmp(port_name, "MGCP")) { MGCP__ConnHdlr_component_MGCP.safe_start(); return TRUE; } if (!strcmp(port_name, "MGCP_MULTI")) { MGCP__ConnHdlr_component_MGCP__MULTI.safe_start(); return TRUE; } if (!strcmp(port_name, "MGCP_PROC")) { MGCP__ConnHdlr_component_MGCP__PROC.safe_start(); return TRUE; } } else if (!strcmp(component_type, "MGCP_Emulation_CT")) { if (!strcmp(port_name, "MGCP")) { MGCP__Emulation__CT_component_MGCP.safe_start(); return TRUE; } if (!strcmp(port_name, "MGCP_CLIENT")) { MGCP__Emulation__CT_component_MGCP__CLIENT.safe_start(); return TRUE; } if (!strcmp(port_name, "MGCP_CLIENT_MULTI")) { MGCP__Emulation__CT_component_MGCP__CLIENT__MULTI.safe_start(); return TRUE; } if (!strcmp(port_name, "MGCP_PROC")) { MGCP__Emulation__CT_component_MGCP__PROC.safe_start(); return TRUE; } } return FALSE; } boolean start_ptc_function(const char *function_name, Text_Buf& function_arguments) { if (!strcmp(function_name, "tr_MGCP_RecvFrom_R")) { MGCP__Types::MgcpMessage_template msg; msg.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function tr_MGCP_RecvFrom_R("); msg.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); tr__MGCP__RecvFrom__R(msg); TTCN_Runtime::function_finished("tr_MGCP_RecvFrom_R"); return TRUE; } else if (!strcmp(function_name, "f_ep_known")) { CHARSTRING ep; ep.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_known("); ep.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__ep__known(ep); TTCN_Runtime::function_finished("f_ep_known"); return TRUE; } else if (!strcmp(function_name, "f_comp_known")) { COMPONENT client; client.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_comp_known("); client.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__comp__known(client); TTCN_Runtime::function_finished("f_comp_known"); return TRUE; } else if (!strcmp(function_name, "f_comp_by_ep")) { CHARSTRING ep; ep.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_comp_by_ep("); ep.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__comp__by__ep(ep); TTCN_Runtime::function_finished("f_comp_by_ep"); return TRUE; } else if (!strcmp(function_name, "f_ep_by_comp")) { COMPONENT client; client.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_by_comp("); client.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__ep__by__comp(client); TTCN_Runtime::function_finished("f_ep_by_comp"); return TRUE; } else if (!strcmp(function_name, "f_ep_table_add")) { COMPONENT comp__ref; CHARSTRING ep; comp__ref.decode_text(function_arguments); ep.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_table_add("); comp__ref.log(); TTCN_Logger::log_event_str(", "); ep.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__ep__table__add(comp__ref, ep); TTCN_Runtime::function_finished("f_ep_table_add"); return TRUE; } else if (!strcmp(function_name, "f_ep_table_del")) { COMPONENT comp__ref; CHARSTRING ep; comp__ref.decode_text(function_arguments); ep.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_table_del("); comp__ref.log(); TTCN_Logger::log_event_str(", "); ep.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__ep__table__del(comp__ref, ep); TTCN_Runtime::function_finished("f_ep_table_del"); return TRUE; } else if (!strcmp(function_name, "f_ep_table_change_connhdlr")) { COMPONENT comp__ref; CHARSTRING ep; comp__ref.decode_text(function_arguments); ep.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ep_table_change_connhdlr("); comp__ref.log(); TTCN_Logger::log_event_str(", "); ep.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__ep__table__change__connhdlr(comp__ref, ep); TTCN_Runtime::function_finished("f_ep_table_change_connhdlr"); return TRUE; } else if (!strcmp(function_name, "f_trans_id_was_pending")) { CHARSTRING trans__id; trans__id.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_trans_id_was_pending("); trans__id.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__trans__id__was__pending(trans__id); TTCN_Runtime::function_finished("f_trans_id_was_pending"); return TRUE; } else if (!strcmp(function_name, "f_ep_table_init")) { TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_ep_table_init()."); TTCN_Runtime::function_started(function_arguments); f__ep__table__init(); TTCN_Runtime::function_finished("f_ep_table_init"); return TRUE; } else if (!strcmp(function_name, "f_forward_to_client")) { MGCP__CodecPort::MGCP__RecvFrom mrf; COMPONENT vc__conn; mrf.decode_text(function_arguments); vc__conn.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_forward_to_client("); mrf.log(); TTCN_Logger::log_event_str(", "); vc__conn.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__forward__to__client(mrf, vc__conn); TTCN_Runtime::function_finished("f_forward_to_client"); return TRUE; } else if (!strcmp(function_name, "main")) { MGCPOps ops; MGCP__conn__parameters p; CHARSTRING id; ops.decode_text(function_arguments); 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("); ops.log(); TTCN_Logger::log_event_str(", "); 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_(ops, p, id); TTCN_Runtime::function_finished("main"); return TRUE; } else if (!strcmp(function_name, "ExpectedCreateCallback")) { MGCP__Types::MgcpCommand cmd; CHARSTRING id; cmd.decode_text(function_arguments); id.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function ExpectedCreateCallback("); cmd.log(); TTCN_Logger::log_event_str(", "); id.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); ExpectedCreateCallback(cmd, id); TTCN_Runtime::function_finished("ExpectedCreateCallback"); return TRUE; } else if (!strcmp(function_name, "f_create_expect")) { ExpectCriteria crit; COMPONENT hdlr; crit.decode_text(function_arguments); hdlr.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_create_expect("); crit.log(); TTCN_Logger::log_event_str(", "); hdlr.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__create__expect(crit, hdlr); TTCN_Runtime::function_finished("f_create_expect"); return TRUE; } else if (!strcmp(function_name, "f_create_mgcp_expect")) { ExpectCriteria dest__number; dest__number.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_create_mgcp_expect("); dest__number.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__create__mgcp__expect(dest__number); TTCN_Runtime::function_finished("f_create_mgcp_expect"); return TRUE; } else if (!strcmp(function_name, "f_create_mgcp_delete_ep")) { CHARSTRING ep; ep.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_create_mgcp_delete_ep("); ep.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__create__mgcp__delete__ep(ep); TTCN_Runtime::function_finished("f_create_mgcp_delete_ep"); return TRUE; } else if (!strcmp(function_name, "f_mgcp_change_connhdlr")) { CHARSTRING ep; ep.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_mgcp_change_connhdlr("); ep.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__mgcp__change__connhdlr(ep); TTCN_Runtime::function_finished("f_mgcp_change_connhdlr"); return TRUE; } else if (!strcmp(function_name, "f_expect_table_init")) { TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_expect_table_init()."); TTCN_Runtime::function_started(function_arguments); f__expect__table__init(); TTCN_Runtime::function_finished("f_expect_table_init"); return TRUE; } else if (!strcmp(function_name, "DummyUnitdataCallback")) { MGCP__Types::MgcpMessage msg; msg.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function DummyUnitdataCallback("); msg.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); DummyUnitdataCallback(msg); TTCN_Runtime::function_finished("DummyUnitdataCallback"); return TRUE; } else return FALSE; } } /* end of namespace */