// 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 "SCCP_Adapter.hh" namespace SCCP__Adapter { /* Literal string constants */ extern const CHARSTRING cs_1(5, "-M3UA"), cs_0(5, "-SCCP"); const unsigned char module_checksum[] = { 0xc3, 0xd8, 0x60, 0xd0, 0x84, 0x2d, 0x61, 0x9b, 0xef, 0x1b, 0x26, 0x2f, 0x7d, 0x40, 0x03, 0x44 }; /* Global variable definitions */ const TTCN_RAWdescriptor_t SCCP__Adapter__Transport_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 SCCP__Adapter__Transport const TTCN_Typedescriptor_t SCCP__Adapter__Transport_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Transport", NULL, &SCCP__Adapter__Transport_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Transport_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter__Config__Sigtran_sctp__addr_default_coding("RAW"); const TTCN_RAWdescriptor_t SCCP__Adapter__Config__Sigtran_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 SCCP__Adapter__Config__Sigtran const TTCN_Typedescriptor_t SCCP__Adapter__Config__Sigtran_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config_Sigtran", NULL, &SCCP__Adapter__Config__Sigtran_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config__Sigtran_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter__Config__Sccplite_tcp__addr_default_coding("RAW"); const XERdescriptor_t SCCP__Adapter__Config__Sccplite_tcp__is__server_xer_ = { {"tcp_is_server>\n", "tcp_is_server>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int SCCP__Adapter__Config__Sccplite_tcp__is__server_oer_ext_arr_[0] = {}; const int SCCP__Adapter__Config__Sccplite_tcp__is__server_oer_p_[0] = {}; const TTCN_OERdescriptor_t SCCP__Adapter__Config__Sccplite_tcp__is__server_oer_ = { -1, TRUE, -1, FALSE, 0, 0, SCCP__Adapter__Config__Sccplite_tcp__is__server_oer_ext_arr_, 0, SCCP__Adapter__Config__Sccplite_tcp__is__server_oer_p_}; const TTCN_Typedescriptor_t SCCP__Adapter__Config__Sccplite_tcp__is__server_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config_Sccplite.tcp_is_server", &BOOLEAN_ber_, &BOOLEAN_raw_, &BOOLEAN_text_, &SCCP__Adapter__Config__Sccplite_tcp__is__server_xer_, &BOOLEAN_json_, &SCCP__Adapter__Config__Sccplite_tcp__is__server_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config__Sccplite_tcp__is__server_default_coding("RAW"); const TTCN_RAWdescriptor_t SCCP__Adapter__Config__Sccplite_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 SCCP__Adapter__Config__Sccplite const TTCN_Typedescriptor_t SCCP__Adapter__Config__Sccplite_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config_Sccplite", NULL, &SCCP__Adapter__Config__Sccplite_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config__Sccplite_ipa__ccm__pars_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter__Config__Sccplite_default_coding("RAW"); const TTCN_RAWdescriptor_t SCCP__Adapter__Transport__ConfigUnion_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 SCCP__Adapter__Transport__ConfigUnion const TTCN_Typedescriptor_t SCCP__Adapter__Transport__ConfigUnion_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion", NULL, &SCCP__Adapter__Transport__ConfigUnion_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Transport__ConfigUnion_sigtran_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter__Transport__ConfigUnion_sccplite_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter__Transport__ConfigUnion_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter__Config_transport_default_coding("RAW"); const TTCN_RAWdescriptor_t SCCP__Adapter__Config_tpars_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 SCCP__Adapter__Config_tpars const TTCN_Typedescriptor_t SCCP__Adapter__Config_tpars_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config.tpars", NULL, &SCCP__Adapter__Config_tpars_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config_tpars_default_coding("RAW"); const XERdescriptor_t SCCP__Adapter__Config_sccp__service__type_xer_ = { {"sccp_service_type>\n", "sccp_service_type>\n"}, {19, 19}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCCP__Adapter__Config_sccp__service__type_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config.sccp_service_type", NULL, &CHARSTRING_raw_, &CHARSTRING_text_, &SCCP__Adapter__Config_sccp__service__type_xer_, &CHARSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config_sccp__service__type_default_coding("RAW"); const XERdescriptor_t SCCP__Adapter__Config_own__pc_xer_ = { {"own_pc>\n", "own_pc>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCCP__Adapter__Config_own__pc_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config.own_pc", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &SCCP__Adapter__Config_own__pc_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config_own__pc_default_coding("RAW"); const XERdescriptor_t SCCP__Adapter__Config_own__ssn_xer_ = { {"own_ssn>\n", "own_ssn>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCCP__Adapter__Config_own__ssn_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config.own_ssn", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &SCCP__Adapter__Config_own__ssn_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config_own__ssn_default_coding("RAW"); const XERdescriptor_t SCCP__Adapter__Config_peer__pc_xer_ = { {"peer_pc>\n", "peer_pc>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCCP__Adapter__Config_peer__pc_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config.peer_pc", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &SCCP__Adapter__Config_peer__pc_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config_peer__pc_default_coding("RAW"); const XERdescriptor_t SCCP__Adapter__Config_peer__ssn_xer_ = { {"peer_ssn>\n", "peer_ssn>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCCP__Adapter__Config_peer__ssn_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config.peer_ssn", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &SCCP__Adapter__Config_peer__ssn_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config_peer__ssn_default_coding("RAW"); const XERdescriptor_t SCCP__Adapter__Config_sio_xer_ = { {"sio>\n", "sio>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int SCCP__Adapter__Config_sio_oer_ext_arr_[0] = {}; const int SCCP__Adapter__Config_sio_oer_p_[0] = {}; const TTCN_OERdescriptor_t SCCP__Adapter__Config_sio_oer_ = { -1, TRUE, -1, FALSE, 0, 0, SCCP__Adapter__Config_sio_oer_ext_arr_, 0, SCCP__Adapter__Config_sio_oer_p_}; const TTCN_Typedescriptor_t SCCP__Adapter__Config_sio_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config.sio", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &SCCP__Adapter__Config_sio_xer_, &OCTETSTRING_json_, &SCCP__Adapter__Config_sio_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config_sio_default_coding("RAW"); const XERdescriptor_t SCCP__Adapter__Config_rctx_xer_ = { {"rctx>\n", "rctx>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t SCCP__Adapter__Config_rctx_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config.rctx", &INTEGER_ber_, &INTEGER_raw_, &INTEGER_text_, &SCCP__Adapter__Config_rctx_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config_rctx_default_coding("RAW"); const TTCN_RAWdescriptor_t SCCP__Adapter__Config_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 SCCP__Adapter__Config const TTCN_Typedescriptor_t SCCP__Adapter__Config_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Config", NULL, &SCCP__Adapter__Config_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Config_default_coding("RAW"); const TTCN_RAWdescriptor_t SCCP__Adapter__Configs_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 SCCP__Adapter__Configs const TTCN_Typedescriptor_t SCCP__Adapter__Configs_descr_ = { "@SCCP_Adapter.SCCP_Adapter_Configs", NULL, &SCCP__Adapter__Configs_raw_, NULL, NULL, NULL, NULL, NULL, &SCCP__Adapter__Config_descr_, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING SCCP__Adapter__Configs_0_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter__Configs_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter_sccp__pars_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter_sccp__addr__own_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter_sccp__addr__peer_default_coding("RAW"); UNIVERSAL_CHARSTRING SCCP__Adapter_cfg_default_coding("RAW"); // No XER for SCCP__Adapter const TTCN_Typedescriptor_t SCCP__Adapter_descr_ = { "@SCCP_Adapter.SCCP_Adapter", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; TTCN_Module module_object("SCCP_Adapter", __DATE__, __TIME__, module_checksum, pre_init_module, NULL, 0U, 4294967295U, 4294967295U, 4294967295U, NULL, 0LU, 0, post_init_module, NULL, NULL, NULL, NULL, NULL, NULL, NULL); const RuntimeVersionChecker ver_checker( current_runtime_version.requires_major_version_11, current_runtime_version.requires_minor_version_1, current_runtime_version.requires_patch_level_0, current_runtime_version.requires_runtime_1); /* Member functions of C++ classes */ SCCP__Adapter__Transport::SCCP__Adapter__Transport() { enum_value = UNBOUND_VALUE; } SCCP__Adapter__Transport::SCCP__Adapter__Transport(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } SCCP__Adapter__Transport::SCCP__Adapter__Transport(enum_type other_value) { enum_value = other_value; } SCCP__Adapter__Transport::SCCP__Adapter__Transport(const SCCP__Adapter__Transport& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); enum_value = other_value.enum_value; } SCCP__Adapter__Transport& SCCP__Adapter__Transport::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport.", other_value); enum_value = (enum_type)other_value; return *this; } SCCP__Adapter__Transport& SCCP__Adapter__Transport::operator=(enum_type other_value) { enum_value = other_value; return *this; } SCCP__Adapter__Transport& SCCP__Adapter__Transport::operator=(const SCCP__Adapter__Transport& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); enum_value = other_value.enum_value; return *this; } boolean SCCP__Adapter__Transport::operator==(int other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport comparison is an unknown numeric value %d", other_value); return enum_value == other_value; } boolean SCCP__Adapter__Transport::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 @SCCP_Adapter.SCCP_Adapter_Transport."); return enum_value == other_value; } boolean SCCP__Adapter__Transport::operator==(const SCCP__Adapter__Transport& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); return enum_value == other_value.enum_value; } boolean SCCP__Adapter__Transport::operator<(int other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport comparison is an unknown numeric value %d", other_value); return enum_value < other_value; } boolean SCCP__Adapter__Transport::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 @SCCP_Adapter.SCCP_Adapter_Transport."); return enum_value < other_value; } boolean SCCP__Adapter__Transport::operator<(const SCCP__Adapter__Transport& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); return enum_value < other_value.enum_value; } boolean SCCP__Adapter__Transport::operator>(int other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); if (!is_valid_enum(other_value)) TTCN_error("The right operand of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport comparison is an unknown numeric value %d", other_value); return enum_value > other_value; } boolean SCCP__Adapter__Transport::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 @SCCP_Adapter.SCCP_Adapter_Transport."); return enum_value > other_value; } boolean SCCP__Adapter__Transport::operator>(const SCCP__Adapter__Transport& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); return enum_value > other_value.enum_value; } const char *SCCP__Adapter__Transport::enum_to_str(enum_type enum_par) { switch (enum_par) { case SCCP__TRANSPORT__SIGTRAN: return "SCCP_TRANSPORT_SIGTRAN"; case SCCP__TRANSPORT__SCCPlite: return "SCCP_TRANSPORT_SCCPlite"; default: return ""; } } SCCP__Adapter__Transport::enum_type SCCP__Adapter__Transport::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, "SCCP_TRANSPORT_SIGTRAN")) return SCCP__TRANSPORT__SIGTRAN; if (!strcmp(str_par, "SCCP_TRANSPORT_SCCPlite")) return SCCP__TRANSPORT__SCCPlite; } return UNKNOWN_VALUE; } boolean SCCP__Adapter__Transport::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int SCCP__Adapter__Transport::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 @SCCP_Adapter.SCCP_Adapter_Transport.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int SCCP__Adapter__Transport::enum2int(const SCCP__Adapter__Transport& 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 @SCCP_Adapter.SCCP_Adapter_Transport.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void SCCP__Adapter__Transport::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport.", int_val); enum_value = (enum_type)int_val; } SCCP__Adapter__Transport::operator SCCP__Adapter__Transport::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); return enum_value; } void SCCP__Adapter__Transport::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 SCCP__Adapter__Transport::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", "@SCCP_Adapter.SCCP_Adapter_Transport"); 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 @SCCP_Adapter.SCCP_Adapter_Transport."); } } void SCCP__Adapter__Transport::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); text_buf.push_int(enum_value); } void SCCP__Adapter__Transport::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 @SCCP_Adapter.SCCP_Adapter_Transport.", enum_value); } void SCCP__Adapter__Transport::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(TRUE, 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 SCCP__Adapter__Transport::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 SCCP__Adapter__Transport::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*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int SCCP__Adapter__Transport::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void SCCP__Adapter__Transport_template::copy_template(const SCCP__Adapter__Transport_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 SCCP__Adapter__Transport_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 SCCP__Adapter__Transport_template(*other_value.implication_.precondition); implication_.implied_template = new SCCP__Adapter__Transport_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 @SCCP_Adapter.SCCP_Adapter_Transport."); } } SCCP__Adapter__Transport_template::SCCP__Adapter__Transport_template() { } SCCP__Adapter__Transport_template::SCCP__Adapter__Transport_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SCCP__Adapter__Transport_template::SCCP__Adapter__Transport_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!SCCP__Adapter__Transport::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport with unknown numeric value %d.", other_value); single_value = (SCCP__Adapter__Transport::enum_type)other_value; } SCCP__Adapter__Transport_template::SCCP__Adapter__Transport_template(SCCP__Adapter__Transport::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } SCCP__Adapter__Transport_template::SCCP__Adapter__Transport_template(const SCCP__Adapter__Transport& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == SCCP__Adapter__Transport::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); single_value = other_value.enum_value; } SCCP__Adapter__Transport_template::SCCP__Adapter__Transport_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (SCCP__Adapter__Transport::enum_type)(const SCCP__Adapter__Transport&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport from an unbound optional field."); } } SCCP__Adapter__Transport_template::SCCP__Adapter__Transport_template(SCCP__Adapter__Transport_template* p_precondition, SCCP__Adapter__Transport_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SCCP__Adapter__Transport_template::SCCP__Adapter__Transport_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; } SCCP__Adapter__Transport_template::SCCP__Adapter__Transport_template(const SCCP__Adapter__Transport_template& other_value) : Base_Template() { copy_template(other_value); } SCCP__Adapter__Transport_template::~SCCP__Adapter__Transport_template() { clean_up(); } boolean SCCP__Adapter__Transport_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean SCCP__Adapter__Transport_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != SCCP__Adapter__Transport::UNBOUND_VALUE; } void SCCP__Adapter__Transport_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; } SCCP__Adapter__Transport_template& SCCP__Adapter__Transport_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SCCP__Adapter__Transport_template& SCCP__Adapter__Transport_template::operator=(int other_value) { if (!SCCP__Adapter__Transport::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (SCCP__Adapter__Transport::enum_type)other_value; return *this; } SCCP__Adapter__Transport_template& SCCP__Adapter__Transport_template::operator=(SCCP__Adapter__Transport::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } SCCP__Adapter__Transport_template& SCCP__Adapter__Transport_template::operator=(const SCCP__Adapter__Transport& other_value) { if (other_value.enum_value == SCCP__Adapter__Transport::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } SCCP__Adapter__Transport_template& SCCP__Adapter__Transport_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (SCCP__Adapter__Transport::enum_type)(const SCCP__Adapter__Transport&)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 @SCCP_Adapter.SCCP_Adapter_Transport."); } return *this; } SCCP__Adapter__Transport_template& SCCP__Adapter__Transport_template::operator=(const SCCP__Adapter__Transport_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SCCP__Adapter__Transport_template::match(SCCP__Adapter__Transport::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 @SCCP_Adapter.SCCP_Adapter_Transport."); } return FALSE; } boolean SCCP__Adapter__Transport_template::match(const SCCP__Adapter__Transport& other_value, boolean) const { if (other_value.enum_value == SCCP__Adapter__Transport::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport with an unbound value."); return match(other_value.enum_value); } SCCP__Adapter__Transport::enum_type SCCP__Adapter__Transport_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 @SCCP_Adapter.SCCP_Adapter_Transport."); return single_value; } void SCCP__Adapter__Transport_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 SCCP__Adapter__Transport_template[list_length]; break; default: TTCN_error("Setting an invalid type for a template of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); } } SCCP__Adapter__Transport_template& SCCP__Adapter__Transport_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 @SCCP_Adapter.SCCP_Adapter_Transport."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport."); return value_list.list_value[list_index]; } void SCCP__Adapter__Transport_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(SCCP__Adapter__Transport::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 SCCP__Adapter__Transport_template::log_match(const SCCP__Adapter__Transport& 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 SCCP__Adapter__Transport_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 @SCCP_Adapter.SCCP_Adapter_Transport."); } } void SCCP__Adapter__Transport_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (SCCP__Adapter__Transport::enum_type)text_buf.pull_int().get_val(); if (!SCCP__Adapter__Transport::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @SCCP_Adapter.SCCP_Adapter_Transport.", 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 SCCP__Adapter__Transport_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 @SCCP_Adapter.SCCP_Adapter_Transport."); } } boolean SCCP__Adapter__Transport_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SCCP__Adapter__Transport_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: { SCCP__Adapter__Transport_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: { SCCP__Adapter__Transport::enum_type enum_val = SCCP__Adapter__Transport::str_to_enum(m_p->get_enumerated(), m_p->get_enumerated_value()); if (!SCCP__Adapter__Transport::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @SCCP_Adapter.SCCP_Adapter_Transport."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { SCCP__Adapter__Transport_template* precondition = new SCCP__Adapter__Transport_template; precondition->set_param(*m_p->get_elem(0)); SCCP__Adapter__Transport_template* implied_template = new SCCP__Adapter__Transport_template; implied_template->set_param(*m_p->get_elem(1)); *this = SCCP__Adapter__Transport_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@SCCP_Adapter.SCCP_Adapter_Transport"); } is_ifpresent = param.get_ifpresent(); } void SCCP__Adapter__Transport_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 : "@SCCP_Adapter.SCCP_Adapter_Transport"); } SCCP__Adapter__Config__Sigtran::SCCP__Adapter__Config__Sigtran() { } SCCP__Adapter__Config__Sigtran::SCCP__Adapter__Config__Sigtran(const M3UA__Emulation::SCTP__Association__Address& par_sctp__addr) : field_sctp__addr(par_sctp__addr) { } SCCP__Adapter__Config__Sigtran::SCCP__Adapter__Config__Sigtran(const SCCP__Adapter__Config__Sigtran& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); if (other_value.sctp__addr().is_bound()) field_sctp__addr = other_value.sctp__addr(); else field_sctp__addr.clean_up(); } void SCCP__Adapter__Config__Sigtran::clean_up() { field_sctp__addr.clean_up(); } const TTCN_Typedescriptor_t* SCCP__Adapter__Config__Sigtran::get_descriptor() const { return &SCCP__Adapter__Config__Sigtran_descr_; } SCCP__Adapter__Config__Sigtran& SCCP__Adapter__Config__Sigtran::operator=(const SCCP__Adapter__Config__Sigtran& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); if (other_value.sctp__addr().is_bound()) field_sctp__addr = other_value.sctp__addr(); else field_sctp__addr.clean_up(); } return *this; } boolean SCCP__Adapter__Config__Sigtran::operator==(const SCCP__Adapter__Config__Sigtran& other_value) const { return field_sctp__addr==other_value.field_sctp__addr; } boolean SCCP__Adapter__Config__Sigtran::is_bound() const { return (field_sctp__addr.is_bound()); } boolean SCCP__Adapter__Config__Sigtran::is_value() const { return field_sctp__addr.is_value(); } void SCCP__Adapter__Config__Sigtran::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ sctp_addr := "); field_sctp__addr.log(); TTCN_Logger::log_event_str(" }"); } void SCCP__Adapter__Config__Sigtran::set_implicit_omit() { if (sctp__addr().is_bound()) sctp__addr().set_implicit_omit(); } void SCCP__Adapter__Config__Sigtran::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (10 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) sctp__addr().set_param(*param.get_elem(0)); 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(), "sctp_addr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sctp__addr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@SCCP_Adapter.SCCP_Adapter_Config_Sigtran"); } } void SCCP__Adapter__Config__Sigtran::encode_text(Text_Buf& text_buf) const { field_sctp__addr.encode_text(text_buf); } void SCCP__Adapter__Config__Sigtran::decode_text(Text_Buf& text_buf) { field_sctp__addr.decode_text(text_buf); } void SCCP__Adapter__Config__Sigtran::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 SCCP__Adapter__Config__Sigtran::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 SCCP__Adapter__Config__Sigtran::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, M3UA__Emulation::SCTP__Association__Address_descr_.raw->forceomit); decoded_field_length = field_sctp__addr.RAW_decode(M3UA__Emulation::SCTP__Association__Address_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SCCP__Adapter__Config__Sigtran::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 = 1; myleaf.body.node.nodes = init_nodes_of_enc_tree(1); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, M3UA__Emulation::SCTP__Association__Address_descr_.raw); encoded_length += field_sctp__addr.RAW_encode(M3UA__Emulation::SCTP__Association__Address_descr_, *myleaf.body.node.nodes[0]); return myleaf.length = encoded_length; } struct SCCP__Adapter__Config__Sigtran_template::single_value_struct { M3UA__Emulation::SCTP__Association__Address_template field_sctp__addr; }; void SCCP__Adapter__Config__Sigtran_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_sctp__addr = ANY_VALUE; } } } void SCCP__Adapter__Config__Sigtran_template::copy_value(const SCCP__Adapter__Config__Sigtran& other_value) { single_value = new single_value_struct; if (other_value.sctp__addr().is_bound()) { single_value->field_sctp__addr = other_value.sctp__addr(); } else { single_value->field_sctp__addr.clean_up(); } set_selection(SPECIFIC_VALUE); } void SCCP__Adapter__Config__Sigtran_template::copy_template(const SCCP__Adapter__Config__Sigtran_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.sctp__addr().get_selection()) { single_value->field_sctp__addr = other_value.sctp__addr(); } else { single_value->field_sctp__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 SCCP__Adapter__Config__Sigtran_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 SCCP__Adapter__Config__Sigtran_template(*other_value.implication_.precondition); implication_.implied_template = new SCCP__Adapter__Config__Sigtran_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 @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); break; } set_selection(other_value); } SCCP__Adapter__Config__Sigtran_template::SCCP__Adapter__Config__Sigtran_template() { } SCCP__Adapter__Config__Sigtran_template::SCCP__Adapter__Config__Sigtran_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SCCP__Adapter__Config__Sigtran_template::SCCP__Adapter__Config__Sigtran_template(const SCCP__Adapter__Config__Sigtran& other_value) { copy_value(other_value); } SCCP__Adapter__Config__Sigtran_template::SCCP__Adapter__Config__Sigtran_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Config__Sigtran&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran from an unbound optional field."); } } SCCP__Adapter__Config__Sigtran_template::SCCP__Adapter__Config__Sigtran_template(SCCP__Adapter__Config__Sigtran_template* p_precondition, SCCP__Adapter__Config__Sigtran_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SCCP__Adapter__Config__Sigtran_template::SCCP__Adapter__Config__Sigtran_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; } SCCP__Adapter__Config__Sigtran_template::SCCP__Adapter__Config__Sigtran_template(const SCCP__Adapter__Config__Sigtran_template& other_value) : Base_Template() { copy_template(other_value); } SCCP__Adapter__Config__Sigtran_template::~SCCP__Adapter__Config__Sigtran_template() { clean_up(); } SCCP__Adapter__Config__Sigtran_template& SCCP__Adapter__Config__Sigtran_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SCCP__Adapter__Config__Sigtran_template& SCCP__Adapter__Config__Sigtran_template::operator=(const SCCP__Adapter__Config__Sigtran& other_value) { clean_up(); copy_value(other_value); return *this; } SCCP__Adapter__Config__Sigtran_template& SCCP__Adapter__Config__Sigtran_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Config__Sigtran&)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 @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); } return *this; } SCCP__Adapter__Config__Sigtran_template& SCCP__Adapter__Config__Sigtran_template::operator=(const SCCP__Adapter__Config__Sigtran_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SCCP__Adapter__Config__Sigtran_template::match(const SCCP__Adapter__Config__Sigtran& 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.sctp__addr().is_bound()) return FALSE; if(!single_value->field_sctp__addr.match(other_value.sctp__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 @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); } return FALSE; } boolean SCCP__Adapter__Config__Sigtran_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_sctp__addr.is_bound(); } boolean SCCP__Adapter__Config__Sigtran_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_sctp__addr.is_value(); } void SCCP__Adapter__Config__Sigtran_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; } SCCP__Adapter__Config__Sigtran SCCP__Adapter__Config__Sigtran_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 @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); SCCP__Adapter__Config__Sigtran ret_val; if (single_value->field_sctp__addr.is_bound()) { ret_val.sctp__addr() = single_value->field_sctp__addr.valueof(); } return ret_val; } void SCCP__Adapter__Config__Sigtran_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 @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SCCP__Adapter__Config__Sigtran_template[list_length]; } SCCP__Adapter__Config__Sigtran_template& SCCP__Adapter__Config__Sigtran_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 @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); return value_list.list_value[list_index]; } M3UA__Emulation::SCTP__Association__Address_template& SCCP__Adapter__Config__Sigtran_template::sctp__addr() { set_specific(); return single_value->field_sctp__addr; } const M3UA__Emulation::SCTP__Association__Address_template& SCCP__Adapter__Config__Sigtran_template::sctp__addr() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sctp_addr of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); return single_value->field_sctp__addr; } int SCCP__Adapter__Config__Sigtran_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 1; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran 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 @SCCP_Adapter.SCCP_Adapter_Config_Sigtran containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); } return 0; } void SCCP__Adapter__Config__Sigtran_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ sctp_addr := "); single_value->field_sctp__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 SCCP__Adapter__Config__Sigtran_template::log_match(const SCCP__Adapter__Config__Sigtran& 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_sctp__addr.match(match_value.sctp__addr(), legacy)){ TTCN_Logger::log_logmatch_info(".sctp_addr"); single_value->field_sctp__addr.log_match(match_value.sctp__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("{ sctp_addr := "); single_value->field_sctp__addr.log_match(match_value.sctp__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 SCCP__Adapter__Config__Sigtran_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (sctp__addr().is_bound()) sctp__addr().set_implicit_omit(); } void SCCP__Adapter__Config__Sigtran_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_sctp__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 @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); } } void SCCP__Adapter__Config__Sigtran_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_sctp__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 SCCP__Adapter__Config__Sigtran_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 @SCCP_Adapter.SCCP_Adapter_Config_Sigtran."); } } void SCCP__Adapter__Config__Sigtran_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: { SCCP__Adapter__Config__Sigtran_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) sctp__addr().set_param(*param.get_elem(0)); 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(), "sctp_addr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sctp__addr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @SCCP_Adapter.SCCP_Adapter_Config_Sigtran: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SCCP__Adapter__Config__Sigtran_template* precondition = new SCCP__Adapter__Config__Sigtran_template; precondition->set_param(*param.get_elem(0)); SCCP__Adapter__Config__Sigtran_template* implied_template = new SCCP__Adapter__Config__Sigtran_template; implied_template->set_param(*param.get_elem(1)); *this = SCCP__Adapter__Config__Sigtran_template(precondition, implied_template); } break; default: param.type_error("record template", "@SCCP_Adapter.SCCP_Adapter_Config_Sigtran"); } is_ifpresent = param.get_ifpresent(); } void SCCP__Adapter__Config__Sigtran_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_sctp__addr.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config_Sigtran"); 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 : "@SCCP_Adapter.SCCP_Adapter_Config_Sigtran"); } boolean SCCP__Adapter__Config__Sigtran_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SCCP__Adapter__Config__Sigtran_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_ipa__ccm__pars) : field_tcp__addr(par_tcp__addr), field_tcp__is__server(par_tcp__is__server), field_ipa__ccm__pars(par_ipa__ccm__pars) { } SCCP__Adapter__Config__Sccplite::SCCP__Adapter__Config__Sccplite(const SCCP__Adapter__Config__Sccplite& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); if (other_value.tcp__addr().is_bound()) field_tcp__addr = other_value.tcp__addr(); else field_tcp__addr.clean_up(); if (other_value.tcp__is__server().is_bound()) field_tcp__is__server = other_value.tcp__is__server(); else field_tcp__is__server.clean_up(); if (other_value.ipa__ccm__pars().is_bound()) field_ipa__ccm__pars = other_value.ipa__ccm__pars(); else field_ipa__ccm__pars.clean_up(); } void SCCP__Adapter__Config__Sccplite::clean_up() { field_tcp__addr.clean_up(); field_tcp__is__server.clean_up(); field_ipa__ccm__pars.clean_up(); } const TTCN_Typedescriptor_t* SCCP__Adapter__Config__Sccplite::get_descriptor() const { return &SCCP__Adapter__Config__Sccplite_descr_; } SCCP__Adapter__Config__Sccplite& SCCP__Adapter__Config__Sccplite::operator=(const SCCP__Adapter__Config__Sccplite& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); if (other_value.tcp__addr().is_bound()) field_tcp__addr = other_value.tcp__addr(); else field_tcp__addr.clean_up(); if (other_value.tcp__is__server().is_bound()) field_tcp__is__server = other_value.tcp__is__server(); else field_tcp__is__server.clean_up(); if (other_value.ipa__ccm__pars().is_bound()) field_ipa__ccm__pars = other_value.ipa__ccm__pars(); else field_ipa__ccm__pars.clean_up(); } return *this; } boolean SCCP__Adapter__Config__Sccplite::operator==(const SCCP__Adapter__Config__Sccplite& other_value) const { return field_tcp__addr==other_value.field_tcp__addr && field_tcp__is__server==other_value.field_tcp__is__server && field_ipa__ccm__pars==other_value.field_ipa__ccm__pars; } boolean SCCP__Adapter__Config__Sccplite::is_bound() const { return (field_tcp__addr.is_bound()) || (field_tcp__is__server.is_bound()) || (OPTIONAL_OMIT == field_ipa__ccm__pars.get_selection() || field_ipa__ccm__pars.is_bound()); } boolean SCCP__Adapter__Config__Sccplite::is_value() const { return field_tcp__addr.is_value() && field_tcp__is__server.is_value() && (OPTIONAL_OMIT == field_ipa__ccm__pars.get_selection() || field_ipa__ccm__pars.is_value()); } int SCCP__Adapter__Config__Sccplite::size_of() const { int ret_val = 2; if (field_ipa__ccm__pars.ispresent()) ret_val++; return ret_val; } void SCCP__Adapter__Config__Sccplite::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ tcp_addr := "); field_tcp__addr.log(); TTCN_Logger::log_event_str(", tcp_is_server := "); field_tcp__is__server.log(); TTCN_Logger::log_event_str(", ipa_ccm_pars := "); field_ipa__ccm__pars.log(); TTCN_Logger::log_event_str(" }"); } void SCCP__Adapter__Config__Sccplite::set_implicit_omit() { if (tcp__addr().is_bound()) tcp__addr().set_implicit_omit(); if (tcp__is__server().is_bound()) tcp__is__server().set_implicit_omit(); if (!ipa__ccm__pars().is_bound()) ipa__ccm__pars() = OMIT_VALUE; else ipa__ccm__pars().set_implicit_omit(); } void SCCP__Adapter__Config__Sccplite::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (30 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) tcp__addr().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tcp__is__server().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ipa__ccm__pars().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "tcp_addr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tcp__addr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tcp_is_server")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tcp__is__server().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ipa_ccm_pars")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipa__ccm__pars().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@SCCP_Adapter.SCCP_Adapter_Config_Sccplite"); } } void SCCP__Adapter__Config__Sccplite::encode_text(Text_Buf& text_buf) const { field_tcp__addr.encode_text(text_buf); field_tcp__is__server.encode_text(text_buf); field_ipa__ccm__pars.encode_text(text_buf); } void SCCP__Adapter__Config__Sccplite::decode_text(Text_Buf& text_buf) { field_tcp__addr.decode_text(text_buf); field_tcp__is__server.decode_text(text_buf); field_ipa__ccm__pars.decode_text(text_buf); } void SCCP__Adapter__Config__Sccplite::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 SCCP__Adapter__Config__Sccplite::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 SCCP__Adapter__Config__Sccplite::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, M3UA__Emulation::SCTP__Association__Address_descr_.raw->forceomit); decoded_field_length = field_tcp__addr.RAW_decode(M3UA__Emulation::SCTP__Association__Address_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, BOOLEAN_descr_.raw->forceomit); decoded_field_length = field_tcp__is__server.RAW_decode(BOOLEAN_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(2)) { field_ipa__ccm__pars = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, IPA__Emulation::IPA__CCM__Parameters_descr_.raw->forceomit); decoded_field_length = field_ipa__ccm__pars().RAW_decode(IPA__Emulation::IPA__CCM__Parameters_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_ipa__ccm__pars = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_ipa__ccm__pars=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SCCP__Adapter__Config__Sccplite::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 = 3; myleaf.body.node.nodes = init_nodes_of_enc_tree(3); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, M3UA__Emulation::SCTP__Association__Address_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, BOOLEAN_descr_.raw); if (field_ipa__ccm__pars.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, IPA__Emulation::IPA__CCM__Parameters_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; encoded_length += field_tcp__addr.RAW_encode(M3UA__Emulation::SCTP__Association__Address_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_tcp__is__server.RAW_encode(BOOLEAN_descr_, *myleaf.body.node.nodes[1]); if (field_ipa__ccm__pars.ispresent()) { encoded_length += field_ipa__ccm__pars().RAW_encode(IPA__Emulation::IPA__CCM__Parameters_descr_, *myleaf.body.node.nodes[2]); } return myleaf.length = encoded_length; } struct SCCP__Adapter__Config__Sccplite_template::single_value_struct { M3UA__Emulation::SCTP__Association__Address_template field_tcp__addr; BOOLEAN_template field_tcp__is__server; IPA__Emulation::IPA__CCM__Parameters_template field_ipa__ccm__pars; }; void SCCP__Adapter__Config__Sccplite_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_tcp__addr = ANY_VALUE; single_value->field_tcp__is__server = ANY_VALUE; single_value->field_ipa__ccm__pars = ANY_OR_OMIT; } } } void SCCP__Adapter__Config__Sccplite_template::copy_value(const SCCP__Adapter__Config__Sccplite& other_value) { single_value = new single_value_struct; if (other_value.tcp__addr().is_bound()) { single_value->field_tcp__addr = other_value.tcp__addr(); } else { single_value->field_tcp__addr.clean_up(); } if (other_value.tcp__is__server().is_bound()) { single_value->field_tcp__is__server = other_value.tcp__is__server(); } else { single_value->field_tcp__is__server.clean_up(); } if (other_value.ipa__ccm__pars().is_bound()) { if (other_value.ipa__ccm__pars().ispresent()) single_value->field_ipa__ccm__pars = other_value.ipa__ccm__pars()(); else single_value->field_ipa__ccm__pars = OMIT_VALUE; } else { single_value->field_ipa__ccm__pars.clean_up(); } set_selection(SPECIFIC_VALUE); } void SCCP__Adapter__Config__Sccplite_template::copy_template(const SCCP__Adapter__Config__Sccplite_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.tcp__addr().get_selection()) { single_value->field_tcp__addr = other_value.tcp__addr(); } else { single_value->field_tcp__addr.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.tcp__is__server().get_selection()) { single_value->field_tcp__is__server = other_value.tcp__is__server(); } else { single_value->field_tcp__is__server.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ipa__ccm__pars().get_selection()) { single_value->field_ipa__ccm__pars = other_value.ipa__ccm__pars(); } else { single_value->field_ipa__ccm__pars.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 SCCP__Adapter__Config__Sccplite_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 SCCP__Adapter__Config__Sccplite_template(*other_value.implication_.precondition); implication_.implied_template = new SCCP__Adapter__Config__Sccplite_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 @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); break; } set_selection(other_value); } SCCP__Adapter__Config__Sccplite_template::SCCP__Adapter__Config__Sccplite_template() { } SCCP__Adapter__Config__Sccplite_template::SCCP__Adapter__Config__Sccplite_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SCCP__Adapter__Config__Sccplite_template::SCCP__Adapter__Config__Sccplite_template(const SCCP__Adapter__Config__Sccplite& other_value) { copy_value(other_value); } SCCP__Adapter__Config__Sccplite_template::SCCP__Adapter__Config__Sccplite_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Config__Sccplite&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite from an unbound optional field."); } } SCCP__Adapter__Config__Sccplite_template::SCCP__Adapter__Config__Sccplite_template(SCCP__Adapter__Config__Sccplite_template* p_precondition, SCCP__Adapter__Config__Sccplite_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SCCP__Adapter__Config__Sccplite_template::SCCP__Adapter__Config__Sccplite_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; } SCCP__Adapter__Config__Sccplite_template::SCCP__Adapter__Config__Sccplite_template(const SCCP__Adapter__Config__Sccplite_template& other_value) : Base_Template() { copy_template(other_value); } SCCP__Adapter__Config__Sccplite_template::~SCCP__Adapter__Config__Sccplite_template() { clean_up(); } SCCP__Adapter__Config__Sccplite_template& SCCP__Adapter__Config__Sccplite_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SCCP__Adapter__Config__Sccplite_template& SCCP__Adapter__Config__Sccplite_template::operator=(const SCCP__Adapter__Config__Sccplite& other_value) { clean_up(); copy_value(other_value); return *this; } SCCP__Adapter__Config__Sccplite_template& SCCP__Adapter__Config__Sccplite_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Config__Sccplite&)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 @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); } return *this; } SCCP__Adapter__Config__Sccplite_template& SCCP__Adapter__Config__Sccplite_template::operator=(const SCCP__Adapter__Config__Sccplite_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SCCP__Adapter__Config__Sccplite_template::match(const SCCP__Adapter__Config__Sccplite& 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.tcp__addr().is_bound()) return FALSE; if(!single_value->field_tcp__addr.match(other_value.tcp__addr(), legacy))return FALSE; if(!other_value.tcp__is__server().is_bound()) return FALSE; if(!single_value->field_tcp__is__server.match(other_value.tcp__is__server(), legacy))return FALSE; if(!other_value.ipa__ccm__pars().is_bound()) return FALSE; if((other_value.ipa__ccm__pars().ispresent() ? !single_value->field_ipa__ccm__pars.match((const IPA__Emulation::IPA__CCM__Parameters&)other_value.ipa__ccm__pars(), legacy) : !single_value->field_ipa__ccm__pars.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); } return FALSE; } boolean SCCP__Adapter__Config__Sccplite_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_tcp__addr.is_bound() || single_value->field_tcp__is__server.is_bound() || (single_value->field_ipa__ccm__pars.is_omit() || single_value->field_ipa__ccm__pars.is_bound()); } boolean SCCP__Adapter__Config__Sccplite_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_tcp__addr.is_value() && single_value->field_tcp__is__server.is_value() && (single_value->field_ipa__ccm__pars.is_omit() || single_value->field_ipa__ccm__pars.is_value()); } void SCCP__Adapter__Config__Sccplite_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; } SCCP__Adapter__Config__Sccplite SCCP__Adapter__Config__Sccplite_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 @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); SCCP__Adapter__Config__Sccplite ret_val; if (single_value->field_tcp__addr.is_bound()) { ret_val.tcp__addr() = single_value->field_tcp__addr.valueof(); } if (single_value->field_tcp__is__server.is_bound()) { ret_val.tcp__is__server() = single_value->field_tcp__is__server.valueof(); } if (single_value->field_ipa__ccm__pars.is_omit()) ret_val.ipa__ccm__pars() = OMIT_VALUE; else if (single_value->field_ipa__ccm__pars.is_bound()) { ret_val.ipa__ccm__pars() = single_value->field_ipa__ccm__pars.valueof(); } return ret_val; } void SCCP__Adapter__Config__Sccplite_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 @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SCCP__Adapter__Config__Sccplite_template[list_length]; } SCCP__Adapter__Config__Sccplite_template& SCCP__Adapter__Config__Sccplite_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 @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); return value_list.list_value[list_index]; } M3UA__Emulation::SCTP__Association__Address_template& SCCP__Adapter__Config__Sccplite_template::tcp__addr() { set_specific(); return single_value->field_tcp__addr; } const M3UA__Emulation::SCTP__Association__Address_template& SCCP__Adapter__Config__Sccplite_template::tcp__addr() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tcp_addr of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); return single_value->field_tcp__addr; } BOOLEAN_template& SCCP__Adapter__Config__Sccplite_template::tcp__is__server() { set_specific(); return single_value->field_tcp__is__server; } const BOOLEAN_template& SCCP__Adapter__Config__Sccplite_template::tcp__is__server() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tcp_is_server of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); return single_value->field_tcp__is__server; } IPA__Emulation::IPA__CCM__Parameters_template& SCCP__Adapter__Config__Sccplite_template::ipa__ccm__pars() { set_specific(); return single_value->field_ipa__ccm__pars; } const IPA__Emulation::IPA__CCM__Parameters_template& SCCP__Adapter__Config__Sccplite_template::ipa__ccm__pars() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ipa_ccm_pars of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); return single_value->field_ipa__ccm__pars; } int SCCP__Adapter__Config__Sccplite_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_ipa__ccm__pars.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 @SCCP_Adapter.SCCP_Adapter_Config_Sccplite 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 @SCCP_Adapter.SCCP_Adapter_Config_Sccplite containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); } return 0; } void SCCP__Adapter__Config__Sccplite_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ tcp_addr := "); single_value->field_tcp__addr.log(); TTCN_Logger::log_event_str(", tcp_is_server := "); single_value->field_tcp__is__server.log(); TTCN_Logger::log_event_str(", ipa_ccm_pars := "); single_value->field_ipa__ccm__pars.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 SCCP__Adapter__Config__Sccplite_template::log_match(const SCCP__Adapter__Config__Sccplite& 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_tcp__addr.match(match_value.tcp__addr(), legacy)){ TTCN_Logger::log_logmatch_info(".tcp_addr"); single_value->field_tcp__addr.log_match(match_value.tcp__addr(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_tcp__is__server.match(match_value.tcp__is__server(), legacy)){ TTCN_Logger::log_logmatch_info(".tcp_is_server"); single_value->field_tcp__is__server.log_match(match_value.tcp__is__server(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.ipa__ccm__pars().ispresent()){ if(!single_value->field_ipa__ccm__pars.match(match_value.ipa__ccm__pars(), legacy)){ TTCN_Logger::log_logmatch_info(".ipa_ccm_pars"); single_value->field_ipa__ccm__pars.log_match(match_value.ipa__ccm__pars(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ipa__ccm__pars.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ipa_ccm_pars := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ipa__ccm__pars.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ tcp_addr := "); single_value->field_tcp__addr.log_match(match_value.tcp__addr(), legacy); TTCN_Logger::log_event_str(", tcp_is_server := "); single_value->field_tcp__is__server.log_match(match_value.tcp__is__server(), legacy); TTCN_Logger::log_event_str(", ipa_ccm_pars := "); if (match_value.ipa__ccm__pars().ispresent()) { single_value->field_ipa__ccm__pars.log_match(match_value.ipa__ccm__pars(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ipa__ccm__pars.log(); if (single_value->field_ipa__ccm__pars.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void SCCP__Adapter__Config__Sccplite_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (tcp__addr().is_bound()) tcp__addr().set_implicit_omit(); if (tcp__is__server().is_bound()) tcp__is__server().set_implicit_omit(); if (!ipa__ccm__pars().is_bound()) ipa__ccm__pars() = OMIT_VALUE; else ipa__ccm__pars().set_implicit_omit(); } void SCCP__Adapter__Config__Sccplite_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_tcp__addr.encode_text(text_buf); single_value->field_tcp__is__server.encode_text(text_buf); single_value->field_ipa__ccm__pars.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 @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); } } void SCCP__Adapter__Config__Sccplite_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_tcp__addr.decode_text(text_buf); single_value->field_tcp__is__server.decode_text(text_buf); single_value->field_ipa__ccm__pars.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 SCCP__Adapter__Config__Sccplite_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 @SCCP_Adapter.SCCP_Adapter_Config_Sccplite."); } } void SCCP__Adapter__Config__Sccplite_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: { SCCP__Adapter__Config__Sccplite_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) tcp__addr().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tcp__is__server().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ipa__ccm__pars().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "tcp_addr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tcp__addr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tcp_is_server")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tcp__is__server().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ipa_ccm_pars")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipa__ccm__pars().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @SCCP_Adapter.SCCP_Adapter_Config_Sccplite: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SCCP__Adapter__Config__Sccplite_template* precondition = new SCCP__Adapter__Config__Sccplite_template; precondition->set_param(*param.get_elem(0)); SCCP__Adapter__Config__Sccplite_template* implied_template = new SCCP__Adapter__Config__Sccplite_template; implied_template->set_param(*param.get_elem(1)); *this = SCCP__Adapter__Config__Sccplite_template(precondition, implied_template); } break; default: param.type_error("record template", "@SCCP_Adapter.SCCP_Adapter_Config_Sccplite"); } is_ifpresent = param.get_ifpresent(); } void SCCP__Adapter__Config__Sccplite_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_tcp__addr.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config_Sccplite"); single_value->field_tcp__is__server.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config_Sccplite"); single_value->field_ipa__ccm__pars.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config_Sccplite"); 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 : "@SCCP_Adapter.SCCP_Adapter_Config_Sccplite"); } boolean SCCP__Adapter__Config__Sccplite_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SCCP__Adapter__Config__Sccplite_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_idxis_value(); case ALT_sccplite: return field_sccplite->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void SCCP__Adapter__Transport__ConfigUnion::clean_up() { switch (union_selection) { case ALT_sigtran: delete field_sigtran; break; case ALT_sccplite: delete field_sccplite; break; default: break; } union_selection = UNBOUND_VALUE; } void SCCP__Adapter__Transport__ConfigUnion::log() const { switch (union_selection) { case ALT_sigtran: TTCN_Logger::log_event_str("{ sigtran := "); field_sigtran->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_sccplite: TTCN_Logger::log_event_str("{ sccplite := "); field_sccplite->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void SCCP__Adapter__Transport__ConfigUnion::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "union value"); Module_Param_Ptr m_p = ¶m; if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return; if (m_p->get_type()!=Module_Param::MP_Assignment_List) { param.error("union value with field name was expected"); } Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1); char* last_name = mp_last->get_id()->get_name(); if (!strcmp(last_name, "sigtran")) { sigtran().set_param(*mp_last); if (!sigtran().is_bound()) clean_up(); return; } if (!strcmp(last_name, "sccplite")) { sccplite().set_param(*mp_last); if (!sccplite().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion.", last_name); } void SCCP__Adapter__Transport__ConfigUnion::set_implicit_omit() { switch (union_selection) { case ALT_sigtran: field_sigtran->set_implicit_omit(); break; case ALT_sccplite: field_sccplite->set_implicit_omit(); break; default: break; } } void SCCP__Adapter__Transport__ConfigUnion::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_sigtran: field_sigtran->encode_text(text_buf); break; case ALT_sccplite: field_sccplite->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } } void SCCP__Adapter__Transport__ConfigUnion::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_sigtran: sigtran().decode_text(text_buf); break; case ALT_sccplite: sccplite().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } } void SCCP__Adapter__Transport__ConfigUnion::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(TRUE, 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 SCCP__Adapter__Transport__ConfigUnion::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 SCCP__Adapter__Transport__ConfigUnion::RAW_decode( const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int sel_field, boolean, const RAW_Force_Omit* force_omit) { int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; int decoded_length=0; int starting_pos=p_buf.get_pos_bit(); if(sel_field!=-1){ switch(sel_field){ case 0: { RAW_Force_Omit field_force_omit(0, force_omit, SCCP__Adapter__Config__Sigtran_descr_.raw->forceomit); decoded_length = sigtran().RAW_decode(SCCP__Adapter__Config__Sigtran_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 1: { RAW_Force_Omit field_force_omit(1, force_omit, SCCP__Adapter__Config__Sccplite_descr_.raw->forceomit); decoded_length = sccplite().RAW_decode(SCCP__Adapter__Config__Sccplite_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } default: break; } return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } else { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_0_force_omit(0, force_omit, SCCP__Adapter__Config__Sigtran_descr_.raw->forceomit); decoded_length = sigtran().RAW_decode(SCCP__Adapter__Config__Sigtran_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_0_force_omit); if (decoded_length >= 0) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_1_force_omit(1, force_omit, SCCP__Adapter__Config__Sccplite_descr_.raw->forceomit); decoded_length = sccplite().RAW_decode(SCCP__Adapter__Config__Sccplite_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_length >= 0) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } } clean_up(); return -1; } int SCCP__Adapter__Transport__ConfigUnion::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); memset(myleaf.body.node.nodes, 0, 2 * sizeof(RAW_enc_tree *)); switch (union_selection) { case ALT_sigtran: myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, SCCP__Adapter__Config__Sigtran_descr_.raw); encoded_length = field_sigtran->RAW_encode(SCCP__Adapter__Config__Sigtran_descr_, *myleaf.body.node.nodes[0]); myleaf.body.node.nodes[0]->coding_descr = &SCCP__Adapter__Config__Sigtran_descr_; break; case ALT_sccplite: myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, SCCP__Adapter__Config__Sccplite_descr_.raw); encoded_length = field_sccplite->RAW_encode(SCCP__Adapter__Config__Sccplite_descr_, *myleaf.body.node.nodes[1]); myleaf.body.node.nodes[1]->coding_descr = &SCCP__Adapter__Config__Sccplite_descr_; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); } return encoded_length; } void SCCP__Adapter__Transport__ConfigUnion_template::copy_value(const SCCP__Adapter__Transport__ConfigUnion& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: single_value.field_sigtran = new SCCP__Adapter__Config__Sigtran_template(other_value.sigtran()); break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: single_value.field_sccplite = new SCCP__Adapter__Config__Sccplite_template(other_value.sccplite()); break; default: TTCN_error("Initializing a template with an unbound value of type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } set_selection(SPECIFIC_VALUE); } void SCCP__Adapter__Transport__ConfigUnion_template::copy_template(const SCCP__Adapter__Transport__ConfigUnion_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value.union_selection = other_value.single_value.union_selection; switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: single_value.field_sigtran = new SCCP__Adapter__Config__Sigtran_template(*other_value.single_value.field_sigtran); break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: single_value.field_sccplite = new SCCP__Adapter__Config__Sccplite_template(*other_value.single_value.field_sccplite); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } 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 SCCP__Adapter__Transport__ConfigUnion_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 SCCP__Adapter__Transport__ConfigUnion_template(*other_value.implication_.precondition); implication_.implied_template = new SCCP__Adapter__Transport__ConfigUnion_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } set_selection(other_value); } SCCP__Adapter__Transport__ConfigUnion_template::SCCP__Adapter__Transport__ConfigUnion_template() { } SCCP__Adapter__Transport__ConfigUnion_template::SCCP__Adapter__Transport__ConfigUnion_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SCCP__Adapter__Transport__ConfigUnion_template::SCCP__Adapter__Transport__ConfigUnion_template(const SCCP__Adapter__Transport__ConfigUnion& other_value) { copy_value(other_value); } SCCP__Adapter__Transport__ConfigUnion_template::SCCP__Adapter__Transport__ConfigUnion_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Transport__ConfigUnion&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion from an unbound optional field."); } } SCCP__Adapter__Transport__ConfigUnion_template::SCCP__Adapter__Transport__ConfigUnion_template(SCCP__Adapter__Transport__ConfigUnion_template* p_precondition, SCCP__Adapter__Transport__ConfigUnion_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SCCP__Adapter__Transport__ConfigUnion_template::SCCP__Adapter__Transport__ConfigUnion_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; } SCCP__Adapter__Transport__ConfigUnion_template::SCCP__Adapter__Transport__ConfigUnion_template(const SCCP__Adapter__Transport__ConfigUnion_template& other_value) : Base_Template(){ copy_template(other_value); } SCCP__Adapter__Transport__ConfigUnion_template::~SCCP__Adapter__Transport__ConfigUnion_template() { clean_up(); } void SCCP__Adapter__Transport__ConfigUnion_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: delete single_value.field_sigtran; break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: delete single_value.field_sccplite; default: break; } break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } SCCP__Adapter__Transport__ConfigUnion_template& SCCP__Adapter__Transport__ConfigUnion_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SCCP__Adapter__Transport__ConfigUnion_template& SCCP__Adapter__Transport__ConfigUnion_template::operator=(const SCCP__Adapter__Transport__ConfigUnion& other_value) { clean_up(); copy_value(other_value); return *this; } SCCP__Adapter__Transport__ConfigUnion_template& SCCP__Adapter__Transport__ConfigUnion_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Transport__ConfigUnion&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } return *this; } SCCP__Adapter__Transport__ConfigUnion_template& SCCP__Adapter__Transport__ConfigUnion_template::operator=(const SCCP__Adapter__Transport__ConfigUnion_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SCCP__Adapter__Transport__ConfigUnion_template::match(const SCCP__Adapter__Transport__ConfigUnion& 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: { SCCP__Adapter__Transport__ConfigUnion::union_selection_type value_selection = other_value.get_selection(); if (value_selection == SCCP__Adapter__Transport__ConfigUnion::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: return single_value.field_sigtran->match(other_value.sigtran(), legacy); case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: return single_value.field_sccplite->match(other_value.sccplite(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } } case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error ("Matching an uninitialized template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } return FALSE; } boolean SCCP__Adapter__Transport__ConfigUnion_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: return single_value.field_sigtran->is_value(); case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: return single_value.field_sccplite->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } } SCCP__Adapter__Transport__ConfigUnion SCCP__Adapter__Transport__ConfigUnion_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); SCCP__Adapter__Transport__ConfigUnion ret_val; switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: ret_val.sigtran() = single_value.field_sigtran->valueof(); break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: ret_val.sccplite() = single_value.field_sccplite->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } return ret_val; } SCCP__Adapter__Transport__ConfigUnion_template& SCCP__Adapter__Transport__ConfigUnion_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); return value_list.list_value[list_index]; } void SCCP__Adapter__Transport__ConfigUnion_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error ("Internal error: Setting an invalid list for a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SCCP__Adapter__Transport__ConfigUnion_template[list_length]; } SCCP__Adapter__Config__Sigtran_template& SCCP__Adapter__Transport__ConfigUnion_template::sigtran() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_sigtran = new SCCP__Adapter__Config__Sigtran_template(ANY_VALUE); else single_value.field_sigtran = new SCCP__Adapter__Config__Sigtran_template; single_value.union_selection = SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran; set_selection(SPECIFIC_VALUE); } return *single_value.field_sigtran; } const SCCP__Adapter__Config__Sigtran_template& SCCP__Adapter__Transport__ConfigUnion_template::sigtran() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sigtran in a non-specific template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); if (single_value.union_selection != SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran) TTCN_error("Accessing non-selected field sigtran in a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); return *single_value.field_sigtran; } SCCP__Adapter__Config__Sccplite_template& SCCP__Adapter__Transport__ConfigUnion_template::sccplite() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_sccplite = new SCCP__Adapter__Config__Sccplite_template(ANY_VALUE); else single_value.field_sccplite = new SCCP__Adapter__Config__Sccplite_template; single_value.union_selection = SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite; set_selection(SPECIFIC_VALUE); } return *single_value.field_sccplite; } const SCCP__Adapter__Config__Sccplite_template& SCCP__Adapter__Transport__ConfigUnion_template::sccplite() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sccplite in a non-specific template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); if (single_value.union_selection != SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite) TTCN_error("Accessing non-selected field sccplite in a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); return *single_value.field_sccplite; } boolean SCCP__Adapter__Transport__ConfigUnion_template::ischosen(SCCP__Adapter__Transport__ConfigUnion::union_selection_type checked_selection) const { if (checked_selection == SCCP__Adapter__Transport__ConfigUnion::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == SCCP__Adapter__Transport__ConfigUnion::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); return single_value.union_selection == checked_selection; case VALUE_LIST: { if (value_list.n_values < 1) TTCN_error("Internal error: Performing ischosen() operation on a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion containing an empty list."); boolean ret_val = value_list.list_value[0].ischosen(checked_selection); for (unsigned int list_count = 1; ret_val == TRUE && list_count < value_list.n_values; list_count++) { ret_val = value_list.list_value[list_count].ischosen(checked_selection); } return ret_val; } default: return FALSE; } return FALSE; } void SCCP__Adapter__Transport__ConfigUnion_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: TTCN_Logger::log_event_str("{ sigtran := "); single_value.field_sigtran->log(); TTCN_Logger::log_event_str(" }"); break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: TTCN_Logger::log_event_str("{ sccplite := "); single_value.field_sccplite->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_str(""); } break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void SCCP__Adapter__Transport__ConfigUnion_template::log_match(const SCCP__Adapter__Transport__ConfigUnion& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity() && match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); return; } if (template_selection == SPECIFIC_VALUE && single_value.union_selection == match_value.get_selection()) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".sigtran"); single_value.field_sigtran->log_match(match_value.sigtran(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ sigtran := "); single_value.field_sigtran->log_match(match_value.sigtran(), legacy); TTCN_Logger::log_event_str(" }"); } break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".sccplite"); single_value.field_sccplite->log_match(match_value.sccplite(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ sccplite := "); single_value.field_sccplite->log_match(match_value.sccplite(), legacy); TTCN_Logger::log_event_str(" }"); } break; default: TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(""); } } else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void SCCP__Adapter__Transport__ConfigUnion_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: single_value.field_sigtran->set_implicit_omit(); break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: single_value.field_sccplite->set_implicit_omit(); break; default: break; } } void SCCP__Adapter__Transport__ConfigUnion_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value.union_selection); switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: single_value.field_sigtran->encode_text(text_buf); break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: single_value.field_sccplite->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized template of type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } } void SCCP__Adapter__Transport__ConfigUnion_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = SCCP__Adapter__Transport__ConfigUnion::UNBOUND_VALUE; SCCP__Adapter__Transport__ConfigUnion::union_selection_type new_selection = (SCCP__Adapter__Transport__ConfigUnion::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: single_value.field_sigtran = new SCCP__Adapter__Config__Sigtran_template; single_value.field_sigtran->decode_text(text_buf); break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: single_value.field_sccplite = new SCCP__Adapter__Config__Sccplite_template; single_value.field_sccplite->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } single_value.union_selection = new_selection; } case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new SCCP__Adapter__Transport__ConfigUnion_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized selector was received in a template of type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } } boolean SCCP__Adapter__Transport__ConfigUnion_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SCCP__Adapter__Transport__ConfigUnion_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int v_idx=0; v_idx(param.get_id()) != NULL && param.get_id()->next_name()) { char* param_field = param.get_id()->get_current_name(); if (param_field[0] >= '0' && param_field[0] <= '9') { param.error("Unexpected array index in module parameter, expected a valid field" " name for union template type `@SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion'"); } if (strcmp("sigtran", param_field) == 0) { sigtran().set_param(param); return; } else if (strcmp("sccplite", param_field) == 0) { sccplite().set_param(param); return; } else param.error("Field `%s' not found in union template type `@SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion'", param_field); } param.basic_check(Module_Param::BC_TEMPLATE, "union template"); Module_Param_Ptr m_p = ¶m; switch (m_p->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { SCCP__Adapter__Transport__ConfigUnion_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Value_List: if (m_p->get_size()==0) break; param.type_error("union template", "@SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion"); break; case Module_Param::MP_Assignment_List: { Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1); char* last_name = mp_last->get_id()->get_name(); if (!strcmp(last_name, "sigtran")) { sigtran().set_param(*mp_last); break; } if (!strcmp(last_name, "sccplite")) { sccplite().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion.", last_name); } break; case Module_Param::MP_Implication_Template: { SCCP__Adapter__Transport__ConfigUnion_template* precondition = new SCCP__Adapter__Transport__ConfigUnion_template; precondition->set_param(*m_p->get_elem(0)); SCCP__Adapter__Transport__ConfigUnion_template* implied_template = new SCCP__Adapter__Transport__ConfigUnion_template; implied_template->set_param(*m_p->get_elem(1)); *this = SCCP__Adapter__Transport__ConfigUnion_template(precondition, implied_template); } break; default: param.type_error("union template", "@SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion"); } is_ifpresent = param.get_ifpresent(); } void SCCP__Adapter__Transport__ConfigUnion_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; switch (single_value.union_selection) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: single_value.field_sigtran->check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion"); return; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: single_value.field_sccplite->check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion."); } 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 : "@SCCP_Adapter.SCCP_Adapter_Transport_ConfigUnion"); } SCCP__Adapter__Config::SCCP__Adapter__Config() { } SCCP__Adapter__Config::SCCP__Adapter__Config(const SCCP__Adapter__Transport& par_transport, const SCCP__Adapter__Transport__ConfigUnion& par_tpars, const CHARSTRING& par_sccp__service__type, const INTEGER& par_own__pc, const INTEGER& par_own__ssn, const INTEGER& par_peer__pc, const INTEGER& par_peer__ssn, const OCTETSTRING& par_sio, const INTEGER& par_rctx) : field_transport(par_transport), field_tpars(par_tpars), field_sccp__service__type(par_sccp__service__type), field_own__pc(par_own__pc), field_own__ssn(par_own__ssn), field_peer__pc(par_peer__pc), field_peer__ssn(par_peer__ssn), field_sio(par_sio), field_rctx(par_rctx) { } SCCP__Adapter__Config::SCCP__Adapter__Config(const SCCP__Adapter__Config& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SCCP_Adapter.SCCP_Adapter_Config."); if (other_value.transport().is_bound()) field_transport = other_value.transport(); else field_transport.clean_up(); if (other_value.tpars().is_bound()) field_tpars = other_value.tpars(); else field_tpars.clean_up(); if (other_value.sccp__service__type().is_bound()) field_sccp__service__type = other_value.sccp__service__type(); else field_sccp__service__type.clean_up(); if (other_value.own__pc().is_bound()) field_own__pc = other_value.own__pc(); else field_own__pc.clean_up(); if (other_value.own__ssn().is_bound()) field_own__ssn = other_value.own__ssn(); else field_own__ssn.clean_up(); if (other_value.peer__pc().is_bound()) field_peer__pc = other_value.peer__pc(); else field_peer__pc.clean_up(); if (other_value.peer__ssn().is_bound()) field_peer__ssn = other_value.peer__ssn(); else field_peer__ssn.clean_up(); if (other_value.sio().is_bound()) field_sio = other_value.sio(); else field_sio.clean_up(); if (other_value.rctx().is_bound()) field_rctx = other_value.rctx(); else field_rctx.clean_up(); } void SCCP__Adapter__Config::clean_up() { field_transport.clean_up(); field_tpars.clean_up(); field_sccp__service__type.clean_up(); field_own__pc.clean_up(); field_own__ssn.clean_up(); field_peer__pc.clean_up(); field_peer__ssn.clean_up(); field_sio.clean_up(); field_rctx.clean_up(); } const TTCN_Typedescriptor_t* SCCP__Adapter__Config::get_descriptor() const { return &SCCP__Adapter__Config_descr_; } SCCP__Adapter__Config& SCCP__Adapter__Config::operator=(const SCCP__Adapter__Config& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @SCCP_Adapter.SCCP_Adapter_Config."); if (other_value.transport().is_bound()) field_transport = other_value.transport(); else field_transport.clean_up(); if (other_value.tpars().is_bound()) field_tpars = other_value.tpars(); else field_tpars.clean_up(); if (other_value.sccp__service__type().is_bound()) field_sccp__service__type = other_value.sccp__service__type(); else field_sccp__service__type.clean_up(); if (other_value.own__pc().is_bound()) field_own__pc = other_value.own__pc(); else field_own__pc.clean_up(); if (other_value.own__ssn().is_bound()) field_own__ssn = other_value.own__ssn(); else field_own__ssn.clean_up(); if (other_value.peer__pc().is_bound()) field_peer__pc = other_value.peer__pc(); else field_peer__pc.clean_up(); if (other_value.peer__ssn().is_bound()) field_peer__ssn = other_value.peer__ssn(); else field_peer__ssn.clean_up(); if (other_value.sio().is_bound()) field_sio = other_value.sio(); else field_sio.clean_up(); if (other_value.rctx().is_bound()) field_rctx = other_value.rctx(); else field_rctx.clean_up(); } return *this; } boolean SCCP__Adapter__Config::operator==(const SCCP__Adapter__Config& other_value) const { return field_transport==other_value.field_transport && field_tpars==other_value.field_tpars && field_sccp__service__type==other_value.field_sccp__service__type && field_own__pc==other_value.field_own__pc && field_own__ssn==other_value.field_own__ssn && field_peer__pc==other_value.field_peer__pc && field_peer__ssn==other_value.field_peer__ssn && field_sio==other_value.field_sio && field_rctx==other_value.field_rctx; } boolean SCCP__Adapter__Config::is_bound() const { return (field_transport.is_bound()) || (field_tpars.is_bound()) || (field_sccp__service__type.is_bound()) || (field_own__pc.is_bound()) || (field_own__ssn.is_bound()) || (field_peer__pc.is_bound()) || (field_peer__ssn.is_bound()) || (field_sio.is_bound()) || (field_rctx.is_bound()); } boolean SCCP__Adapter__Config::is_value() const { return field_transport.is_value() && field_tpars.is_value() && field_sccp__service__type.is_value() && field_own__pc.is_value() && field_own__ssn.is_value() && field_peer__pc.is_value() && field_peer__ssn.is_value() && field_sio.is_value() && field_rctx.is_value(); } void SCCP__Adapter__Config::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ transport := "); field_transport.log(); TTCN_Logger::log_event_str(", tpars := "); field_tpars.log(); TTCN_Logger::log_event_str(", sccp_service_type := "); field_sccp__service__type.log(); TTCN_Logger::log_event_str(", own_pc := "); field_own__pc.log(); TTCN_Logger::log_event_str(", own_ssn := "); field_own__ssn.log(); TTCN_Logger::log_event_str(", peer_pc := "); field_peer__pc.log(); TTCN_Logger::log_event_str(", peer_ssn := "); field_peer__ssn.log(); TTCN_Logger::log_event_str(", sio := "); field_sio.log(); TTCN_Logger::log_event_str(", rctx := "); field_rctx.log(); TTCN_Logger::log_event_str(" }"); } void SCCP__Adapter__Config::set_implicit_omit() { if (transport().is_bound()) transport().set_implicit_omit(); if (tpars().is_bound()) tpars().set_implicit_omit(); if (sccp__service__type().is_bound()) sccp__service__type().set_implicit_omit(); if (own__pc().is_bound()) own__pc().set_implicit_omit(); if (own__ssn().is_bound()) own__ssn().set_implicit_omit(); if (peer__pc().is_bound()) peer__pc().set_implicit_omit(); if (peer__ssn().is_bound()) peer__ssn().set_implicit_omit(); if (sio().is_bound()) sio().set_implicit_omit(); if (rctx().is_bound()) rctx().set_implicit_omit(); } void SCCP__Adapter__Config::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 (90 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) transport().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tpars().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) sccp__service__type().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) own__pc().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) own__ssn().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) peer__pc().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) peer__ssn().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) sio().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) rctx().set_param(*param.get_elem(8)); 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(), "transport")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transport().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tpars")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tpars().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sccp_service_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sccp__service__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "own_pc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { own__pc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "own_ssn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { own__ssn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "peer_pc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { peer__pc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "peer_ssn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { peer__ssn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sio().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_idxerror("Non existent field name in type @SCCP_Adapter.SCCP_Adapter_Config: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@SCCP_Adapter.SCCP_Adapter_Config"); } } void SCCP__Adapter__Config::encode_text(Text_Buf& text_buf) const { field_transport.encode_text(text_buf); field_tpars.encode_text(text_buf); field_sccp__service__type.encode_text(text_buf); field_own__pc.encode_text(text_buf); field_own__ssn.encode_text(text_buf); field_peer__pc.encode_text(text_buf); field_peer__ssn.encode_text(text_buf); field_sio.encode_text(text_buf); field_rctx.encode_text(text_buf); } void SCCP__Adapter__Config::decode_text(Text_Buf& text_buf) { field_transport.decode_text(text_buf); field_tpars.decode_text(text_buf); field_sccp__service__type.decode_text(text_buf); field_own__pc.decode_text(text_buf); field_own__ssn.decode_text(text_buf); field_peer__pc.decode_text(text_buf); field_peer__ssn.decode_text(text_buf); field_sio.decode_text(text_buf); field_rctx.decode_text(text_buf); } void SCCP__Adapter__Config::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 SCCP__Adapter__Config::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 SCCP__Adapter__Config::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; int selected_field = -1; 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, SCCP__Adapter__Transport_descr_.raw->forceomit); decoded_field_length = field_transport.RAW_decode(SCCP__Adapter__Transport_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()); if (field_transport == SCCP__Adapter__Transport::SCCP__TRANSPORT__SIGTRAN) selected_field = 0; else if (field_transport == SCCP__Adapter__Transport::SCCP__TRANSPORT__SCCPlite) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_1_force_omit(1, force_omit, SCCP__Adapter__Config_tpars_descr_.raw->forceomit); decoded_field_length = field_tpars.RAW_decode(SCCP__Adapter__Config_tpars_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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, CHARSTRING_descr_.raw->forceomit); decoded_field_length = field_sccp__service__type.RAW_decode(CHARSTRING_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, INTEGER_descr_.raw->forceomit); decoded_field_length = field_own__pc.RAW_decode(INTEGER_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()); RAW_Force_Omit field_4_force_omit(4, force_omit, INTEGER_descr_.raw->forceomit); decoded_field_length = field_own__ssn.RAW_decode(INTEGER_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_4_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_5_force_omit(5, force_omit, INTEGER_descr_.raw->forceomit); decoded_field_length = field_peer__pc.RAW_decode(INTEGER_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_5_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_6_force_omit(6, force_omit, INTEGER_descr_.raw->forceomit); decoded_field_length = field_peer__ssn.RAW_decode(INTEGER_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_6_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_7_force_omit(7, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_sio.RAW_decode(OCTETSTRING_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_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_8_force_omit(8, force_omit, INTEGER_descr_.raw->forceomit); decoded_field_length = field_rctx.RAW_decode(INTEGER_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_8_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 SCCP__Adapter__Config::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 = 9; myleaf.body.node.nodes = init_nodes_of_enc_tree(9); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, SCCP__Adapter__Transport_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SCCP__Adapter__Config_tpars_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, CHARSTRING_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, INTEGER_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, INTEGER_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, INTEGER_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, INTEGER_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, OCTETSTRING_descr_.raw); myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, INTEGER_descr_.raw); encoded_length += field_transport.RAW_encode(SCCP__Adapter__Transport_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_tpars.RAW_encode(SCCP__Adapter__Config_tpars_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_sccp__service__type.RAW_encode(CHARSTRING_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_own__pc.RAW_encode(INTEGER_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_own__ssn.RAW_encode(INTEGER_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_peer__pc.RAW_encode(INTEGER_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_peer__ssn.RAW_encode(INTEGER_descr_, *myleaf.body.node.nodes[6]); encoded_length += field_sio.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[7]); encoded_length += field_rctx.RAW_encode(INTEGER_descr_, *myleaf.body.node.nodes[8]); switch (field_tpars.get_selection()) { case SCCP__Adapter__Transport__ConfigUnion::ALT_sigtran: if (field_transport != SCCP__Adapter__Transport::SCCP__TRANSPORT__SIGTRAN) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 0 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); SCCP__Adapter__Transport new_val(SCCP__Adapter__Transport::SCCP__TRANSPORT__SIGTRAN); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) new_val.RAW_encode(SCCP__Adapter__Transport_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; case SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite: if (field_transport != SCCP__Adapter__Transport::SCCP__TRANSPORT__SCCPlite) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 0 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); SCCP__Adapter__Transport new_val(SCCP__Adapter__Transport::SCCP__TRANSPORT__SCCPlite); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) new_val.RAW_encode(SCCP__Adapter__Transport_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; default:; } return myleaf.length = encoded_length; } struct SCCP__Adapter__Config_template::single_value_struct { SCCP__Adapter__Transport_template field_transport; SCCP__Adapter__Transport__ConfigUnion_template field_tpars; CHARSTRING_template field_sccp__service__type; INTEGER_template field_own__pc; INTEGER_template field_own__ssn; INTEGER_template field_peer__pc; INTEGER_template field_peer__ssn; OCTETSTRING_template field_sio; INTEGER_template field_rctx; }; void SCCP__Adapter__Config_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_transport = ANY_VALUE; single_value->field_tpars = ANY_VALUE; single_value->field_sccp__service__type = ANY_VALUE; single_value->field_own__pc = ANY_VALUE; single_value->field_own__ssn = ANY_VALUE; single_value->field_peer__pc = ANY_VALUE; single_value->field_peer__ssn = ANY_VALUE; single_value->field_sio = ANY_VALUE; single_value->field_rctx = ANY_VALUE; } } } void SCCP__Adapter__Config_template::copy_value(const SCCP__Adapter__Config& other_value) { single_value = new single_value_struct; if (other_value.transport().is_bound()) { single_value->field_transport = other_value.transport(); } else { single_value->field_transport.clean_up(); } if (other_value.tpars().is_bound()) { single_value->field_tpars = other_value.tpars(); } else { single_value->field_tpars.clean_up(); } if (other_value.sccp__service__type().is_bound()) { single_value->field_sccp__service__type = other_value.sccp__service__type(); } else { single_value->field_sccp__service__type.clean_up(); } if (other_value.own__pc().is_bound()) { single_value->field_own__pc = other_value.own__pc(); } else { single_value->field_own__pc.clean_up(); } if (other_value.own__ssn().is_bound()) { single_value->field_own__ssn = other_value.own__ssn(); } else { single_value->field_own__ssn.clean_up(); } if (other_value.peer__pc().is_bound()) { single_value->field_peer__pc = other_value.peer__pc(); } else { single_value->field_peer__pc.clean_up(); } if (other_value.peer__ssn().is_bound()) { single_value->field_peer__ssn = other_value.peer__ssn(); } else { single_value->field_peer__ssn.clean_up(); } if (other_value.sio().is_bound()) { single_value->field_sio = other_value.sio(); } else { single_value->field_sio.clean_up(); } if (other_value.rctx().is_bound()) { single_value->field_rctx = other_value.rctx(); } else { single_value->field_rctx.clean_up(); } set_selection(SPECIFIC_VALUE); } void SCCP__Adapter__Config_template::copy_template(const SCCP__Adapter__Config_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.transport().get_selection()) { single_value->field_transport = other_value.transport(); } else { single_value->field_transport.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.tpars().get_selection()) { single_value->field_tpars = other_value.tpars(); } else { single_value->field_tpars.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sccp__service__type().get_selection()) { single_value->field_sccp__service__type = other_value.sccp__service__type(); } else { single_value->field_sccp__service__type.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.own__pc().get_selection()) { single_value->field_own__pc = other_value.own__pc(); } else { single_value->field_own__pc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.own__ssn().get_selection()) { single_value->field_own__ssn = other_value.own__ssn(); } else { single_value->field_own__ssn.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.peer__pc().get_selection()) { single_value->field_peer__pc = other_value.peer__pc(); } else { single_value->field_peer__pc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.peer__ssn().get_selection()) { single_value->field_peer__ssn = other_value.peer__ssn(); } else { single_value->field_peer__ssn.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sio().get_selection()) { single_value->field_sio = other_value.sio(); } else { single_value->field_sio.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rctx().get_selection()) { single_value->field_rctx = other_value.rctx(); } else { single_value->field_rctx.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 SCCP__Adapter__Config_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 SCCP__Adapter__Config_template(*other_value.implication_.precondition); implication_.implied_template = new SCCP__Adapter__Config_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 @SCCP_Adapter.SCCP_Adapter_Config."); break; } set_selection(other_value); } SCCP__Adapter__Config_template::SCCP__Adapter__Config_template() { } SCCP__Adapter__Config_template::SCCP__Adapter__Config_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SCCP__Adapter__Config_template::SCCP__Adapter__Config_template(const SCCP__Adapter__Config& other_value) { copy_value(other_value); } SCCP__Adapter__Config_template::SCCP__Adapter__Config_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Config&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @SCCP_Adapter.SCCP_Adapter_Config from an unbound optional field."); } } SCCP__Adapter__Config_template::SCCP__Adapter__Config_template(SCCP__Adapter__Config_template* p_precondition, SCCP__Adapter__Config_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SCCP__Adapter__Config_template::SCCP__Adapter__Config_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; } SCCP__Adapter__Config_template::SCCP__Adapter__Config_template(const SCCP__Adapter__Config_template& other_value) : Base_Template() { copy_template(other_value); } SCCP__Adapter__Config_template::~SCCP__Adapter__Config_template() { clean_up(); } SCCP__Adapter__Config_template& SCCP__Adapter__Config_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SCCP__Adapter__Config_template& SCCP__Adapter__Config_template::operator=(const SCCP__Adapter__Config& other_value) { clean_up(); copy_value(other_value); return *this; } SCCP__Adapter__Config_template& SCCP__Adapter__Config_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Config&)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 @SCCP_Adapter.SCCP_Adapter_Config."); } return *this; } SCCP__Adapter__Config_template& SCCP__Adapter__Config_template::operator=(const SCCP__Adapter__Config_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SCCP__Adapter__Config_template::match(const SCCP__Adapter__Config& 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.transport().is_bound()) return FALSE; if(!single_value->field_transport.match(other_value.transport(), legacy))return FALSE; if(!other_value.tpars().is_bound()) return FALSE; if(!single_value->field_tpars.match(other_value.tpars(), legacy))return FALSE; if(!other_value.sccp__service__type().is_bound()) return FALSE; if(!single_value->field_sccp__service__type.match(other_value.sccp__service__type(), legacy))return FALSE; if(!other_value.own__pc().is_bound()) return FALSE; if(!single_value->field_own__pc.match(other_value.own__pc(), legacy))return FALSE; if(!other_value.own__ssn().is_bound()) return FALSE; if(!single_value->field_own__ssn.match(other_value.own__ssn(), legacy))return FALSE; if(!other_value.peer__pc().is_bound()) return FALSE; if(!single_value->field_peer__pc.match(other_value.peer__pc(), legacy))return FALSE; if(!other_value.peer__ssn().is_bound()) return FALSE; if(!single_value->field_peer__ssn.match(other_value.peer__ssn(), legacy))return FALSE; if(!other_value.sio().is_bound()) return FALSE; if(!single_value->field_sio.match(other_value.sio(), legacy))return FALSE; if(!other_value.rctx().is_bound()) return FALSE; if(!single_value->field_rctx.match(other_value.rctx(), 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 @SCCP_Adapter.SCCP_Adapter_Config."); } return FALSE; } boolean SCCP__Adapter__Config_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_transport.is_bound() || single_value->field_tpars.is_bound() || single_value->field_sccp__service__type.is_bound() || single_value->field_own__pc.is_bound() || single_value->field_own__ssn.is_bound() || single_value->field_peer__pc.is_bound() || single_value->field_peer__ssn.is_bound() || single_value->field_sio.is_bound() || single_value->field_rctx.is_bound(); } boolean SCCP__Adapter__Config_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_transport.is_value() && single_value->field_tpars.is_value() && single_value->field_sccp__service__type.is_value() && single_value->field_own__pc.is_value() && single_value->field_own__ssn.is_value() && single_value->field_peer__pc.is_value() && single_value->field_peer__ssn.is_value() && single_value->field_sio.is_value() && single_value->field_rctx.is_value(); } void SCCP__Adapter__Config_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; } SCCP__Adapter__Config SCCP__Adapter__Config_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 @SCCP_Adapter.SCCP_Adapter_Config."); SCCP__Adapter__Config ret_val; if (single_value->field_transport.is_bound()) { ret_val.transport() = single_value->field_transport.valueof(); } if (single_value->field_tpars.is_bound()) { ret_val.tpars() = single_value->field_tpars.valueof(); } if (single_value->field_sccp__service__type.is_bound()) { ret_val.sccp__service__type() = single_value->field_sccp__service__type.valueof(); } if (single_value->field_own__pc.is_bound()) { ret_val.own__pc() = single_value->field_own__pc.valueof(); } if (single_value->field_own__ssn.is_bound()) { ret_val.own__ssn() = single_value->field_own__ssn.valueof(); } if (single_value->field_peer__pc.is_bound()) { ret_val.peer__pc() = single_value->field_peer__pc.valueof(); } if (single_value->field_peer__ssn.is_bound()) { ret_val.peer__ssn() = single_value->field_peer__ssn.valueof(); } if (single_value->field_sio.is_bound()) { ret_val.sio() = single_value->field_sio.valueof(); } if (single_value->field_rctx.is_bound()) { ret_val.rctx() = single_value->field_rctx.valueof(); } return ret_val; } void SCCP__Adapter__Config_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 @SCCP_Adapter.SCCP_Adapter_Config."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SCCP__Adapter__Config_template[list_length]; } SCCP__Adapter__Config_template& SCCP__Adapter__Config_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 @SCCP_Adapter.SCCP_Adapter_Config."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @SCCP_Adapter.SCCP_Adapter_Config."); return value_list.list_value[list_index]; } SCCP__Adapter__Transport_template& SCCP__Adapter__Config_template::transport() { set_specific(); return single_value->field_transport; } const SCCP__Adapter__Transport_template& SCCP__Adapter__Config_template::transport() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field transport of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config."); return single_value->field_transport; } SCCP__Adapter__Transport__ConfigUnion_template& SCCP__Adapter__Config_template::tpars() { set_specific(); return single_value->field_tpars; } const SCCP__Adapter__Transport__ConfigUnion_template& SCCP__Adapter__Config_template::tpars() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tpars of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config."); return single_value->field_tpars; } CHARSTRING_template& SCCP__Adapter__Config_template::sccp__service__type() { set_specific(); return single_value->field_sccp__service__type; } const CHARSTRING_template& SCCP__Adapter__Config_template::sccp__service__type() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sccp_service_type of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config."); return single_value->field_sccp__service__type; } INTEGER_template& SCCP__Adapter__Config_template::own__pc() { set_specific(); return single_value->field_own__pc; } const INTEGER_template& SCCP__Adapter__Config_template::own__pc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field own_pc of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config."); return single_value->field_own__pc; } INTEGER_template& SCCP__Adapter__Config_template::own__ssn() { set_specific(); return single_value->field_own__ssn; } const INTEGER_template& SCCP__Adapter__Config_template::own__ssn() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field own_ssn of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config."); return single_value->field_own__ssn; } INTEGER_template& SCCP__Adapter__Config_template::peer__pc() { set_specific(); return single_value->field_peer__pc; } const INTEGER_template& SCCP__Adapter__Config_template::peer__pc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field peer_pc of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config."); return single_value->field_peer__pc; } INTEGER_template& SCCP__Adapter__Config_template::peer__ssn() { set_specific(); return single_value->field_peer__ssn; } const INTEGER_template& SCCP__Adapter__Config_template::peer__ssn() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field peer_ssn of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config."); return single_value->field_peer__ssn; } OCTETSTRING_template& SCCP__Adapter__Config_template::sio() { set_specific(); return single_value->field_sio; } const OCTETSTRING_template& SCCP__Adapter__Config_template::sio() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sio of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config."); return single_value->field_sio; } INTEGER_template& SCCP__Adapter__Config_template::rctx() { set_specific(); return single_value->field_rctx; } const INTEGER_template& SCCP__Adapter__Config_template::rctx() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rctx of a non-specific template of type @SCCP_Adapter.SCCP_Adapter_Config."); return single_value->field_rctx; } int SCCP__Adapter__Config_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 9; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config 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 @SCCP_Adapter.SCCP_Adapter_Config containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter_Config containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @SCCP_Adapter.SCCP_Adapter_Config."); } return 0; } void SCCP__Adapter__Config_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ transport := "); single_value->field_transport.log(); TTCN_Logger::log_event_str(", tpars := "); single_value->field_tpars.log(); TTCN_Logger::log_event_str(", sccp_service_type := "); single_value->field_sccp__service__type.log(); TTCN_Logger::log_event_str(", own_pc := "); single_value->field_own__pc.log(); TTCN_Logger::log_event_str(", own_ssn := "); single_value->field_own__ssn.log(); TTCN_Logger::log_event_str(", peer_pc := "); single_value->field_peer__pc.log(); TTCN_Logger::log_event_str(", peer_ssn := "); single_value->field_peer__ssn.log(); TTCN_Logger::log_event_str(", sio := "); single_value->field_sio.log(); TTCN_Logger::log_event_str(", rctx := "); single_value->field_rctx.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 SCCP__Adapter__Config_template::log_match(const SCCP__Adapter__Config& 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_transport.match(match_value.transport(), legacy)){ TTCN_Logger::log_logmatch_info(".transport"); single_value->field_transport.log_match(match_value.transport(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_tpars.match(match_value.tpars(), legacy)){ TTCN_Logger::log_logmatch_info(".tpars"); single_value->field_tpars.log_match(match_value.tpars(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sccp__service__type.match(match_value.sccp__service__type(), legacy)){ TTCN_Logger::log_logmatch_info(".sccp_service_type"); single_value->field_sccp__service__type.log_match(match_value.sccp__service__type(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_own__pc.match(match_value.own__pc(), legacy)){ TTCN_Logger::log_logmatch_info(".own_pc"); single_value->field_own__pc.log_match(match_value.own__pc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_own__ssn.match(match_value.own__ssn(), legacy)){ TTCN_Logger::log_logmatch_info(".own_ssn"); single_value->field_own__ssn.log_match(match_value.own__ssn(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_peer__pc.match(match_value.peer__pc(), legacy)){ TTCN_Logger::log_logmatch_info(".peer_pc"); single_value->field_peer__pc.log_match(match_value.peer__pc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_peer__ssn.match(match_value.peer__ssn(), legacy)){ TTCN_Logger::log_logmatch_info(".peer_ssn"); single_value->field_peer__ssn.log_match(match_value.peer__ssn(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sio.match(match_value.sio(), legacy)){ TTCN_Logger::log_logmatch_info(".sio"); single_value->field_sio.log_match(match_value.sio(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } 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 { 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("{ transport := "); single_value->field_transport.log_match(match_value.transport(), legacy); TTCN_Logger::log_event_str(", tpars := "); single_value->field_tpars.log_match(match_value.tpars(), legacy); TTCN_Logger::log_event_str(", sccp_service_type := "); single_value->field_sccp__service__type.log_match(match_value.sccp__service__type(), legacy); TTCN_Logger::log_event_str(", own_pc := "); single_value->field_own__pc.log_match(match_value.own__pc(), legacy); TTCN_Logger::log_event_str(", own_ssn := "); single_value->field_own__ssn.log_match(match_value.own__ssn(), legacy); TTCN_Logger::log_event_str(", peer_pc := "); single_value->field_peer__pc.log_match(match_value.peer__pc(), legacy); TTCN_Logger::log_event_str(", peer_ssn := "); single_value->field_peer__ssn.log_match(match_value.peer__ssn(), legacy); TTCN_Logger::log_event_str(", sio := "); single_value->field_sio.log_match(match_value.sio(), legacy); TTCN_Logger::log_event_str(", rctx := "); single_value->field_rctx.log_match(match_value.rctx(), 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 SCCP__Adapter__Config_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (transport().is_bound()) transport().set_implicit_omit(); if (tpars().is_bound()) tpars().set_implicit_omit(); if (sccp__service__type().is_bound()) sccp__service__type().set_implicit_omit(); if (own__pc().is_bound()) own__pc().set_implicit_omit(); if (own__ssn().is_bound()) own__ssn().set_implicit_omit(); if (peer__pc().is_bound()) peer__pc().set_implicit_omit(); if (peer__ssn().is_bound()) peer__ssn().set_implicit_omit(); if (sio().is_bound()) sio().set_implicit_omit(); if (rctx().is_bound()) rctx().set_implicit_omit(); } void SCCP__Adapter__Config_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_transport.encode_text(text_buf); single_value->field_tpars.encode_text(text_buf); single_value->field_sccp__service__type.encode_text(text_buf); single_value->field_own__pc.encode_text(text_buf); single_value->field_own__ssn.encode_text(text_buf); single_value->field_peer__pc.encode_text(text_buf); single_value->field_peer__ssn.encode_text(text_buf); single_value->field_sio.encode_text(text_buf); single_value->field_rctx.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 @SCCP_Adapter.SCCP_Adapter_Config."); } } void SCCP__Adapter__Config_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_transport.decode_text(text_buf); single_value->field_tpars.decode_text(text_buf); single_value->field_sccp__service__type.decode_text(text_buf); single_value->field_own__pc.decode_text(text_buf); single_value->field_own__ssn.decode_text(text_buf); single_value->field_peer__pc.decode_text(text_buf); single_value->field_peer__ssn.decode_text(text_buf); single_value->field_sio.decode_text(text_buf); single_value->field_rctx.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 SCCP__Adapter__Config_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 @SCCP_Adapter.SCCP_Adapter_Config."); } } void SCCP__Adapter__Config_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: { SCCP__Adapter__Config_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) transport().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tpars().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) sccp__service__type().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) own__pc().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) own__ssn().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) peer__pc().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) peer__ssn().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) sio().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) rctx().set_param(*param.get_elem(8)); 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(), "transport")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transport().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tpars")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tpars().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sccp_service_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sccp__service__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "own_pc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { own__pc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "own_ssn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { own__ssn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "peer_pc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { peer__pc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "peer_ssn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { peer__ssn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sio().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_idxerror("Non existent field name in type @SCCP_Adapter.SCCP_Adapter_Config: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SCCP__Adapter__Config_template* precondition = new SCCP__Adapter__Config_template; precondition->set_param(*param.get_elem(0)); SCCP__Adapter__Config_template* implied_template = new SCCP__Adapter__Config_template; implied_template->set_param(*param.get_elem(1)); *this = SCCP__Adapter__Config_template(precondition, implied_template); } break; default: param.type_error("record template", "@SCCP_Adapter.SCCP_Adapter_Config"); } is_ifpresent = param.get_ifpresent(); } void SCCP__Adapter__Config_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_transport.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config"); single_value->field_tpars.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config"); single_value->field_sccp__service__type.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config"); single_value->field_own__pc.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config"); single_value->field_own__ssn.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config"); single_value->field_peer__pc.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config"); single_value->field_peer__ssn.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config"); single_value->field_sio.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config"); single_value->field_rctx.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter_Config"); 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 : "@SCCP_Adapter.SCCP_Adapter_Config"); } boolean SCCP__Adapter__Config_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SCCP__Adapter__Config_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_idxref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } SCCP__Adapter__Configs::SCCP__Adapter__Configs(const SCCP__Adapter__Configs& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } SCCP__Adapter__Configs::~SCCP__Adapter__Configs() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void SCCP__Adapter__Configs::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."); } } SCCP__Adapter__Configs& SCCP__Adapter__Configs::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; } SCCP__Adapter__Configs& SCCP__Adapter__Configs::operator=(const SCCP__Adapter__Configs& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean SCCP__Adapter__Configs::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); return val_ptr->n_elements == 0 ; } boolean SCCP__Adapter__Configs::operator==(const SCCP__Adapter__Configs& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); 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; } SCCP__Adapter__Config& SCCP__Adapter__Configs::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @SCCP_Adapter.SCCP_Adapter_Configs 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 = (SCCP__Adapter__Config**)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 SCCP__Adapter__Config(*(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 SCCP__Adapter__Config; } return *val_ptr->value_elements[index_value]; } SCCP__Adapter__Config& SCCP__Adapter__Configs::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @SCCP_Adapter.SCCP_Adapter_Configs."); return (*this)[(int)index_value]; } const SCCP__Adapter__Config& SCCP__Adapter__Configs::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); if (index_value < 0) TTCN_error("Accessing an element of type @SCCP_Adapter.SCCP_Adapter_Configs using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @SCCP_Adapter.SCCP_Adapter_Configs: 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 SCCP__Adapter__Config& SCCP__Adapter__Configs::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @SCCP_Adapter.SCCP_Adapter_Configs."); return (*this)[(int)index_value]; } SCCP__Adapter__Configs SCCP__Adapter__Configs::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } SCCP__Adapter__Configs SCCP__Adapter__Configs::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } SCCP__Adapter__Configs SCCP__Adapter__Configs::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } SCCP__Adapter__Configs SCCP__Adapter__Configs::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); 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; SCCP__Adapter__Configs 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 SCCP__Adapter__Config(*val_ptr->value_elements[i]); } } return ret_val; } SCCP__Adapter__Configs SCCP__Adapter__Configs::operator+(const SCCP__Adapter__Configs& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @SCCP_Adapter.SCCP_Adapter_Configs concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; SCCP__Adapter__Configs 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 SCCP__Adapter__Config(*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 SCCP__Adapter__Config(*other_value.val_ptr->value_elements[i]); } } return ret_val; } SCCP__Adapter__Configs SCCP__Adapter__Configs::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@SCCP_Adapter.SCCP_Adapter_Configs","element"); SCCP__Adapter__Configs ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new SCCP__Adapter__Config(*val_ptr->value_elements[i+index]); } } return ret_val; } SCCP__Adapter__Configs SCCP__Adapter__Configs::replace(int index, int len, const SCCP__Adapter__Configs& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); check_replace_arguments(val_ptr->n_elements, index, len, "@SCCP_Adapter.SCCP_Adapter_Configs","element"); SCCP__Adapter__Configs 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 SCCP__Adapter__Config(*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 SCCP__Adapter__Config(*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 SCCP__Adapter__Config(*val_ptr->value_elements[index+i+len]); } } return ret_val; } SCCP__Adapter__Configs SCCP__Adapter__Configs::replace(int index, int len, const SCCP__Adapter__Configs_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 SCCP__Adapter__Configs::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @SCCP_Adapter.SCCP_Adapter_Configs."); 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 = (SCCP__Adapter__Config**)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 SCCP__Adapter__Config(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (SCCP__Adapter__Config**)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 @SCCP_Adapter.SCCP_Adapter_Configs: %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 = (SCCP__Adapter__Config**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean SCCP__Adapter__Configs::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 SCCP__Adapter__Configs::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); return val_ptr->n_elements; } int SCCP__Adapter__Configs::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); 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 SCCP__Adapter__Configs::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 SCCP__Adapter__Configs::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 SCCP__Adapter__Configs::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", "@SCCP_Adapter.SCCP_Adapter_Configs"); } 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", "@SCCP_Adapter.SCCP_Adapter_Configs"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void SCCP__Adapter__Configs::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @SCCP_Adapter.SCCP_Adapter_Configs."); 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 SCCP__Adapter__Configs::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 @SCCP_Adapter.SCCP_Adapter_Configs."); val_ptr->value_elements = (SCCP__Adapter__Config**)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 SCCP__Adapter__Config; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void SCCP__Adapter__Configs::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 SCCP__Adapter__Configs::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 SCCP__Adapter__Configs::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean /*no_err*/, int sel_field, boolean first_call, const RAW_Force_Omit*){ int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; int decoded_length=0; int decoded_field_length=0; size_t start_of_field=0; if(first_call) { clean_up(); val_ptr=new recordof_setof_struct; val_ptr->ref_count=1; val_ptr->n_elements=0; val_ptr->value_elements=NULL; } int start_field=val_ptr->n_elements; if(p_td.raw->fieldlength || sel_field!=-1){ int a=0; if(sel_field==-1) sel_field=p_td.raw->fieldlength; start_of_field=p_buf.get_pos_bit(); for(a=0;a=0){ delete &(*this)[a+start_field]; a--; val_ptr->n_elements--; } p_buf.set_pos_bit(start_of_field); return decoded_field_length; } decoded_length+=decoded_field_length; limit-=decoded_field_length; } if(a==0) val_ptr->n_elements=0; } else { if(limit==0){ if(!first_call) return -1; val_ptr->n_elements=0; return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength; } int a=start_field; while(limit>0){ start_of_field=p_buf.get_pos_bit(); decoded_field_length=(*this)[a].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE); if(decoded_field_length < 0){ delete &(*this)[a]; val_ptr->n_elements--; p_buf.set_pos_bit(start_of_field); if(a>start_field){ return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength; } else return -1; } decoded_length+=decoded_field_length; limit-=decoded_field_length; a++; } } return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength; } int SCCP__Adapter__Configs::RAW_encode(const TTCN_Typedescriptor_t& p_td,RAW_enc_tree& myleaf) const{ int encoded_length=0; int encoded_num_of_records=p_td.raw->fieldlength?smaller(val_ptr->n_elements, p_td.raw->fieldlength):val_ptr->n_elements; myleaf.isleaf=FALSE; myleaf.rec_of=TRUE; myleaf.body.node.num_of_nodes=encoded_num_of_records; myleaf.body.node.nodes=init_nodes_of_enc_tree(encoded_num_of_records); for(int a=0;araw); encoded_length+=(*this)[a].RAW_encode(*p_td.oftype_descr,*myleaf.body.node.nodes[a]); } return myleaf.length=encoded_length; } void SCCP__Adapter__Configs_template::copy_value(const SCCP__Adapter__Configs& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @SCCP_Adapter.SCCP_Adapter_Configs with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (SCCP__Adapter__Config_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 SCCP__Adapter__Config_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new SCCP__Adapter__Config_template; } } set_selection(SPECIFIC_VALUE); } void SCCP__Adapter__Configs_template::copy_template(const SCCP__Adapter__Configs_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 = (SCCP__Adapter__Config_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 SCCP__Adapter__Config_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new SCCP__Adapter__Config_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 SCCP__Adapter__Configs_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 SCCP__Adapter__Configs_template(*other_value.implication_.precondition); implication_.implied_template = new SCCP__Adapter__Configs_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 @SCCP_Adapter.SCCP_Adapter_Configs."); break; } set_selection(other_value); } boolean SCCP__Adapter__Configs_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 SCCP__Adapter__Configs_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const SCCP__Adapter__Configs*)value_ptr)[value_index], legacy); else return ((const SCCP__Adapter__Configs_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } SCCP__Adapter__Configs_template::SCCP__Adapter__Configs_template() { } SCCP__Adapter__Configs_template::SCCP__Adapter__Configs_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } SCCP__Adapter__Configs_template::SCCP__Adapter__Configs_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } SCCP__Adapter__Configs_template::SCCP__Adapter__Configs_template(const SCCP__Adapter__Configs& other_value) { copy_value(other_value); } SCCP__Adapter__Configs_template::SCCP__Adapter__Configs_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Configs&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @SCCP_Adapter.SCCP_Adapter_Configs from an unbound optional field."); } } SCCP__Adapter__Configs_template::SCCP__Adapter__Configs_template(SCCP__Adapter__Configs_template* p_precondition, SCCP__Adapter__Configs_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SCCP__Adapter__Configs_template::SCCP__Adapter__Configs_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; } SCCP__Adapter__Configs_template::SCCP__Adapter__Configs_template(const SCCP__Adapter__Configs_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } SCCP__Adapter__Configs_template::~SCCP__Adapter__Configs_template() { clean_up(); } void SCCP__Adapter__Configs_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; } SCCP__Adapter__Configs_template& SCCP__Adapter__Configs_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SCCP__Adapter__Configs_template& SCCP__Adapter__Configs_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } SCCP__Adapter__Configs_template& SCCP__Adapter__Configs_template::operator=(const SCCP__Adapter__Configs& other_value) { clean_up(); copy_value(other_value); return *this; } SCCP__Adapter__Configs_template& SCCP__Adapter__Configs_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter__Configs&)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 @SCCP_Adapter.SCCP_Adapter_Configs."); } return *this; } SCCP__Adapter__Configs_template& SCCP__Adapter__Configs_template::operator=(const SCCP__Adapter__Configs_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } SCCP__Adapter__Config_template& SCCP__Adapter__Configs_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @SCCP_Adapter.SCCP_Adapter_Configs 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 @SCCP_Adapter.SCCP_Adapter_Configs."); break; } return *single_value.value_elements[index_value]; } SCCP__Adapter__Config_template& SCCP__Adapter__Configs_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @SCCP_Adapter.SCCP_Adapter_Configs."); return (*this)[(int)index_value]; } const SCCP__Adapter__Config_template& SCCP__Adapter__Configs_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @SCCP_Adapter.SCCP_Adapter_Configs using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @SCCP_Adapter.SCCP_Adapter_Configs."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @SCCP_Adapter.SCCP_Adapter_Configs: 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 SCCP__Adapter__Config_template& SCCP__Adapter__Configs_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @SCCP_Adapter.SCCP_Adapter_Configs."); return (*this)[(int)index_value]; } void SCCP__Adapter__Configs_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @SCCP_Adapter.SCCP_Adapter_Configs."); 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 = (SCCP__Adapter__Config_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 SCCP__Adapter__Config_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 SCCP__Adapter__Config_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 = (SCCP__Adapter__Config_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int SCCP__Adapter__Configs_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 SCCP__Adapter__Configs_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 @SCCP_Adapter.SCCP_Adapter_Configs 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 @SCCP_Adapter.SCCP_Adapter_Configs 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 @SCCP_Adapter.SCCP_Adapter_Configs 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 @SCCP_Adapter.SCCP_Adapter_Configs 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 @SCCP_Adapter.SCCP_Adapter_Configs 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 @SCCP_Adapter.SCCP_Adapter_Configs containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @SCCP_Adapter.SCCP_Adapter_Configs.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @SCCP_Adapter.SCCP_Adapter_Configs"); } boolean SCCP__Adapter__Configs_template::match(const SCCP__Adapter__Configs& 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 @SCCP_Adapter.SCCP_Adapter_Configs."); } return FALSE; } boolean SCCP__Adapter__Configs_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; } SCCP__Adapter__Configs SCCP__Adapter__Configs_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 @SCCP_Adapter.SCCP_Adapter_Configs."); SCCP__Adapter__Configs 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; } SCCP__Adapter__Configs SCCP__Adapter__Configs_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); } SCCP__Adapter__Configs SCCP__Adapter__Configs_template::replace(int index, int len, const SCCP__Adapter__Configs_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()); } SCCP__Adapter__Configs SCCP__Adapter__Configs_template::replace(int index, int len, const SCCP__Adapter__Configs& 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 SCCP__Adapter__Configs_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 SCCP__Adapter__Configs_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @SCCP_Adapter.SCCP_Adapter_Configs."); } set_selection(template_type); } SCCP__Adapter__Configs_template& SCCP__Adapter__Configs_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 @SCCP_Adapter.SCCP_Adapter_Configs."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @SCCP_Adapter.SCCP_Adapter_Configs."); return value_list.list_value[list_index]; } void SCCP__Adapter__Configs_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 SCCP__Adapter__Configs_template::log_match(const SCCP__Adapter__Configs& 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 SCCP__Adapter__Configs_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 @SCCP_Adapter.SCCP_Adapter_Configs."); } } void SCCP__Adapter__Configs_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 @SCCP_Adapter.SCCP_Adapter_Configs."); single_value.value_elements = (SCCP__Adapter__Config_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 SCCP__Adapter__Config_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 SCCP__Adapter__Configs_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 @SCCP_Adapter.SCCP_Adapter_Configs."); } } boolean SCCP__Adapter__Configs_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SCCP__Adapter__Configs_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 SCCP__Adapter__Configs_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: { SCCP__Adapter__Configs_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: { SCCP__Adapter__Configs_template* precondition = new SCCP__Adapter__Configs_template; precondition->set_param(*param.get_elem(0)); SCCP__Adapter__Configs_template* implied_template = new SCCP__Adapter__Configs_template; implied_template->set_param(*param.get_elem(1)); *this = SCCP__Adapter__Configs_template(precondition, implied_template); } break; default: param.type_error("record of template", "@SCCP_Adapter.SCCP_Adapter_Configs"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void SCCP__Adapter__Configs_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 : "@SCCP_Adapter.SCCP_Adapter_Configs"); 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 : "@SCCP_Adapter.SCCP_Adapter_Configs"); } boolean SCCP__Adapter__Configs_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); } } SCCP__Adapter::SCCP__Adapter() { } SCCP__Adapter::SCCP__Adapter(const COMPONENT& par_vc__M3UA, const COMPONENT& par_vc__IPA, const COMPONENT& par_vc__WAIT, const COMPONENT& par_vc__SCCP, const SCCP__Types::MSC__SCCP__MTP3__parameters& par_sccp__pars, const SCCPasp__Types::SCCP__PAR__Address& par_sccp__addr__own, const SCCPasp__Types::SCCP__PAR__Address& par_sccp__addr__peer, const SCCP__Adapter__Config& par_cfg) : field_vc__M3UA(par_vc__M3UA), field_vc__IPA(par_vc__IPA), field_vc__WAIT(par_vc__WAIT), field_vc__SCCP(par_vc__SCCP), field_sccp__pars(par_sccp__pars), field_sccp__addr__own(par_sccp__addr__own), field_sccp__addr__peer(par_sccp__addr__peer), field_cfg(par_cfg) { } SCCP__Adapter::SCCP__Adapter(const SCCP__Adapter& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @SCCP_Adapter.SCCP_Adapter."); if (other_value.vc__M3UA().is_bound()) field_vc__M3UA = other_value.vc__M3UA(); else field_vc__M3UA.clean_up(); if (other_value.vc__IPA().is_bound()) field_vc__IPA = other_value.vc__IPA(); else field_vc__IPA.clean_up(); if (other_value.vc__WAIT().is_bound()) field_vc__WAIT = other_value.vc__WAIT(); else field_vc__WAIT.clean_up(); if (other_value.vc__SCCP().is_bound()) field_vc__SCCP = other_value.vc__SCCP(); else field_vc__SCCP.clean_up(); if (other_value.sccp__pars().is_bound()) field_sccp__pars = other_value.sccp__pars(); else field_sccp__pars.clean_up(); if (other_value.sccp__addr__own().is_bound()) field_sccp__addr__own = other_value.sccp__addr__own(); else field_sccp__addr__own.clean_up(); if (other_value.sccp__addr__peer().is_bound()) field_sccp__addr__peer = other_value.sccp__addr__peer(); else field_sccp__addr__peer.clean_up(); if (other_value.cfg().is_bound()) field_cfg = other_value.cfg(); else field_cfg.clean_up(); } void SCCP__Adapter::clean_up() { field_vc__M3UA.clean_up(); field_vc__IPA.clean_up(); field_vc__WAIT.clean_up(); field_vc__SCCP.clean_up(); field_sccp__pars.clean_up(); field_sccp__addr__own.clean_up(); field_sccp__addr__peer.clean_up(); field_cfg.clean_up(); } const TTCN_Typedescriptor_t* SCCP__Adapter::get_descriptor() const { return &SCCP__Adapter_descr_; } SCCP__Adapter& SCCP__Adapter::operator=(const SCCP__Adapter& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @SCCP_Adapter.SCCP_Adapter."); if (other_value.vc__M3UA().is_bound()) field_vc__M3UA = other_value.vc__M3UA(); else field_vc__M3UA.clean_up(); if (other_value.vc__IPA().is_bound()) field_vc__IPA = other_value.vc__IPA(); else field_vc__IPA.clean_up(); if (other_value.vc__WAIT().is_bound()) field_vc__WAIT = other_value.vc__WAIT(); else field_vc__WAIT.clean_up(); if (other_value.vc__SCCP().is_bound()) field_vc__SCCP = other_value.vc__SCCP(); else field_vc__SCCP.clean_up(); if (other_value.sccp__pars().is_bound()) field_sccp__pars = other_value.sccp__pars(); else field_sccp__pars.clean_up(); if (other_value.sccp__addr__own().is_bound()) field_sccp__addr__own = other_value.sccp__addr__own(); else field_sccp__addr__own.clean_up(); if (other_value.sccp__addr__peer().is_bound()) field_sccp__addr__peer = other_value.sccp__addr__peer(); else field_sccp__addr__peer.clean_up(); if (other_value.cfg().is_bound()) field_cfg = other_value.cfg(); else field_cfg.clean_up(); } return *this; } boolean SCCP__Adapter::operator==(const SCCP__Adapter& other_value) const { return field_vc__M3UA==other_value.field_vc__M3UA && field_vc__IPA==other_value.field_vc__IPA && field_vc__WAIT==other_value.field_vc__WAIT && field_vc__SCCP==other_value.field_vc__SCCP && field_sccp__pars==other_value.field_sccp__pars && field_sccp__addr__own==other_value.field_sccp__addr__own && field_sccp__addr__peer==other_value.field_sccp__addr__peer && field_cfg==other_value.field_cfg; } boolean SCCP__Adapter::is_bound() const { return (field_vc__M3UA.is_bound()) || (field_vc__IPA.is_bound()) || (field_vc__WAIT.is_bound()) || (field_vc__SCCP.is_bound()) || (field_sccp__pars.is_bound()) || (field_sccp__addr__own.is_bound()) || (field_sccp__addr__peer.is_bound()) || (field_cfg.is_bound()); } boolean SCCP__Adapter::is_value() const { return field_vc__M3UA.is_value() && field_vc__IPA.is_value() && field_vc__WAIT.is_value() && field_vc__SCCP.is_value() && field_sccp__pars.is_value() && field_sccp__addr__own.is_value() && field_sccp__addr__peer.is_value() && field_cfg.is_value(); } void SCCP__Adapter::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ vc_M3UA := "); field_vc__M3UA.log(); TTCN_Logger::log_event_str(", vc_IPA := "); field_vc__IPA.log(); TTCN_Logger::log_event_str(", vc_WAIT := "); field_vc__WAIT.log(); TTCN_Logger::log_event_str(", vc_SCCP := "); field_vc__SCCP.log(); TTCN_Logger::log_event_str(", sccp_pars := "); field_sccp__pars.log(); TTCN_Logger::log_event_str(", sccp_addr_own := "); field_sccp__addr__own.log(); TTCN_Logger::log_event_str(", sccp_addr_peer := "); field_sccp__addr__peer.log(); TTCN_Logger::log_event_str(", cfg := "); field_cfg.log(); TTCN_Logger::log_event_str(" }"); } void SCCP__Adapter::set_implicit_omit() { if (vc__M3UA().is_bound()) vc__M3UA().set_implicit_omit(); if (vc__IPA().is_bound()) vc__IPA().set_implicit_omit(); if (vc__WAIT().is_bound()) vc__WAIT().set_implicit_omit(); if (vc__SCCP().is_bound()) vc__SCCP().set_implicit_omit(); if (sccp__pars().is_bound()) sccp__pars().set_implicit_omit(); if (sccp__addr__own().is_bound()) sccp__addr__own().set_implicit_omit(); if (sccp__addr__peer().is_bound()) sccp__addr__peer().set_implicit_omit(); if (cfg().is_bound()) cfg().set_implicit_omit(); } void SCCP__Adapter::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 (80 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) vc__M3UA().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) vc__IPA().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) vc__WAIT().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) vc__SCCP().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) sccp__pars().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) sccp__addr__own().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) sccp__addr__peer().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) cfg().set_param(*param.get_elem(7)); 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(), "vc_M3UA")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__M3UA().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vc_IPA")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__IPA().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vc_WAIT")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__WAIT().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vc_SCCP")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__SCCP().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sccp_pars")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sccp__pars().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sccp_addr_own")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sccp__addr__own().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sccp_addr_peer")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sccp__addr__peer().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cfg")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cfg().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @SCCP_Adapter.SCCP_Adapter: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@SCCP_Adapter.SCCP_Adapter"); } } void SCCP__Adapter::encode_text(Text_Buf& text_buf) const { field_vc__M3UA.encode_text(text_buf); field_vc__IPA.encode_text(text_buf); field_vc__WAIT.encode_text(text_buf); field_vc__SCCP.encode_text(text_buf); field_sccp__pars.encode_text(text_buf); field_sccp__addr__own.encode_text(text_buf); field_sccp__addr__peer.encode_text(text_buf); field_cfg.encode_text(text_buf); } void SCCP__Adapter::decode_text(Text_Buf& text_buf) { field_vc__M3UA.decode_text(text_buf); field_vc__IPA.decode_text(text_buf); field_vc__WAIT.decode_text(text_buf); field_vc__SCCP.decode_text(text_buf); field_sccp__pars.decode_text(text_buf); field_sccp__addr__own.decode_text(text_buf); field_sccp__addr__peer.decode_text(text_buf); field_cfg.decode_text(text_buf); } struct SCCP__Adapter_template::single_value_struct { COMPONENT_template field_vc__M3UA; COMPONENT_template field_vc__IPA; COMPONENT_template field_vc__WAIT; COMPONENT_template field_vc__SCCP; SCCP__Types::MSC__SCCP__MTP3__parameters_template field_sccp__pars; SCCPasp__Types::SCCP__PAR__Address_template field_sccp__addr__own; SCCPasp__Types::SCCP__PAR__Address_template field_sccp__addr__peer; SCCP__Adapter__Config_template field_cfg; }; void SCCP__Adapter_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_vc__M3UA = ANY_VALUE; single_value->field_vc__IPA = ANY_VALUE; single_value->field_vc__WAIT = ANY_VALUE; single_value->field_vc__SCCP = ANY_VALUE; single_value->field_sccp__pars = ANY_VALUE; single_value->field_sccp__addr__own = ANY_VALUE; single_value->field_sccp__addr__peer = ANY_VALUE; single_value->field_cfg = ANY_VALUE; } } } void SCCP__Adapter_template::copy_value(const SCCP__Adapter& other_value) { single_value = new single_value_struct; if (other_value.vc__M3UA().is_bound()) { single_value->field_vc__M3UA = other_value.vc__M3UA(); } else { single_value->field_vc__M3UA.clean_up(); } if (other_value.vc__IPA().is_bound()) { single_value->field_vc__IPA = other_value.vc__IPA(); } else { single_value->field_vc__IPA.clean_up(); } if (other_value.vc__WAIT().is_bound()) { single_value->field_vc__WAIT = other_value.vc__WAIT(); } else { single_value->field_vc__WAIT.clean_up(); } if (other_value.vc__SCCP().is_bound()) { single_value->field_vc__SCCP = other_value.vc__SCCP(); } else { single_value->field_vc__SCCP.clean_up(); } if (other_value.sccp__pars().is_bound()) { single_value->field_sccp__pars = other_value.sccp__pars(); } else { single_value->field_sccp__pars.clean_up(); } if (other_value.sccp__addr__own().is_bound()) { single_value->field_sccp__addr__own = other_value.sccp__addr__own(); } else { single_value->field_sccp__addr__own.clean_up(); } if (other_value.sccp__addr__peer().is_bound()) { single_value->field_sccp__addr__peer = other_value.sccp__addr__peer(); } else { single_value->field_sccp__addr__peer.clean_up(); } if (other_value.cfg().is_bound()) { single_value->field_cfg = other_value.cfg(); } else { single_value->field_cfg.clean_up(); } set_selection(SPECIFIC_VALUE); } void SCCP__Adapter_template::copy_template(const SCCP__Adapter_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.vc__M3UA().get_selection()) { single_value->field_vc__M3UA = other_value.vc__M3UA(); } else { single_value->field_vc__M3UA.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.vc__IPA().get_selection()) { single_value->field_vc__IPA = other_value.vc__IPA(); } else { single_value->field_vc__IPA.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.vc__WAIT().get_selection()) { single_value->field_vc__WAIT = other_value.vc__WAIT(); } else { single_value->field_vc__WAIT.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.vc__SCCP().get_selection()) { single_value->field_vc__SCCP = other_value.vc__SCCP(); } else { single_value->field_vc__SCCP.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sccp__pars().get_selection()) { single_value->field_sccp__pars = other_value.sccp__pars(); } else { single_value->field_sccp__pars.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sccp__addr__own().get_selection()) { single_value->field_sccp__addr__own = other_value.sccp__addr__own(); } else { single_value->field_sccp__addr__own.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sccp__addr__peer().get_selection()) { single_value->field_sccp__addr__peer = other_value.sccp__addr__peer(); } else { single_value->field_sccp__addr__peer.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cfg().get_selection()) { single_value->field_cfg = other_value.cfg(); } else { single_value->field_cfg.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 SCCP__Adapter_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 SCCP__Adapter_template(*other_value.implication_.precondition); implication_.implied_template = new SCCP__Adapter_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 @SCCP_Adapter.SCCP_Adapter."); break; } set_selection(other_value); } SCCP__Adapter_template::SCCP__Adapter_template() { } SCCP__Adapter_template::SCCP__Adapter_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SCCP__Adapter_template::SCCP__Adapter_template(const SCCP__Adapter& other_value) { copy_value(other_value); } SCCP__Adapter_template::SCCP__Adapter_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @SCCP_Adapter.SCCP_Adapter from an unbound optional field."); } } SCCP__Adapter_template::SCCP__Adapter_template(SCCP__Adapter_template* p_precondition, SCCP__Adapter_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SCCP__Adapter_template::SCCP__Adapter_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; } SCCP__Adapter_template::SCCP__Adapter_template(const SCCP__Adapter_template& other_value) : Base_Template() { copy_template(other_value); } SCCP__Adapter_template::~SCCP__Adapter_template() { clean_up(); } SCCP__Adapter_template& SCCP__Adapter_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SCCP__Adapter_template& SCCP__Adapter_template::operator=(const SCCP__Adapter& other_value) { clean_up(); copy_value(other_value); return *this; } SCCP__Adapter_template& SCCP__Adapter_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SCCP__Adapter&)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 @SCCP_Adapter.SCCP_Adapter."); } return *this; } SCCP__Adapter_template& SCCP__Adapter_template::operator=(const SCCP__Adapter_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SCCP__Adapter_template::match(const SCCP__Adapter& 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.vc__M3UA().is_bound()) return FALSE; if(!single_value->field_vc__M3UA.match(other_value.vc__M3UA(), legacy))return FALSE; if(!other_value.vc__IPA().is_bound()) return FALSE; if(!single_value->field_vc__IPA.match(other_value.vc__IPA(), legacy))return FALSE; if(!other_value.vc__WAIT().is_bound()) return FALSE; if(!single_value->field_vc__WAIT.match(other_value.vc__WAIT(), legacy))return FALSE; if(!other_value.vc__SCCP().is_bound()) return FALSE; if(!single_value->field_vc__SCCP.match(other_value.vc__SCCP(), legacy))return FALSE; if(!other_value.sccp__pars().is_bound()) return FALSE; if(!single_value->field_sccp__pars.match(other_value.sccp__pars(), legacy))return FALSE; if(!other_value.sccp__addr__own().is_bound()) return FALSE; if(!single_value->field_sccp__addr__own.match(other_value.sccp__addr__own(), legacy))return FALSE; if(!other_value.sccp__addr__peer().is_bound()) return FALSE; if(!single_value->field_sccp__addr__peer.match(other_value.sccp__addr__peer(), legacy))return FALSE; if(!other_value.cfg().is_bound()) return FALSE; if(!single_value->field_cfg.match(other_value.cfg(), 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 @SCCP_Adapter.SCCP_Adapter."); } return FALSE; } boolean SCCP__Adapter_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_vc__M3UA.is_bound() || single_value->field_vc__IPA.is_bound() || single_value->field_vc__WAIT.is_bound() || single_value->field_vc__SCCP.is_bound() || single_value->field_sccp__pars.is_bound() || single_value->field_sccp__addr__own.is_bound() || single_value->field_sccp__addr__peer.is_bound() || single_value->field_cfg.is_bound(); } boolean SCCP__Adapter_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_vc__M3UA.is_value() && single_value->field_vc__IPA.is_value() && single_value->field_vc__WAIT.is_value() && single_value->field_vc__SCCP.is_value() && single_value->field_sccp__pars.is_value() && single_value->field_sccp__addr__own.is_value() && single_value->field_sccp__addr__peer.is_value() && single_value->field_cfg.is_value(); } void SCCP__Adapter_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; } SCCP__Adapter SCCP__Adapter_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 @SCCP_Adapter.SCCP_Adapter."); SCCP__Adapter ret_val; if (single_value->field_vc__M3UA.is_bound()) { ret_val.vc__M3UA() = single_value->field_vc__M3UA.valueof(); } if (single_value->field_vc__IPA.is_bound()) { ret_val.vc__IPA() = single_value->field_vc__IPA.valueof(); } if (single_value->field_vc__WAIT.is_bound()) { ret_val.vc__WAIT() = single_value->field_vc__WAIT.valueof(); } if (single_value->field_vc__SCCP.is_bound()) { ret_val.vc__SCCP() = single_value->field_vc__SCCP.valueof(); } if (single_value->field_sccp__pars.is_bound()) { ret_val.sccp__pars() = single_value->field_sccp__pars.valueof(); } if (single_value->field_sccp__addr__own.is_bound()) { ret_val.sccp__addr__own() = single_value->field_sccp__addr__own.valueof(); } if (single_value->field_sccp__addr__peer.is_bound()) { ret_val.sccp__addr__peer() = single_value->field_sccp__addr__peer.valueof(); } if (single_value->field_cfg.is_bound()) { ret_val.cfg() = single_value->field_cfg.valueof(); } return ret_val; } void SCCP__Adapter_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 @SCCP_Adapter.SCCP_Adapter."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SCCP__Adapter_template[list_length]; } SCCP__Adapter_template& SCCP__Adapter_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 @SCCP_Adapter.SCCP_Adapter."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @SCCP_Adapter.SCCP_Adapter."); return value_list.list_value[list_index]; } COMPONENT_template& SCCP__Adapter_template::vc__M3UA() { set_specific(); return single_value->field_vc__M3UA; } const COMPONENT_template& SCCP__Adapter_template::vc__M3UA() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field vc_M3UA of a non-specific template of type @SCCP_Adapter.SCCP_Adapter."); return single_value->field_vc__M3UA; } COMPONENT_template& SCCP__Adapter_template::vc__IPA() { set_specific(); return single_value->field_vc__IPA; } const COMPONENT_template& SCCP__Adapter_template::vc__IPA() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field vc_IPA of a non-specific template of type @SCCP_Adapter.SCCP_Adapter."); return single_value->field_vc__IPA; } COMPONENT_template& SCCP__Adapter_template::vc__WAIT() { set_specific(); return single_value->field_vc__WAIT; } const COMPONENT_template& SCCP__Adapter_template::vc__WAIT() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field vc_WAIT of a non-specific template of type @SCCP_Adapter.SCCP_Adapter."); return single_value->field_vc__WAIT; } COMPONENT_template& SCCP__Adapter_template::vc__SCCP() { set_specific(); return single_value->field_vc__SCCP; } const COMPONENT_template& SCCP__Adapter_template::vc__SCCP() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field vc_SCCP of a non-specific template of type @SCCP_Adapter.SCCP_Adapter."); return single_value->field_vc__SCCP; } SCCP__Types::MSC__SCCP__MTP3__parameters_template& SCCP__Adapter_template::sccp__pars() { set_specific(); return single_value->field_sccp__pars; } const SCCP__Types::MSC__SCCP__MTP3__parameters_template& SCCP__Adapter_template::sccp__pars() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sccp_pars of a non-specific template of type @SCCP_Adapter.SCCP_Adapter."); return single_value->field_sccp__pars; } SCCPasp__Types::SCCP__PAR__Address_template& SCCP__Adapter_template::sccp__addr__own() { set_specific(); return single_value->field_sccp__addr__own; } const SCCPasp__Types::SCCP__PAR__Address_template& SCCP__Adapter_template::sccp__addr__own() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sccp_addr_own of a non-specific template of type @SCCP_Adapter.SCCP_Adapter."); return single_value->field_sccp__addr__own; } SCCPasp__Types::SCCP__PAR__Address_template& SCCP__Adapter_template::sccp__addr__peer() { set_specific(); return single_value->field_sccp__addr__peer; } const SCCPasp__Types::SCCP__PAR__Address_template& SCCP__Adapter_template::sccp__addr__peer() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sccp_addr_peer of a non-specific template of type @SCCP_Adapter.SCCP_Adapter."); return single_value->field_sccp__addr__peer; } SCCP__Adapter__Config_template& SCCP__Adapter_template::cfg() { set_specific(); return single_value->field_cfg; } const SCCP__Adapter__Config_template& SCCP__Adapter_template::cfg() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cfg of a non-specific template of type @SCCP_Adapter.SCCP_Adapter."); return single_value->field_cfg; } int SCCP__Adapter_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 8; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter 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 @SCCP_Adapter.SCCP_Adapter containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @SCCP_Adapter.SCCP_Adapter containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @SCCP_Adapter.SCCP_Adapter."); } return 0; } void SCCP__Adapter_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ vc_M3UA := "); single_value->field_vc__M3UA.log(); TTCN_Logger::log_event_str(", vc_IPA := "); single_value->field_vc__IPA.log(); TTCN_Logger::log_event_str(", vc_WAIT := "); single_value->field_vc__WAIT.log(); TTCN_Logger::log_event_str(", vc_SCCP := "); single_value->field_vc__SCCP.log(); TTCN_Logger::log_event_str(", sccp_pars := "); single_value->field_sccp__pars.log(); TTCN_Logger::log_event_str(", sccp_addr_own := "); single_value->field_sccp__addr__own.log(); TTCN_Logger::log_event_str(", sccp_addr_peer := "); single_value->field_sccp__addr__peer.log(); TTCN_Logger::log_event_str(", cfg := "); single_value->field_cfg.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 SCCP__Adapter_template::log_match(const SCCP__Adapter& 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_vc__M3UA.match(match_value.vc__M3UA(), legacy)){ TTCN_Logger::log_logmatch_info(".vc_M3UA"); single_value->field_vc__M3UA.log_match(match_value.vc__M3UA(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_vc__IPA.match(match_value.vc__IPA(), legacy)){ TTCN_Logger::log_logmatch_info(".vc_IPA"); single_value->field_vc__IPA.log_match(match_value.vc__IPA(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_vc__WAIT.match(match_value.vc__WAIT(), legacy)){ TTCN_Logger::log_logmatch_info(".vc_WAIT"); single_value->field_vc__WAIT.log_match(match_value.vc__WAIT(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_vc__SCCP.match(match_value.vc__SCCP(), legacy)){ TTCN_Logger::log_logmatch_info(".vc_SCCP"); single_value->field_vc__SCCP.log_match(match_value.vc__SCCP(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sccp__pars.match(match_value.sccp__pars(), legacy)){ TTCN_Logger::log_logmatch_info(".sccp_pars"); single_value->field_sccp__pars.log_match(match_value.sccp__pars(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sccp__addr__own.match(match_value.sccp__addr__own(), legacy)){ TTCN_Logger::log_logmatch_info(".sccp_addr_own"); single_value->field_sccp__addr__own.log_match(match_value.sccp__addr__own(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sccp__addr__peer.match(match_value.sccp__addr__peer(), legacy)){ TTCN_Logger::log_logmatch_info(".sccp_addr_peer"); single_value->field_sccp__addr__peer.log_match(match_value.sccp__addr__peer(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cfg.match(match_value.cfg(), legacy)){ TTCN_Logger::log_logmatch_info(".cfg"); single_value->field_cfg.log_match(match_value.cfg(), 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("{ vc_M3UA := "); single_value->field_vc__M3UA.log_match(match_value.vc__M3UA(), legacy); TTCN_Logger::log_event_str(", vc_IPA := "); single_value->field_vc__IPA.log_match(match_value.vc__IPA(), legacy); TTCN_Logger::log_event_str(", vc_WAIT := "); single_value->field_vc__WAIT.log_match(match_value.vc__WAIT(), legacy); TTCN_Logger::log_event_str(", vc_SCCP := "); single_value->field_vc__SCCP.log_match(match_value.vc__SCCP(), legacy); TTCN_Logger::log_event_str(", sccp_pars := "); single_value->field_sccp__pars.log_match(match_value.sccp__pars(), legacy); TTCN_Logger::log_event_str(", sccp_addr_own := "); single_value->field_sccp__addr__own.log_match(match_value.sccp__addr__own(), legacy); TTCN_Logger::log_event_str(", sccp_addr_peer := "); single_value->field_sccp__addr__peer.log_match(match_value.sccp__addr__peer(), legacy); TTCN_Logger::log_event_str(", cfg := "); single_value->field_cfg.log_match(match_value.cfg(), 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 SCCP__Adapter_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (vc__M3UA().is_bound()) vc__M3UA().set_implicit_omit(); if (vc__IPA().is_bound()) vc__IPA().set_implicit_omit(); if (vc__WAIT().is_bound()) vc__WAIT().set_implicit_omit(); if (vc__SCCP().is_bound()) vc__SCCP().set_implicit_omit(); if (sccp__pars().is_bound()) sccp__pars().set_implicit_omit(); if (sccp__addr__own().is_bound()) sccp__addr__own().set_implicit_omit(); if (sccp__addr__peer().is_bound()) sccp__addr__peer().set_implicit_omit(); if (cfg().is_bound()) cfg().set_implicit_omit(); } void SCCP__Adapter_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_vc__M3UA.encode_text(text_buf); single_value->field_vc__IPA.encode_text(text_buf); single_value->field_vc__WAIT.encode_text(text_buf); single_value->field_vc__SCCP.encode_text(text_buf); single_value->field_sccp__pars.encode_text(text_buf); single_value->field_sccp__addr__own.encode_text(text_buf); single_value->field_sccp__addr__peer.encode_text(text_buf); single_value->field_cfg.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 @SCCP_Adapter.SCCP_Adapter."); } } void SCCP__Adapter_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_vc__M3UA.decode_text(text_buf); single_value->field_vc__IPA.decode_text(text_buf); single_value->field_vc__WAIT.decode_text(text_buf); single_value->field_vc__SCCP.decode_text(text_buf); single_value->field_sccp__pars.decode_text(text_buf); single_value->field_sccp__addr__own.decode_text(text_buf); single_value->field_sccp__addr__peer.decode_text(text_buf); single_value->field_cfg.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 SCCP__Adapter_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 @SCCP_Adapter.SCCP_Adapter."); } } void SCCP__Adapter_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: { SCCP__Adapter_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) vc__M3UA().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) vc__IPA().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) vc__WAIT().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) vc__SCCP().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) sccp__pars().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) sccp__addr__own().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) sccp__addr__peer().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) cfg().set_param(*param.get_elem(7)); 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(), "vc_M3UA")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__M3UA().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vc_IPA")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__IPA().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vc_WAIT")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__WAIT().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vc_SCCP")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vc__SCCP().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sccp_pars")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sccp__pars().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sccp_addr_own")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sccp__addr__own().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sccp_addr_peer")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sccp__addr__peer().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cfg")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cfg().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @SCCP_Adapter.SCCP_Adapter: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SCCP__Adapter_template* precondition = new SCCP__Adapter_template; precondition->set_param(*param.get_elem(0)); SCCP__Adapter_template* implied_template = new SCCP__Adapter_template; implied_template->set_param(*param.get_elem(1)); *this = SCCP__Adapter_template(precondition, implied_template); } break; default: param.type_error("record template", "@SCCP_Adapter.SCCP_Adapter"); } is_ifpresent = param.get_ifpresent(); } void SCCP__Adapter_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_vc__M3UA.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter"); single_value->field_vc__IPA.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter"); single_value->field_vc__WAIT.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter"); single_value->field_vc__SCCP.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter"); single_value->field_sccp__pars.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter"); single_value->field_sccp__addr__own.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter"); single_value->field_sccp__addr__peer.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter"); single_value->field_cfg.check_restriction(t_res, t_name ? t_name : "@SCCP_Adapter.SCCP_Adapter"); 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 : "@SCCP_Adapter.SCCP_Adapter"); } boolean SCCP__Adapter_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SCCP__Adapter_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_idxn_elements == 0; } void SCCP__Adapter__Configs_encoder(const SCCP__Adapter__Configs& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name) { TTCN_EncDec::coding_t coding_type; unsigned int extra_options = 0; TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE); if (coding_type != TTCN_EncDec::CT_RAW) { TTCN_Logger::begin_event_log2str(); coding_name.log(); TTCN_error("Type `@SCCP_Adapter.SCCP_Adapter_Configs' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(SCCP__Adapter__Configs_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER SCCP__Adapter__Configs_decoder(OCTETSTRING& input_stream, SCCP__Adapter__Configs& output_value, const UNIVERSAL_CHARSTRING& coding_name) { TTCN_EncDec::coding_t coding_type; unsigned int extra_options = 0; TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE); if (coding_type != TTCN_EncDec::CT_RAW) { TTCN_Logger::begin_event_log2str(); coding_name.log(); TTCN_error("Type `@SCCP_Adapter.SCCP_Adapter_Configs' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(SCCP__Adapter__Configs_descr_, ttcn_buf, coding_type, extra_options); switch (TTCN_EncDec::get_last_error_type()) { case TTCN_EncDec::ET_NONE: ttcn_buf.cut(); ttcn_buf.get_string(input_stream); return 0; case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: return 2; default: return 1; } } void SCCP__Adapter_sccp__addr__own_encoder(const SCCPasp__Types::SCCP__PAR__Address& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name) { TTCN_EncDec::coding_t coding_type; unsigned int extra_options = 0; TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE); if (coding_type != TTCN_EncDec::CT_RAW) { TTCN_Logger::begin_event_log2str(); coding_name.log(); TTCN_error("Type `@SCCPasp_Types.SCCP_PAR_Address' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(SCCPasp__Types::SCCP__PAR__Address_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER SCCP__Adapter_sccp__addr__own_decoder(OCTETSTRING& input_stream, SCCPasp__Types::SCCP__PAR__Address& output_value, const UNIVERSAL_CHARSTRING& coding_name) { TTCN_EncDec::coding_t coding_type; unsigned int extra_options = 0; TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE); if (coding_type != TTCN_EncDec::CT_RAW) { TTCN_Logger::begin_event_log2str(); coding_name.log(); TTCN_error("Type `@SCCPasp_Types.SCCP_PAR_Address' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(SCCPasp__Types::SCCP__PAR__Address_descr_, ttcn_buf, coding_type, extra_options); switch (TTCN_EncDec::get_last_error_type()) { case TTCN_EncDec::ET_NONE: ttcn_buf.cut(); ttcn_buf.get_string(input_stream); return 0; case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: return 2; default: return 1; } } void SCCP__Adapter_sccp__addr__peer_encoder(const SCCPasp__Types::SCCP__PAR__Address& input_value, OCTETSTRING& output_stream, const UNIVERSAL_CHARSTRING& coding_name) { TTCN_EncDec::coding_t coding_type; unsigned int extra_options = 0; TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, TRUE); if (coding_type != TTCN_EncDec::CT_RAW) { TTCN_Logger::begin_event_log2str(); coding_name.log(); TTCN_error("Type `@SCCPasp_Types.SCCP_PAR_Address' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(SCCPasp__Types::SCCP__PAR__Address_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER SCCP__Adapter_sccp__addr__peer_decoder(OCTETSTRING& input_stream, SCCPasp__Types::SCCP__PAR__Address& output_value, const UNIVERSAL_CHARSTRING& coding_name) { TTCN_EncDec::coding_t coding_type; unsigned int extra_options = 0; TTCN_EncDec::get_coding_from_str(coding_name, &coding_type, &extra_options, FALSE); if (coding_type != TTCN_EncDec::CT_RAW) { TTCN_Logger::begin_event_log2str(); coding_name.log(); TTCN_error("Type `@SCCPasp_Types.SCCP_PAR_Address' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(SCCPasp__Types::SCCP__PAR__Address_descr_, ttcn_buf, coding_type, extra_options); switch (TTCN_EncDec::get_last_error_type()) { case TTCN_EncDec::ET_NONE: ttcn_buf.cut(); ttcn_buf.get_string(input_stream); return 0; case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: return 2; default: return 1; } } void init__pars(SCCP__Adapter& ba, const SCCP__Adapter__Config& cfg) { SCCP__Adapter__Config cfg_shadow(cfg); TTCN_Location current_location("SCCP_Adapter.ttcnpp", 85, TTCN_Location::LOCATION_FUNCTION, "init_pars"); current_location.update_lineno(86); /* SCCP_Adapter.ttcnpp, line 86 */ { SCCP__Types::MSC__SCCP__MTP3__parameters& tmp_1 = ba.sccp__pars(); /* 7388 */ { MTP3asp__Types::MTP3__Field__sio& tmp_2 = tmp_1.sio(); tmp_2.ni() = substr(oct2bit(const_cast< const SCCP__Adapter__Config&>(cfg_shadow).sio()), 0, 2); tmp_2.prio() = substr(oct2bit(const_cast< const SCCP__Adapter__Config&>(cfg_shadow).sio()), 2, 2); tmp_2.si() = substr(oct2bit(const_cast< const SCCP__Adapter__Config&>(cfg_shadow).sio()), 4, 4); } tmp_1.opc() = const_cast< const SCCP__Adapter__Config&>(cfg_shadow).own__pc(); tmp_1.dpc() = const_cast< const SCCP__Adapter__Config&>(cfg_shadow).peer__pc(); tmp_1.sls() = 0; tmp_1.sccp__serviceType() = const_cast< const SCCP__Adapter__Config&>(cfg_shadow).sccp__service__type(); tmp_1.ssn() = const_cast< const SCCP__Adapter__Config&>(cfg_shadow).own__ssn(); } current_location.update_lineno(98); /* SCCP_Adapter.ttcnpp, line 98 */ ba.sccp__addr__own() = SCCP__Templates::ts__SccpAddr__PC__SSN(const_cast< const SCCP__Adapter__Config&>(cfg_shadow).own__pc(), const_cast< const SCCP__Adapter__Config&>(cfg_shadow).own__ssn(), const_cast< const SCCP__Adapter__Config&>(cfg_shadow).sio(), const_cast< const SCCP__Adapter__Config&>(cfg_shadow).sccp__service__type()).valueof(); current_location.update_lineno(99); /* SCCP_Adapter.ttcnpp, line 99 */ ba.sccp__addr__peer() = SCCP__Templates::ts__SccpAddr__PC__SSN(const_cast< const SCCP__Adapter__Config&>(cfg_shadow).peer__pc(), const_cast< const SCCP__Adapter__Config&>(cfg_shadow).peer__ssn(), const_cast< const SCCP__Adapter__Config&>(cfg_shadow).sio(), const_cast< const SCCP__Adapter__Config&>(cfg_shadow).sccp__service__type()).valueof(); current_location.update_lineno(101); /* SCCP_Adapter.ttcnpp, line 101 */ { boolean tmp_8; { boolean tmp_5 = cfg_shadow.is_bound(); if(tmp_5) { const SCCP__Adapter__Config& tmp_6 = cfg_shadow; const SCCP__Adapter__Transport__ConfigUnion& tmp_7 = tmp_6.tpars(); tmp_5 = tmp_7.is_bound(); if (tmp_5) { tmp_5 = tmp_7.ischosen(SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite); } } tmp_8 = tmp_5; } if (tmp_8) { current_location.update_lineno(102); /* SCCP_Adapter.ttcnpp, line 102 */ { boolean tmp_16; { boolean tmp_9 = cfg_shadow.is_bound(); if(tmp_9) { const SCCP__Adapter__Config& tmp_10 = cfg_shadow; const SCCP__Adapter__Transport__ConfigUnion& tmp_11 = tmp_10.tpars(); tmp_9 = tmp_11.is_bound(); if(tmp_9) { tmp_9 = tmp_11.ischosen(SCCP__Adapter__Transport__ConfigUnion::ALT_sccplite); } if(tmp_9) { const SCCP__Adapter__Transport__ConfigUnion& tmp_12 = tmp_11; const SCCP__Adapter__Config__Sccplite& tmp_13 = tmp_12.sccplite(); tmp_9 = tmp_13.is_bound(); if(tmp_9) { const OPTIONAL< IPA__Emulation::IPA__CCM__Parameters >& tmp_14 = tmp_13.ipa__ccm__pars(); switch (tmp_14.get_selection()) { case OPTIONAL_UNBOUND: tmp_9 = FALSE; break; case OPTIONAL_OMIT: tmp_9 = FALSE; break; default: { const IPA__Emulation::IPA__CCM__Parameters& tmp_15 = (const IPA__Emulation::IPA__CCM__Parameters&) tmp_14; tmp_9 = tmp_15.is_present(); break;} } } } } tmp_16 = (!(tmp_9)); } if (tmp_16) { current_location.update_lineno(103); /* SCCP_Adapter.ttcnpp, line 103 */ cfg_shadow.tpars().sccplite().ipa__ccm__pars() = IPA__Emulation::c__IPA__default__ccm__pars; } } } } current_location.update_lineno(107); /* SCCP_Adapter.ttcnpp, line 107 */ ba.cfg() = cfg_shadow; } void f__sccp__adapter__init(SCCP__Adapter& ba, const SCCP__Adapter__Config& cfg, const CHARSTRING& id) { TTCN_Location current_location("SCCP_Adapter.ttcnpp", 110, TTCN_Location::LOCATION_FUNCTION, "f_sccp_adapter_init"); current_location.update_lineno(111); /* SCCP_Adapter.ttcnpp, line 111 */ init__pars(ba, cfg); current_location.update_lineno(114); /* SCCP_Adapter.ttcnpp, line 114 */ ba.vc__SCCP() = TTCN_Runtime::create_component("SCCP_Emulation", "SCCP_CT", (id + cs_0), NULL, TRUE); { const SCCP__Adapter__Transport &tmp_21 = const_cast< const SCCP__Adapter&>(ba).cfg().transport(); current_location.update_lineno(116); /* SCCP_Adapter.ttcnpp, line 116 */ if(tmp_21 == SCCP__Adapter__Transport::SCCP__TRANSPORT__SIGTRAN) goto tmp_20_0; goto tmp_20_1; tmp_20_0: { current_location.update_lineno(117); /* SCCP_Adapter.ttcnpp, line 117 */ INTEGER_template rctx; current_location.update_lineno(118); /* SCCP_Adapter.ttcnpp, line 118 */ { boolean tmp_27; { boolean tmp_22 = ba.is_bound(); if(tmp_22) { const SCCP__Adapter& tmp_23 = ba; const SCCP__Adapter__Config& tmp_24 = tmp_23.cfg(); tmp_22 = tmp_24.is_bound(); if(tmp_22) { const SCCP__Adapter__Config& tmp_25 = tmp_24; const INTEGER& tmp_26 = tmp_25.rctx(); tmp_22 = tmp_26.is_present(); } } tmp_27 = (!(tmp_22)); } if (tmp_27) { current_location.update_lineno(119); /* SCCP_Adapter.ttcnpp, line 119 */ rctx = OMIT_VALUE; } else { current_location.update_lineno(121); /* SCCP_Adapter.ttcnpp, line 121 */ rctx = const_cast< const SCCP__Adapter&>(ba).cfg().rctx(); } } current_location.update_lineno(123); /* SCCP_Adapter.ttcnpp, line 123 */ ba.vc__M3UA() = TTCN_Runtime::create_component("M3UA_Emulation", "M3UA_CT", (id + cs_1), NULL, TRUE); current_location.update_lineno(124); /* SCCP_Adapter.ttcnpp, line 124 */ { Map_Params tmp_31(0); TTCN_Runtime::map_port(const_cast< const SCCP__Adapter&>(ba).vc__M3UA(), M3UA__Emulation::M3UA__CT_component_SCTP__PORT.get_name(), SYSTEM_COMPREF, "sctp", tmp_31); } current_location.update_lineno(126); /* SCCP_Adapter.ttcnpp, line 126 */ TTCN_Runtime::connect_port(const_cast< const SCCP__Adapter&>(ba).vc__M3UA(), M3UA__Emulation::M3UA__CT_component_MTP3__SP__PORT.get_name(), const_cast< const SCCP__Adapter&>(ba).vc__SCCP(), SCCP__Emulation::SCCP__CT_component_MTP3__SCCP__PORT.get_name()); current_location.update_lineno(127); /* SCCP_Adapter.ttcnpp, line 127 */ M3UA__Emulation::start_f__M3UA__Emulation(const_cast< const SCCP__Adapter&>(ba).vc__M3UA(), const_cast< const SCCP__Adapter&>(ba).cfg().tpars().sigtran().sctp__addr(), rctx); goto tmp_20_end; } tmp_20_1: { current_location.update_lineno(156); /* SCCP_Adapter.ttcnpp, line 156 */ TTCN_Runtime::setverdict(FAIL,(TTCN_Logger::begin_event_log2str(),TTCN_Logger::log_event_str("Unsuppored RAN_Transport"),TTCN_Logger::end_event_log2str())); current_location.update_lineno(157); /* SCCP_Adapter.ttcnpp, line 157 */ TTCN_Runtime::stop_component(MTC_COMPREF); } tmp_20_end: /* empty */; } } void f__sccp__adapter__start(SCCP__Adapter& ba) { TTCN_Location current_location("SCCP_Adapter.ttcnpp", 164, TTCN_Location::LOCATION_FUNCTION, "f_sccp_adapter_start"); current_location.update_lineno(165); /* SCCP_Adapter.ttcnpp, line 165 */ SCCP__Emulation::start_SCCPStart(const_cast< const SCCP__Adapter&>(ba).vc__SCCP(), const_cast< const SCCP__Adapter&>(ba).sccp__pars()); } void f__sccp__adapter__cleanup(SCCP__Adapter& ba) { TTCN_Location current_location("SCCP_Adapter.ttcnpp", 168, TTCN_Location::LOCATION_FUNCTION, "f_sccp_adapter_cleanup"); current_location.update_lineno(169); /* SCCP_Adapter.ttcnpp, line 169 */ if ((const_cast< const SCCP__Adapter&>(ba).cfg().transport() == SCCP__Adapter__Transport::SCCP__TRANSPORT__SIGTRAN)) { current_location.update_lineno(170); /* SCCP_Adapter.ttcnpp, line 170 */ { Map_Params tmp_32(0); TTCN_Runtime::unmap_port(const_cast< const SCCP__Adapter&>(ba).vc__M3UA(), M3UA__Emulation::M3UA__CT_component_SCTP__PORT.get_name(), SYSTEM_COMPREF, "sctp", tmp_32); } current_location.update_lineno(171); /* SCCP_Adapter.ttcnpp, line 171 */ TTCN_Runtime::disconnect_port(const_cast< const SCCP__Adapter&>(ba).vc__M3UA(), M3UA__Emulation::M3UA__CT_component_MTP3__SP__PORT.get_name(), const_cast< const SCCP__Adapter&>(ba).vc__SCCP(), SCCP__Emulation::SCCP__CT_component_MTP3__SCCP__PORT.get_name()); current_location.update_lineno(172); /* SCCP_Adapter.ttcnpp, line 172 */ const_cast< const SCCP__Adapter&>(ba).vc__M3UA().stop(); } current_location.update_lineno(174); /* SCCP_Adapter.ttcnpp, line 174 */ const_cast< const SCCP__Adapter&>(ba).vc__SCCP().stop(); } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("SCCP_Adapter.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "SCCP_Adapter"); M3UA__Emulation::module_object.pre_init_module(); IPA__Emulation::module_object.pre_init_module(); SCCP__Templates::module_object.pre_init_module(); module_object.add_function("init_pars", (genericfunc_t)&init__pars, NULL); module_object.add_function("f_sccp_adapter_init", (genericfunc_t)&f__sccp__adapter__init, NULL); module_object.add_function("f_sccp_adapter_start", (genericfunc_t)&f__sccp__adapter__start, NULL); module_object.add_function("f_sccp_adapter_cleanup", (genericfunc_t)&f__sccp__adapter__cleanup, NULL); } void post_init_module() { TTCN_Location current_location("SCCP_Adapter.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "SCCP_Adapter"); M3UA__Emulation::module_object.post_init_module(); IPA__Emulation::module_object.post_init_module(); SCCP__Templates::module_object.post_init_module(); } } /* end of namespace */