// 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 "M3UA_Emulation.hh" namespace M3UA__Emulation { /* Literal string constants */ const unsigned char bs_2_bits[] = { 0 }, bs_0_bits[] = { 0 }, bs_1_bits[] = { 0 }; extern const BITSTRING bs_2(2, bs_2_bits), bs_0(4, bs_0_bits), bs_1(6, bs_1_bits); const unsigned char os_1_octets[] = { 0 }, os_12_octets[] = { 0, 1 }, os_18_octets[] = { 0, 2 }, os_16_octets[] = { 0, 6 }, os_17_octets[] = { 0, 13 }, os_0_octets[] = { 1 }, os_13_octets[] = { 1, 1 }, os_14_octets[] = { 2, 2 }, os_15_octets[] = { 2, 16 }, os_2_octets[] = { 3, 1 }, os_4_octets[] = { 3, 2 }, os_10_octets[] = { 3, 3 }, os_3_octets[] = { 3, 4 }, os_5_octets[] = { 3, 5 }, os_11_octets[] = { 3, 6 }, os_6_octets[] = { 4, 1 }, os_8_octets[] = { 4, 2 }, os_7_octets[] = { 4, 3 }, os_9_octets[] = { 4, 4 }; extern const OCTETSTRING os_1(1, os_1_octets), os_12(2, os_12_octets), os_18(2, os_18_octets), os_16(2, os_16_octets), os_17(2, os_17_octets), os_0(1, os_0_octets), os_13(2, os_13_octets), os_14(2, os_14_octets), os_15(2, os_15_octets), os_2(2, os_2_octets), os_4(2, os_4_octets), os_10(2, os_10_octets), os_3(2, os_3_octets), os_5(2, os_5_octets), os_11(2, os_11_octets), os_6(2, os_6_octets), os_8(2, os_8_octets), os_7(2, os_7_octets), os_9(2, os_9_octets); extern const CHARSTRING cs_0(4, "omit"); const unsigned char module_checksum[] = { 0x71, 0xa4, 0x2c, 0x88, 0x11, 0x65, 0xc5, 0xac, 0x17, 0xbd, 0x94, 0x44, 0x6c, 0x2f, 0x2f, 0x20 }; /* Global variable definitions */ BOOLEAN modulepar_tsp__logVerbose; const BOOLEAN& tsp__logVerbose = modulepar_tsp__logVerbose; FLOAT modulepar_tsp__Timer; const FLOAT& tsp__Timer = modulepar_tsp__Timer; FLOAT modulepar_tsp__ASPUP__Resend__Timer; const FLOAT& tsp__ASPUP__Resend__Timer = modulepar_tsp__ASPUP__Resend__Timer; FLOAT modulepar_tsp__ASPAC__Resend__Timer; const FLOAT& tsp__ASPAC__Resend__Timer = modulepar_tsp__ASPAC__Resend__Timer; FLOAT modulepar_tsp__Assoc__Restart__Timer; const FLOAT& tsp__Assoc__Restart__Timer = modulepar_tsp__Assoc__Restart__Timer; FLOAT modulepar_tsp__Heartbeat__Timer; const FLOAT& tsp__Heartbeat__Timer = modulepar_tsp__Heartbeat__Timer; INTEGER modulepar_tsp__SCTP__PayloadProtocolID; const INTEGER& tsp__SCTP__PayloadProtocolID = modulepar_tsp__SCTP__PayloadProtocolID; BOOLEAN modulepar_tsp__Enable__M3UA__Heartbeat; const BOOLEAN& tsp__Enable__M3UA__Heartbeat = modulepar_tsp__Enable__M3UA__Heartbeat; BOOLEAN modulepar_tsp__SCTP__Server__Mode; const BOOLEAN& tsp__SCTP__Server__Mode = modulepar_tsp__SCTP__Server__Mode; BOOLEAN modulepar_tsp__M3UA__Server__Mode; const BOOLEAN& tsp__M3UA__Server__Mode = modulepar_tsp__M3UA__Server__Mode; // No XER for TRANSFERreq__Buffer const TTCN_Typedescriptor_t TRANSFERreq__Buffer_descr_ = { "@M3UA_Emulation.TRANSFERreq_Buffer", NULL, NULL, NULL, NULL, NULL, NULL, NULL, &MTP3asp__Types::ASP__MTP3__TRANSFERreq_descr_, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING TRANSFERreq__Buffer_0_default_coding("RAW"); const XERdescriptor_t SCTP__Association__Address_local__sctp__port_xer_ = { {"local_sctp_port>\n", "local_sctp_port>\n"}, {17, 17}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCTP__Association__Address_local__sctp__port_descr_ = { "@M3UA_Emulation.SCTP_Association_Address.local_sctp_port", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &SCTP__Association__Address_local__sctp__port_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t SCTP__Association__Address_local__ip__addr_xer_ = { {"local_ip_addr>\n", "local_ip_addr>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCTP__Association__Address_local__ip__addr_descr_ = { "@M3UA_Emulation.SCTP_Association_Address.local_ip_addr", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &SCTP__Association__Address_local__ip__addr_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t SCTP__Association__Address_remote__sctp__port_xer_ = { {"remote_sctp_port>\n", "remote_sctp_port>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCTP__Association__Address_remote__sctp__port_descr_ = { "@M3UA_Emulation.SCTP_Association_Address.remote_sctp_port", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &SCTP__Association__Address_remote__sctp__port_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t SCTP__Association__Address_remote__ip__addr_xer_ = { {"remote_ip_addr>\n", "remote_ip_addr>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCTP__Association__Address_remote__ip__addr_descr_ = { "@M3UA_Emulation.SCTP_Association_Address.remote_ip_addr", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &SCTP__Association__Address_remote__ip__addr_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const TTCN_RAWdescriptor_t SCTP__Association__Address_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN_CHAR_CODING,NULL,false}; // No XER for SCTP__Association__Address const TTCN_Typedescriptor_t SCTP__Association__Address_descr_ = { "@M3UA_Emulation.SCTP_Association_Address", NULL, &SCTP__Association__Address_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for M3UA__Entity const TTCN_Typedescriptor_t M3UA__Entity_descr_ = { "@M3UA_Emulation.M3UA_Entity", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; // No XER for M3UA__CommStatus const TTCN_Typedescriptor_t M3UA__CommStatus_descr_ = { "@M3UA_Emulation.M3UA_CommStatus", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t M3UA__Entity_sCTP__Assoc__ID_xer_ = { {"sCTP_Assoc_ID>\n", "sCTP_Assoc_ID>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED |XER_OPTIONAL, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t M3UA__Entity_sCTP__Assoc__ID_descr_ = { "@M3UA_Emulation.M3UA_Entity.sCTP_Assoc_ID", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &M3UA__Entity_sCTP__Assoc__ID_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING M3UA__Entity_rctx_default_coding("RAW"); const TTCN_Typedescriptor_t& M3UA__CT_descr_ = COMPONENT_descr_; M3UA__Entity M3UA__CT_component_v__Entity; TRANSFERreq__Buffer M3UA__CT_component_v__TRANSFERreq__Buffer; SCTPasp__Types::ASP__SCTP M3UA__CT_component_v__ASP__SCTP; SCTPasp__Types::ASP__SCTP__SEND__FAILED M3UA__CT_component_v__ASP__SCTP__SEND__FAILED; SCTPasp__Types::ASP__SCTP__RESULT M3UA__CT_component_v__ASP__SCTP__RESULT; SCTPasp__Types::ASP__SCTP__Connected M3UA__CT_component_v__ASP__SCTP__Connected; SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE; SCTPasp__Types::ASP__SCTP__SHUTDOWN__EVENT M3UA__CT_component_v__ASP__SCTP__SHUTDOWN__EVENT; M3UA__Types::PDU__M3UA M3UA__CT_component_v__PDU__M3UA; TIMER M3UA__CT_component_T__Timer("T_Timer"); TIMER M3UA__CT_component_T__ASPUP__resend("T_ASPUP_resend"); TIMER M3UA__CT_component_T__ASPAC__resend("T_ASPAC_resend"); TIMER M3UA__CT_component_T__Heartbeat("T_Heartbeat"); TIMER M3UA__CT_component_T__Assoc__restart("T_Assoc_restart"); MTP3asp__SP__PT__Int M3UA__CT_component_MTP3__SP__PORT("MTP3_SP_PORT"); SCTPasp__PortType::SCTPasp__PT M3UA__CT_component_SCTP__PORT("SCTP_PORT"); M3UA__Types::PDU__M3UA_template template_t__PDU__M3UA__ASPUP__Ack; const M3UA__Types::PDU__M3UA_template& t__PDU__M3UA__ASPUP__Ack = template_t__PDU__M3UA__ASPUP__Ack; M3UA__Types::PDU__M3UA_template template_t__PDU__M3UA__ASPDN; const M3UA__Types::PDU__M3UA_template& t__PDU__M3UA__ASPDN = template_t__PDU__M3UA__ASPDN; M3UA__Types::PDU__M3UA_template template_t__PDU__M3UA__ASPDN__Ack; const M3UA__Types::PDU__M3UA_template& t__PDU__M3UA__ASPDN__Ack = template_t__PDU__M3UA__ASPDN__Ack; INTEGER_template template_f__M3UA__Emulation_rctx_defval; const INTEGER_template& f__M3UA__Emulation_rctx_defval = template_f__M3UA__Emulation_rctx_defval; TTCN_Module module_object("M3UA_Emulation", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, set_module_param, NULL, log_module_param, init_comp_type, init_system_port, start_ptc_function, NULL); const RuntimeVersionChecker ver_checker( current_runtime_version.requires_major_version_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 */ const MTP3asp__Types::ASP__MTP3__TRANSFERreq TRANSFERreq__Buffer::UNBOUND_ELEM; TRANSFERreq__Buffer::TRANSFERreq__Buffer() { val_ptr = NULL; } TRANSFERreq__Buffer::TRANSFERreq__Buffer(null_type) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } TRANSFERreq__Buffer::TRANSFERreq__Buffer(const TRANSFERreq__Buffer& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } TRANSFERreq__Buffer::~TRANSFERreq__Buffer() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void TRANSFERreq__Buffer::clean_up() { if (val_ptr != NULL) { if (val_ptr->ref_count > 1) { val_ptr->ref_count--; val_ptr = NULL; } else if (val_ptr->ref_count == 1) { for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) if (val_ptr->value_elements[elem_count] != NULL) delete val_ptr->value_elements[elem_count]; free_pointers((void**)val_ptr->value_elements); delete val_ptr; val_ptr = NULL; } else TTCN_error("Internal error: Invalid reference counter in a record of/set of value."); } } TRANSFERreq__Buffer& TRANSFERreq__Buffer::operator=(null_type) { clean_up(); val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; return *this; } TRANSFERreq__Buffer& TRANSFERreq__Buffer::operator=(const TRANSFERreq__Buffer& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean TRANSFERreq__Buffer::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); return val_ptr->n_elements == 0 ; } boolean TRANSFERreq__Buffer::operator==(const TRANSFERreq__Buffer& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); if (val_ptr == other_value.val_ptr) return TRUE; if (val_ptr->n_elements != (other_value.val_ptr)->n_elements) return FALSE; for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){ if (val_ptr->value_elements[elem_count] != NULL){ if ((other_value.val_ptr)->value_elements[elem_count] != NULL){ if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE; } else return FALSE; } else { if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE; } } return TRUE; } MTP3asp__Types::ASP__MTP3__TRANSFERreq& TRANSFERreq__Buffer::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @M3UA_Emulation.TRANSFERreq_Buffer using a negative index: %d.", index_value); if (val_ptr == NULL) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } else if (val_ptr->ref_count > 1) { struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct; new_val_ptr->ref_count = 1; new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements; new_val_ptr->value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq**)allocate_pointers(new_val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){ if (val_ptr->value_elements[elem_count] != NULL){ new_val_ptr->value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (index_value >= val_ptr->n_elements) set_size(index_value + 1); if (val_ptr->value_elements[index_value] == NULL) { val_ptr->value_elements[index_value] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq; } return *val_ptr->value_elements[index_value]; } MTP3asp__Types::ASP__MTP3__TRANSFERreq& TRANSFERreq__Buffer::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @M3UA_Emulation.TRANSFERreq_Buffer."); return (*this)[(int)index_value]; } const MTP3asp__Types::ASP__MTP3__TRANSFERreq& TRANSFERreq__Buffer::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); if (index_value < 0) TTCN_error("Accessing an element of type @M3UA_Emulation.TRANSFERreq_Buffer using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @M3UA_Emulation.TRANSFERreq_Buffer: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements); return (val_ptr->value_elements[index_value] == NULL) ? UNBOUND_ELEM : *val_ptr->value_elements[index_value]; } const MTP3asp__Types::ASP__MTP3__TRANSFERreq& TRANSFERreq__Buffer::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @M3UA_Emulation.TRANSFERreq_Buffer."); return (*this)[(int)index_value]; } TRANSFERreq__Buffer TRANSFERreq__Buffer::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } TRANSFERreq__Buffer TRANSFERreq__Buffer::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } TRANSFERreq__Buffer TRANSFERreq__Buffer::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } TRANSFERreq__Buffer TRANSFERreq__Buffer::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); if (val_ptr->n_elements == 0) return *this; int rc; if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements; else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements); if (rc == 0) return *this; TRANSFERreq__Buffer ret_val; ret_val.set_size(val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new MTP3asp__Types::ASP__MTP3__TRANSFERreq(*val_ptr->value_elements[i]); } } return ret_val; } TRANSFERreq__Buffer TRANSFERreq__Buffer::operator+(const TRANSFERreq__Buffer& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @M3UA_Emulation.TRANSFERreq_Buffer concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; TRANSFERreq__Buffer ret_val; ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq(*val_ptr->value_elements[i]); } } for (int i=0; in_elements; i++) { if (other_value.val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq(*other_value.val_ptr->value_elements[i]); } } return ret_val; } TRANSFERreq__Buffer TRANSFERreq__Buffer::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@M3UA_Emulation.TRANSFERreq_Buffer","element"); TRANSFERreq__Buffer ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq(*val_ptr->value_elements[i+index]); } } return ret_val; } TRANSFERreq__Buffer TRANSFERreq__Buffer::replace(int index, int len, const TRANSFERreq__Buffer& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); check_replace_arguments(val_ptr->n_elements, index, len, "@M3UA_Emulation.TRANSFERreq_Buffer","element"); TRANSFERreq__Buffer ret_val; ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len); for (int i = 0; i < index; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq(*val_ptr->value_elements[i]); } } for (int i = 0; i < repl.val_ptr->n_elements; i++) { if (repl.val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i+index] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq(*repl.val_ptr->value_elements[i]); } } for (int i = 0; i < val_ptr->n_elements - index - len; i++) { if (val_ptr->value_elements[index+i+len] != NULL) { ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq(*val_ptr->value_elements[index+i+len]); } } return ret_val; } TRANSFERreq__Buffer TRANSFERreq__Buffer::replace(int index, int len, const TRANSFERreq__Buffer_template& repl) const { if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value."); return replace(index, len, repl.valueof()); } void TRANSFERreq__Buffer::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @M3UA_Emulation.TRANSFERreq_Buffer."); if (val_ptr == NULL) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } else if (val_ptr->ref_count > 1) { struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct; new_val_ptr->ref_count = 1; new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements; new_val_ptr->value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq**)allocate_pointers(new_val_ptr->n_elements); for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) { if (val_ptr->value_elements[elem_count] != NULL){ new_val_ptr->value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); #ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @M3UA_Emulation.TRANSFERreq_Buffer: %d",new_size); #endif val_ptr->n_elements = new_size; } else if (new_size < val_ptr->n_elements) { for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++) if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count]; val_ptr->value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean TRANSFERreq__Buffer::is_value() const { if (val_ptr == NULL) return FALSE; for(int i = 0; i < val_ptr->n_elements; ++i) { if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE; } return TRUE; } int TRANSFERreq__Buffer::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); return val_ptr->n_elements; } int TRANSFERreq__Buffer::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length; return 0; } void TRANSFERreq__Buffer::log() const { if (val_ptr == NULL) {; TTCN_Logger::log_event_unbound(); return; } switch (val_ptr->n_elements) { case 0: TTCN_Logger::log_event_str("{ }"); break; default: TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); (*this)[elem_count].log(); } TTCN_Logger::log_event_str(" }"); } } void TRANSFERreq__Buffer::set_implicit_omit() { if (val_ptr == NULL) return; for (int i = 0; i < val_ptr->n_elements; i++) { if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit(); } } void TRANSFERreq__Buffer::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value"); switch (param.get_operation_type()) { case Module_Param::OT_ASSIGN: if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) { *this = NULL_VALUE; return; } switch (param.get_type()) { case Module_Param::MP_Value_List: set_size(param.get_size()); for (size_t i=0; iget_type()!=Module_Param::MP_NotUsed) { (*this)[i].set_param(*curr); if (!(*this)[i].is_bound()) { delete val_ptr->value_elements[i]; val_ptr->value_elements[i] = NULL; } } } break; case Module_Param::MP_Indexed_List: for (size_t i=0; iget_id()->get_index()].set_param(*curr); if (!(*this)[curr->get_id()->get_index()].is_bound()) { delete val_ptr->value_elements[curr->get_id()->get_index()]; val_ptr->value_elements[curr->get_id()->get_index()] = NULL; } } break; default: param.type_error("record of value", "@M3UA_Emulation.TRANSFERreq_Buffer"); } break; case Module_Param::OT_CONCAT: switch (param.get_type()) { case Module_Param::MP_Value_List: { if (!is_bound()) *this = NULL_VALUE; int start_idx = lengthof(); for (size_t i=0; iget_type()!=Module_Param::MP_NotUsed)) { (*this)[start_idx+(int)i].set_param(*curr); } } } break; case Module_Param::MP_Indexed_List: param.error("Cannot concatenate an indexed value list"); break; default: param.type_error("record of value", "@M3UA_Emulation.TRANSFERreq_Buffer"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void TRANSFERreq__Buffer::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); text_buf.push_int(val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) (*this)[elem_count].encode_text(text_buf); } void TRANSFERreq__Buffer::decode_text(Text_Buf& text_buf) { clean_up(); val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = text_buf.pull_int().get_val(); if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @M3UA_Emulation.TRANSFERreq_Buffer."); val_ptr->value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq**)allocate_pointers(val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) { val_ptr->value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void TRANSFERreq__Buffer_template::copy_value(const TRANSFERreq__Buffer& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @M3UA_Emulation.TRANSFERreq_Buffer with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (other_value[elem_count].is_bound()) { single_value.value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq_template; } } set_selection(SPECIFIC_VALUE); } void TRANSFERreq__Buffer_template::copy_template(const TRANSFERreq__Buffer_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value.n_elements = other_value.single_value.n_elements; single_value.value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) { single_value.value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq_template; } } 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 TRANSFERreq__Buffer_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 TRANSFERreq__Buffer_template(*other_value.implication_.precondition); implication_.implied_template = new TRANSFERreq__Buffer_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 @M3UA_Emulation.TRANSFERreq_Buffer."); break; } set_selection(other_value); } boolean TRANSFERreq__Buffer_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy) { if (value_index >= 0) return ((const TRANSFERreq__Buffer_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const TRANSFERreq__Buffer*)value_ptr)[value_index], legacy); else return ((const TRANSFERreq__Buffer_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } TRANSFERreq__Buffer_template::TRANSFERreq__Buffer_template() { } TRANSFERreq__Buffer_template::TRANSFERreq__Buffer_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } TRANSFERreq__Buffer_template::TRANSFERreq__Buffer_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } TRANSFERreq__Buffer_template::TRANSFERreq__Buffer_template(const TRANSFERreq__Buffer& other_value) { copy_value(other_value); } TRANSFERreq__Buffer_template::TRANSFERreq__Buffer_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const TRANSFERreq__Buffer&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @M3UA_Emulation.TRANSFERreq_Buffer from an unbound optional field."); } } TRANSFERreq__Buffer_template::TRANSFERreq__Buffer_template(TRANSFERreq__Buffer_template* p_precondition, TRANSFERreq__Buffer_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } TRANSFERreq__Buffer_template::TRANSFERreq__Buffer_template(Dynamic_Match_Interface* p_dyn_match) : Base_Record_Of_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } TRANSFERreq__Buffer_template::TRANSFERreq__Buffer_template(const TRANSFERreq__Buffer_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } TRANSFERreq__Buffer_template::~TRANSFERreq__Buffer_template() { clean_up(); } void TRANSFERreq__Buffer_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) delete single_value.value_elements[elem_count]; free_pointers((void**)single_value.value_elements); 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; } TRANSFERreq__Buffer_template& TRANSFERreq__Buffer_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } TRANSFERreq__Buffer_template& TRANSFERreq__Buffer_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } TRANSFERreq__Buffer_template& TRANSFERreq__Buffer_template::operator=(const TRANSFERreq__Buffer& other_value) { clean_up(); copy_value(other_value); return *this; } TRANSFERreq__Buffer_template& TRANSFERreq__Buffer_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const TRANSFERreq__Buffer&)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 @M3UA_Emulation.TRANSFERreq_Buffer."); } return *this; } TRANSFERreq__Buffer_template& TRANSFERreq__Buffer_template::operator=(const TRANSFERreq__Buffer_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } MTP3asp__Types::ASP__MTP3__TRANSFERreq_template& TRANSFERreq__Buffer_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @M3UA_Emulation.TRANSFERreq_Buffer using a negative index: %d.", index_value); switch (template_selection) { case SPECIFIC_VALUE: if(index_value < single_value.n_elements) break; // no break case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case UNINITIALIZED_TEMPLATE: set_size(index_value + 1); break; default: TTCN_error("Accessing an element of a non-specific template for type @M3UA_Emulation.TRANSFERreq_Buffer."); break; } return *single_value.value_elements[index_value]; } MTP3asp__Types::ASP__MTP3__TRANSFERreq_template& TRANSFERreq__Buffer_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @M3UA_Emulation.TRANSFERreq_Buffer."); return (*this)[(int)index_value]; } const MTP3asp__Types::ASP__MTP3__TRANSFERreq_template& TRANSFERreq__Buffer_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @M3UA_Emulation.TRANSFERreq_Buffer using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @M3UA_Emulation.TRANSFERreq_Buffer."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @M3UA_Emulation.TRANSFERreq_Buffer: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements); return *single_value.value_elements[index_value]; } const MTP3asp__Types::ASP__MTP3__TRANSFERreq_template& TRANSFERreq__Buffer_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @M3UA_Emulation.TRANSFERreq_Buffer."); return (*this)[(int)index_value]; } void TRANSFERreq__Buffer_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @M3UA_Emulation.TRANSFERreq_Buffer."); template_sel old_selection = template_selection; if (old_selection != SPECIFIC_VALUE) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; } if (new_size > single_value.n_elements) { single_value.value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++) single_value.value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq_template(ANY_VALUE); } else { for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++) single_value.value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq_template; } single_value.n_elements = new_size; } else if (new_size < single_value.n_elements) { for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++) delete single_value.value_elements[elem_count]; single_value.value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int TRANSFERreq__Buffer_template::n_elem() const { switch (template_selection) { case SPECIFIC_VALUE: return single_value.n_elements; break; case VALUE_LIST: return value_list.n_values; break; default: TTCN_error("Performing n_elem"); } } int TRANSFERreq__Buffer_template::size_of(boolean is_size) const { const char* op_name = is_size ? "size" : "length"; int min_size; boolean has_any_or_none; if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @M3UA_Emulation.TRANSFERreq_Buffer which has an ifpresent attribute.", op_name); switch (template_selection) { case SPECIFIC_VALUE: { min_size = 0; has_any_or_none = FALSE; int elem_count = single_value.n_elements; if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; } for (int i=0; iget_selection()) { case OMIT_VALUE: TTCN_error("Performing %sof() operation on a template of type @M3UA_Emulation.TRANSFERreq_Buffer containing omit element.", op_name); case ANY_OR_OMIT: has_any_or_none = TRUE; break; default: min_size++; break; } } } break; case OMIT_VALUE: TTCN_error("Performing %sof() operation on a template of type @M3UA_Emulation.TRANSFERreq_Buffer containing omit value.", op_name); case ANY_VALUE: case ANY_OR_OMIT: min_size = 0; has_any_or_none = TRUE; break; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Performing %sof() operation on a template of type @M3UA_Emulation.TRANSFERreq_Buffer containing an empty list.", op_name); int item_size = value_list.list_value[0].size_of(is_size); for (unsigned int i = 1; i < value_list.n_values; i++) { if (value_list.list_value[i].size_of(is_size)!=item_size) TTCN_error("Performing %sof() operation on a template of type @M3UA_Emulation.TRANSFERreq_Buffer containing a value list with different sizes.", op_name); } min_size = item_size; has_any_or_none = FALSE; break; } case COMPLEMENTED_LIST: TTCN_error("Performing %sof() operation on a template of type @M3UA_Emulation.TRANSFERreq_Buffer containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @M3UA_Emulation.TRANSFERreq_Buffer.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @M3UA_Emulation.TRANSFERreq_Buffer"); } boolean TRANSFERreq__Buffer_template::match(const TRANSFERreq__Buffer& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; int value_length = other_value.size_of(); if (!match_length(value_length)) return FALSE; switch (template_selection) { case SPECIFIC_VALUE: return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy); case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, 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 with an uninitialized/unsupported template of type @M3UA_Emulation.TRANSFERreq_Buffer."); } return FALSE; } boolean TRANSFERreq__Buffer_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) if (!single_value.value_elements[elem_count]->is_value()) return FALSE; return TRUE; } TRANSFERreq__Buffer TRANSFERreq__Buffer_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 @M3UA_Emulation.TRANSFERreq_Buffer."); TRANSFERreq__Buffer ret_val; ret_val.set_size(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) if (single_value.value_elements[elem_count]->is_bound()) { ret_val[elem_count] = single_value.value_elements[elem_count]->valueof(); } return ret_val; } TRANSFERreq__Buffer TRANSFERreq__Buffer_template::substr(int index, int returncount) const { if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value."); return valueof().substr(index, returncount); } TRANSFERreq__Buffer TRANSFERreq__Buffer_template::replace(int index, int len, const TRANSFERreq__Buffer_template& repl) const { if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value."); if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value."); return valueof().replace(index, len, repl.valueof()); } TRANSFERreq__Buffer TRANSFERreq__Buffer_template::replace(int index, int len, const TRANSFERreq__Buffer& repl) const { if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value."); return valueof().replace(index, len, repl); } void TRANSFERreq__Buffer_template::set_type(template_sel template_type, unsigned int list_length) { clean_up(); switch (template_type) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = list_length; value_list.list_value = new TRANSFERreq__Buffer_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @M3UA_Emulation.TRANSFERreq_Buffer."); } set_selection(template_type); } TRANSFERreq__Buffer_template& TRANSFERreq__Buffer_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of type @M3UA_Emulation.TRANSFERreq_Buffer."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @M3UA_Emulation.TRANSFERreq_Buffer."); return value_list.list_value[list_index]; } void TRANSFERreq__Buffer_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: if (single_value.n_elements > 0) { TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); if (permutation_starts_at(elem_count)) TTCN_Logger::log_event_str("permutation("); single_value.value_elements[elem_count]->log(); if (permutation_ends_at(elem_count)) TTCN_Logger::log_char(')'); } TTCN_Logger::log_event_str(" }"); } else 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_restricted(); log_ifpresent(); } void TRANSFERreq__Buffer_template::log_match(const TRANSFERreq__Buffer& 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 && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){ TTCN_Logger::log_logmatch_info("[%d]", elem_count); single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } log_match_length(single_value.n_elements); } 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 && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) { TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy); } TTCN_Logger::log_event_str(" }"); log_match_length(single_value.n_elements); } 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 TRANSFERreq__Buffer_template::encode_text(Text_Buf& text_buf) const { encode_text_permutation(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) single_value.value_elements[elem_count]->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 @M3UA_Emulation.TRANSFERreq_Buffer."); } } void TRANSFERreq__Buffer_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_permutation(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value.n_elements = text_buf.pull_int().get_val(); if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @M3UA_Emulation.TRANSFERreq_Buffer."); single_value.value_elements = (MTP3asp__Types::ASP__MTP3__TRANSFERreq_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { single_value.value_elements[elem_count] = new MTP3asp__Types::ASP__MTP3__TRANSFERreq_template; single_value.value_elements[elem_count]->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 TRANSFERreq__Buffer_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 for a template of type @M3UA_Emulation.TRANSFERreq_Buffer."); } } boolean TRANSFERreq__Buffer_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean TRANSFERreq__Buffer_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iset_implicit_omit(); } } void TRANSFERreq__Buffer_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of 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: { TRANSFERreq__Buffer_template temp; 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_iget_id()->get_index())].set_param(*param.get_elem(p_i)); } break; case Module_Param::MP_Value_List: { set_size(param.get_size()); int curr_idx = 0; for (size_t p_i=0; p_iget_type()) { case Module_Param::MP_NotUsed: curr_idx++; break; case Module_Param::MP_Permutation_Template: { int perm_start_idx = curr_idx; Module_Param* param_i = param.get_elem(p_i); for (size_t perm_i=0; perm_iget_size(); perm_i++) { (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i))); curr_idx++; } int perm_end_idx = curr_idx - 1; add_permutation(perm_start_idx, perm_end_idx); } break; default: (*this)[curr_idx].set_param(*param.get_elem(p_i)); curr_idx++; } } } break; case Module_Param::MP_Implication_Template: { TRANSFERreq__Buffer_template* precondition = new TRANSFERreq__Buffer_template; precondition->set_param(*param.get_elem(0)); TRANSFERreq__Buffer_template* implied_template = new TRANSFERreq__Buffer_template; implied_template->set_param(*param.get_elem(1)); *this = TRANSFERreq__Buffer_template(precondition, implied_template); } break; default: param.type_error("record of template", "@M3UA_Emulation.TRANSFERreq_Buffer"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void TRANSFERreq__Buffer_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; for (int i=0; icheck_restriction(t_res, t_name ? t_name : "@M3UA_Emulation.TRANSFERreq_Buffer"); 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 : "@M3UA_Emulation.TRANSFERreq_Buffer"); } boolean TRANSFERreq__Buffer_template::get_istemplate_kind(const char* type) const { if (!strcmp(type, "AnyElement")) { if (template_selection != SPECIFIC_VALUE) { return FALSE; } for (int i = 0; i < single_value.n_elements; i++) { if (single_value.value_elements[i]->get_selection() == ANY_VALUE) { return TRUE; } } return FALSE; } else if (!strcmp(type, "AnyElementsOrNone")) { if (template_selection != SPECIFIC_VALUE) { return FALSE; } for (int i = 0; i < single_value.n_elements; i++) { if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) { return TRUE; } } return FALSE; } else if (!strcmp(type, "permutation")) { return number_of_permutations; } else if (!strcmp(type, "length")) { return length_restriction_type != NO_LENGTH_RESTRICTION; } else { return Base_Template::get_istemplate_kind(type); } } SCTP__Association__Address::SCTP__Association__Address() { } SCTP__Association__Address::SCTP__Association__Address(const INTEGER& par_local__sctp__port, const CHARSTRING& par_local__ip__addr, const INTEGER& par_remote__sctp__port, const CHARSTRING& par_remote__ip__addr) : field_local__sctp__port(par_local__sctp__port), field_local__ip__addr(par_local__ip__addr), field_remote__sctp__port(par_remote__sctp__port), field_remote__ip__addr(par_remote__ip__addr) { } SCTP__Association__Address::SCTP__Association__Address(const SCTP__Association__Address& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @M3UA_Emulation.SCTP_Association_Address."); if (other_value.local__sctp__port().is_bound()) field_local__sctp__port = other_value.local__sctp__port(); else field_local__sctp__port.clean_up(); if (other_value.local__ip__addr().is_bound()) field_local__ip__addr = other_value.local__ip__addr(); else field_local__ip__addr.clean_up(); if (other_value.remote__sctp__port().is_bound()) field_remote__sctp__port = other_value.remote__sctp__port(); else field_remote__sctp__port.clean_up(); if (other_value.remote__ip__addr().is_bound()) field_remote__ip__addr = other_value.remote__ip__addr(); else field_remote__ip__addr.clean_up(); } void SCTP__Association__Address::clean_up() { field_local__sctp__port.clean_up(); field_local__ip__addr.clean_up(); field_remote__sctp__port.clean_up(); field_remote__ip__addr.clean_up(); } const TTCN_Typedescriptor_t* SCTP__Association__Address::get_descriptor() const { return &SCTP__Association__Address_descr_; } SCTP__Association__Address& SCTP__Association__Address::operator=(const SCTP__Association__Address& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @M3UA_Emulation.SCTP_Association_Address."); if (other_value.local__sctp__port().is_bound()) field_local__sctp__port = other_value.local__sctp__port(); else field_local__sctp__port.clean_up(); if (other_value.local__ip__addr().is_bound()) field_local__ip__addr = other_value.local__ip__addr(); else field_local__ip__addr.clean_up(); if (other_value.remote__sctp__port().is_bound()) field_remote__sctp__port = other_value.remote__sctp__port(); else field_remote__sctp__port.clean_up(); if (other_value.remote__ip__addr().is_bound()) field_remote__ip__addr = other_value.remote__ip__addr(); else field_remote__ip__addr.clean_up(); } return *this; } boolean SCTP__Association__Address::operator==(const SCTP__Association__Address& other_value) const { return field_local__sctp__port==other_value.field_local__sctp__port && field_local__ip__addr==other_value.field_local__ip__addr && field_remote__sctp__port==other_value.field_remote__sctp__port && field_remote__ip__addr==other_value.field_remote__ip__addr; } boolean SCTP__Association__Address::is_bound() const { return (field_local__sctp__port.is_bound()) || (field_local__ip__addr.is_bound()) || (field_remote__sctp__port.is_bound()) || (field_remote__ip__addr.is_bound()); } boolean SCTP__Association__Address::is_value() const { return field_local__sctp__port.is_value() && field_local__ip__addr.is_value() && field_remote__sctp__port.is_value() && field_remote__ip__addr.is_value(); } void SCTP__Association__Address::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ local_sctp_port := "); field_local__sctp__port.log(); TTCN_Logger::log_event_str(", local_ip_addr := "); field_local__ip__addr.log(); TTCN_Logger::log_event_str(", remote_sctp_port := "); field_remote__sctp__port.log(); TTCN_Logger::log_event_str(", remote_ip_addr := "); field_remote__ip__addr.log(); TTCN_Logger::log_event_str(" }"); } void SCTP__Association__Address::set_implicit_omit() { if (local__sctp__port().is_bound()) local__sctp__port().set_implicit_omit(); if (local__ip__addr().is_bound()) local__ip__addr().set_implicit_omit(); if (remote__sctp__port().is_bound()) remote__sctp__port().set_implicit_omit(); if (remote__ip__addr().is_bound()) remote__ip__addr().set_implicit_omit(); } void SCTP__Association__Address::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (40 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) local__sctp__port().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) local__ip__addr().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) remote__sctp__port().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) remote__ip__addr().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "local_sctp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__sctp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "local_ip_addr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__ip__addr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "remote_sctp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { remote__sctp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "remote_ip_addr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { remote__ip__addr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @M3UA_Emulation.SCTP_Association_Address: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@M3UA_Emulation.SCTP_Association_Address"); } } void SCTP__Association__Address::encode_text(Text_Buf& text_buf) const { field_local__sctp__port.encode_text(text_buf); field_local__ip__addr.encode_text(text_buf); field_remote__sctp__port.encode_text(text_buf); field_remote__ip__addr.encode_text(text_buf); } void SCTP__Association__Address::decode_text(Text_Buf& text_buf) { field_local__sctp__port.decode_text(text_buf); field_local__ip__addr.decode_text(text_buf); field_remote__sctp__port.decode_text(text_buf); field_remote__ip__addr.decode_text(text_buf); } void SCTP__Association__Address::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void SCTP__Association__Address::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int SCTP__Association__Address::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord; else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB; else local_top_order=ORDER_LSB; RAW_Force_Omit field_0_force_omit(0, force_omit, INTEGER_descr_.raw->forceomit); decoded_field_length = field_local__sctp__port.RAW_decode(INTEGER_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_1_force_omit(1, force_omit, CHARSTRING_descr_.raw->forceomit); decoded_field_length = field_local__ip__addr.RAW_decode(CHARSTRING_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_2_force_omit(2, force_omit, INTEGER_descr_.raw->forceomit); decoded_field_length = field_remote__sctp__port.RAW_decode(INTEGER_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_3_force_omit(3, force_omit, CHARSTRING_descr_.raw->forceomit); decoded_field_length = field_remote__ip__addr.RAW_decode(CHARSTRING_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SCTP__Association__Address::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 4; myleaf.body.node.nodes = init_nodes_of_enc_tree(4); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, INTEGER_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CHARSTRING_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, INTEGER_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, CHARSTRING_descr_.raw); encoded_length += field_local__sctp__port.RAW_encode(INTEGER_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_local__ip__addr.RAW_encode(CHARSTRING_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_remote__sctp__port.RAW_encode(INTEGER_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_remote__ip__addr.RAW_encode(CHARSTRING_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct SCTP__Association__Address_template::single_value_struct { INTEGER_template field_local__sctp__port; CHARSTRING_template field_local__ip__addr; INTEGER_template field_remote__sctp__port; CHARSTRING_template field_remote__ip__addr; }; void SCTP__Association__Address_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_local__sctp__port = ANY_VALUE; single_value->field_local__ip__addr = ANY_VALUE; single_value->field_remote__sctp__port = ANY_VALUE; single_value->field_remote__ip__addr = ANY_VALUE; } } } void SCTP__Association__Address_template::copy_value(const SCTP__Association__Address& other_value) { single_value = new single_value_struct; if (other_value.local__sctp__port().is_bound()) { single_value->field_local__sctp__port = other_value.local__sctp__port(); } else { single_value->field_local__sctp__port.clean_up(); } if (other_value.local__ip__addr().is_bound()) { single_value->field_local__ip__addr = other_value.local__ip__addr(); } else { single_value->field_local__ip__addr.clean_up(); } if (other_value.remote__sctp__port().is_bound()) { single_value->field_remote__sctp__port = other_value.remote__sctp__port(); } else { single_value->field_remote__sctp__port.clean_up(); } if (other_value.remote__ip__addr().is_bound()) { single_value->field_remote__ip__addr = other_value.remote__ip__addr(); } else { single_value->field_remote__ip__addr.clean_up(); } set_selection(SPECIFIC_VALUE); } void SCTP__Association__Address_template::copy_template(const SCTP__Association__Address_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.local__sctp__port().get_selection()) { single_value->field_local__sctp__port = other_value.local__sctp__port(); } else { single_value->field_local__sctp__port.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.local__ip__addr().get_selection()) { single_value->field_local__ip__addr = other_value.local__ip__addr(); } else { single_value->field_local__ip__addr.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.remote__sctp__port().get_selection()) { single_value->field_remote__sctp__port = other_value.remote__sctp__port(); } else { single_value->field_remote__sctp__port.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.remote__ip__addr().get_selection()) { single_value->field_remote__ip__addr = other_value.remote__ip__addr(); } else { single_value->field_remote__ip__addr.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 SCTP__Association__Address_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 SCTP__Association__Address_template(*other_value.implication_.precondition); implication_.implied_template = new SCTP__Association__Address_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 @M3UA_Emulation.SCTP_Association_Address."); break; } set_selection(other_value); } SCTP__Association__Address_template::SCTP__Association__Address_template() { } SCTP__Association__Address_template::SCTP__Association__Address_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SCTP__Association__Address_template::SCTP__Association__Address_template(const SCTP__Association__Address& other_value) { copy_value(other_value); } SCTP__Association__Address_template::SCTP__Association__Address_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCTP__Association__Address&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @M3UA_Emulation.SCTP_Association_Address from an unbound optional field."); } } SCTP__Association__Address_template::SCTP__Association__Address_template(SCTP__Association__Address_template* p_precondition, SCTP__Association__Address_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SCTP__Association__Address_template::SCTP__Association__Address_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; } SCTP__Association__Address_template::SCTP__Association__Address_template(const SCTP__Association__Address_template& other_value) : Base_Template() { copy_template(other_value); } SCTP__Association__Address_template::~SCTP__Association__Address_template() { clean_up(); } SCTP__Association__Address_template& SCTP__Association__Address_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SCTP__Association__Address_template& SCTP__Association__Address_template::operator=(const SCTP__Association__Address& other_value) { clean_up(); copy_value(other_value); return *this; } SCTP__Association__Address_template& SCTP__Association__Address_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCTP__Association__Address&)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 @M3UA_Emulation.SCTP_Association_Address."); } return *this; } SCTP__Association__Address_template& SCTP__Association__Address_template::operator=(const SCTP__Association__Address_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SCTP__Association__Address_template::match(const SCTP__Association__Address& 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.local__sctp__port().is_bound()) return FALSE; if(!single_value->field_local__sctp__port.match(other_value.local__sctp__port(), legacy))return FALSE; if(!other_value.local__ip__addr().is_bound()) return FALSE; if(!single_value->field_local__ip__addr.match(other_value.local__ip__addr(), legacy))return FALSE; if(!other_value.remote__sctp__port().is_bound()) return FALSE; if(!single_value->field_remote__sctp__port.match(other_value.remote__sctp__port(), legacy))return FALSE; if(!other_value.remote__ip__addr().is_bound()) return FALSE; if(!single_value->field_remote__ip__addr.match(other_value.remote__ip__addr(), 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 @M3UA_Emulation.SCTP_Association_Address."); } return FALSE; } boolean SCTP__Association__Address_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_local__sctp__port.is_bound() || single_value->field_local__ip__addr.is_bound() || single_value->field_remote__sctp__port.is_bound() || single_value->field_remote__ip__addr.is_bound(); } boolean SCTP__Association__Address_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_local__sctp__port.is_value() && single_value->field_local__ip__addr.is_value() && single_value->field_remote__sctp__port.is_value() && single_value->field_remote__ip__addr.is_value(); } void SCTP__Association__Address_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; } SCTP__Association__Address SCTP__Association__Address_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 @M3UA_Emulation.SCTP_Association_Address."); SCTP__Association__Address ret_val; if (single_value->field_local__sctp__port.is_bound()) { ret_val.local__sctp__port() = single_value->field_local__sctp__port.valueof(); } if (single_value->field_local__ip__addr.is_bound()) { ret_val.local__ip__addr() = single_value->field_local__ip__addr.valueof(); } if (single_value->field_remote__sctp__port.is_bound()) { ret_val.remote__sctp__port() = single_value->field_remote__sctp__port.valueof(); } if (single_value->field_remote__ip__addr.is_bound()) { ret_val.remote__ip__addr() = single_value->field_remote__ip__addr.valueof(); } return ret_val; } void SCTP__Association__Address_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 @M3UA_Emulation.SCTP_Association_Address."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SCTP__Association__Address_template[list_length]; } SCTP__Association__Address_template& SCTP__Association__Address_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 @M3UA_Emulation.SCTP_Association_Address."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @M3UA_Emulation.SCTP_Association_Address."); return value_list.list_value[list_index]; } INTEGER_template& SCTP__Association__Address_template::local__sctp__port() { set_specific(); return single_value->field_local__sctp__port; } const INTEGER_template& SCTP__Association__Address_template::local__sctp__port() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field local_sctp_port of a non-specific template of type @M3UA_Emulation.SCTP_Association_Address."); return single_value->field_local__sctp__port; } CHARSTRING_template& SCTP__Association__Address_template::local__ip__addr() { set_specific(); return single_value->field_local__ip__addr; } const CHARSTRING_template& SCTP__Association__Address_template::local__ip__addr() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field local_ip_addr of a non-specific template of type @M3UA_Emulation.SCTP_Association_Address."); return single_value->field_local__ip__addr; } INTEGER_template& SCTP__Association__Address_template::remote__sctp__port() { set_specific(); return single_value->field_remote__sctp__port; } const INTEGER_template& SCTP__Association__Address_template::remote__sctp__port() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field remote_sctp_port of a non-specific template of type @M3UA_Emulation.SCTP_Association_Address."); return single_value->field_remote__sctp__port; } CHARSTRING_template& SCTP__Association__Address_template::remote__ip__addr() { set_specific(); return single_value->field_remote__ip__addr; } const CHARSTRING_template& SCTP__Association__Address_template::remote__ip__addr() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field remote_ip_addr of a non-specific template of type @M3UA_Emulation.SCTP_Association_Address."); return single_value->field_remote__ip__addr; } int SCTP__Association__Address_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.SCTP_Association_Address which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 4; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @M3UA_Emulation.SCTP_Association_Address 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 @M3UA_Emulation.SCTP_Association_Address containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.SCTP_Association_Address containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.SCTP_Association_Address containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.SCTP_Association_Address containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.SCTP_Association_Address containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.SCTP_Association_Address containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.SCTP_Association_Address containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @M3UA_Emulation.SCTP_Association_Address."); } return 0; } void SCTP__Association__Address_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ local_sctp_port := "); single_value->field_local__sctp__port.log(); TTCN_Logger::log_event_str(", local_ip_addr := "); single_value->field_local__ip__addr.log(); TTCN_Logger::log_event_str(", remote_sctp_port := "); single_value->field_remote__sctp__port.log(); TTCN_Logger::log_event_str(", remote_ip_addr := "); single_value->field_remote__ip__addr.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 SCTP__Association__Address_template::log_match(const SCTP__Association__Address& 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_local__sctp__port.match(match_value.local__sctp__port(), legacy)){ TTCN_Logger::log_logmatch_info(".local_sctp_port"); single_value->field_local__sctp__port.log_match(match_value.local__sctp__port(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_local__ip__addr.match(match_value.local__ip__addr(), legacy)){ TTCN_Logger::log_logmatch_info(".local_ip_addr"); single_value->field_local__ip__addr.log_match(match_value.local__ip__addr(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_remote__sctp__port.match(match_value.remote__sctp__port(), legacy)){ TTCN_Logger::log_logmatch_info(".remote_sctp_port"); single_value->field_remote__sctp__port.log_match(match_value.remote__sctp__port(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_remote__ip__addr.match(match_value.remote__ip__addr(), legacy)){ TTCN_Logger::log_logmatch_info(".remote_ip_addr"); single_value->field_remote__ip__addr.log_match(match_value.remote__ip__addr(), 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("{ local_sctp_port := "); single_value->field_local__sctp__port.log_match(match_value.local__sctp__port(), legacy); TTCN_Logger::log_event_str(", local_ip_addr := "); single_value->field_local__ip__addr.log_match(match_value.local__ip__addr(), legacy); TTCN_Logger::log_event_str(", remote_sctp_port := "); single_value->field_remote__sctp__port.log_match(match_value.remote__sctp__port(), legacy); TTCN_Logger::log_event_str(", remote_ip_addr := "); single_value->field_remote__ip__addr.log_match(match_value.remote__ip__addr(), 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 SCTP__Association__Address_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (local__sctp__port().is_bound()) local__sctp__port().set_implicit_omit(); if (local__ip__addr().is_bound()) local__ip__addr().set_implicit_omit(); if (remote__sctp__port().is_bound()) remote__sctp__port().set_implicit_omit(); if (remote__ip__addr().is_bound()) remote__ip__addr().set_implicit_omit(); } void SCTP__Association__Address_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_local__sctp__port.encode_text(text_buf); single_value->field_local__ip__addr.encode_text(text_buf); single_value->field_remote__sctp__port.encode_text(text_buf); single_value->field_remote__ip__addr.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 @M3UA_Emulation.SCTP_Association_Address."); } } void SCTP__Association__Address_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_local__sctp__port.decode_text(text_buf); single_value->field_local__ip__addr.decode_text(text_buf); single_value->field_remote__sctp__port.decode_text(text_buf); single_value->field_remote__ip__addr.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 SCTP__Association__Address_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 @M3UA_Emulation.SCTP_Association_Address."); } } void SCTP__Association__Address_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: { SCTP__Association__Address_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) local__sctp__port().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) local__ip__addr().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) remote__sctp__port().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) remote__ip__addr().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "local_sctp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__sctp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "local_ip_addr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { local__ip__addr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "remote_sctp_port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { remote__sctp__port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "remote_ip_addr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { remote__ip__addr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @M3UA_Emulation.SCTP_Association_Address: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SCTP__Association__Address_template* precondition = new SCTP__Association__Address_template; precondition->set_param(*param.get_elem(0)); SCTP__Association__Address_template* implied_template = new SCTP__Association__Address_template; implied_template->set_param(*param.get_elem(1)); *this = SCTP__Association__Address_template(precondition, implied_template); } break; default: param.type_error("record template", "@M3UA_Emulation.SCTP_Association_Address"); } is_ifpresent = param.get_ifpresent(); } void SCTP__Association__Address_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_local__sctp__port.check_restriction(t_res, t_name ? t_name : "@M3UA_Emulation.SCTP_Association_Address"); single_value->field_local__ip__addr.check_restriction(t_res, t_name ? t_name : "@M3UA_Emulation.SCTP_Association_Address"); single_value->field_remote__sctp__port.check_restriction(t_res, t_name ? t_name : "@M3UA_Emulation.SCTP_Association_Address"); single_value->field_remote__ip__addr.check_restriction(t_res, t_name ? t_name : "@M3UA_Emulation.SCTP_Association_Address"); 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 : "@M3UA_Emulation.SCTP_Association_Address"); } boolean SCTP__Association__Address_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SCTP__Association__Address_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_commStatus, const OPTIONAL< INTEGER >& par_sCTP__Assoc__ID, const OPTIONAL< M3UA__Types::M3UA__Routing__Context >& par_rctx, const SCTP__Association__Address& par_assoc) : field_commStatus(par_commStatus), field_sCTP__Assoc__ID(par_sCTP__Assoc__ID), field_rctx(par_rctx), field_assoc(par_assoc) { } M3UA__Entity::M3UA__Entity(const M3UA__Entity& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @M3UA_Emulation.M3UA_Entity."); if (other_value.commStatus().is_bound()) field_commStatus = other_value.commStatus(); else field_commStatus.clean_up(); if (other_value.sCTP__Assoc__ID().is_bound()) field_sCTP__Assoc__ID = other_value.sCTP__Assoc__ID(); else field_sCTP__Assoc__ID.clean_up(); if (other_value.rctx().is_bound()) field_rctx = other_value.rctx(); else field_rctx.clean_up(); if (other_value.assoc().is_bound()) field_assoc = other_value.assoc(); else field_assoc.clean_up(); } void M3UA__Entity::clean_up() { field_commStatus.clean_up(); field_sCTP__Assoc__ID.clean_up(); field_rctx.clean_up(); field_assoc.clean_up(); } const TTCN_Typedescriptor_t* M3UA__Entity::get_descriptor() const { return &M3UA__Entity_descr_; } M3UA__Entity& M3UA__Entity::operator=(const M3UA__Entity& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @M3UA_Emulation.M3UA_Entity."); if (other_value.commStatus().is_bound()) field_commStatus = other_value.commStatus(); else field_commStatus.clean_up(); if (other_value.sCTP__Assoc__ID().is_bound()) field_sCTP__Assoc__ID = other_value.sCTP__Assoc__ID(); else field_sCTP__Assoc__ID.clean_up(); if (other_value.rctx().is_bound()) field_rctx = other_value.rctx(); else field_rctx.clean_up(); if (other_value.assoc().is_bound()) field_assoc = other_value.assoc(); else field_assoc.clean_up(); } return *this; } boolean M3UA__Entity::operator==(const M3UA__Entity& other_value) const { return field_commStatus==other_value.field_commStatus && field_sCTP__Assoc__ID==other_value.field_sCTP__Assoc__ID && field_rctx==other_value.field_rctx && field_assoc==other_value.field_assoc; } boolean M3UA__Entity::is_bound() const { return (OPTIONAL_OMIT == field_commStatus.get_selection() || field_commStatus.is_bound()) || (OPTIONAL_OMIT == field_sCTP__Assoc__ID.get_selection() || field_sCTP__Assoc__ID.is_bound()) || (OPTIONAL_OMIT == field_rctx.get_selection() || field_rctx.is_bound()) || (field_assoc.is_bound()); } boolean M3UA__Entity::is_value() const { return (OPTIONAL_OMIT == field_commStatus.get_selection() || field_commStatus.is_value()) && (OPTIONAL_OMIT == field_sCTP__Assoc__ID.get_selection() || field_sCTP__Assoc__ID.is_value()) && (OPTIONAL_OMIT == field_rctx.get_selection() || field_rctx.is_value()) && field_assoc.is_value(); } int M3UA__Entity::size_of() const { int ret_val = 1; if (field_commStatus.ispresent()) ret_val++; if (field_sCTP__Assoc__ID.ispresent()) ret_val++; if (field_rctx.ispresent()) ret_val++; return ret_val; } void M3UA__Entity::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ commStatus := "); field_commStatus.log(); TTCN_Logger::log_event_str(", sCTP_Assoc_ID := "); field_sCTP__Assoc__ID.log(); TTCN_Logger::log_event_str(", rctx := "); field_rctx.log(); TTCN_Logger::log_event_str(", assoc := "); field_assoc.log(); TTCN_Logger::log_event_str(" }"); } void M3UA__Entity::set_implicit_omit() { if (!commStatus().is_bound()) commStatus() = OMIT_VALUE; else commStatus().set_implicit_omit(); if (!sCTP__Assoc__ID().is_bound()) sCTP__Assoc__ID() = OMIT_VALUE; else sCTP__Assoc__ID().set_implicit_omit(); if (!rctx().is_bound()) rctx() = OMIT_VALUE; else rctx().set_implicit_omit(); if (assoc().is_bound()) assoc().set_implicit_omit(); } void M3UA__Entity::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (40 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) commStatus().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sCTP__Assoc__ID().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rctx().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) assoc().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "commStatus")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { commStatus().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sCTP_Assoc_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sCTP__Assoc__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rctx")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rctx().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "assoc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { assoc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @M3UA_Emulation.M3UA_Entity: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@M3UA_Emulation.M3UA_Entity"); } } void M3UA__Entity::encode_text(Text_Buf& text_buf) const { field_commStatus.encode_text(text_buf); field_sCTP__Assoc__ID.encode_text(text_buf); field_rctx.encode_text(text_buf); field_assoc.encode_text(text_buf); } void M3UA__Entity::decode_text(Text_Buf& text_buf) { field_commStatus.decode_text(text_buf); field_sCTP__Assoc__ID.decode_text(text_buf); field_rctx.decode_text(text_buf); field_assoc.decode_text(text_buf); } struct M3UA__Entity_template::single_value_struct { M3UA__CommStatus_template field_commStatus; INTEGER_template field_sCTP__Assoc__ID; M3UA__Types::M3UA__Routing__Context_template field_rctx; SCTP__Association__Address_template field_assoc; }; void M3UA__Entity_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_commStatus = ANY_OR_OMIT; single_value->field_sCTP__Assoc__ID = ANY_OR_OMIT; single_value->field_rctx = ANY_OR_OMIT; single_value->field_assoc = ANY_VALUE; } } } void M3UA__Entity_template::copy_value(const M3UA__Entity& other_value) { single_value = new single_value_struct; if (other_value.commStatus().is_bound()) { if (other_value.commStatus().ispresent()) single_value->field_commStatus = other_value.commStatus()(); else single_value->field_commStatus = OMIT_VALUE; } else { single_value->field_commStatus.clean_up(); } if (other_value.sCTP__Assoc__ID().is_bound()) { if (other_value.sCTP__Assoc__ID().ispresent()) single_value->field_sCTP__Assoc__ID = other_value.sCTP__Assoc__ID()(); else single_value->field_sCTP__Assoc__ID = OMIT_VALUE; } else { single_value->field_sCTP__Assoc__ID.clean_up(); } if (other_value.rctx().is_bound()) { if (other_value.rctx().ispresent()) single_value->field_rctx = other_value.rctx()(); else single_value->field_rctx = OMIT_VALUE; } else { single_value->field_rctx.clean_up(); } if (other_value.assoc().is_bound()) { single_value->field_assoc = other_value.assoc(); } else { single_value->field_assoc.clean_up(); } set_selection(SPECIFIC_VALUE); } void M3UA__Entity_template::copy_template(const M3UA__Entity_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.commStatus().get_selection()) { single_value->field_commStatus = other_value.commStatus(); } else { single_value->field_commStatus.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sCTP__Assoc__ID().get_selection()) { single_value->field_sCTP__Assoc__ID = other_value.sCTP__Assoc__ID(); } else { single_value->field_sCTP__Assoc__ID.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rctx().get_selection()) { single_value->field_rctx = other_value.rctx(); } else { single_value->field_rctx.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.assoc().get_selection()) { single_value->field_assoc = other_value.assoc(); } else { single_value->field_assoc.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 M3UA__Entity_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 M3UA__Entity_template(*other_value.implication_.precondition); implication_.implied_template = new M3UA__Entity_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 @M3UA_Emulation.M3UA_Entity."); break; } set_selection(other_value); } M3UA__Entity_template::M3UA__Entity_template() { } M3UA__Entity_template::M3UA__Entity_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } M3UA__Entity_template::M3UA__Entity_template(const M3UA__Entity& other_value) { copy_value(other_value); } M3UA__Entity_template::M3UA__Entity_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const M3UA__Entity&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @M3UA_Emulation.M3UA_Entity from an unbound optional field."); } } M3UA__Entity_template::M3UA__Entity_template(M3UA__Entity_template* p_precondition, M3UA__Entity_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } M3UA__Entity_template::M3UA__Entity_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; } M3UA__Entity_template::M3UA__Entity_template(const M3UA__Entity_template& other_value) : Base_Template() { copy_template(other_value); } M3UA__Entity_template::~M3UA__Entity_template() { clean_up(); } M3UA__Entity_template& M3UA__Entity_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } M3UA__Entity_template& M3UA__Entity_template::operator=(const M3UA__Entity& other_value) { clean_up(); copy_value(other_value); return *this; } M3UA__Entity_template& M3UA__Entity_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const M3UA__Entity&)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 @M3UA_Emulation.M3UA_Entity."); } return *this; } M3UA__Entity_template& M3UA__Entity_template::operator=(const M3UA__Entity_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean M3UA__Entity_template::match(const M3UA__Entity& 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.commStatus().is_bound()) return FALSE; if((other_value.commStatus().ispresent() ? !single_value->field_commStatus.match((const M3UA__CommStatus&)other_value.commStatus(), legacy) : !single_value->field_commStatus.match_omit(legacy)))return FALSE; if(!other_value.sCTP__Assoc__ID().is_bound()) return FALSE; if((other_value.sCTP__Assoc__ID().ispresent() ? !single_value->field_sCTP__Assoc__ID.match((const INTEGER&)other_value.sCTP__Assoc__ID(), legacy) : !single_value->field_sCTP__Assoc__ID.match_omit(legacy)))return FALSE; if(!other_value.rctx().is_bound()) return FALSE; if((other_value.rctx().ispresent() ? !single_value->field_rctx.match((const M3UA__Types::M3UA__Routing__Context&)other_value.rctx(), legacy) : !single_value->field_rctx.match_omit(legacy)))return FALSE; if(!other_value.assoc().is_bound()) return FALSE; if(!single_value->field_assoc.match(other_value.assoc(), 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 @M3UA_Emulation.M3UA_Entity."); } return FALSE; } boolean M3UA__Entity_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return (single_value->field_commStatus.is_omit() || single_value->field_commStatus.is_bound()) || (single_value->field_sCTP__Assoc__ID.is_omit() || single_value->field_sCTP__Assoc__ID.is_bound()) || (single_value->field_rctx.is_omit() || single_value->field_rctx.is_bound()) || single_value->field_assoc.is_bound(); } boolean M3UA__Entity_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return (single_value->field_commStatus.is_omit() || single_value->field_commStatus.is_value()) && (single_value->field_sCTP__Assoc__ID.is_omit() || single_value->field_sCTP__Assoc__ID.is_value()) && (single_value->field_rctx.is_omit() || single_value->field_rctx.is_value()) && single_value->field_assoc.is_value(); } void M3UA__Entity_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; } M3UA__Entity M3UA__Entity_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 @M3UA_Emulation.M3UA_Entity."); M3UA__Entity ret_val; if (single_value->field_commStatus.is_omit()) ret_val.commStatus() = OMIT_VALUE; else if (single_value->field_commStatus.is_bound()) { ret_val.commStatus() = single_value->field_commStatus.valueof(); } if (single_value->field_sCTP__Assoc__ID.is_omit()) ret_val.sCTP__Assoc__ID() = OMIT_VALUE; else if (single_value->field_sCTP__Assoc__ID.is_bound()) { ret_val.sCTP__Assoc__ID() = single_value->field_sCTP__Assoc__ID.valueof(); } if (single_value->field_rctx.is_omit()) ret_val.rctx() = OMIT_VALUE; else if (single_value->field_rctx.is_bound()) { ret_val.rctx() = single_value->field_rctx.valueof(); } if (single_value->field_assoc.is_bound()) { ret_val.assoc() = single_value->field_assoc.valueof(); } return ret_val; } void M3UA__Entity_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 @M3UA_Emulation.M3UA_Entity."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new M3UA__Entity_template[list_length]; } M3UA__Entity_template& M3UA__Entity_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 @M3UA_Emulation.M3UA_Entity."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @M3UA_Emulation.M3UA_Entity."); return value_list.list_value[list_index]; } M3UA__CommStatus_template& M3UA__Entity_template::commStatus() { set_specific(); return single_value->field_commStatus; } const M3UA__CommStatus_template& M3UA__Entity_template::commStatus() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field commStatus of a non-specific template of type @M3UA_Emulation.M3UA_Entity."); return single_value->field_commStatus; } INTEGER_template& M3UA__Entity_template::sCTP__Assoc__ID() { set_specific(); return single_value->field_sCTP__Assoc__ID; } const INTEGER_template& M3UA__Entity_template::sCTP__Assoc__ID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sCTP_Assoc_ID of a non-specific template of type @M3UA_Emulation.M3UA_Entity."); return single_value->field_sCTP__Assoc__ID; } M3UA__Types::M3UA__Routing__Context_template& M3UA__Entity_template::rctx() { set_specific(); return single_value->field_rctx; } const M3UA__Types::M3UA__Routing__Context_template& M3UA__Entity_template::rctx() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rctx of a non-specific template of type @M3UA_Emulation.M3UA_Entity."); return single_value->field_rctx; } SCTP__Association__Address_template& M3UA__Entity_template::assoc() { set_specific(); return single_value->field_assoc; } const SCTP__Association__Address_template& M3UA__Entity_template::assoc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field assoc of a non-specific template of type @M3UA_Emulation.M3UA_Entity."); return single_value->field_assoc; } int M3UA__Entity_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.M3UA_Entity which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_commStatus.is_present()) ret_val++; if (single_value->field_sCTP__Assoc__ID.is_present()) ret_val++; if (single_value->field_rctx.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 @M3UA_Emulation.M3UA_Entity 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 @M3UA_Emulation.M3UA_Entity containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.M3UA_Entity containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.M3UA_Entity containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.M3UA_Entity containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.M3UA_Entity containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.M3UA_Entity containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @M3UA_Emulation.M3UA_Entity containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @M3UA_Emulation.M3UA_Entity."); } return 0; } void M3UA__Entity_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ commStatus := "); single_value->field_commStatus.log(); TTCN_Logger::log_event_str(", sCTP_Assoc_ID := "); single_value->field_sCTP__Assoc__ID.log(); TTCN_Logger::log_event_str(", rctx := "); single_value->field_rctx.log(); TTCN_Logger::log_event_str(", assoc := "); single_value->field_assoc.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 M3UA__Entity_template::log_match(const M3UA__Entity& 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.commStatus().ispresent()){ if(!single_value->field_commStatus.match(match_value.commStatus(), legacy)){ TTCN_Logger::log_logmatch_info(".commStatus"); single_value->field_commStatus.log_match(match_value.commStatus(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_commStatus.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".commStatus := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_commStatus.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.sCTP__Assoc__ID().ispresent()){ if(!single_value->field_sCTP__Assoc__ID.match(match_value.sCTP__Assoc__ID(), legacy)){ TTCN_Logger::log_logmatch_info(".sCTP_Assoc_ID"); single_value->field_sCTP__Assoc__ID.log_match(match_value.sCTP__Assoc__ID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_sCTP__Assoc__ID.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".sCTP_Assoc_ID := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_sCTP__Assoc__ID.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.rctx().ispresent()){ if(!single_value->field_rctx.match(match_value.rctx(), legacy)){ TTCN_Logger::log_logmatch_info(".rctx"); single_value->field_rctx.log_match(match_value.rctx(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_rctx.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".rctx := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_rctx.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_assoc.match(match_value.assoc(), legacy)){ TTCN_Logger::log_logmatch_info(".assoc"); single_value->field_assoc.log_match(match_value.assoc(), 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("{ commStatus := "); if (match_value.commStatus().ispresent()) { single_value->field_commStatus.log_match(match_value.commStatus(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_commStatus.log(); if (single_value->field_commStatus.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", sCTP_Assoc_ID := "); if (match_value.sCTP__Assoc__ID().ispresent()) { single_value->field_sCTP__Assoc__ID.log_match(match_value.sCTP__Assoc__ID(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_sCTP__Assoc__ID.log(); if (single_value->field_sCTP__Assoc__ID.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", rctx := "); if (match_value.rctx().ispresent()) { single_value->field_rctx.log_match(match_value.rctx(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_rctx.log(); if (single_value->field_rctx.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", assoc := "); single_value->field_assoc.log_match(match_value.assoc(), 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 M3UA__Entity_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (!commStatus().is_bound()) commStatus() = OMIT_VALUE; else commStatus().set_implicit_omit(); if (!sCTP__Assoc__ID().is_bound()) sCTP__Assoc__ID() = OMIT_VALUE; else sCTP__Assoc__ID().set_implicit_omit(); if (!rctx().is_bound()) rctx() = OMIT_VALUE; else rctx().set_implicit_omit(); if (assoc().is_bound()) assoc().set_implicit_omit(); } void M3UA__Entity_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_commStatus.encode_text(text_buf); single_value->field_sCTP__Assoc__ID.encode_text(text_buf); single_value->field_rctx.encode_text(text_buf); single_value->field_assoc.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 @M3UA_Emulation.M3UA_Entity."); } } void M3UA__Entity_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_commStatus.decode_text(text_buf); single_value->field_sCTP__Assoc__ID.decode_text(text_buf); single_value->field_rctx.decode_text(text_buf); single_value->field_assoc.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 M3UA__Entity_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 @M3UA_Emulation.M3UA_Entity."); } } void M3UA__Entity_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: { M3UA__Entity_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) commStatus().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sCTP__Assoc__ID().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rctx().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) assoc().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "commStatus")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { commStatus().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sCTP_Assoc_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sCTP__Assoc__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rctx")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rctx().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "assoc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { assoc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @M3UA_Emulation.M3UA_Entity: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { M3UA__Entity_template* precondition = new M3UA__Entity_template; precondition->set_param(*param.get_elem(0)); M3UA__Entity_template* implied_template = new M3UA__Entity_template; implied_template->set_param(*param.get_elem(1)); *this = M3UA__Entity_template(precondition, implied_template); } break; default: param.type_error("record template", "@M3UA_Emulation.M3UA_Entity"); } is_ifpresent = param.get_ifpresent(); } void M3UA__Entity_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_commStatus.check_restriction(t_res, t_name ? t_name : "@M3UA_Emulation.M3UA_Entity"); single_value->field_sCTP__Assoc__ID.check_restriction(t_res, t_name ? t_name : "@M3UA_Emulation.M3UA_Entity"); single_value->field_rctx.check_restriction(t_res, t_name ? t_name : "@M3UA_Emulation.M3UA_Entity"); single_value->field_assoc.check_restriction(t_res, t_name ? t_name : "@M3UA_Emulation.M3UA_Entity"); 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 : "@M3UA_Emulation.M3UA_Entity"); } boolean M3UA__Entity_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean M3UA__Entity_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(int other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @M3UA_Emulation.M3UA_CommStatus."); if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @M3UA_Emulation.M3UA_CommStatus comparison is an unknown numeric value %d", other_value); return enum_value > other_value; } boolean M3UA__CommStatus::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @M3UA_Emulation.M3UA_CommStatus."); return enum_value > other_value; } boolean M3UA__CommStatus::operator>(const M3UA__CommStatus& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @M3UA_Emulation.M3UA_CommStatus."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @M3UA_Emulation.M3UA_CommStatus."); return enum_value > other_value.enum_value; } const char *M3UA__CommStatus::enum_to_str(enum_type enum_par) { switch (enum_par) { case aSP__Down__initial__State: return "aSP_Down_initial_State"; case aSP__Down__sCTP__Initialize__Done: return "aSP_Down_sCTP_Initialize_Done"; case aSP__Down__sCTP__Associate__done: return "aSP_Down_sCTP_Associate_done"; case aSP__Down__commUP__Received: return "aSP_Down_commUP_Received"; case aSP__Down__ASPUP__Sent: return "aSP_Down_ASPUP_Sent"; case aSP__Inactive: return "aSP_Inactive"; case aSP__Inact__ASPAC__Sent: return "aSP_Inact_ASPAC_Sent"; case aSP__Active: return "aSP_Active"; default: return ""; } } M3UA__CommStatus::enum_type M3UA__CommStatus::str_to_enum(const char *str_par, const int* int_par, const int* int_par2) { if (int_par == NULL && int_par2 == NULL) { if (!strcmp(str_par, "aSP_Down_initial_State")) return aSP__Down__initial__State; if (!strcmp(str_par, "aSP_Down_sCTP_Initialize_Done")) return aSP__Down__sCTP__Initialize__Done; if (!strcmp(str_par, "aSP_Down_sCTP_Associate_done")) return aSP__Down__sCTP__Associate__done; if (!strcmp(str_par, "aSP_Down_commUP_Received")) return aSP__Down__commUP__Received; if (!strcmp(str_par, "aSP_Down_ASPUP_Sent")) return aSP__Down__ASPUP__Sent; if (!strcmp(str_par, "aSP_Inactive")) return aSP__Inactive; if (!strcmp(str_par, "aSP_Inact_ASPAC_Sent")) return aSP__Inact__ASPAC__Sent; if (!strcmp(str_par, "aSP_Active")) return aSP__Active; } return UNKNOWN_VALUE; } boolean M3UA__CommStatus::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: return TRUE; default: return FALSE; } } int M3UA__CommStatus::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @M3UA_Emulation.M3UA_CommStatus.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int M3UA__CommStatus::enum2int(const M3UA__CommStatus& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @M3UA_Emulation.M3UA_CommStatus.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void M3UA__CommStatus::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @M3UA_Emulation.M3UA_CommStatus.", int_val); enum_value = (enum_type)int_val; } M3UA__CommStatus::operator M3UA__CommStatus::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @M3UA_Emulation.M3UA_CommStatus."); return enum_value; } void M3UA__CommStatus::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void M3UA__CommStatus::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@M3UA_Emulation.M3UA_CommStatus"); enum_value = str_to_enum(param.get_enumerated(), param.get_enumerated_value()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @M3UA_Emulation.M3UA_CommStatus."); } } void M3UA__CommStatus::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @M3UA_Emulation.M3UA_CommStatus."); text_buf.push_int(enum_value); } void M3UA__CommStatus::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @M3UA_Emulation.M3UA_CommStatus.", enum_value); } void M3UA__CommStatus_template::copy_template(const M3UA__CommStatus_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new M3UA__CommStatus_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 M3UA__CommStatus_template(*other_value.implication_.precondition); implication_.implied_template = new M3UA__CommStatus_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @M3UA_Emulation.M3UA_CommStatus."); } } M3UA__CommStatus_template::M3UA__CommStatus_template() { } M3UA__CommStatus_template::M3UA__CommStatus_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } M3UA__CommStatus_template::M3UA__CommStatus_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!M3UA__CommStatus::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @M3UA_Emulation.M3UA_CommStatus with unknown numeric value %d.", other_value); single_value = (M3UA__CommStatus::enum_type)other_value; } M3UA__CommStatus_template::M3UA__CommStatus_template(M3UA__CommStatus::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } M3UA__CommStatus_template::M3UA__CommStatus_template(const M3UA__CommStatus& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == M3UA__CommStatus::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @M3UA_Emulation.M3UA_CommStatus."); single_value = other_value.enum_value; } M3UA__CommStatus_template::M3UA__CommStatus_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (M3UA__CommStatus::enum_type)(const M3UA__CommStatus&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @M3UA_Emulation.M3UA_CommStatus from an unbound optional field."); } } M3UA__CommStatus_template::M3UA__CommStatus_template(M3UA__CommStatus_template* p_precondition, M3UA__CommStatus_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } M3UA__CommStatus_template::M3UA__CommStatus_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; } M3UA__CommStatus_template::M3UA__CommStatus_template(const M3UA__CommStatus_template& other_value) : Base_Template() { copy_template(other_value); } M3UA__CommStatus_template::~M3UA__CommStatus_template() { clean_up(); } boolean M3UA__CommStatus_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean M3UA__CommStatus_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != M3UA__CommStatus::UNBOUND_VALUE; } void M3UA__CommStatus_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } M3UA__CommStatus_template& M3UA__CommStatus_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } M3UA__CommStatus_template& M3UA__CommStatus_template::operator=(int other_value) { if (!M3UA__CommStatus::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @M3UA_Emulation.M3UA_CommStatus.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (M3UA__CommStatus::enum_type)other_value; return *this; } M3UA__CommStatus_template& M3UA__CommStatus_template::operator=(M3UA__CommStatus::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } M3UA__CommStatus_template& M3UA__CommStatus_template::operator=(const M3UA__CommStatus& other_value) { if (other_value.enum_value == M3UA__CommStatus::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @M3UA_Emulation.M3UA_CommStatus to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } M3UA__CommStatus_template& M3UA__CommStatus_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (M3UA__CommStatus::enum_type)(const M3UA__CommStatus&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @M3UA_Emulation.M3UA_CommStatus."); } return *this; } M3UA__CommStatus_template& M3UA__CommStatus_template::operator=(const M3UA__CommStatus_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean M3UA__CommStatus_template::match(M3UA__CommStatus::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @M3UA_Emulation.M3UA_CommStatus."); } return FALSE; } boolean M3UA__CommStatus_template::match(const M3UA__CommStatus& other_value, boolean) const { if (other_value.enum_value == M3UA__CommStatus::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @M3UA_Emulation.M3UA_CommStatus with an unbound value."); return match(other_value.enum_value); } M3UA__CommStatus::enum_type M3UA__CommStatus_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @M3UA_Emulation.M3UA_CommStatus."); return single_value; } void M3UA__CommStatus_template::set_type(template_sel template_type, unsigned int list_length) { clean_up(); switch (template_type) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new M3UA__CommStatus_template[list_length]; break; default: TTCN_error("Setting an invalid type for a template of enumerated type @M3UA_Emulation.M3UA_CommStatus."); } } M3UA__CommStatus_template& M3UA__CommStatus_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @M3UA_Emulation.M3UA_CommStatus."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @M3UA_Emulation.M3UA_CommStatus."); return value_list.list_value[list_index]; } void M3UA__CommStatus_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(M3UA__CommStatus::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void M3UA__CommStatus_template::log_match(const M3UA__CommStatus& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void M3UA__CommStatus_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @M3UA_Emulation.M3UA_CommStatus."); } } void M3UA__CommStatus_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (M3UA__CommStatus::enum_type)text_buf.pull_int().get_val(); if (!M3UA__CommStatus::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @M3UA_Emulation.M3UA_CommStatus.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new M3UA__CommStatus_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @M3UA_Emulation.M3UA_CommStatus."); } } boolean M3UA__CommStatus_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean M3UA__CommStatus_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { M3UA__CommStatus_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { M3UA__CommStatus::enum_type enum_val = M3UA__CommStatus::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value()); if (!M3UA__CommStatus::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @M3UA_Emulation.M3UA_CommStatus."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { M3UA__CommStatus_template* precondition = new M3UA__CommStatus_template; precondition->set_param(*m_p->get_elem(0)); M3UA__CommStatus_template* implied_template = new M3UA__CommStatus_template; implied_template->set_param(*m_p->get_elem(1)); *this = M3UA__CommStatus_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@M3UA_Emulation.M3UA_CommStatus"); } is_ifpresent = param.get_ifpresent(); } void M3UA__CommStatus_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@M3UA_Emulation.M3UA_CommStatus"); } void MTP3asp__SP__PT__Int::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; 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 MTP3asp__SP__PT__Int::clear_queue() { while (msg_queue_head != NULL) remove_msg_queue_head(); } MTP3asp__SP__PT__Int::MTP3asp__SP__PT__Int(const char *par_port_name) : PORT(par_port_name) { msg_queue_head = NULL; msg_queue_tail = NULL; } MTP3asp__SP__PT__Int::~MTP3asp__SP__PT__Int() { clear_queue(); } void MTP3asp__SP__PT__Int::send(const MTP3asp__Types::ASP__MTP3__TRANSFERind& 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(" @MTP3asp_Types.ASP_MTP3_TRANSFERind : "), 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, "@MTP3asp_Types.ASP_MTP3_TRANSFERind"); send_par.encode_text(text_buf); send_data(text_buf, destination_component); } } void MTP3asp__SP__PT__Int::send(const MTP3asp__Types::ASP__MTP3__TRANSFERind& 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 MTP3asp__SP__PT__Int::send(const MTP3asp__Types::ASP__MTP3__TRANSFERind& 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, "@MTP3asp_Types.ASP_MTP3_TRANSFERind"); 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(" @MTP3asp_Types.ASP_MTP3_TRANSFERind : "), send_par.log(), TTCN_Logger::end_event_log2str())); } else send(send_par, COMPONENT(get_default_destination()), timestamp_redirect); } void MTP3asp__SP__PT__Int::send(const MTP3asp__Types::ASP__MTP3__TRANSFERind_template& send_par, const COMPONENT& destination_component, FLOAT* timestamp_redirect) { const MTP3asp__Types::ASP__MTP3__TRANSFERind& send_par_value = MTP3asp__Types::ASP__MTP3__TRANSFERind(send_par.valueof()); send(send_par_value, destination_component, timestamp_redirect); } void MTP3asp__SP__PT__Int::send(const MTP3asp__Types::ASP__MTP3__TRANSFERind_template& send_par, size_t nof_components, const COMPONENT* destination_components, FLOAT* timestamp_redirect) { const MTP3asp__Types::ASP__MTP3__TRANSFERind& send_par_value = MTP3asp__Types::ASP__MTP3__TRANSFERind(send_par.valueof()); send(send_par_value, nof_components, destination_components, timestamp_redirect); } void MTP3asp__SP__PT__Int::send(const MTP3asp__Types::ASP__MTP3__TRANSFERind_template& send_par, boolean broadcast, FLOAT* timestamp_redirect) { const MTP3asp__Types::ASP__MTP3__TRANSFERind& send_par_value = MTP3asp__Types::ASP__MTP3__TRANSFERind(send_par.valueof()); send(send_par_value, broadcast, timestamp_redirect); } alt_status MTP3asp__SP__PT__Int::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(": @MTP3asp_Types.ASP_MTP3_TRANSFERreq: "), my_head->message_0->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 MTP3asp__SP__PT__Int::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(": @MTP3asp_Types.ASP_MTP3_TRANSFERreq: "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); break; default: TTCN_error("Internal error: unknown message"); } } return ALT_YES; } } alt_status MTP3asp__SP__PT__Int::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(": @MTP3asp_Types.ASP_MTP3_TRANSFERreq: "), my_head->message_0->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 MTP3asp__SP__PT__Int::receive(const MTP3asp__Types::ASP__MTP3__TRANSFERreq_template& value_template, MTP3asp__Types::ASP__MTP3__TRANSFERreq *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 @MTP3asp_Types.ASP_MTP3_TRANSFERreq.", 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(": @MTP3asp_Types.ASP_MTP3_TRANSFERreq : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } alt_status MTP3asp__SP__PT__Int::check_receive(const MTP3asp__Types::ASP__MTP3__TRANSFERreq_template& value_template, MTP3asp__Types::ASP__MTP3__TRANSFERreq *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 @MTP3asp_Types.ASP_MTP3_TRANSFERreq.", 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(": @MTP3asp_Types.ASP_MTP3_TRANSFERreq : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } return ALT_YES; } } alt_status MTP3asp__SP__PT__Int::trigger(const MTP3asp__Types::ASP__MTP3__TRANSFERreq_template& value_template, MTP3asp__Types::ASP__MTP3__TRANSFERreq *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 @MTP3asp_Types.ASP_MTP3_TRANSFERreq.", 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(": @MTP3asp_Types.ASP_MTP3_TRANSFERreq : "), my_head->message_0->log(), TTCN_Logger::end_event_log2str()), msg_head_count+1); } remove_msg_queue_head(); return ALT_YES; } } void MTP3asp__SP__PT__Int::incoming_message(const MTP3asp__Types::ASP__MTP3__TRANSFERreq& 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(" @MTP3asp_Types.ASP_MTP3_TRANSFERreq : "), 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 MTP3asp__Types::ASP__MTP3__TRANSFERreq(incoming_par); new_item->sender_component = sender_component; append_to_msg_queue(new_item); } boolean MTP3asp__SP__PT__Int::process_message(const char *message_type, Text_Buf& incoming_buf, component sender_component, OCTETSTRING&) { if (!strcmp(message_type, "@MTP3asp_Types.ASP_MTP3_TRANSFERreq")) { MTP3asp__Types::ASP__MTP3__TRANSFERreq incoming_par; incoming_par.decode_text(incoming_buf); incoming_message(incoming_par, sender_component); return TRUE; } else return FALSE; } as__SCTP__CommunicationUp_Default::as__SCTP__CommunicationUp_Default() : Default_Base("as_SCTP_CommunicationUp") { } alt_status as__SCTP__CommunicationUp_Default::call_altstep(boolean first_alt_run) { return as__SCTP__CommunicationUp_instance(first_alt_run); } as__SCTP__DataArrive_Default::as__SCTP__DataArrive_Default() : Default_Base("as_SCTP_DataArrive") { } alt_status as__SCTP__DataArrive_Default::call_altstep(boolean first_alt_run) { return as__SCTP__DataArrive_instance(first_alt_run); } as__SCTP__Connected_Default::as__SCTP__Connected_Default() : Default_Base("as_SCTP_Connected") { } alt_status as__SCTP__Connected_Default::call_altstep(boolean first_alt_run) { return as__SCTP__Connected_instance(first_alt_run); } as__Unexpected__SCTP__Events_Default::as__Unexpected__SCTP__Events_Default() : Default_Base("as_Unexpected_SCTP_Events") { } alt_status as__Unexpected__SCTP__Events_Default::call_altstep(boolean first_alt_run) { return as__Unexpected__SCTP__Events_instance(first_alt_run); } as__handleM3UA__timers_Default::as__handleM3UA__timers_Default() : Default_Base("as_handleM3UA_timers") { } alt_status as__handleM3UA__timers_Default::call_altstep(boolean first_alt_run) { return as__handleM3UA__timers_instance(first_alt_run); } as__handleSCTP__timers_Default::as__handleSCTP__timers_Default() : Default_Base("as_handleSCTP_timers") { } alt_status as__handleSCTP__timers_Default::call_altstep(boolean first_alt_run) { return as__handleSCTP__timers_instance(first_alt_run); } /* Bodies of functions, altsteps and testcases */ boolean operator==(null_type, const TRANSFERreq__Buffer& other_value) { if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @M3UA_Emulation.TRANSFERreq_Buffer."); return other_value.val_ptr->n_elements == 0; } SCTPasp__Types::ASP__SCTP_template t__S__SCTP__Send(const INTEGER_template& pl__associationID, const INTEGER_template& pl__streamID, const OCTETSTRING_template& pl__userData, const INTEGER_template& pl__protocolID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 116, TTCN_Location::LOCATION_TEMPLATE, "t_S_SCTP_Send"); SCTPasp__Types::ASP__SCTP_template ret_val; ret_val.client__id() = pl__associationID; ret_val.sinfo__stream() = pl__streamID; ret_val.sinfo__ppid() = pl__protocolID; ret_val.data() = pl__userData; return ret_val; } SCTPasp__Types::ASP__SCTP__SEND__FAILED_template t__ASP__SCTP__SEND__FAILED(const INTEGER_template& pl__streamID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 128, TTCN_Location::LOCATION_TEMPLATE, "t_ASP_SCTP_SEND_FAILED"); SCTPasp__Types::ASP__SCTP__SEND__FAILED_template ret_val; ret_val.client__id() = pl__streamID; return ret_val; } SCTPasp__Types::ASP__SCTP__Listen_template t__ASP__SCTP__Listen(const CHARSTRING_template& pl__local__hostname, const INTEGER_template& pl__local__portnumber) { TTCN_Location current_location("M3UA_Emulation.ttcn", 134, TTCN_Location::LOCATION_TEMPLATE, "t_ASP_SCTP_Listen"); SCTPasp__Types::ASP__SCTP__Listen_template ret_val; ret_val.local__hostname() = pl__local__hostname; ret_val.local__portnumber() = pl__local__portnumber; return ret_val; } SCTPasp__Types::ASP__SCTP__Connected_template tr__ASP__SCTP__Connected(const INTEGER_template& pl__client__id, const CHARSTRING_template& pl__local__hostname, const INTEGER_template& pl__local__portnumber, const CHARSTRING_template& pl__peer__hostname, const INTEGER_template& pl__peer__portnumber) { TTCN_Location current_location("M3UA_Emulation.ttcn", 142, TTCN_Location::LOCATION_TEMPLATE, "tr_ASP_SCTP_Connected"); SCTPasp__Types::ASP__SCTP__Connected_template ret_val; ret_val.client__id() = pl__client__id; ret_val.local__hostname() = pl__local__hostname; ret_val.local__portnumber() = pl__local__portnumber; ret_val.peer__hostname() = pl__peer__hostname; ret_val.peer__portnumber() = pl__peer__portnumber; return ret_val; } SCTPasp__Types::ASP__SCTP__ConnectFrom_template t__ASP__SCTP__ConnectFrom(const CHARSTRING_template& pl__local__hostname, const INTEGER_template& pl__local__portnumber, const CHARSTRING_template& pl__peer__hostname, const INTEGER_template& pl__peer__portnumber) { TTCN_Location current_location("M3UA_Emulation.ttcn", 156, TTCN_Location::LOCATION_TEMPLATE, "t_ASP_SCTP_ConnectFrom"); SCTPasp__Types::ASP__SCTP__ConnectFrom_template ret_val; ret_val.local__hostname() = pl__local__hostname; ret_val.local__portnumber() = pl__local__portnumber; ret_val.peer__hostname() = pl__peer__hostname; ret_val.peer__portnumber() = pl__peer__portnumber; return ret_val; } SCTPasp__Types::ASP__SCTP__RESULT_template t__ASP__SCTP__RESULT(const INTEGER_template& pl__client__id, const BOOLEAN_template& pl__error__status, const CHARSTRING_template& pl__error__message) { TTCN_Location current_location("M3UA_Emulation.ttcn", 168, TTCN_Location::LOCATION_TEMPLATE, "t_ASP_SCTP_RESULT"); SCTPasp__Types::ASP__SCTP__RESULT_template ret_val; ret_val.client__id() = pl__client__id; ret_val.error__status() = pl__error__status; ret_val.error__message() = pl__error__message; return ret_val; } SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template tr__S__SCTP__CommunicationUp(const INTEGER_template& pl__associationID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 178, TTCN_Location::LOCATION_TEMPLATE, "tr_S_SCTP_CommunicationUp"); SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template ret_val; ret_val.client__id() = pl__associationID; ret_val.sac__state() = SCTPasp__Types::SAC__STATE::SCTP__COMM__UP; return ret_val; } SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template tr__S__SCTP__CommunicationLost(const INTEGER_template& pl__associationID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 185, TTCN_Location::LOCATION_TEMPLATE, "tr_S_SCTP_CommunicationLost"); SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template ret_val; ret_val.client__id() = pl__associationID; ret_val.sac__state() = SCTPasp__Types::SAC__STATE::SCTP__COMM__LOST; return ret_val; } SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template tr__S__SCTP__ShutdownComplete(const INTEGER_template& pl__associationID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 192, TTCN_Location::LOCATION_TEMPLATE, "tr_S_SCTP_ShutdownComplete"); SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template ret_val; ret_val.client__id() = pl__associationID; ret_val.sac__state() = SCTPasp__Types::SAC__STATE::SCTP__SHUTDOWN__COMP; return ret_val; } SCTPasp__Types::ASP__SCTP__SHUTDOWN__EVENT_template tr__S__SCTP__ShutdownEvent(const INTEGER_template& pl__associationID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 199, TTCN_Location::LOCATION_TEMPLATE, "tr_S_SCTP_ShutdownEvent"); SCTPasp__Types::ASP__SCTP__SHUTDOWN__EVENT_template ret_val; ret_val.client__id() = pl__associationID; return ret_val; } SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template tr__S__SCTP__Restart(const INTEGER_template& pl__associationID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 205, TTCN_Location::LOCATION_TEMPLATE, "tr_S_SCTP_Restart"); SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template ret_val; ret_val.client__id() = pl__associationID; ret_val.sac__state() = SCTPasp__Types::SAC__STATE::SCTP__RESTART; return ret_val; } SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template tr__S__SCTP__CANT__STR__ASSOC(const INTEGER_template& pl__associationID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 212, TTCN_Location::LOCATION_TEMPLATE, "tr_S_SCTP_CANT_STR_ASSOC"); SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE_template ret_val; ret_val.client__id() = pl__associationID; ret_val.sac__state() = SCTPasp__Types::SAC__STATE::SCTP__CANT__STR__ASSOC; return ret_val; } SCTPasp__Types::ASP__SCTP_template tr__S__SCTP__DataArrive(const INTEGER_template& pl__associationID, const INTEGER_template& pl__streamID, const INTEGER_template& pl__protocolID, const OCTETSTRING_template& pl__data) { TTCN_Location current_location("M3UA_Emulation.ttcn", 219, TTCN_Location::LOCATION_TEMPLATE, "tr_S_SCTP_DataArrive"); SCTPasp__Types::ASP__SCTP_template ret_val; ret_val.client__id() = pl__associationID; ret_val.sinfo__stream() = pl__streamID; ret_val.sinfo__ppid() = pl__protocolID; ret_val.data() = pl__data; return ret_val; } SCTPasp__Types::ASP__SCTP__Close_template t__ASP__SCTP__Close(const INTEGER_template& pl__associationID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 231, TTCN_Location::LOCATION_TEMPLATE, "t_ASP_SCTP_Close"); SCTPasp__Types::ASP__SCTP__Close_template ret_val; ret_val.client__id() = pl__associationID; return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__ASPUP(const M3UA__Types::M3UA__ASP__Identifier_template& pl__aSP__Identifier, const M3UA__Types::M3UA__Info__String_template& pl__info__String) { TTCN_Location current_location("M3UA_Emulation.ttcn", 243, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_ASPUP"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__ASPUP_template& tmp_0 = ret_val.m3UA__ASPUP(); tmp_0.version() = os_0; tmp_0.reserved() = os_1; tmp_0.messageClassAndType() = os_2; tmp_0.messageLength() = 0; { M3UA__Types::M3UA__ASPUP__MessageParameters_template& tmp_1 = tmp_0.messageParameters(); tmp_1.aSP__Identifier() = pl__aSP__Identifier; tmp_1.info__String() = pl__info__String; } } return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__ASPAC(const M3UA__Types::M3UA__Traffic__Mode__Type_template& pl__traffic__Mode__Type, const M3UA__Types::M3UA__Routing__Context_template& pl__routing__Context, const M3UA__Types::M3UA__Info__String_template& pl__info__String) { TTCN_Location current_location("M3UA_Emulation.ttcn", 298, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_ASPAC"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__ASPAC_template& tmp_5 = ret_val.m3UA__ASPAC(); tmp_5.version() = os_0; tmp_5.reserved() = os_1; tmp_5.messageClassAndType() = os_6; tmp_5.messageLength() = 0; { M3UA__Types::M3UA__ASPAC__MessageParameters_template& tmp_6 = tmp_5.messageParameters(); tmp_6.traffic__Mode__Type() = pl__traffic__Mode__Type; tmp_6.routing__Context() = pl__routing__Context; tmp_6.info__String() = pl__info__String; } } return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__ASPAC__Ack(const M3UA__Types::M3UA__Traffic__Mode__Type_template& pl__traffic__mode__type, const M3UA__Types::M3UA__Routing__Context_template& pl__routing__Context) { TTCN_Location current_location("M3UA_Emulation.ttcn", 316, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_ASPAC_Ack"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__ASPAC__Ack_template& tmp_7 = ret_val.m3UA__ASPAC__Ack(); tmp_7.version() = os_0; tmp_7.reserved() = os_1; tmp_7.messageClassAndType() = os_7; tmp_7.messageLength() = 0; { M3UA__Types::M3UA__ASPAC__Ack__MessageParameters_template& tmp_8 = tmp_7.messageParameters(); tmp_8.traffic__Mode__Type() = pl__traffic__mode__type; tmp_8.routing__Context() = pl__routing__Context; tmp_8.info__String() = OMIT_VALUE; } } return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__ASPIA(const M3UA__Types::M3UA__Routing__Context_template& pl__routing__Context, const M3UA__Types::M3UA__Info__String_template& pl__info__String) { TTCN_Location current_location("M3UA_Emulation.ttcn", 333, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_ASPIA"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__ASPIA_template& tmp_9 = ret_val.m3UA__ASPIA(); tmp_9.version() = os_0; tmp_9.reserved() = os_1; tmp_9.messageClassAndType() = os_8; tmp_9.messageLength() = 0; { M3UA__Types::M3UA__ASPIA__MessageParameters_template& tmp_10 = tmp_9.messageParameters(); tmp_10.routing__Context() = pl__routing__Context; tmp_10.info__String() = pl__info__String; } } return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__ASPIA__Ack(const M3UA__Types::M3UA__Routing__Context_template& pl__routing__Context) { TTCN_Location current_location("M3UA_Emulation.ttcn", 349, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_ASPIA_Ack"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__ASPIA__Ack_template& tmp_11 = ret_val.m3UA__ASPIA__Ack(); tmp_11.version() = os_0; tmp_11.reserved() = os_1; tmp_11.messageClassAndType() = os_9; tmp_11.messageLength() = 0; { M3UA__Types::M3UA__ASPIA__Ack__MessageParameters_template& tmp_12 = tmp_11.messageParameters(); tmp_12.routing__Context() = pl__routing__Context; tmp_12.info__String() = OMIT_VALUE; } } return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__Heartbeat(const M3UA__Types::M3UA__Heartbeat__Data_template& pl__heartbeat__Data) { TTCN_Location current_location("M3UA_Emulation.ttcn", 364, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_Heartbeat"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__BEAT_template& tmp_13 = ret_val.m3UA__BEAT(); tmp_13.version() = os_0; tmp_13.reserved() = os_1; tmp_13.messageClassAndType() = os_10; tmp_13.messageLength() = 0; tmp_13.messageParameters().heartbeat__Data() = pl__heartbeat__Data; } return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__Beat__Ack(const M3UA__Types::M3UA__Heartbeat__Data_template& pl__heartbeat__Data) { TTCN_Location current_location("M3UA_Emulation.ttcn", 378, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_Beat_Ack"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__BEAT__Ack_template& tmp_14 = ret_val.m3UA__BEAT__Ack(); tmp_14.version() = os_0; tmp_14.reserved() = os_1; tmp_14.messageClassAndType() = os_11; tmp_14.messageLength() = 0; tmp_14.messageParameters().heartbeat__Data() = pl__heartbeat__Data; } return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__NOTIFY(const M3UA__Types::M3UA__Status_template& pl__status, const M3UA__Types::M3UA__ASP__Identifier_template& pl__aSP__Identifier, const M3UA__Types::M3UA__Routing__Context_template& pl__routing__Context, const M3UA__Types::M3UA__Info__String_template& pl__info__String) { TTCN_Location current_location("M3UA_Emulation.ttcn", 392, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_NOTIFY"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__NOTIFY_template& tmp_15 = ret_val.m3UA__NOTIFY(); tmp_15.version() = os_0; tmp_15.reserved() = os_1; tmp_15.messageClassAndType() = os_12; tmp_15.messageLength() = 0; { M3UA__Types::M3UA__NOTIFY__MessageParameters_template& tmp_16 = tmp_15.messageParameters(); tmp_16.status() = pl__status; tmp_16.aSP__Identifier() = pl__aSP__Identifier; tmp_16.routing__Context() = pl__routing__Context; tmp_16.info__String() = pl__info__String; } } return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__DATA(const M3UA__Types::M3UA__Network__Appearance_template& pl__network__Appearance, const M3UA__Types::M3UA__Routing__Context_template& pl__routing__Context, const M3UA__Types::M3UA__Protocol__Data_template& pl__protocol__Data, const M3UA__Types::M3UA__Correlation__ID_template& pl__correlation__ID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 412, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_DATA"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__DATA_template& tmp_17 = ret_val.m3UA__DATA(); tmp_17.version() = os_0; tmp_17.reserved() = os_1; tmp_17.messageClassAndType() = os_13; tmp_17.messageLength() = 0; { M3UA__Types::M3UA__DATA__MessageParameters_template& tmp_18 = tmp_17.messageParameters(); tmp_18.network__Appearance() = pl__network__Appearance; tmp_18.routing__Context() = pl__routing__Context; tmp_18.protocol__Data() = pl__protocol__Data; tmp_18.correlation__ID() = pl__correlation__ID; } } return ret_val; } M3UA__Types::PDU__M3UA_template t__PDU__M3UA__DAVA(const M3UA__Types::M3UA__Network__Appearance_template& pl__network__Appearance, const M3UA__Types::M3UA__Routing__Context_template& pl__routing__Context, const M3UA__Types::M3UA__Affected__Point__Codes_template& pl__affected__Point__Codes, const M3UA__Types::M3UA__Info__String_template& pl__info__String) { TTCN_Location current_location("M3UA_Emulation.ttcn", 432, TTCN_Location::LOCATION_TEMPLATE, "t_PDU_M3UA_DAVA"); M3UA__Types::PDU__M3UA_template ret_val; { M3UA__Types::M3UA__DAVA_template& tmp_19 = ret_val.m3UA__DAVA(); tmp_19.version() = os_0; tmp_19.reserved() = os_1; tmp_19.messageClassAndType() = os_14; tmp_19.messageLength() = 0; { M3UA__Types::M3UA__DAVA__MessageParameters_template& tmp_20 = tmp_19.messageParameters(); tmp_20.network__Appearance() = pl__network__Appearance; tmp_20.routing__Context() = pl__routing__Context; tmp_20.affected__Point__Codes() = pl__affected__Point__Codes; tmp_20.info__String() = pl__info__String; } } return ret_val; } M3UA__Types::M3UA__Protocol__Data_template t__M3UA__Protocol__Data(const OCTETSTRING_template& pl__oPC, const OCTETSTRING_template& pl__dPC, const OCTETSTRING_template& pl__sI, const OCTETSTRING_template& pl__nI, const OCTETSTRING_template& pl__mP, const OCTETSTRING_template& pl__sLS, const OCTETSTRING_template& pl__userProtocolData) { TTCN_Location current_location("M3UA_Emulation.ttcn", 458, TTCN_Location::LOCATION_TEMPLATE, "t_M3UA_Protocol_Data"); M3UA__Types::M3UA__Protocol__Data_template ret_val; ret_val.tag() = os_15; ret_val.lengthInd() = 0; ret_val.oPC() = pl__oPC; ret_val.dPC() = pl__dPC; ret_val.sI() = pl__sI; ret_val.nI() = pl__nI; ret_val.mP() = pl__mP; ret_val.sLS() = pl__sLS; ret_val.userProtocolData() = pl__userProtocolData; return ret_val; } M3UA__Types::M3UA__Routing__Context_template t__RoutingContext(const OCTETSTRING& rctx) { TTCN_Location current_location("M3UA_Emulation.ttcn", 485, TTCN_Location::LOCATION_TEMPLATE, "t_RoutingContext"); M3UA__Types::M3UA__Routing__Context_template ret_val; ret_val.tag() = os_16; ret_val.lengthInd() = 8; ret_val.routingContext() = rctx; return ret_val; } M3UA__Types::M3UA__Status_template t__Status(const OCTETSTRING& status__type, const OCTETSTRING& status__info) { TTCN_Location current_location("M3UA_Emulation.ttcn", 491, TTCN_Location::LOCATION_TEMPLATE, "t_Status"); M3UA__Types::M3UA__Status_template ret_val; ret_val.tag() = os_17; ret_val.lengthInd() = 8; ret_val.statusType() = status__type; ret_val.statusInfo() = status__info; return ret_val; } void f__M3UA__Emulation(const SCTP__Association__Address& pl__Boot, const INTEGER_template& rctx) { TTCN_Location current_location("M3UA_Emulation.ttcn", 498, TTCN_Location::LOCATION_FUNCTION, "f_M3UA_Emulation"); current_location.update_lineno(502); /* M3UA_Emulation.ttcn, line 502 */ M3UA__CT_component_v__Entity.assoc() = pl__Boot; current_location.update_lineno(503); /* M3UA_Emulation.ttcn, line 503 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__initial__State; current_location.update_lineno(504); /* M3UA_Emulation.ttcn, line 504 */ if (rctx.get_istemplate_kind((const char*)cs_0)) { current_location.update_lineno(505); /* M3UA_Emulation.ttcn, line 505 */ M3UA__CT_component_v__Entity.rctx() = OMIT_VALUE; } else { current_location.update_lineno(507); /* M3UA_Emulation.ttcn, line 507 */ M3UA__CT_component_v__Entity.rctx() = t__RoutingContext(int2oct(rctx.valueof(), 4)).valueof(); } current_location.update_lineno(512); /* M3UA_Emulation.ttcn, line 512 */ TTCN_Logger::log_str(TTCN_USER, "*************************************************"); current_location.update_lineno(513); /* M3UA_Emulation.ttcn, line 513 */ TTCN_Logger::log_str(TTCN_USER, "M3UA emulation initiated, the test can be started"); current_location.update_lineno(514); /* M3UA_Emulation.ttcn, line 514 */ TTCN_Logger::log_str(TTCN_USER, "*************************************************"); current_location.update_lineno(516); /* M3UA_Emulation.ttcn, line 516 */ f__Initialize__SCTP(); current_location.update_lineno(519); /* M3UA_Emulation.ttcn, line 519 */ f__M3UA__ScanEvents(); } void start_f__M3UA__Emulation(const COMPONENT& component_reference, const SCTP__Association__Address& pl__Boot, const INTEGER_template& rctx) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_M3UA_Emulation("); pl__Boot.log(); TTCN_Logger::log_event_str(", "); rctx.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, "M3UA_Emulation", "f_M3UA_Emulation", text_buf); pl__Boot.encode_text(text_buf); rctx.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__Initialize__SCTP() { TTCN_Location current_location("M3UA_Emulation.ttcn", 524, TTCN_Location::LOCATION_FUNCTION, "f_Initialize_SCTP"); current_location.update_lineno(526); /* M3UA_Emulation.ttcn, line 526 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__sCTP__Initialize__Done; current_location.update_lineno(527); /* M3UA_Emulation.ttcn, line 527 */ if (tsp__SCTP__Server__Mode) { current_location.update_lineno(530); /* M3UA_Emulation.ttcn, line 530 */ M3UA__CT_component_SCTP__PORT.send(t__ASP__SCTP__Listen(CHARSTRING_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().local__ip__addr()), INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().local__sctp__port())), FALSE, NULL); } else { current_location.update_lineno(536); /* M3UA_Emulation.ttcn, line 536 */ f__Associate(); current_location.update_lineno(537); /* M3UA_Emulation.ttcn, line 537 */ M3UA__CT_component_T__Assoc__restart.start(); } current_location.update_lineno(540); /* M3UA_Emulation.ttcn, line 540 */ if ((tsp__SCTP__PayloadProtocolID == 3)) { current_location.update_lineno(541); /* M3UA_Emulation.ttcn, line 541 */ if ((!(tsp__M3UA__Server__Mode))) { current_location.update_lineno(542); /* M3UA_Emulation.ttcn, line 542 */ M3UA__CT_component_T__ASPUP__resend.start(); current_location.update_lineno(543); /* M3UA_Emulation.ttcn, line 543 */ M3UA__CT_component_T__ASPAC__resend.start(); } current_location.update_lineno(545); /* M3UA_Emulation.ttcn, line 545 */ if (tsp__Enable__M3UA__Heartbeat) { current_location.update_lineno(546); /* M3UA_Emulation.ttcn, line 546 */ M3UA__CT_component_T__Heartbeat.start(); } } } void start_f__Initialize__SCTP(const COMPONENT& component_reference) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_Initialize_SCTP("); 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, "M3UA_Emulation", "f_Initialize_SCTP", text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__Associate() { TTCN_Location current_location("M3UA_Emulation.ttcn", 552, TTCN_Location::LOCATION_FUNCTION, "f_Associate"); current_location.update_lineno(554); /* M3UA_Emulation.ttcn, line 554 */ M3UA__CT_component_SCTP__PORT.send(t__ASP__SCTP__ConnectFrom(CHARSTRING_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().local__ip__addr()), INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().local__sctp__port()), CHARSTRING_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().remote__ip__addr()), INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().remote__sctp__port())), FALSE, NULL); current_location.update_lineno(560); /* M3UA_Emulation.ttcn, line 560 */ M3UA__CT_component_T__Timer.start(); current_location.update_lineno(561); /* M3UA_Emulation.ttcn, line 561 */ { tmp_26: alt_status tmp_26_alt_flag_0 = ALT_MAYBE; alt_status tmp_26_alt_flag_1 = ALT_MAYBE; alt_status tmp_26_default_flag = ALT_MAYBE; boolean first_run = TRUE; TTCN_Snapshot::take_new(FALSE); for ( ; ; ) { if (tmp_26_alt_flag_0 == ALT_MAYBE) { current_location.update_lineno(562); /* M3UA_Emulation.ttcn, line 562 */ tmp_26_alt_flag_0 = M3UA__CT_component_SCTP__PORT.receive(t__ASP__SCTP__RESULT(INTEGER_template(ANY_OR_OMIT), BOOLEAN_template(ANY_VALUE), CHARSTRING_template(ANY_OR_OMIT)), &(M3UA__CT_component_v__ASP__SCTP__RESULT), any_compref, NULL, NULL, NULL); if (tmp_26_alt_flag_0 == ALT_YES) { current_location.update_lineno(563); /* M3UA_Emulation.ttcn, line 563 */ if (const_cast< const SCTPasp__Types::ASP__SCTP__RESULT&>(M3UA__CT_component_v__ASP__SCTP__RESULT).error__status()) { current_location.update_lineno(564); /* M3UA_Emulation.ttcn, line 564 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Connect failed: "); const_cast< const SCTPasp__Types::ASP__SCTP__RESULT&>(M3UA__CT_component_v__ASP__SCTP__RESULT).error__message().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } else { current_location.update_lineno(567); /* M3UA_Emulation.ttcn, line 567 */ M3UA__CT_component_v__Entity.sCTP__Assoc__ID() = const_cast< const SCTPasp__Types::ASP__SCTP__RESULT&>(M3UA__CT_component_v__ASP__SCTP__RESULT).client__id(); current_location.update_lineno(568); /* M3UA_Emulation.ttcn, line 568 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__sCTP__Associate__done; current_location.update_lineno(569); /* M3UA_Emulation.ttcn, line 569 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("SCTP_ConnectResult -> connection established from: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().local__ip__addr().log(); TTCN_Logger::log_char(':'); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().local__sctp__port().log(); TTCN_Logger::log_event_str(" to server: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().remote__ip__addr().log(); TTCN_Logger::log_char(':'); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().remote__sctp__port().log(); TTCN_Logger::log_event_str(" association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(574); /* M3UA_Emulation.ttcn, line 574 */ if (tsp__logVerbose) { current_location.update_lineno(575); /* M3UA_Emulation.ttcn, line 575 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } current_location.update_lineno(579); /* M3UA_Emulation.ttcn, line 579 */ M3UA__CT_component_T__Timer.stop(); break; } } if (tmp_26_alt_flag_1 == ALT_MAYBE) { current_location.update_lineno(581); /* M3UA_Emulation.ttcn, line 581 */ tmp_26_alt_flag_1 = M3UA__CT_component_T__Timer.timeout(NULL); if (tmp_26_alt_flag_1 == ALT_YES) { current_location.update_lineno(582); /* M3UA_Emulation.ttcn, line 582 */ TTCN_Logger::log_str(TTCN_USER, "----------------------------------------------"); current_location.update_lineno(583); /* M3UA_Emulation.ttcn, line 583 */ TTCN_Logger::log_str(TTCN_USER, "No response received to t_ASP_SCTP_ConnectFrom"); current_location.update_lineno(584); /* M3UA_Emulation.ttcn, line 584 */ TTCN_Logger::log_str(TTCN_USER, "----------------------------------------------"); current_location.update_lineno(585); /* M3UA_Emulation.ttcn, line 585 */ TTCN_Runtime::setverdict(FAIL); break; } } if (tmp_26_default_flag == ALT_MAYBE) { tmp_26_default_flag = TTCN_Default::try_altsteps(first_run); if (tmp_26_default_flag == ALT_YES || tmp_26_default_flag == ALT_BREAK) break; else if (tmp_26_default_flag == ALT_REPEAT) goto tmp_26; } current_location.update_lineno(561); /* M3UA_Emulation.ttcn, line 561 */ if (tmp_26_alt_flag_0 == ALT_NO && tmp_26_alt_flag_1 == ALT_NO && tmp_26_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file M3UA_Emulation.ttcn between lines 561 and 588."); TTCN_Snapshot::take_new(TRUE); first_run = FALSE; } } } void start_f__Associate(const COMPONENT& component_reference) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_Associate("); 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, "M3UA_Emulation", "f_Associate", text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__M3UA__ScanEvents() { TTCN_Location current_location("M3UA_Emulation.ttcn", 592, TTCN_Location::LOCATION_FUNCTION, "f_M3UA_ScanEvents"); current_location.update_lineno(594); /* M3UA_Emulation.ttcn, line 594 */ MTP3asp__Types::ASP__MTP3__TRANSFERreq vl__ASP__MTP3__TRANSFERreq; current_location.update_lineno(596); /* M3UA_Emulation.ttcn, line 596 */ { tmp_29: alt_status tmp_29_alt_flag_0 = ALT_MAYBE; alt_status tmp_29_alt_flag_1 = ALT_MAYBE; alt_status tmp_29_alt_flag_2 = ALT_MAYBE; alt_status tmp_29_alt_flag_3 = ALT_MAYBE; alt_status tmp_29_alt_flag_4 = ALT_MAYBE; alt_status tmp_29_alt_flag_5 = ALT_MAYBE; alt_status tmp_29_alt_flag_6 = ALT_MAYBE; alt_status tmp_29_default_flag = ALT_MAYBE; boolean first_run = TRUE; TTCN_Snapshot::take_new(FALSE); for ( ; ; ) { if (tmp_29_alt_flag_0 == ALT_MAYBE) { current_location.update_lineno(597); /* M3UA_Emulation.ttcn, line 597 */ tmp_29_alt_flag_0 = M3UA__CT_component_MTP3__SP__PORT.receive(MTP3asp__Types::ASP__MTP3__TRANSFERreq_template(ANY_VALUE), &(vl__ASP__MTP3__TRANSFERreq), any_compref, NULL, NULL, NULL); if (tmp_29_alt_flag_0 == ALT_YES) { current_location.update_lineno(599); /* M3UA_Emulation.ttcn, line 599 */ f__Send__MTP3__TRANSFERreq(vl__ASP__MTP3__TRANSFERreq); current_location.update_lineno(600); /* M3UA_Emulation.ttcn, line 600 */ goto tmp_29; } } if (tmp_29_alt_flag_1 == ALT_MAYBE) { current_location.update_lineno(602); /* M3UA_Emulation.ttcn, line 602 */ tmp_29_alt_flag_1 = as__SCTP__CommunicationUp_instance(first_run); if (tmp_29_alt_flag_1 == ALT_REPEAT) goto tmp_29; if (tmp_29_alt_flag_1 == ALT_BREAK) break; if (tmp_29_alt_flag_1 == ALT_YES) break; } if (tmp_29_alt_flag_2 == ALT_MAYBE) { current_location.update_lineno(603); /* M3UA_Emulation.ttcn, line 603 */ tmp_29_alt_flag_2 = as__SCTP__DataArrive_instance(first_run); if (tmp_29_alt_flag_2 == ALT_REPEAT) goto tmp_29; if (tmp_29_alt_flag_2 == ALT_BREAK) break; if (tmp_29_alt_flag_2 == ALT_YES) break; } if (tmp_29_alt_flag_3 == ALT_MAYBE) { current_location.update_lineno(604); /* M3UA_Emulation.ttcn, line 604 */ tmp_29_alt_flag_3 = as__SCTP__Connected_instance(first_run); if (tmp_29_alt_flag_3 == ALT_REPEAT) goto tmp_29; if (tmp_29_alt_flag_3 == ALT_BREAK) break; if (tmp_29_alt_flag_3 == ALT_YES) break; } if (tmp_29_alt_flag_4 == ALT_MAYBE) { current_location.update_lineno(605); /* M3UA_Emulation.ttcn, line 605 */ tmp_29_alt_flag_4 = as__Unexpected__SCTP__Events_instance(first_run); if (tmp_29_alt_flag_4 == ALT_REPEAT) goto tmp_29; if (tmp_29_alt_flag_4 == ALT_BREAK) break; if (tmp_29_alt_flag_4 == ALT_YES) break; } if (tmp_29_alt_flag_5 == ALT_MAYBE) { current_location.update_lineno(606); /* M3UA_Emulation.ttcn, line 606 */ tmp_29_alt_flag_5 = as__handleM3UA__timers_instance(first_run); if (tmp_29_alt_flag_5 == ALT_REPEAT) goto tmp_29; if (tmp_29_alt_flag_5 == ALT_BREAK) break; if (tmp_29_alt_flag_5 == ALT_YES) break; } if (tmp_29_alt_flag_6 == ALT_MAYBE) { current_location.update_lineno(607); /* M3UA_Emulation.ttcn, line 607 */ tmp_29_alt_flag_6 = as__handleSCTP__timers_instance(first_run); if (tmp_29_alt_flag_6 == ALT_REPEAT) goto tmp_29; if (tmp_29_alt_flag_6 == ALT_BREAK) break; if (tmp_29_alt_flag_6 == ALT_YES) break; } if (tmp_29_default_flag == ALT_MAYBE) { tmp_29_default_flag = TTCN_Default::try_altsteps(first_run); if (tmp_29_default_flag == ALT_YES || tmp_29_default_flag == ALT_BREAK) break; else if (tmp_29_default_flag == ALT_REPEAT) goto tmp_29; } current_location.update_lineno(596); /* M3UA_Emulation.ttcn, line 596 */ if (tmp_29_alt_flag_0 == ALT_NO && tmp_29_alt_flag_1 == ALT_NO && tmp_29_alt_flag_2 == ALT_NO && tmp_29_alt_flag_3 == ALT_NO && tmp_29_alt_flag_4 == ALT_NO && tmp_29_alt_flag_5 == ALT_NO && tmp_29_alt_flag_6 == ALT_NO && tmp_29_default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in the alt statement in file M3UA_Emulation.ttcn between lines 596 and 608."); TTCN_Snapshot::take_new(TRUE); first_run = FALSE; } } } void start_f__M3UA__ScanEvents(const COMPONENT& component_reference) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_M3UA_ScanEvents("); TTCN_Logger::log_event_str(") on component "); component_reference.log(); TTCN_Logger::log_char('.'); TTCN_Logger::end_event(); Text_Buf text_buf; TTCN_Runtime::prepare_start_component(component_reference, "M3UA_Emulation", "f_M3UA_ScanEvents", text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__Send__MTP3__TRANSFERreq(const MTP3asp__Types::ASP__MTP3__TRANSFERreq& pl__ASP__MTP3__TRANSFERreq) { TTCN_Location current_location("M3UA_Emulation.ttcn", 611, TTCN_Location::LOCATION_FUNCTION, "f_Send_MTP3_TRANSFERreq"); current_location.update_lineno(614); /* M3UA_Emulation.ttcn, line 614 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { current_location.update_lineno(615); /* M3UA_Emulation.ttcn, line 615 */ if ((tsp__SCTP__PayloadProtocolID == 3)) { current_location.update_lineno(616); /* M3UA_Emulation.ttcn, line 616 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(1), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__DATA(M3UA__Types::M3UA__Network__Appearance_template(OMIT_VALUE), M3UA__Types::M3UA__Routing__Context_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).rctx()), t__M3UA__Protocol__Data(OCTETSTRING_template(int2oct(const_cast< const MTP3asp__Types::ASP__MTP3__TRANSFERreq&>(pl__ASP__MTP3__TRANSFERreq).opc(), 4)), OCTETSTRING_template(int2oct(const_cast< const MTP3asp__Types::ASP__MTP3__TRANSFERreq&>(pl__ASP__MTP3__TRANSFERreq).dpc(), 4)), OCTETSTRING_template(bit2oct((bs_0 + const_cast< const MTP3asp__Types::ASP__MTP3__TRANSFERreq&>(pl__ASP__MTP3__TRANSFERreq).sio().si()))), OCTETSTRING_template(bit2oct((bs_1 + const_cast< const MTP3asp__Types::ASP__MTP3__TRANSFERreq&>(pl__ASP__MTP3__TRANSFERreq).sio().ni()))), OCTETSTRING_template(bit2oct((bs_1 + const_cast< const MTP3asp__Types::ASP__MTP3__TRANSFERreq&>(pl__ASP__MTP3__TRANSFERreq).sio().prio()))), OCTETSTRING_template(int2oct(const_cast< const MTP3asp__Types::ASP__MTP3__TRANSFERreq&>(pl__ASP__MTP3__TRANSFERreq).sls(), 1)), OCTETSTRING_template(const_cast< const MTP3asp__Types::ASP__MTP3__TRANSFERreq&>(pl__ASP__MTP3__TRANSFERreq).data())), M3UA__Types::M3UA__Correlation__ID_template(OMIT_VALUE)).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); } else { current_location.update_lineno(637); /* M3UA_Emulation.ttcn, line 637 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(1), OCTETSTRING_template(const_cast< const MTP3asp__Types::ASP__MTP3__TRANSFERreq&>(pl__ASP__MTP3__TRANSFERreq).data()), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); } current_location.update_lineno(644); /* M3UA_Emulation.ttcn, line 644 */ if (tsp__logVerbose) { current_location.update_lineno(645); /* M3UA_Emulation.ttcn, line 645 */ TTCN_Logger::log_str(TTCN_USER, "MTP3_SP_PORT: ASP_MTP3_TRANSFERreq received -> message sent via SCTP"); } } else { current_location.update_lineno(655); /* M3UA_Emulation.ttcn, line 655 */ M3UA__CT_component_v__TRANSFERreq__Buffer[M3UA__CT_component_v__TRANSFERreq__Buffer.size_of()] = pl__ASP__MTP3__TRANSFERreq; current_location.update_lineno(657); /* M3UA_Emulation.ttcn, line 657 */ if (tsp__logVerbose) { current_location.update_lineno(658); /* M3UA_Emulation.ttcn, line 658 */ TTCN_Logger::log_str(TTCN_USER, "MTP3_SP_PORT: ASP_MTP3_TRANSFERreq received in an inactive state -> message was buffered"); } } } void start_f__Send__MTP3__TRANSFERreq(const COMPONENT& component_reference, const MTP3asp__Types::ASP__MTP3__TRANSFERreq& pl__ASP__MTP3__TRANSFERreq) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_Send_MTP3_TRANSFERreq("); pl__ASP__MTP3__TRANSFERreq.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, "M3UA_Emulation", "f_Send_MTP3_TRANSFERreq", text_buf); pl__ASP__MTP3__TRANSFERreq.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } alt_status as__SCTP__CommunicationUp_instance(boolean first_alt_run) { TTCN_Location current_location("M3UA_Emulation.ttcn", 666, TTCN_Location::LOCATION_ALTSTEP, "as_SCTP_CommunicationUp"); alt_status ret_val = ALT_NO; current_location.update_lineno(668); /* M3UA_Emulation.ttcn, line 668 */ switch (M3UA__CT_component_SCTP__PORT.receive(tr__S__SCTP__CommunicationUp(INTEGER_template(ANY_VALUE)), &(M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE), any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(670); /* M3UA_Emulation.ttcn, line 670 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID() == const_cast< const SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE&>(M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE).client__id())) { current_location.update_lineno(671); /* M3UA_Emulation.ttcn, line 671 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Down__sCTP__Associate__done)) { current_location.update_lineno(672); /* M3UA_Emulation.ttcn, line 672 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__commUP__Received; current_location.update_lineno(673); /* M3UA_Emulation.ttcn, line 673 */ if ((tsp__SCTP__PayloadProtocolID != 3)) { current_location.update_lineno(674); /* M3UA_Emulation.ttcn, line 674 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Active; current_location.update_lineno(675); /* M3UA_Emulation.ttcn, line 675 */ INTEGER v__i; current_location.update_lineno(676); /* M3UA_Emulation.ttcn, line 676 */ v__i = 0; current_location.update_lineno(676); /* M3UA_Emulation.ttcn, line 676 */ for ( ; ; ) { current_location.update_lineno(676); /* M3UA_Emulation.ttcn, line 676 */ if (!(v__i < M3UA__CT_component_v__TRANSFERreq__Buffer.size_of())) break; current_location.update_lineno(677); /* M3UA_Emulation.ttcn, line 677 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Sending buffered message #"); v__i.log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(678); /* M3UA_Emulation.ttcn, line 678 */ f__Send__MTP3__TRANSFERreq(MTP3asp__Types::ASP__MTP3__TRANSFERreq(const_cast< const TRANSFERreq__Buffer&>(M3UA__CT_component_v__TRANSFERreq__Buffer)[v__i])); current_location.update_lineno(676); /* M3UA_Emulation.ttcn, line 676 */ { INTEGER tmp_34; ++v__i; } } current_location.update_lineno(680); /* M3UA_Emulation.ttcn, line 680 */ M3UA__CT_component_v__TRANSFERreq__Buffer = NULL_VALUE; } current_location.update_lineno(683); /* M3UA_Emulation.ttcn, line 683 */ if (tsp__logVerbose) { current_location.update_lineno(684); /* M3UA_Emulation.ttcn, line 684 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } current_location.update_lineno(687); /* M3UA_Emulation.ttcn, line 687 */ { boolean tmp_36; tmp_36 = (!(tsp__M3UA__Server__Mode)); if (tmp_36) tmp_36 = (tsp__SCTP__PayloadProtocolID == 3); if (tmp_36) { current_location.update_lineno(689); /* M3UA_Emulation.ttcn, line 689 */ f__ASPUP__Sending(); } } } else { current_location.update_lineno(693); /* M3UA_Emulation.ttcn, line 693 */ if (tsp__logVerbose) { current_location.update_lineno(694); /* M3UA_Emulation.ttcn, line 694 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("SCTP_CommunicationUp received in wrong state (i.e. not after SCTP_Associate is done) in state: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } } else { current_location.update_lineno(700); /* M3UA_Emulation.ttcn, line 700 */ if (tsp__logVerbose) { current_location.update_lineno(701); /* M3UA_Emulation.ttcn, line 701 */ TTCN_Logger::log_str(TTCN_USER, "Association does not exists, received in CommunicationUp"); } } current_location.update_lineno(704); /* M3UA_Emulation.ttcn, line 704 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } return ret_val; } void as__SCTP__CommunicationUp(boolean nodefault_modifier) { altstep_begin: boolean block_flag = FALSE; alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED; for ( ; ; ) { TTCN_Snapshot::take_new(block_flag); if (altstep_flag != ALT_NO) { altstep_flag = as__SCTP__CommunicationUp_instance(!block_flag); if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return; else if (altstep_flag == ALT_REPEAT) goto altstep_begin; } if (!nodefault_modifier && default_flag != ALT_NO) { default_flag = TTCN_Default::try_altsteps(!block_flag); if (default_flag == ALT_YES || default_flag == ALT_BREAK) return; else if (default_flag == ALT_REPEAT) goto altstep_begin; } if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_SCTP_CommunicationUp."); else block_flag = TRUE; } } Default_Base *activate_as__SCTP__CommunicationUp() { return new as__SCTP__CommunicationUp_Default(); } alt_status as__SCTP__DataArrive_instance(boolean first_alt_run) { TTCN_Location current_location("M3UA_Emulation.ttcn", 709, TTCN_Location::LOCATION_ALTSTEP, "as_SCTP_DataArrive"); alt_status ret_val = ALT_NO; current_location.update_lineno(711); /* M3UA_Emulation.ttcn, line 711 */ switch (M3UA__CT_component_SCTP__PORT.receive(tr__S__SCTP__DataArrive(INTEGER_template(ANY_VALUE), INTEGER_template(ANY_VALUE), INTEGER_template(ANY_VALUE), OCTETSTRING_template(ANY_VALUE)), &(M3UA__CT_component_v__ASP__SCTP), any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(719); /* M3UA_Emulation.ttcn, line 719 */ if (f__Assoc__Exists(INTEGER(const_cast< const SCTPasp__Types::ASP__SCTP&>(M3UA__CT_component_v__ASP__SCTP).client__id()))) { current_location.update_lineno(720); /* M3UA_Emulation.ttcn, line 720 */ if (tsp__logVerbose) { current_location.update_lineno(721); /* M3UA_Emulation.ttcn, line 721 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Message received on association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } current_location.update_lineno(723); /* M3UA_Emulation.ttcn, line 723 */ if ((tsp__SCTP__PayloadProtocolID == 3)) { current_location.update_lineno(724); /* M3UA_Emulation.ttcn, line 724 */ M3UA__CT_component_v__PDU__M3UA = M3UA__Types::dec__PDU__M3UA(const_cast< const SCTPasp__Types::ASP__SCTP&>(M3UA__CT_component_v__ASP__SCTP).data()); current_location.update_lineno(725); /* M3UA_Emulation.ttcn, line 725 */ f__handle__M3UA__msg(M3UA__Types::PDU__M3UA(M3UA__CT_component_v__PDU__M3UA)); } else { current_location.update_lineno(728); /* M3UA_Emulation.ttcn, line 728 */ f__handle__nonM3UA__msg(OCTETSTRING(const_cast< const SCTPasp__Types::ASP__SCTP&>(M3UA__CT_component_v__ASP__SCTP).data())); } } else { current_location.update_lineno(732); /* M3UA_Emulation.ttcn, line 732 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Message received on unknown association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" -> closing connection"); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(734); /* M3UA_Emulation.ttcn, line 734 */ M3UA__CT_component_SCTP__PORT.send(t__ASP__SCTP__Close(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID())), FALSE, NULL); current_location.update_lineno(735); /* M3UA_Emulation.ttcn, line 735 */ TTCN_Logger::log_str(TTCN_USER, "SCTP connection closed"); } current_location.update_lineno(737); /* M3UA_Emulation.ttcn, line 737 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } return ret_val; } void as__SCTP__DataArrive(boolean nodefault_modifier) { altstep_begin: boolean block_flag = FALSE; alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED; for ( ; ; ) { TTCN_Snapshot::take_new(block_flag); if (altstep_flag != ALT_NO) { altstep_flag = as__SCTP__DataArrive_instance(!block_flag); if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return; else if (altstep_flag == ALT_REPEAT) goto altstep_begin; } if (!nodefault_modifier && default_flag != ALT_NO) { default_flag = TTCN_Default::try_altsteps(!block_flag); if (default_flag == ALT_YES || default_flag == ALT_BREAK) return; else if (default_flag == ALT_REPEAT) goto altstep_begin; } if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_SCTP_DataArrive."); else block_flag = TRUE; } } Default_Base *activate_as__SCTP__DataArrive() { return new as__SCTP__DataArrive_Default(); } alt_status as__SCTP__Connected_instance(boolean first_alt_run) { TTCN_Location current_location("M3UA_Emulation.ttcn", 744, TTCN_Location::LOCATION_ALTSTEP, "as_SCTP_Connected"); alt_status ret_val = ALT_NO; current_location.update_lineno(746); /* M3UA_Emulation.ttcn, line 746 */ static boolean guard_expr_0 = FALSE; if (first_alt_run) { guard_expr_0 = tsp__SCTP__Server__Mode; } if (guard_expr_0) { current_location.update_lineno(746); /* M3UA_Emulation.ttcn, line 746 */ switch (M3UA__CT_component_SCTP__PORT.receive(tr__ASP__SCTP__Connected(INTEGER_template(ANY_VALUE), CHARSTRING_template(ANY_VALUE), INTEGER_template(ANY_VALUE), CHARSTRING_template(ANY_VALUE), INTEGER_template(ANY_VALUE)), &(M3UA__CT_component_v__ASP__SCTP__Connected), any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(749); /* M3UA_Emulation.ttcn, line 749 */ { boolean tmp_38; { boolean tmp_39; { boolean tmp_40; tmp_40 = (const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).local__portnumber() == const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().local__sctp__port()); if (tmp_40) tmp_40 = (const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).local__hostname() == const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().local__ip__addr()); tmp_39 = tmp_40; } if (tmp_39) tmp_39 = (const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).peer__portnumber() == const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().remote__sctp__port()); tmp_38 = tmp_39; } if (tmp_38) tmp_38 = (const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).peer__hostname() == const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).assoc().remote__ip__addr()); if (tmp_38) { current_location.update_lineno(757); /* M3UA_Emulation.ttcn, line 757 */ M3UA__CT_component_v__Entity.sCTP__Assoc__ID() = const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).client__id(); current_location.update_lineno(758); /* M3UA_Emulation.ttcn, line 758 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__sCTP__Associate__done; current_location.update_lineno(759); /* M3UA_Emulation.ttcn, line 759 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("ASP_SCTP_Connected -> accepted connection from client: "); const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).peer__hostname().log(); TTCN_Logger::log_char(':'); const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).peer__portnumber().log(); TTCN_Logger::log_event_str(" on server: "); const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).local__hostname().log(); TTCN_Logger::log_char(':'); const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).local__portnumber().log(); TTCN_Logger::log_event_str(" with association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } else { current_location.update_lineno(767); /* M3UA_Emulation.ttcn, line 767 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("ASP_SCTP_Connected -> connection from unknown client: "); const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).peer__hostname().log(); TTCN_Logger::log_char(':'); const_cast< const SCTPasp__Types::ASP__SCTP__Connected&>(M3UA__CT_component_v__ASP__SCTP__Connected).peer__portnumber().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } current_location.update_lineno(771); /* M3UA_Emulation.ttcn, line 771 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } } return ret_val; } void as__SCTP__Connected(boolean nodefault_modifier) { altstep_begin: boolean block_flag = FALSE; alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED; for ( ; ; ) { TTCN_Snapshot::take_new(block_flag); if (altstep_flag != ALT_NO) { altstep_flag = as__SCTP__Connected_instance(!block_flag); if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return; else if (altstep_flag == ALT_REPEAT) goto altstep_begin; } if (!nodefault_modifier && default_flag != ALT_NO) { default_flag = TTCN_Default::try_altsteps(!block_flag); if (default_flag == ALT_YES || default_flag == ALT_BREAK) return; else if (default_flag == ALT_REPEAT) goto altstep_begin; } if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_SCTP_Connected."); else block_flag = TRUE; } } Default_Base *activate_as__SCTP__Connected() { return new as__SCTP__Connected_Default(); } alt_status as__Unexpected__SCTP__Events_instance(boolean first_alt_run) { TTCN_Location current_location("M3UA_Emulation.ttcn", 776, TTCN_Location::LOCATION_ALTSTEP, "as_Unexpected_SCTP_Events"); alt_status ret_val = ALT_NO; current_location.update_lineno(781); /* M3UA_Emulation.ttcn, line 781 */ switch (M3UA__CT_component_SCTP__PORT.receive(tr__S__SCTP__CommunicationLost(INTEGER_template(ANY_VALUE)), &(M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE), any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(783); /* M3UA_Emulation.ttcn, line 783 */ if (f__Assoc__Exists(INTEGER(const_cast< const SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE&>(M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE).client__id()))) { current_location.update_lineno(784); /* M3UA_Emulation.ttcn, line 784 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { } current_location.update_lineno(787); /* M3UA_Emulation.ttcn, line 787 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__sCTP__Initialize__Done; current_location.update_lineno(788); /* M3UA_Emulation.ttcn, line 788 */ M3UA__CT_component_v__Entity.sCTP__Assoc__ID() = OMIT_VALUE; current_location.update_lineno(789); /* M3UA_Emulation.ttcn, line 789 */ if (tsp__logVerbose) { current_location.update_lineno(790); /* M3UA_Emulation.ttcn, line 790 */ TTCN_Logger::log_str(TTCN_USER, "SCTP_CommunicationLost received"); current_location.update_lineno(791); /* M3UA_Emulation.ttcn, line 791 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" cleared, state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } else { current_location.update_lineno(796); /* M3UA_Emulation.ttcn, line 796 */ if (tsp__logVerbose) { current_location.update_lineno(797); /* M3UA_Emulation.ttcn, line 797 */ TTCN_Logger::log_str(TTCN_USER, "Association does not exist, received in CommunicationLost"); } } current_location.update_lineno(800); /* M3UA_Emulation.ttcn, line 800 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } current_location.update_lineno(802); /* M3UA_Emulation.ttcn, line 802 */ switch (M3UA__CT_component_SCTP__PORT.receive(tr__S__SCTP__ShutdownComplete(INTEGER_template(ANY_VALUE)), &(M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE), any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(804); /* M3UA_Emulation.ttcn, line 804 */ if (f__Assoc__Exists(INTEGER(const_cast< const SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE&>(M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE).client__id()))) { current_location.update_lineno(805); /* M3UA_Emulation.ttcn, line 805 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { } current_location.update_lineno(808); /* M3UA_Emulation.ttcn, line 808 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__sCTP__Initialize__Done; current_location.update_lineno(809); /* M3UA_Emulation.ttcn, line 809 */ if (tsp__logVerbose) { current_location.update_lineno(810); /* M3UA_Emulation.ttcn, line 810 */ TTCN_Logger::log_str(TTCN_USER, "SCTP_ShutdownComplete received"); current_location.update_lineno(811); /* M3UA_Emulation.ttcn, line 811 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } else { current_location.update_lineno(816); /* M3UA_Emulation.ttcn, line 816 */ if (tsp__logVerbose) { current_location.update_lineno(817); /* M3UA_Emulation.ttcn, line 817 */ TTCN_Logger::log_str(TTCN_USER, "Association does not exist, received in ShutdownComplete"); } } current_location.update_lineno(820); /* M3UA_Emulation.ttcn, line 820 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } current_location.update_lineno(822); /* M3UA_Emulation.ttcn, line 822 */ switch (M3UA__CT_component_SCTP__PORT.receive(tr__S__SCTP__ShutdownEvent(INTEGER_template(ANY_VALUE)), &(M3UA__CT_component_v__ASP__SCTP__SHUTDOWN__EVENT), any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(824); /* M3UA_Emulation.ttcn, line 824 */ if (f__Assoc__Exists(INTEGER(const_cast< const SCTPasp__Types::ASP__SCTP__SHUTDOWN__EVENT&>(M3UA__CT_component_v__ASP__SCTP__SHUTDOWN__EVENT).client__id()))) { current_location.update_lineno(825); /* M3UA_Emulation.ttcn, line 825 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { } current_location.update_lineno(828); /* M3UA_Emulation.ttcn, line 828 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__sCTP__Initialize__Done; current_location.update_lineno(829); /* M3UA_Emulation.ttcn, line 829 */ if (tsp__logVerbose) { current_location.update_lineno(830); /* M3UA_Emulation.ttcn, line 830 */ TTCN_Logger::log_str(TTCN_USER, "SCTP_ShutdownEvent received"); current_location.update_lineno(831); /* M3UA_Emulation.ttcn, line 831 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } else { current_location.update_lineno(836); /* M3UA_Emulation.ttcn, line 836 */ if (tsp__logVerbose) { current_location.update_lineno(837); /* M3UA_Emulation.ttcn, line 837 */ TTCN_Logger::log_str(TTCN_USER, "Association does not exist, received in ShutdownEvent"); } } current_location.update_lineno(840); /* M3UA_Emulation.ttcn, line 840 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } current_location.update_lineno(842); /* M3UA_Emulation.ttcn, line 842 */ switch (M3UA__CT_component_SCTP__PORT.receive(tr__ASP__SCTP__Connected(INTEGER_template(ANY_VALUE), CHARSTRING_template(ANY_VALUE), INTEGER_template(ANY_VALUE), CHARSTRING_template(ANY_VALUE), INTEGER_template(ANY_VALUE)), &(M3UA__CT_component_v__ASP__SCTP__Connected), any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(844); /* M3UA_Emulation.ttcn, line 844 */ TTCN_Logger::log_str(TTCN_USER, "Unexpected ASP_SCTP_Connected"); current_location.update_lineno(845); /* M3UA_Emulation.ttcn, line 845 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } current_location.update_lineno(847); /* M3UA_Emulation.ttcn, line 847 */ switch (M3UA__CT_component_SCTP__PORT.receive(tr__S__SCTP__Restart(INTEGER_template(ANY_VALUE)), &(M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE), any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(848); /* M3UA_Emulation.ttcn, line 848 */ if (f__Assoc__Exists(INTEGER(const_cast< const SCTPasp__Types::ASP__SCTP__ASSOC__CHANGE&>(M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE).client__id()))) { current_location.update_lineno(849); /* M3UA_Emulation.ttcn, line 849 */ TTCN_Logger::log_str(TTCN_USER, "SCTP_Restart received"); current_location.update_lineno(850); /* M3UA_Emulation.ttcn, line 850 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__commUP__Received; current_location.update_lineno(851); /* M3UA_Emulation.ttcn, line 851 */ if (tsp__logVerbose) { current_location.update_lineno(852); /* M3UA_Emulation.ttcn, line 852 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } else { current_location.update_lineno(857); /* M3UA_Emulation.ttcn, line 857 */ if (tsp__logVerbose) { current_location.update_lineno(858); /* M3UA_Emulation.ttcn, line 858 */ TTCN_Logger::log_str(TTCN_USER, "Association does not exist, received in SCTP_Restart"); } } current_location.update_lineno(861); /* M3UA_Emulation.ttcn, line 861 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } current_location.update_lineno(863); /* M3UA_Emulation.ttcn, line 863 */ switch (M3UA__CT_component_SCTP__PORT.receive(t__ASP__SCTP__SEND__FAILED(INTEGER_template(ANY_VALUE)), &(M3UA__CT_component_v__ASP__SCTP__SEND__FAILED), any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(865); /* M3UA_Emulation.ttcn, line 865 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("SCTP_Send failed for association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(866); /* M3UA_Emulation.ttcn, line 866 */ if (f__Assoc__Exists(INTEGER(const_cast< const SCTPasp__Types::ASP__SCTP__SEND__FAILED&>(M3UA__CT_component_v__ASP__SCTP__SEND__FAILED).client__id()))) { } else { current_location.update_lineno(871); /* M3UA_Emulation.ttcn, line 871 */ TTCN_Logger::log_str(TTCN_USER, "Send error received for association that doesn't exist"); } current_location.update_lineno(873); /* M3UA_Emulation.ttcn, line 873 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } current_location.update_lineno(875); /* M3UA_Emulation.ttcn, line 875 */ switch (M3UA__CT_component_SCTP__PORT.receive(tr__S__SCTP__CANT__STR__ASSOC(INTEGER_template(ANY_VALUE)), NULL, any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(876); /* M3UA_Emulation.ttcn, line 876 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } current_location.update_lineno(878); /* M3UA_Emulation.ttcn, line 878 */ switch (M3UA__CT_component_SCTP__PORT.receive(any_compref, NULL, NULL, NULL)) { case ALT_YES: { current_location.update_lineno(879); /* M3UA_Emulation.ttcn, line 879 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } return ret_val; } void as__Unexpected__SCTP__Events(boolean nodefault_modifier) { altstep_begin: boolean block_flag = FALSE; alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED; for ( ; ; ) { TTCN_Snapshot::take_new(block_flag); if (altstep_flag != ALT_NO) { altstep_flag = as__Unexpected__SCTP__Events_instance(!block_flag); if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return; else if (altstep_flag == ALT_REPEAT) goto altstep_begin; } if (!nodefault_modifier && default_flag != ALT_NO) { default_flag = TTCN_Default::try_altsteps(!block_flag); if (default_flag == ALT_YES || default_flag == ALT_BREAK) return; else if (default_flag == ALT_REPEAT) goto altstep_begin; } if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_Unexpected_SCTP_Events."); else block_flag = TRUE; } } Default_Base *activate_as__Unexpected__SCTP__Events() { return new as__Unexpected__SCTP__Events_Default(); } alt_status as__handleM3UA__timers_instance(boolean first_alt_run) { TTCN_Location current_location("M3UA_Emulation.ttcn", 885, TTCN_Location::LOCATION_ALTSTEP, "as_handleM3UA_timers"); alt_status ret_val = ALT_NO; current_location.update_lineno(887); /* M3UA_Emulation.ttcn, line 887 */ switch (M3UA__CT_component_T__ASPUP__resend.timeout(NULL)) { case ALT_YES: { current_location.update_lineno(888); /* M3UA_Emulation.ttcn, line 888 */ { boolean tmp_48; tmp_48 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Down__commUP__Received); if (!tmp_48) tmp_48 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Down__ASPUP__Sent); if (tmp_48) { current_location.update_lineno(891); /* M3UA_Emulation.ttcn, line 891 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__ASPUP(M3UA__Types::M3UA__ASP__Identifier_template(OMIT_VALUE), M3UA__Types::M3UA__Info__String_template(OMIT_VALUE)).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(897); /* M3UA_Emulation.ttcn, line 897 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__ASPUP__Sent; current_location.update_lineno(898); /* M3UA_Emulation.ttcn, line 898 */ if (tsp__logVerbose) { current_location.update_lineno(899); /* M3UA_Emulation.ttcn, line 899 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } } current_location.update_lineno(903); /* M3UA_Emulation.ttcn, line 903 */ M3UA__CT_component_T__ASPUP__resend.start(); current_location.update_lineno(904); /* M3UA_Emulation.ttcn, line 904 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } current_location.update_lineno(907); /* M3UA_Emulation.ttcn, line 907 */ switch (M3UA__CT_component_T__ASPAC__resend.timeout(NULL)) { case ALT_YES: { current_location.update_lineno(908); /* M3UA_Emulation.ttcn, line 908 */ { boolean tmp_50; tmp_50 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inactive); if (!tmp_50) tmp_50 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inact__ASPAC__Sent); if (tmp_50) { current_location.update_lineno(910); /* M3UA_Emulation.ttcn, line 910 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__ASPAC(M3UA__Types::M3UA__Traffic__Mode__Type_template(OMIT_VALUE), M3UA__Types::M3UA__Routing__Context_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).rctx()), M3UA__Types::M3UA__Info__String_template(OMIT_VALUE)).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(916); /* M3UA_Emulation.ttcn, line 916 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Inact__ASPAC__Sent; current_location.update_lineno(917); /* M3UA_Emulation.ttcn, line 917 */ if (tsp__logVerbose) { current_location.update_lineno(918); /* M3UA_Emulation.ttcn, line 918 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } } current_location.update_lineno(922); /* M3UA_Emulation.ttcn, line 922 */ M3UA__CT_component_T__ASPAC__resend.start(); current_location.update_lineno(923); /* M3UA_Emulation.ttcn, line 923 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } current_location.update_lineno(926); /* M3UA_Emulation.ttcn, line 926 */ static boolean guard_expr_2 = FALSE; if (first_alt_run) { guard_expr_2 = tsp__Enable__M3UA__Heartbeat; } if (guard_expr_2) { current_location.update_lineno(926); /* M3UA_Emulation.ttcn, line 926 */ switch (M3UA__CT_component_T__Heartbeat.timeout(NULL)) { case ALT_YES: { current_location.update_lineno(927); /* M3UA_Emulation.ttcn, line 927 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { current_location.update_lineno(928); /* M3UA_Emulation.ttcn, line 928 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__Heartbeat(M3UA__Types::M3UA__Heartbeat__Data_template(OMIT_VALUE)).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(934); /* M3UA_Emulation.ttcn, line 934 */ if (tsp__logVerbose) { current_location.update_lineno(935); /* M3UA_Emulation.ttcn, line 935 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Heartbeat sent to association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } current_location.update_lineno(938); /* M3UA_Emulation.ttcn, line 938 */ M3UA__CT_component_T__Heartbeat.start(); current_location.update_lineno(939); /* M3UA_Emulation.ttcn, line 939 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } } return ret_val; } void as__handleM3UA__timers(boolean nodefault_modifier) { altstep_begin: boolean block_flag = FALSE; alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED; for ( ; ; ) { TTCN_Snapshot::take_new(block_flag); if (altstep_flag != ALT_NO) { altstep_flag = as__handleM3UA__timers_instance(!block_flag); if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return; else if (altstep_flag == ALT_REPEAT) goto altstep_begin; } if (!nodefault_modifier && default_flag != ALT_NO) { default_flag = TTCN_Default::try_altsteps(!block_flag); if (default_flag == ALT_YES || default_flag == ALT_BREAK) return; else if (default_flag == ALT_REPEAT) goto altstep_begin; } if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_handleM3UA_timers."); else block_flag = TRUE; } } Default_Base *activate_as__handleM3UA__timers() { return new as__handleM3UA__timers_Default(); } alt_status as__handleSCTP__timers_instance(boolean first_alt_run) { TTCN_Location current_location("M3UA_Emulation.ttcn", 944, TTCN_Location::LOCATION_ALTSTEP, "as_handleSCTP_timers"); alt_status ret_val = ALT_NO; current_location.update_lineno(946); /* M3UA_Emulation.ttcn, line 946 */ static boolean guard_expr_0 = FALSE; if (first_alt_run) { guard_expr_0 = (!(tsp__SCTP__Server__Mode)); } if (guard_expr_0) { current_location.update_lineno(946); /* M3UA_Emulation.ttcn, line 946 */ switch (M3UA__CT_component_T__Assoc__restart.timeout(NULL)) { case ALT_YES: { current_location.update_lineno(947); /* M3UA_Emulation.ttcn, line 947 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Down__sCTP__Initialize__Done)) { current_location.update_lineno(948); /* M3UA_Emulation.ttcn, line 948 */ f__Associate(); } current_location.update_lineno(950); /* M3UA_Emulation.ttcn, line 950 */ M3UA__CT_component_T__Assoc__restart.start(); current_location.update_lineno(951); /* M3UA_Emulation.ttcn, line 951 */ return ALT_REPEAT; } case ALT_MAYBE: ret_val = ALT_MAYBE; default: break; } } return ret_val; } void as__handleSCTP__timers(boolean nodefault_modifier) { altstep_begin: boolean block_flag = FALSE; alt_status altstep_flag = ALT_UNCHECKED, default_flag = ALT_UNCHECKED; for ( ; ; ) { TTCN_Snapshot::take_new(block_flag); if (altstep_flag != ALT_NO) { altstep_flag = as__handleSCTP__timers_instance(!block_flag); if (altstep_flag == ALT_YES || altstep_flag == ALT_BREAK) return; else if (altstep_flag == ALT_REPEAT) goto altstep_begin; } if (!nodefault_modifier && default_flag != ALT_NO) { default_flag = TTCN_Default::try_altsteps(!block_flag); if (default_flag == ALT_YES || default_flag == ALT_BREAK) return; else if (default_flag == ALT_REPEAT) goto altstep_begin; } if (altstep_flag == ALT_NO && default_flag == ALT_NO) TTCN_error("None of the branches can be chosen in altstep as_handleSCTP_timers."); else block_flag = TRUE; } } Default_Base *activate_as__handleSCTP__timers() { return new as__handleSCTP__timers_Default(); } void f__ASPUP__Sending() { TTCN_Location current_location("M3UA_Emulation.ttcn", 957, TTCN_Location::LOCATION_FUNCTION, "f_ASPUP_Sending"); current_location.update_lineno(959); /* M3UA_Emulation.ttcn, line 959 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__ASPUP(M3UA__Types::M3UA__ASP__Identifier_template(OMIT_VALUE), M3UA__Types::M3UA__Info__String_template(OMIT_VALUE)).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(965); /* M3UA_Emulation.ttcn, line 965 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__ASPUP__Sent; current_location.update_lineno(966); /* M3UA_Emulation.ttcn, line 966 */ if (tsp__logVerbose) { current_location.update_lineno(967); /* M3UA_Emulation.ttcn, line 967 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPUP sent"); current_location.update_lineno(968); /* M3UA_Emulation.ttcn, line 968 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } void start_f__ASPUP__Sending(const COMPONENT& component_reference) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_ASPUP_Sending("); 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, "M3UA_Emulation", "f_ASPUP_Sending", text_buf); TTCN_Runtime::send_start_component(text_buf); } BOOLEAN f__Assoc__Exists(const INTEGER& pl__assocID) { TTCN_Location current_location("M3UA_Emulation.ttcn", 978, TTCN_Location::LOCATION_FUNCTION, "f_Assoc_Exists"); current_location.update_lineno(980); /* M3UA_Emulation.ttcn, line 980 */ { boolean tmp_53; { boolean tmp_54 = M3UA__CT_component_v__Entity.is_bound(); if(tmp_54) { const OPTIONAL< INTEGER >& tmp_55 = M3UA__CT_component_v__Entity.sCTP__Assoc__ID(); switch (tmp_55.get_selection()) { case OPTIONAL_UNBOUND: tmp_54 = FALSE; break; case OPTIONAL_OMIT: tmp_54 = FALSE; break; default: { const INTEGER& tmp_56 = (const INTEGER&) tmp_55; tmp_54 = tmp_56.is_present(); break;} } } tmp_53 = tmp_54; } if (tmp_53) tmp_53 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID() == pl__assocID); if (tmp_53) { current_location.update_lineno(981); /* M3UA_Emulation.ttcn, line 981 */ return TRUE; } else { current_location.update_lineno(984); /* M3UA_Emulation.ttcn, line 984 */ if (tsp__logVerbose) { current_location.update_lineno(985); /* M3UA_Emulation.ttcn, line 985 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" not found"); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } } current_location.update_lineno(988); /* M3UA_Emulation.ttcn, line 988 */ return FALSE; } void start_f__Assoc__Exists(const COMPONENT& component_reference, const INTEGER& pl__assocID) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_Assoc_Exists("); pl__assocID.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, "M3UA_Emulation", "f_Assoc_Exists", text_buf); pl__assocID.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__handle__M3UA__msg(const M3UA__Types::PDU__M3UA& pl__PDU__M3UA) { TTCN_Location current_location("M3UA_Emulation.ttcn", 991, TTCN_Location::LOCATION_FUNCTION, "f_handle_M3UA_msg"); current_location.update_lineno(993); /* M3UA_Emulation.ttcn, line 993 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__DATA)) { current_location.update_lineno(994); /* M3UA_Emulation.ttcn, line 994 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { current_location.update_lineno(996); /* M3UA_Emulation.ttcn, line 996 */ M3UA__CT_component_MTP3__SP__PORT.send(MTP3asp__Types::tr__ASP__MTP3__TRANSFERind__sio(BITSTRING_template(substr(oct2bit(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DATA().messageParameters().protocol__Data().nI()), 6, 2)), BITSTRING_template(substr(oct2bit(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DATA().messageParameters().protocol__Data().mP()), 6, 2)), BITSTRING_template(substr(oct2bit(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DATA().messageParameters().protocol__Data().sI()), 4, 4)), INTEGER_template(oct2int(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DATA().messageParameters().protocol__Data().oPC())), INTEGER_template(oct2int(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DATA().messageParameters().protocol__Data().dPC())), INTEGER_template(oct2int(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DATA().messageParameters().protocol__Data().sLS())), OCTETSTRING_template(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DATA().messageParameters().protocol__Data().userProtocolData())).valueof(), FALSE, NULL); current_location.update_lineno(1006); /* M3UA_Emulation.ttcn, line 1006 */ if (tsp__logVerbose) { current_location.update_lineno(1007); /* M3UA_Emulation.ttcn, line 1007 */ TTCN_Logger::log_str(TTCN_USER, "MTP3_SP_PORT: Data received -> TRANSFERind sent"); } } else { current_location.update_lineno(1012); /* M3UA_Emulation.ttcn, line 1012 */ if (tsp__logVerbose) { current_location.update_lineno(1013); /* M3UA_Emulation.ttcn, line 1013 */ TTCN_Logger::log_str(TTCN_USER, "MTP3_SP_PORT: Data received, no user connected -> discard"); } } } else { current_location.update_lineno(1017); /* M3UA_Emulation.ttcn, line 1017 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__BEAT)) { current_location.update_lineno(1018); /* M3UA_Emulation.ttcn, line 1018 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { current_location.update_lineno(1019); /* M3UA_Emulation.ttcn, line 1019 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__Beat__Ack(M3UA__Types::M3UA__Heartbeat__Data_template(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__BEAT().messageParameters().heartbeat__Data())).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(1028); /* M3UA_Emulation.ttcn, line 1028 */ if (tsp__logVerbose) { current_location.update_lineno(1029); /* M3UA_Emulation.ttcn, line 1029 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_BEAT received -> M3UA_BEAT_Ack sent"); } } else { current_location.update_lineno(1033); /* M3UA_Emulation.ttcn, line 1033 */ if (tsp__logVerbose) { current_location.update_lineno(1034); /* M3UA_Emulation.ttcn, line 1034 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_BEAT received in wrong state"); } } } else { current_location.update_lineno(1038); /* M3UA_Emulation.ttcn, line 1038 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__BEAT__Ack)) { current_location.update_lineno(1039); /* M3UA_Emulation.ttcn, line 1039 */ if (tsp__logVerbose) { current_location.update_lineno(1040); /* M3UA_Emulation.ttcn, line 1040 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_BEAT_Ack -> discard"); } } else { current_location.update_lineno(1043); /* M3UA_Emulation.ttcn, line 1043 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__ERR)) { current_location.update_lineno(1044); /* M3UA_Emulation.ttcn, line 1044 */ if (tsp__logVerbose) { current_location.update_lineno(1045); /* M3UA_Emulation.ttcn, line 1045 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_ERR -> discard"); } } else { current_location.update_lineno(1048); /* M3UA_Emulation.ttcn, line 1048 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__NOTIFY)) { current_location.update_lineno(1049); /* M3UA_Emulation.ttcn, line 1049 */ if (tsp__logVerbose) { current_location.update_lineno(1050); /* M3UA_Emulation.ttcn, line 1050 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_NOTIFY -> discard"); } } else { current_location.update_lineno(1053); /* M3UA_Emulation.ttcn, line 1053 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__DUNA)) { current_location.update_lineno(1054); /* M3UA_Emulation.ttcn, line 1054 */ if (tsp__logVerbose) { current_location.update_lineno(1055); /* M3UA_Emulation.ttcn, line 1055 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_DUNA -> discard"); } } else { current_location.update_lineno(1058); /* M3UA_Emulation.ttcn, line 1058 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__DAVA)) { current_location.update_lineno(1059); /* M3UA_Emulation.ttcn, line 1059 */ if (tsp__logVerbose) { current_location.update_lineno(1060); /* M3UA_Emulation.ttcn, line 1060 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_DAVA -> discard"); } } else { current_location.update_lineno(1066); /* M3UA_Emulation.ttcn, line 1066 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__DAUD)) { current_location.update_lineno(1067); /* M3UA_Emulation.ttcn, line 1067 */ { boolean tmp_57; { boolean tmp_58; tmp_58 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inactive); if (!tmp_58) tmp_58 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inact__ASPAC__Sent); tmp_57 = tmp_58; } if (!tmp_57) tmp_57 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active); if (tmp_57) { current_location.update_lineno(1071); /* M3UA_Emulation.ttcn, line 1071 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__DAVA(M3UA__Types::M3UA__Network__Appearance_template(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DAUD().messageParameters().network__Appearance()), M3UA__Types::M3UA__Routing__Context_template(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DAUD().messageParameters().routing__Context()), M3UA__Types::M3UA__Affected__Point__Codes_template(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DAUD().messageParameters().affected__Point__Codes()), M3UA__Types::M3UA__Info__String_template(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__DAUD().messageParameters().info__String())).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(1083); /* M3UA_Emulation.ttcn, line 1083 */ if (tsp__logVerbose) { current_location.update_lineno(1084); /* M3UA_Emulation.ttcn, line 1084 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_DAUD received -> DAVA sent"); } } else { current_location.update_lineno(1088); /* M3UA_Emulation.ttcn, line 1088 */ if (tsp__logVerbose) { current_location.update_lineno(1089); /* M3UA_Emulation.ttcn, line 1089 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_DAUD received in wrong state"); } } } } else { current_location.update_lineno(1093); /* M3UA_Emulation.ttcn, line 1093 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__SCON)) { current_location.update_lineno(1094); /* M3UA_Emulation.ttcn, line 1094 */ if (tsp__logVerbose) { current_location.update_lineno(1095); /* M3UA_Emulation.ttcn, line 1095 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_SCON -> discard"); } } else { current_location.update_lineno(1098); /* M3UA_Emulation.ttcn, line 1098 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__DUPU)) { current_location.update_lineno(1099); /* M3UA_Emulation.ttcn, line 1099 */ if (tsp__logVerbose) { current_location.update_lineno(1100); /* M3UA_Emulation.ttcn, line 1100 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_DUPU -> discard"); } } else { current_location.update_lineno(1103); /* M3UA_Emulation.ttcn, line 1103 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__DRST)) { current_location.update_lineno(1104); /* M3UA_Emulation.ttcn, line 1104 */ if (tsp__logVerbose) { current_location.update_lineno(1105); /* M3UA_Emulation.ttcn, line 1105 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_DRST -> discard"); } } else { current_location.update_lineno(1110); /* M3UA_Emulation.ttcn, line 1110 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__ASPUP)) { current_location.update_lineno(1111); /* M3UA_Emulation.ttcn, line 1111 */ { boolean tmp_59; tmp_59 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Down__commUP__Received); if (!tmp_59) tmp_59 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Down__ASPUP__Sent); if ((tmp_59 && tsp__M3UA__Server__Mode)) { current_location.update_lineno(1114); /* M3UA_Emulation.ttcn, line 1114 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Inactive; current_location.update_lineno(1115); /* M3UA_Emulation.ttcn, line 1115 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__ASPUP__Ack.valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(1121); /* M3UA_Emulation.ttcn, line 1121 */ if (tsp__logVerbose) { current_location.update_lineno(1122); /* M3UA_Emulation.ttcn, line 1122 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPUP received -> M3UA_ASPUP_Ack sent"); current_location.update_lineno(1123); /* M3UA_Emulation.ttcn, line 1123 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } current_location.update_lineno(1127); /* M3UA_Emulation.ttcn, line 1127 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__NOTIFY(t__Status(os_12, os_18), M3UA__Types::M3UA__ASP__Identifier_template(OMIT_VALUE), M3UA__Types::M3UA__Routing__Context_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).rctx()), M3UA__Types::M3UA__Info__String_template(OMIT_VALUE)).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(1137); /* M3UA_Emulation.ttcn, line 1137 */ if (tsp__logVerbose) { current_location.update_lineno(1138); /* M3UA_Emulation.ttcn, line 1138 */ TTCN_Logger::log_str(TTCN_USER, "AS state changed -> M3UA_NOTIFY sent"); } } else { current_location.update_lineno(1142); /* M3UA_Emulation.ttcn, line 1142 */ if (tsp__logVerbose) { current_location.update_lineno(1143); /* M3UA_Emulation.ttcn, line 1143 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPUP received in wrong state or the emulation is not in M3UA server mode"); } } } } else { current_location.update_lineno(1150); /* M3UA_Emulation.ttcn, line 1150 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__ASPDN)) { current_location.update_lineno(1151); /* M3UA_Emulation.ttcn, line 1151 */ { boolean tmp_61; { boolean tmp_62; tmp_62 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inactive); if (!tmp_62) tmp_62 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inact__ASPAC__Sent); tmp_61 = tmp_62; } if (!tmp_61) tmp_61 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active); if (tmp_61) { current_location.update_lineno(1154); /* M3UA_Emulation.ttcn, line 1154 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__ASPDN__Ack.valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(1160); /* M3UA_Emulation.ttcn, line 1160 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { } current_location.update_lineno(1163); /* M3UA_Emulation.ttcn, line 1163 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Down__commUP__Received; current_location.update_lineno(1164); /* M3UA_Emulation.ttcn, line 1164 */ if (tsp__logVerbose) { current_location.update_lineno(1165); /* M3UA_Emulation.ttcn, line 1165 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPDN received -> ASPDN_Ack sent"); current_location.update_lineno(1166); /* M3UA_Emulation.ttcn, line 1166 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } else { current_location.update_lineno(1171); /* M3UA_Emulation.ttcn, line 1171 */ if (tsp__logVerbose) { current_location.update_lineno(1172); /* M3UA_Emulation.ttcn, line 1172 */ TTCN_Logger::log_str(TTCN_USER, "ASPDN received in wrong state or the emulation is not in M3UA server mode"); } } } } else { current_location.update_lineno(1179); /* M3UA_Emulation.ttcn, line 1179 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__ASPUP__Ack)) { current_location.update_lineno(1180); /* M3UA_Emulation.ttcn, line 1180 */ { boolean tmp_64; { boolean tmp_65; tmp_65 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Down__ASPUP__Sent); if (!tmp_65) tmp_65 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inactive); tmp_64 = tmp_65; } if (tmp_64) tmp_64 = (!(tsp__M3UA__Server__Mode)); if (tmp_64) { current_location.update_lineno(1183); /* M3UA_Emulation.ttcn, line 1183 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Inactive; current_location.update_lineno(1184); /* M3UA_Emulation.ttcn, line 1184 */ if (tsp__logVerbose) { current_location.update_lineno(1185); /* M3UA_Emulation.ttcn, line 1185 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPUP_Ack received -> send M3UA_ASPAC"); current_location.update_lineno(1186); /* M3UA_Emulation.ttcn, line 1186 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } current_location.update_lineno(1189); /* M3UA_Emulation.ttcn, line 1189 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__ASPAC(M3UA__Types::M3UA__Traffic__Mode__Type_template(OMIT_VALUE), M3UA__Types::M3UA__Routing__Context_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).rctx()), M3UA__Types::M3UA__Info__String_template(OMIT_VALUE)).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(1196); /* M3UA_Emulation.ttcn, line 1196 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Inact__ASPAC__Sent; current_location.update_lineno(1197); /* M3UA_Emulation.ttcn, line 1197 */ if (tsp__logVerbose) { current_location.update_lineno(1198); /* M3UA_Emulation.ttcn, line 1198 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } else { current_location.update_lineno(1203); /* M3UA_Emulation.ttcn, line 1203 */ if (tsp__logVerbose) { current_location.update_lineno(1204); /* M3UA_Emulation.ttcn, line 1204 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPUP_Ack received in wrong state or the emulation is not in M3UA client mode"); } } } } else { current_location.update_lineno(1209); /* M3UA_Emulation.ttcn, line 1209 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__ASPDN__Ack)) { current_location.update_lineno(1210); /* M3UA_Emulation.ttcn, line 1210 */ if (tsp__logVerbose) { current_location.update_lineno(1211); /* M3UA_Emulation.ttcn, line 1211 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_ASPDN_Ack -> discard"); } } else { current_location.update_lineno(1217); /* M3UA_Emulation.ttcn, line 1217 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__ASPAC)) { current_location.update_lineno(1218); /* M3UA_Emulation.ttcn, line 1218 */ { boolean tmp_68; tmp_68 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inactive); if (!tmp_68) tmp_68 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inact__ASPAC__Sent); if ((tmp_68 && tsp__M3UA__Server__Mode)) { current_location.update_lineno(1221); /* M3UA_Emulation.ttcn, line 1221 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Active; current_location.update_lineno(1222); /* M3UA_Emulation.ttcn, line 1222 */ if (tsp__logVerbose) { current_location.update_lineno(1223); /* M3UA_Emulation.ttcn, line 1223 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPAC received -> M3UA_ASPAC_Ack sent"); current_location.update_lineno(1224); /* M3UA_Emulation.ttcn, line 1224 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } current_location.update_lineno(1227); /* M3UA_Emulation.ttcn, line 1227 */ INTEGER v__i; current_location.update_lineno(1228); /* M3UA_Emulation.ttcn, line 1228 */ v__i = 0; current_location.update_lineno(1228); /* M3UA_Emulation.ttcn, line 1228 */ for ( ; ; ) { current_location.update_lineno(1228); /* M3UA_Emulation.ttcn, line 1228 */ if (!(v__i < M3UA__CT_component_v__TRANSFERreq__Buffer.size_of())) break; current_location.update_lineno(1229); /* M3UA_Emulation.ttcn, line 1229 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Sending buffered message #"); v__i.log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(1230); /* M3UA_Emulation.ttcn, line 1230 */ f__Send__MTP3__TRANSFERreq(MTP3asp__Types::ASP__MTP3__TRANSFERreq(const_cast< const TRANSFERreq__Buffer&>(M3UA__CT_component_v__TRANSFERreq__Buffer)[v__i])); current_location.update_lineno(1228); /* M3UA_Emulation.ttcn, line 1228 */ { INTEGER tmp_71; ++v__i; } } current_location.update_lineno(1232); /* M3UA_Emulation.ttcn, line 1232 */ M3UA__CT_component_v__TRANSFERreq__Buffer = NULL_VALUE; current_location.update_lineno(1234); /* M3UA_Emulation.ttcn, line 1234 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__ASPAC__Ack(M3UA__Types::M3UA__Traffic__Mode__Type_template(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__ASPAC().messageParameters().traffic__Mode__Type()), M3UA__Types::M3UA__Routing__Context_template(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__ASPAC().messageParameters().routing__Context())).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(1247); /* M3UA_Emulation.ttcn, line 1247 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__NOTIFY(t__Status(os_12, os_12), M3UA__Types::M3UA__ASP__Identifier_template(OMIT_VALUE), M3UA__Types::M3UA__Routing__Context_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).rctx()), M3UA__Types::M3UA__Info__String_template(OMIT_VALUE)).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(1257); /* M3UA_Emulation.ttcn, line 1257 */ if (tsp__logVerbose) { current_location.update_lineno(1258); /* M3UA_Emulation.ttcn, line 1258 */ TTCN_Logger::log_str(TTCN_USER, "AS state changed -> M3UA_NOTIFY sent"); } } else { current_location.update_lineno(1262); /* M3UA_Emulation.ttcn, line 1262 */ if (tsp__logVerbose) { current_location.update_lineno(1263); /* M3UA_Emulation.ttcn, line 1263 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPAC received in wrong state or the emulation is not in M3UA server mode"); } } } } else { current_location.update_lineno(1270); /* M3UA_Emulation.ttcn, line 1270 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__ASPAC__Ack)) { current_location.update_lineno(1271); /* M3UA_Emulation.ttcn, line 1271 */ { boolean tmp_73; { boolean tmp_74; tmp_74 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Inact__ASPAC__Sent); if (!tmp_74) tmp_74 = (const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active); tmp_73 = tmp_74; } if (tmp_73) tmp_73 = (!(tsp__M3UA__Server__Mode)); if (tmp_73) { current_location.update_lineno(1275); /* M3UA_Emulation.ttcn, line 1275 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Active; current_location.update_lineno(1276); /* M3UA_Emulation.ttcn, line 1276 */ if (tsp__logVerbose) { current_location.update_lineno(1277); /* M3UA_Emulation.ttcn, line 1277 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("ASPAC_Ack received for association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(1278); /* M3UA_Emulation.ttcn, line 1278 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } current_location.update_lineno(1281); /* M3UA_Emulation.ttcn, line 1281 */ INTEGER v__i; current_location.update_lineno(1282); /* M3UA_Emulation.ttcn, line 1282 */ v__i = 0; current_location.update_lineno(1282); /* M3UA_Emulation.ttcn, line 1282 */ for ( ; ; ) { current_location.update_lineno(1282); /* M3UA_Emulation.ttcn, line 1282 */ if (!(v__i < M3UA__CT_component_v__TRANSFERreq__Buffer.size_of())) break; current_location.update_lineno(1283); /* M3UA_Emulation.ttcn, line 1283 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Sending buffered message #"); v__i.log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } current_location.update_lineno(1284); /* M3UA_Emulation.ttcn, line 1284 */ f__Send__MTP3__TRANSFERreq(MTP3asp__Types::ASP__MTP3__TRANSFERreq(const_cast< const TRANSFERreq__Buffer&>(M3UA__CT_component_v__TRANSFERreq__Buffer)[v__i])); current_location.update_lineno(1282); /* M3UA_Emulation.ttcn, line 1282 */ { INTEGER tmp_77; ++v__i; } } current_location.update_lineno(1286); /* M3UA_Emulation.ttcn, line 1286 */ M3UA__CT_component_v__TRANSFERreq__Buffer = NULL_VALUE; } else { current_location.update_lineno(1289); /* M3UA_Emulation.ttcn, line 1289 */ if (tsp__logVerbose) { current_location.update_lineno(1290); /* M3UA_Emulation.ttcn, line 1290 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("M3UA_ASPAC_Ack received in wrong state on association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" or the emulation is not in M3UA client mode"); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } } } else { current_location.update_lineno(1298); /* M3UA_Emulation.ttcn, line 1298 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__ASPIA)) { current_location.update_lineno(1299); /* M3UA_Emulation.ttcn, line 1299 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { current_location.update_lineno(1300); /* M3UA_Emulation.ttcn, line 1300 */ M3UA__CT_component_SCTP__PORT.send(t__S__SCTP__Send(INTEGER_template(const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID()), INTEGER_template(0), OCTETSTRING_template(M3UA__Types::enc__PDU__M3UA(t__PDU__M3UA__ASPIA__Ack(M3UA__Types::M3UA__Routing__Context_template(const_cast< const M3UA__Types::PDU__M3UA&>(pl__PDU__M3UA).m3UA__ASPIA().messageParameters().routing__Context())).valueof())), INTEGER_template(tsp__SCTP__PayloadProtocolID)), FALSE, NULL); current_location.update_lineno(1310); /* M3UA_Emulation.ttcn, line 1310 */ M3UA__CT_component_v__Entity.commStatus() = M3UA__CommStatus::aSP__Inactive; current_location.update_lineno(1311); /* M3UA_Emulation.ttcn, line 1311 */ if (tsp__logVerbose) { current_location.update_lineno(1312); /* M3UA_Emulation.ttcn, line 1312 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPIA received -> M3UA_ASPIA_Ack sent"); current_location.update_lineno(1313); /* M3UA_Emulation.ttcn, line 1313 */ try { TTCN_Logger::begin_event(TTCN_USER); TTCN_Logger::log_event_str("Association #"); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).sCTP__Assoc__ID().log(); TTCN_Logger::log_event_str(" state changed to: "); const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus().log(); TTCN_Logger::end_event(); } catch (...) { TTCN_Logger::finish_event(); throw; } } } else { current_location.update_lineno(1318); /* M3UA_Emulation.ttcn, line 1318 */ if (tsp__logVerbose) { current_location.update_lineno(1319); /* M3UA_Emulation.ttcn, line 1319 */ TTCN_Logger::log_str(TTCN_USER, "M3UA_ASPIA received in wrong state or the emulation is not running in M3UA server mode"); } } } else { current_location.update_lineno(1324); /* M3UA_Emulation.ttcn, line 1324 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__ASPIA__Ack)) { current_location.update_lineno(1325); /* M3UA_Emulation.ttcn, line 1325 */ if (tsp__logVerbose) { current_location.update_lineno(1326); /* M3UA_Emulation.ttcn, line 1326 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_ASPIA_Ack -> discard"); } } else { current_location.update_lineno(1329); /* M3UA_Emulation.ttcn, line 1329 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__REG__REQ)) { current_location.update_lineno(1330); /* M3UA_Emulation.ttcn, line 1330 */ if (tsp__logVerbose) { current_location.update_lineno(1331); /* M3UA_Emulation.ttcn, line 1331 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_REG_REQ -> discard"); } } else { current_location.update_lineno(1334); /* M3UA_Emulation.ttcn, line 1334 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__REG__RSP)) { current_location.update_lineno(1335); /* M3UA_Emulation.ttcn, line 1335 */ if (tsp__logVerbose) { current_location.update_lineno(1336); /* M3UA_Emulation.ttcn, line 1336 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_REG_RSP -> discard"); } } else { current_location.update_lineno(1339); /* M3UA_Emulation.ttcn, line 1339 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__DEREG__REQ)) { current_location.update_lineno(1340); /* M3UA_Emulation.ttcn, line 1340 */ if (tsp__logVerbose) { current_location.update_lineno(1341); /* M3UA_Emulation.ttcn, line 1341 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_DEREG_REQ -> discard"); } } else { current_location.update_lineno(1344); /* M3UA_Emulation.ttcn, line 1344 */ if (pl__PDU__M3UA.ischosen(M3UA__Types::PDU__M3UA::ALT_m3UA__DEREG__RSP)) { current_location.update_lineno(1345); /* M3UA_Emulation.ttcn, line 1345 */ if (tsp__logVerbose) { current_location.update_lineno(1346); /* M3UA_Emulation.ttcn, line 1346 */ TTCN_Logger::log_str(TTCN_USER, "Received M3UA_DEREG_RSP -> discard"); } } } } } } } } } } } } } } } } } } } } } } } } } void start_f__handle__M3UA__msg(const COMPONENT& component_reference, const M3UA__Types::PDU__M3UA& pl__PDU__M3UA) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_handle_M3UA_msg("); pl__PDU__M3UA.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, "M3UA_Emulation", "f_handle_M3UA_msg", text_buf); pl__PDU__M3UA.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } void f__handle__nonM3UA__msg(const OCTETSTRING& pl__PDU) { TTCN_Location current_location("M3UA_Emulation.ttcn", 1351, TTCN_Location::LOCATION_FUNCTION, "f_handle_nonM3UA_msg"); current_location.update_lineno(1353); /* M3UA_Emulation.ttcn, line 1353 */ if ((const_cast< const M3UA__Entity&>(M3UA__CT_component_v__Entity).commStatus() == M3UA__CommStatus::aSP__Active)) { current_location.update_lineno(1355); /* M3UA_Emulation.ttcn, line 1355 */ M3UA__CT_component_MTP3__SP__PORT.send(MTP3asp__Types::tr__ASP__MTP3__TRANSFERind__sio(BITSTRING_template(bs_2), BITSTRING_template(bs_2), BITSTRING_template(bs_0), INTEGER_template(0), INTEGER_template(0), INTEGER_template(0), OCTETSTRING_template(pl__PDU)).valueof(), FALSE, NULL); current_location.update_lineno(1364); /* M3UA_Emulation.ttcn, line 1364 */ if (tsp__logVerbose) { current_location.update_lineno(1365); /* M3UA_Emulation.ttcn, line 1365 */ TTCN_Logger::log_str(TTCN_USER, "Non-M3UA DATA received -> TRANSFERind sent"); } } else { current_location.update_lineno(1369); /* M3UA_Emulation.ttcn, line 1369 */ if (tsp__logVerbose) { current_location.update_lineno(1370); /* M3UA_Emulation.ttcn, line 1370 */ TTCN_Logger::log_str(TTCN_USER, "DATA received, but no user connected -> discard"); } } } void start_f__handle__nonM3UA__msg(const COMPONENT& component_reference, const OCTETSTRING& pl__PDU) { TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_handle_nonM3UA_msg("); pl__PDU.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, "M3UA_Emulation", "f_handle_nonM3UA_msg", text_buf); pl__PDU.encode_text(text_buf); TTCN_Runtime::send_start_component(text_buf); } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("M3UA_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "M3UA_Emulation"); M3UA__Types::module_object.pre_init_module(); SCTPasp__PortType::module_object.pre_init_module(); MTP3asp__Types::module_object.pre_init_module(); current_location.update_lineno(23); /* M3UA_Emulation.ttcn, line 23 */ modulepar_tsp__logVerbose = FALSE; module_object.add_modulepar("tsp_logVerbose"); current_location.update_lineno(24); /* M3UA_Emulation.ttcn, line 24 */ modulepar_tsp__Timer = 2.0; module_object.add_modulepar("tsp_Timer"); current_location.update_lineno(25); /* M3UA_Emulation.ttcn, line 25 */ modulepar_tsp__ASPUP__Resend__Timer = 2.0; module_object.add_modulepar("tsp_ASPUP_Resend_Timer"); current_location.update_lineno(26); /* M3UA_Emulation.ttcn, line 26 */ modulepar_tsp__ASPAC__Resend__Timer = 2.0; module_object.add_modulepar("tsp_ASPAC_Resend_Timer"); current_location.update_lineno(27); /* M3UA_Emulation.ttcn, line 27 */ modulepar_tsp__Assoc__Restart__Timer = 6.0e1; module_object.add_modulepar("tsp_Assoc_Restart_Timer"); current_location.update_lineno(28); /* M3UA_Emulation.ttcn, line 28 */ modulepar_tsp__Heartbeat__Timer = 3.0e1; module_object.add_modulepar("tsp_Heartbeat_Timer"); current_location.update_lineno(29); /* M3UA_Emulation.ttcn, line 29 */ modulepar_tsp__SCTP__PayloadProtocolID = 3; module_object.add_modulepar("tsp_SCTP_PayloadProtocolID"); current_location.update_lineno(30); /* M3UA_Emulation.ttcn, line 30 */ modulepar_tsp__Enable__M3UA__Heartbeat = FALSE; module_object.add_modulepar("tsp_Enable_M3UA_Heartbeat"); current_location.update_lineno(31); /* M3UA_Emulation.ttcn, line 31 */ modulepar_tsp__SCTP__Server__Mode = FALSE; module_object.add_modulepar("tsp_SCTP_Server_Mode"); current_location.update_lineno(32); /* M3UA_Emulation.ttcn, line 32 */ modulepar_tsp__M3UA__Server__Mode = FALSE; module_object.add_modulepar("tsp_M3UA_Server_Mode"); module_object.add_function("f_M3UA_Emulation", (genericfunc_t)&f__M3UA__Emulation, (genericfunc_t)&start_f__M3UA__Emulation); module_object.add_function("f_Initialize_SCTP", (genericfunc_t)&f__Initialize__SCTP, (genericfunc_t)&start_f__Initialize__SCTP); module_object.add_function("f_Associate", (genericfunc_t)&f__Associate, (genericfunc_t)&start_f__Associate); module_object.add_function("f_M3UA_ScanEvents", (genericfunc_t)&f__M3UA__ScanEvents, (genericfunc_t)&start_f__M3UA__ScanEvents); module_object.add_function("f_Send_MTP3_TRANSFERreq", (genericfunc_t)&f__Send__MTP3__TRANSFERreq, (genericfunc_t)&start_f__Send__MTP3__TRANSFERreq); module_object.add_altstep("as_SCTP_CommunicationUp", (genericfunc_t)&as__SCTP__CommunicationUp_instance, (genericfunc_t )&activate_as__SCTP__CommunicationUp, (genericfunc_t )&as__SCTP__CommunicationUp); module_object.add_altstep("as_SCTP_DataArrive", (genericfunc_t)&as__SCTP__DataArrive_instance, (genericfunc_t )&activate_as__SCTP__DataArrive, (genericfunc_t )&as__SCTP__DataArrive); module_object.add_altstep("as_SCTP_Connected", (genericfunc_t)&as__SCTP__Connected_instance, (genericfunc_t )&activate_as__SCTP__Connected, (genericfunc_t )&as__SCTP__Connected); module_object.add_altstep("as_Unexpected_SCTP_Events", (genericfunc_t)&as__Unexpected__SCTP__Events_instance, (genericfunc_t )&activate_as__Unexpected__SCTP__Events, (genericfunc_t )&as__Unexpected__SCTP__Events); module_object.add_altstep("as_handleM3UA_timers", (genericfunc_t)&as__handleM3UA__timers_instance, (genericfunc_t )&activate_as__handleM3UA__timers, (genericfunc_t )&as__handleM3UA__timers); module_object.add_altstep("as_handleSCTP_timers", (genericfunc_t)&as__handleSCTP__timers_instance, (genericfunc_t )&activate_as__handleSCTP__timers, (genericfunc_t )&as__handleSCTP__timers); module_object.add_function("f_ASPUP_Sending", (genericfunc_t)&f__ASPUP__Sending, (genericfunc_t)&start_f__ASPUP__Sending); module_object.add_function("f_Assoc_Exists", (genericfunc_t)&f__Assoc__Exists, (genericfunc_t)&start_f__Assoc__Exists); module_object.add_function("f_handle_M3UA_msg", (genericfunc_t)&f__handle__M3UA__msg, (genericfunc_t)&start_f__handle__M3UA__msg); module_object.add_function("f_handle_nonM3UA_msg", (genericfunc_t)&f__handle__nonM3UA__msg, (genericfunc_t)&start_f__handle__nonM3UA__msg); } void post_init_module() { TTCN_Location current_location("M3UA_Emulation.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "M3UA_Emulation"); M3UA__Types::module_object.post_init_module(); SCTPasp__PortType::module_object.post_init_module(); MTP3asp__Types::module_object.post_init_module(); M3UA__CT_component_T__Timer.set_default_duration(tsp__Timer); M3UA__CT_component_T__ASPUP__resend.set_default_duration(tsp__ASPUP__Resend__Timer); M3UA__CT_component_T__ASPAC__resend.set_default_duration(tsp__ASPAC__Resend__Timer); M3UA__CT_component_T__Heartbeat.set_default_duration(tsp__Heartbeat__Timer); M3UA__CT_component_T__Assoc__restart.set_default_duration(tsp__Assoc__Restart__Timer); current_location.update_lineno(259); /* M3UA_Emulation.ttcn, line 259 */ { M3UA__Types::M3UA__ASPUP__Ack_template& tmp_2 = template_t__PDU__M3UA__ASPUP__Ack.m3UA__ASPUP__Ack(); tmp_2.version() = os_0; tmp_2.reserved() = os_1; tmp_2.messageClassAndType() = os_3; tmp_2.messageLength() = 0; tmp_2.messageParameters().info__String() = OMIT_VALUE; } current_location.update_lineno(272); /* M3UA_Emulation.ttcn, line 272 */ { M3UA__Types::M3UA__ASPDN_template& tmp_3 = template_t__PDU__M3UA__ASPDN.m3UA__ASPDN(); tmp_3.version() = os_0; tmp_3.reserved() = os_1; tmp_3.messageClassAndType() = os_4; tmp_3.messageLength() = 0; tmp_3.messageParameters().info__String() = OMIT_VALUE; } current_location.update_lineno(285); /* M3UA_Emulation.ttcn, line 285 */ { M3UA__Types::M3UA__ASPDN__Ack_template& tmp_4 = template_t__PDU__M3UA__ASPDN__Ack.m3UA__ASPDN__Ack(); tmp_4.version() = os_0; tmp_4.reserved() = os_1; tmp_4.messageClassAndType() = os_5; tmp_4.messageLength() = 0; tmp_4.messageParameters().info__String() = OMIT_VALUE; } current_location.update_lineno(499); /* M3UA_Emulation.ttcn, line 499 */ template_f__M3UA__Emulation_rctx_defval = OMIT_VALUE; } boolean set_module_param(Module_Param& param) { const char* const par_name = param.get_id()->get_current_name(); if (!strcmp(par_name, "tsp_logVerbose")) { modulepar_tsp__logVerbose.set_param(param); return TRUE; } else if (!strcmp(par_name, "tsp_Timer")) { modulepar_tsp__Timer.set_param(param); return TRUE; } else if (!strcmp(par_name, "tsp_ASPUP_Resend_Timer")) { modulepar_tsp__ASPUP__Resend__Timer.set_param(param); return TRUE; } else if (!strcmp(par_name, "tsp_ASPAC_Resend_Timer")) { modulepar_tsp__ASPAC__Resend__Timer.set_param(param); return TRUE; } else if (!strcmp(par_name, "tsp_Assoc_Restart_Timer")) { modulepar_tsp__Assoc__Restart__Timer.set_param(param); return TRUE; } else if (!strcmp(par_name, "tsp_Heartbeat_Timer")) { modulepar_tsp__Heartbeat__Timer.set_param(param); return TRUE; } else if (!strcmp(par_name, "tsp_SCTP_PayloadProtocolID")) { modulepar_tsp__SCTP__PayloadProtocolID.set_param(param); return TRUE; } else if (!strcmp(par_name, "tsp_Enable_M3UA_Heartbeat")) { modulepar_tsp__Enable__M3UA__Heartbeat.set_param(param); return TRUE; } else if (!strcmp(par_name, "tsp_SCTP_Server_Mode")) { modulepar_tsp__SCTP__Server__Mode.set_param(param); return TRUE; } else if (!strcmp(par_name, "tsp_M3UA_Server_Mode")) { modulepar_tsp__M3UA__Server__Mode.set_param(param); return TRUE; } else return FALSE; } void log_module_param() { TTCN_Logger::log_event_str("tsp_logVerbose := "); tsp__logVerbose.log(); TTCN_Logger::log_event_str(", tsp_Timer := "); tsp__Timer.log(); TTCN_Logger::log_event_str(", tsp_ASPUP_Resend_Timer := "); tsp__ASPUP__Resend__Timer.log(); TTCN_Logger::log_event_str(", tsp_ASPAC_Resend_Timer := "); tsp__ASPAC__Resend__Timer.log(); TTCN_Logger::log_event_str(", tsp_Assoc_Restart_Timer := "); tsp__Assoc__Restart__Timer.log(); TTCN_Logger::log_event_str(", tsp_Heartbeat_Timer := "); tsp__Heartbeat__Timer.log(); TTCN_Logger::log_event_str(", tsp_SCTP_PayloadProtocolID := "); tsp__SCTP__PayloadProtocolID.log(); TTCN_Logger::log_event_str(", tsp_Enable_M3UA_Heartbeat := "); tsp__Enable__M3UA__Heartbeat.log(); TTCN_Logger::log_event_str(", tsp_SCTP_Server_Mode := "); tsp__SCTP__Server__Mode.log(); TTCN_Logger::log_event_str(", tsp_M3UA_Server_Mode := "); tsp__M3UA__Server__Mode.log(); } boolean init_comp_type(const char *component_type, boolean init_base_comps) { (void)init_base_comps; if (!strcmp(component_type, "M3UA_CT")) { M3UA__CT_component_v__Entity.clean_up(); M3UA__CT_component_v__TRANSFERreq__Buffer = NULL_VALUE; M3UA__CT_component_v__ASP__SCTP.clean_up(); M3UA__CT_component_v__ASP__SCTP__SEND__FAILED.clean_up(); M3UA__CT_component_v__ASP__SCTP__RESULT.clean_up(); M3UA__CT_component_v__ASP__SCTP__Connected.clean_up(); M3UA__CT_component_v__ASP__SCTP__ASSOC__CHANGE.clean_up(); M3UA__CT_component_v__ASP__SCTP__SHUTDOWN__EVENT.clean_up(); M3UA__CT_component_v__PDU__M3UA.clean_up(); M3UA__CT_component_MTP3__SP__PORT.activate_port(); M3UA__CT_component_SCTP__PORT.activate_port(); return TRUE; } else return FALSE; } boolean init_system_port(const char* component_type, const char* port_name) { if (!strcmp(component_type, "M3UA_CT")) { if (!strcmp(port_name, "MTP3_SP_PORT")) { M3UA__CT_component_MTP3__SP__PORT.safe_start(); return TRUE; } if (!strcmp(port_name, "SCTP_PORT")) { M3UA__CT_component_SCTP__PORT.safe_start(); return TRUE; } } return FALSE; } boolean start_ptc_function(const char *function_name, Text_Buf& function_arguments) { if (!strcmp(function_name, "f_M3UA_Emulation")) { SCTP__Association__Address pl__Boot; INTEGER_template rctx; pl__Boot.decode_text(function_arguments); rctx.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_M3UA_Emulation("); pl__Boot.log(); TTCN_Logger::log_event_str(", "); rctx.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__M3UA__Emulation(pl__Boot, rctx); TTCN_Runtime::function_finished("f_M3UA_Emulation"); return TRUE; } else if (!strcmp(function_name, "f_Initialize_SCTP")) { TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_Initialize_SCTP()."); TTCN_Runtime::function_started(function_arguments); f__Initialize__SCTP(); TTCN_Runtime::function_finished("f_Initialize_SCTP"); return TRUE; } else if (!strcmp(function_name, "f_Associate")) { TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_Associate()."); TTCN_Runtime::function_started(function_arguments); f__Associate(); TTCN_Runtime::function_finished("f_Associate"); return TRUE; } else if (!strcmp(function_name, "f_M3UA_ScanEvents")) { TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_M3UA_ScanEvents()."); TTCN_Runtime::function_started(function_arguments); f__M3UA__ScanEvents(); TTCN_Runtime::function_finished("f_M3UA_ScanEvents"); return TRUE; } else if (!strcmp(function_name, "f_Send_MTP3_TRANSFERreq")) { MTP3asp__Types::ASP__MTP3__TRANSFERreq pl__ASP__MTP3__TRANSFERreq; pl__ASP__MTP3__TRANSFERreq.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_Send_MTP3_TRANSFERreq("); pl__ASP__MTP3__TRANSFERreq.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__Send__MTP3__TRANSFERreq(pl__ASP__MTP3__TRANSFERreq); TTCN_Runtime::function_finished("f_Send_MTP3_TRANSFERreq"); return TRUE; } else if (!strcmp(function_name, "f_ASPUP_Sending")) { TTCN_Logger::log_str(TTCN_Logger::PARALLEL_PTC, "Starting function f_ASPUP_Sending()."); TTCN_Runtime::function_started(function_arguments); f__ASPUP__Sending(); TTCN_Runtime::function_finished("f_ASPUP_Sending"); return TRUE; } else if (!strcmp(function_name, "f_Assoc_Exists")) { INTEGER pl__assocID; pl__assocID.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_Assoc_Exists("); pl__assocID.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__Assoc__Exists(pl__assocID); TTCN_Runtime::function_finished("f_Assoc_Exists"); return TRUE; } else if (!strcmp(function_name, "f_handle_M3UA_msg")) { M3UA__Types::PDU__M3UA pl__PDU__M3UA; pl__PDU__M3UA.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_handle_M3UA_msg("); pl__PDU__M3UA.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__handle__M3UA__msg(pl__PDU__M3UA); TTCN_Runtime::function_finished("f_handle_M3UA_msg"); return TRUE; } else if (!strcmp(function_name, "f_handle_nonM3UA_msg")) { OCTETSTRING pl__PDU; pl__PDU.decode_text(function_arguments); TTCN_Logger::begin_event(TTCN_Logger::PARALLEL_PTC); TTCN_Logger::log_event_str("Starting function f_handle_nonM3UA_msg("); pl__PDU.log(); TTCN_Logger::log_event_str(")."); TTCN_Logger::end_event(); TTCN_Runtime::function_started(function_arguments); f__handle__nonM3UA__msg(pl__PDU); TTCN_Runtime::function_finished("f_handle_nonM3UA_msg"); return TRUE; } else return FALSE; } } /* end of namespace */