// This C++ source file was generated by the TTCN-3 compiler // of the TTCN-3 Test Executor version 9.0.0 // for (build@3978f7fbee0c) on Mon Jun 24 02:37:33 2024 // Copyright (c) 2000-2023 Ericsson Telecom AB // Do not edit this file unless you know what you are doing. /* Including header files */ #include "GSM_Types.hh" namespace GSM__Types { /* Literal string constants */ const unsigned char bs_6_bits[] = { 0 }, bs_4_bits[] = { 0 }, bs_0_bits[] = { 8 }, bs_2_bits[] = { 4 }, bs_3_bits[] = { 2 }, bs_5_bits[] = { 1 }, bs_1_bits[] = { 15 }; extern const BITSTRING bs_6(1, bs_6_bits), bs_4(4, bs_4_bits), bs_0(4, bs_0_bits), bs_2(3, bs_2_bits), bs_3(2, bs_3_bits), bs_5(1, bs_5_bits), bs_1(4, bs_1_bits); const unsigned char hs_6_nibbles[] = { 33, 3 }, hs_3_nibbles[] = { 33, 99, 84 }, hs_2_nibbles[] = { 33, 243, 84 }, hs_4_nibbles[] = { 98, 2 }, hs_1_nibbles[] = { 98, 242, 36 }, hs_5_nibbles[] = { 36 }, hs_7_nibbles[] = { 84 }, hs_8_nibbles[] = { 84, 6 }, hs_0_nibbles[] = { 15 }; extern const HEXSTRING hs_6(3, hs_6_nibbles), hs_3(6, hs_3_nibbles), hs_2(6, hs_2_nibbles), hs_4(3, hs_4_nibbles), hs_1(6, hs_1_nibbles), hs_5(2, hs_5_nibbles), hs_7(2, hs_7_nibbles), hs_8(3, hs_8_nibbles), hs_0(1, hs_0_nibbles); const unsigned char os_4_octets[] = { 33, 99, 84 }, os_3_octets[] = { 33, 243, 84 }, os_2_octets[] = { 98, 242, 36 }, os_1_octets[] = { 238, 238, 238, 238 }, os_0_octets[] = { 255, 255, 255, 255 }; extern const OCTETSTRING os_4(3, os_4_octets), os_3(3, os_3_octets), os_2(3, os_2_octets), os_1(4, os_1_octets), os_0(4, os_0_octets); extern const CHARSTRING cs_0(14, "GSM_Types.ttcn"); const unsigned char module_checksum[] = { 0x7f, 0x86, 0x5e, 0xc2, 0xc9, 0x3f, 0x4c, 0xa7, 0x18, 0x0f, 0x6f, 0x0b, 0xc1, 0x1a, 0x8e, 0x13 }; /* Global variable definitions */ const TTCN_RAWdescriptor_t GsmArfcn_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmArfcn_xer_ = { {"GsmArfcn>\n", "GsmArfcn>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t GsmArfcn_descr_ = { "@GSM_Types.GsmArfcn", &INTEGER_ber_, &GsmArfcn_raw_, &INTEGER_text_, &GsmArfcn_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmArfcn_default_coding("RAW"); const TTCN_RAWdescriptor_t UmtsArfcn_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t UmtsArfcn_xer_ = { {"UmtsArfcn>\n", "UmtsArfcn>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t UmtsArfcn_descr_ = { "@GSM_Types.UmtsArfcn", &INTEGER_ber_, &UmtsArfcn_raw_, &INTEGER_text_, &UmtsArfcn_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING UmtsArfcn_default_coding("RAW"); const TTCN_RAWdescriptor_t UmtsScramblingCode_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t UmtsScramblingCode_xer_ = { {"UmtsScramblingCode>\n", "UmtsScramblingCode>\n"}, {20, 20}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t UmtsScramblingCode_descr_ = { "@GSM_Types.UmtsScramblingCode", &INTEGER_ber_, &UmtsScramblingCode_raw_, &INTEGER_text_, &UmtsScramblingCode_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING UmtsScramblingCode_default_coding("RAW"); INTEGER const_GsmMaxFrameNumber; const INTEGER& GsmMaxFrameNumber = const_GsmMaxFrameNumber; const TTCN_RAWdescriptor_t GsmFrameNumber_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmFrameNumber_xer_ = { {"GsmFrameNumber>\n", "GsmFrameNumber>\n"}, {16, 16}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t GsmFrameNumber_descr_ = { "@GSM_Types.GsmFrameNumber", &INTEGER_ber_, &GsmFrameNumber_raw_, &INTEGER_text_, &GsmFrameNumber_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmFrameNumber_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmRxLev_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmRxLev_xer_ = { {"GsmRxLev>\n", "GsmRxLev>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t GsmRxLev_descr_ = { "@GSM_Types.GsmRxLev", &INTEGER_ber_, &GsmRxLev_raw_, &INTEGER_text_, &GsmRxLev_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmRxLev_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmTsc_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmTsc_xer_ = { {"GsmTsc>\n", "GsmTsc>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t GsmTsc_descr_ = { "@GSM_Types.GsmTsc", &INTEGER_ber_, &GsmTsc_raw_, &INTEGER_text_, &GsmTsc_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmTsc_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmTmsi_raw_ = {32,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmTmsi_xer_ = { {"GsmTmsi>\n", "GsmTmsi>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t GsmTmsi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t GsmTmsi_descr_ = { "@GSM_Types.GsmTmsi", &INTEGER_ber_, &GsmTmsi_raw_, &INTEGER_text_, &GsmTmsi_xer_, &INTEGER_json_, &GsmTmsi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmTmsi_default_coding("RAW"); const TTCN_RAWdescriptor_t GprsTlli_raw_ = {32,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,4,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GprsTlli_xer_ = { {"GprsTlli>\n", "GprsTlli>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int GprsTlli_oer_ext_arr_[0] = {}; const int GprsTlli_oer_p_[0] = {}; const TTCN_OERdescriptor_t GprsTlli_oer_ = { -1, TRUE, 4, FALSE, 0, 0, GprsTlli_oer_ext_arr_, 0, GprsTlli_oer_p_}; const TTCN_Typedescriptor_t GprsTlli_descr_ = { "@GSM_Types.GprsTlli", &OCTETSTRING_ber_, &GprsTlli_raw_, &OCTETSTRING_text_, &GprsTlli_xer_, &OCTETSTRING_json_, &GprsTlli_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GprsTlli_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmMcc_raw_ = {12,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmMcc_xer_ = { {"GsmMcc>\n", "GsmMcc>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t GsmMcc_descr_ = { "@GSM_Types.GsmMcc", NULL, &GsmMcc_raw_, NULL, &GsmMcc_xer_, &HEXSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmMcc_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmMnc_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmMnc_xer_ = { {"GsmMnc>\n", "GsmMnc>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t GsmMnc_descr_ = { "@GSM_Types.GsmMnc", NULL, &GsmMnc_raw_, NULL, &GsmMnc_xer_, &HEXSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmMnc_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmLac_raw_ = {16,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmLac_xer_ = { {"GsmLac>\n", "GsmLac>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t GsmLac_descr_ = { "@GSM_Types.GsmLac", &INTEGER_ber_, &GsmLac_raw_, &INTEGER_text_, &GsmLac_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmLac_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmCellId_raw_ = {16,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmCellId_xer_ = { {"GsmCellId>\n", "GsmCellId>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t GsmCellId_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t GsmCellId_descr_ = { "@GSM_Types.GsmCellId", &INTEGER_ber_, &GsmCellId_raw_, &INTEGER_text_, &GsmCellId_xer_, &INTEGER_json_, &GsmCellId_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmCellId_default_coding("RAW"); const TTCN_RAWdescriptor_t GroupCallRef_raw_ = {0,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GroupCallRef_xer_ = { {"GroupCallRef>\n", "GroupCallRef>\n"}, {14, 14}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int GroupCallRef_oer_ext_arr_[0] = {}; const int GroupCallRef_oer_p_[0] = {}; const TTCN_OERdescriptor_t GroupCallRef_oer_ = { -1, TRUE, -1, FALSE, 0, 0, GroupCallRef_oer_ext_arr_, 0, GroupCallRef_oer_p_}; const TTCN_Typedescriptor_t GroupCallRef_descr_ = { "@GSM_Types.GroupCallRef", &OCTETSTRING_ber_, &GroupCallRef_raw_, &OCTETSTRING_text_, &GroupCallRef_xer_, &OCTETSTRING_json_, &GroupCallRef_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GroupCallRef_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmBandArfcn_pcs_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmBandArfcn_pcs_xer_ = { {"pcs>\n", "pcs>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int GsmBandArfcn_pcs_oer_ext_arr_[0] = {}; const int GsmBandArfcn_pcs_oer_p_[0] = {}; const TTCN_OERdescriptor_t GsmBandArfcn_pcs_oer_ = { -1, TRUE, -1, FALSE, 0, 0, GsmBandArfcn_pcs_oer_ext_arr_, 0, GsmBandArfcn_pcs_oer_p_}; const TTCN_Typedescriptor_t GsmBandArfcn_pcs_descr_ = { "@GSM_Types.GsmBandArfcn.pcs", &BOOLEAN_ber_, &GsmBandArfcn_pcs_raw_, &BOOLEAN_text_, &GsmBandArfcn_pcs_xer_, &BOOLEAN_json_, &GsmBandArfcn_pcs_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmBandArfcn_pcs_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmBandArfcn_uplink_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmBandArfcn_uplink_xer_ = { {"uplink>\n", "uplink>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int GsmBandArfcn_uplink_oer_ext_arr_[0] = {}; const int GsmBandArfcn_uplink_oer_p_[0] = {}; const TTCN_OERdescriptor_t GsmBandArfcn_uplink_oer_ = { -1, TRUE, -1, FALSE, 0, 0, GsmBandArfcn_uplink_oer_ext_arr_, 0, GsmBandArfcn_uplink_oer_p_}; const TTCN_Typedescriptor_t GsmBandArfcn_uplink_descr_ = { "@GSM_Types.GsmBandArfcn.uplink", &BOOLEAN_ber_, &GsmBandArfcn_uplink_raw_, &BOOLEAN_text_, &GsmBandArfcn_uplink_xer_, &BOOLEAN_json_, &GsmBandArfcn_uplink_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmBandArfcn_uplink_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmBandArfcn_spare_raw_ = {4,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,4,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmBandArfcn_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t GsmBandArfcn_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t GsmBandArfcn_spare_descr_ = { "@GSM_Types.GsmBandArfcn.spare", &BITSTRING_ber_, &GsmBandArfcn_spare_raw_, NULL, &GsmBandArfcn_spare_xer_, &BITSTRING_json_, &GsmBandArfcn_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmBandArfcn_spare_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmBandArfcn_arfcn_raw_ = {10,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmBandArfcn_arfcn_xer_ = { {"arfcn>\n", "arfcn>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t GsmBandArfcn_arfcn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t GsmBandArfcn_arfcn_descr_ = { "@GSM_Types.GsmBandArfcn.arfcn", &INTEGER_ber_, &GsmBandArfcn_arfcn_raw_, &INTEGER_text_, &GsmBandArfcn_arfcn_xer_, &INTEGER_json_, &GsmBandArfcn_arfcn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmBandArfcn_arfcn_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmBandArfcn_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for GsmBandArfcn const TTCN_Typedescriptor_t GsmBandArfcn_descr_ = { "@GSM_Types.GsmBandArfcn", NULL, &GsmBandArfcn_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmBandArfcn_default_coding("RAW"); BOOLEAN_template template_ts__GsmBandArfcn_pcs_defval; const BOOLEAN_template& ts__GsmBandArfcn_pcs_defval = template_ts__GsmBandArfcn_pcs_defval; BOOLEAN_template template_ts__GsmBandArfcn_uplink_defval; const BOOLEAN_template& ts__GsmBandArfcn_uplink_defval = template_ts__GsmBandArfcn_uplink_defval; BOOLEAN_template template_tr__GsmBandArfcn_pcs_defval; const BOOLEAN_template& tr__GsmBandArfcn_pcs_defval = template_tr__GsmBandArfcn_pcs_defval; BOOLEAN_template template_tr__GsmBandArfcn_uplink_defval; const BOOLEAN_template& tr__GsmBandArfcn_uplink_defval = template_tr__GsmBandArfcn_uplink_defval; const TTCN_RAWdescriptor_t PchanConfig_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PchanConfig const TTCN_Typedescriptor_t PchanConfig_descr_ = { "@GSM_Types.PchanConfig", NULL, &PchanConfig_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PchanConfig_default_coding("RAW"); const TTCN_RAWdescriptor_t GprsCodingScheme_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for GprsCodingScheme const TTCN_Typedescriptor_t GprsCodingScheme_descr_ = { "@GSM_Types.GprsCodingScheme", NULL, &GprsCodingScheme_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GprsCodingScheme_default_coding("RAW"); OCTETSTRING const_TLLI__UNUSED; const OCTETSTRING& TLLI__UNUSED = const_TLLI__UNUSED; const TTCN_RAWdescriptor_t ChannelNeeded_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for ChannelNeeded const TTCN_Typedescriptor_t ChannelNeeded_descr_ = { "@GSM_Types.ChannelNeeded", NULL, &ChannelNeeded_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ChannelNeeded_default_coding("RAW"); const TTCN_RAWdescriptor_t ChannelNeeded12_second_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for ChannelNeeded12_second const TTCN_Typedescriptor_t ChannelNeeded12_second_descr_ = { "@GSM_Types.ChannelNeeded12.second", NULL, &ChannelNeeded12_second_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ChannelNeeded12_second_default_coding("RAW"); const TTCN_RAWdescriptor_t ChannelNeeded12_first_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for ChannelNeeded12_first const TTCN_Typedescriptor_t ChannelNeeded12_first_descr_ = { "@GSM_Types.ChannelNeeded12.first", NULL, &ChannelNeeded12_first_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ChannelNeeded12_first_default_coding("RAW"); const TTCN_RAWdescriptor_t ChannelNeeded12_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for ChannelNeeded12 const TTCN_Typedescriptor_t ChannelNeeded12_descr_ = { "@GSM_Types.ChannelNeeded12", NULL, &ChannelNeeded12_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ChannelNeeded12_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr0_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChanNr0 const TTCN_Typedescriptor_t RslChanNr0_descr_ = { "@GSM_Types.RslChanNr0", NULL, &RslChanNr0_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr0_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr2_tag_raw_ = {4,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,4,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RslChanNr2_tag_xer_ = { {"tag>\n", "tag>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t RslChanNr2_tag_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t RslChanNr2_tag_descr_ = { "@GSM_Types.RslChanNr2.tag", &BITSTRING_ber_, &RslChanNr2_tag_raw_, NULL, &RslChanNr2_tag_xer_, &BITSTRING_json_, &RslChanNr2_tag_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr2_tag_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr2_sub__chan_raw_ = {1,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RslChanNr2_sub__chan_xer_ = { {"sub_chan>\n", "sub_chan>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t RslChanNr2_sub__chan_descr_ = { "@GSM_Types.RslChanNr2.sub_chan", &INTEGER_ber_, &RslChanNr2_sub__chan_raw_, &INTEGER_text_, &RslChanNr2_sub__chan_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr2_sub__chan_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr2_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChanNr2 const TTCN_Typedescriptor_t RslChanNr2_descr_ = { "@GSM_Types.RslChanNr2", NULL, &RslChanNr2_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr2_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr4_tag_raw_ = {3,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,3,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RslChanNr4_tag_xer_ = { {"tag>\n", "tag>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t RslChanNr4_tag_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t RslChanNr4_tag_descr_ = { "@GSM_Types.RslChanNr4.tag", &BITSTRING_ber_, &RslChanNr4_tag_raw_, NULL, &RslChanNr4_tag_xer_, &BITSTRING_json_, &RslChanNr4_tag_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr4_tag_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr4_sub__chan_raw_ = {2,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RslChanNr4_sub__chan_xer_ = { {"sub_chan>\n", "sub_chan>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t RslChanNr4_sub__chan_descr_ = { "@GSM_Types.RslChanNr4.sub_chan", &INTEGER_ber_, &RslChanNr4_sub__chan_raw_, &INTEGER_text_, &RslChanNr4_sub__chan_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr4_sub__chan_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr4_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChanNr4 const TTCN_Typedescriptor_t RslChanNr4_descr_ = { "@GSM_Types.RslChanNr4", NULL, &RslChanNr4_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr4_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr8_tag_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,2,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RslChanNr8_tag_xer_ = { {"tag>\n", "tag>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t RslChanNr8_tag_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t RslChanNr8_tag_descr_ = { "@GSM_Types.RslChanNr8.tag", &BITSTRING_ber_, &RslChanNr8_tag_raw_, NULL, &RslChanNr8_tag_xer_, &BITSTRING_json_, &RslChanNr8_tag_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr8_tag_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr8_sub__chan_raw_ = {3,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RslChanNr8_sub__chan_xer_ = { {"sub_chan>\n", "sub_chan>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t RslChanNr8_sub__chan_descr_ = { "@GSM_Types.RslChanNr8.sub_chan", &INTEGER_ber_, &RslChanNr8_sub__chan_raw_, &INTEGER_text_, &RslChanNr8_sub__chan_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr8_sub__chan_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNr8_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChanNr8 const TTCN_Typedescriptor_t RslChanNr8_descr_ = { "@GSM_Types.RslChanNr8", NULL, &RslChanNr8_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNr8_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNrU_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChanNrU const TTCN_Typedescriptor_t RslChanNrU_descr_ = { "@GSM_Types.RslChanNrU", NULL, &RslChanNrU_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const TTCN_RAWdescriptor_t RslChanNrU_ch0_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChanNrU_ch0 const TTCN_Typedescriptor_t RslChanNrU_ch0_descr_ = { "@GSM_Types.RslChanNrU.ch0", NULL, &RslChanNrU_ch0_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNrU_ch0_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNrU_lm_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChanNrU_lm const TTCN_Typedescriptor_t RslChanNrU_lm_descr_ = { "@GSM_Types.RslChanNrU.lm", NULL, &RslChanNrU_lm_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNrU_lm_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNrU_sdcch4_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChanNrU_sdcch4 const TTCN_Typedescriptor_t RslChanNrU_sdcch4_descr_ = { "@GSM_Types.RslChanNrU.sdcch4", NULL, &RslChanNrU_sdcch4_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNrU_sdcch4_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChanNrU_sdcch8_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChanNrU_sdcch8 const TTCN_Typedescriptor_t RslChanNrU_sdcch8_descr_ = { "@GSM_Types.RslChanNrU.sdcch8", NULL, &RslChanNrU_sdcch8_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChanNrU_sdcch8_default_coding("RAW"); UNIVERSAL_CHARSTRING RslChanNrU_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChannelNr_u_raw_ = {5,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChannelNr_u const TTCN_Typedescriptor_t RslChannelNr_u_descr_ = { "@GSM_Types.RslChannelNr.u", NULL, &RslChannelNr_u_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChannelNr_u_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChannelNr_tn_raw_ = {3,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RslChannelNr_tn_xer_ = { {"tn>\n", "tn>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t RslChannelNr_tn_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t RslChannelNr_tn_descr_ = { "@GSM_Types.RslChannelNr.tn", &INTEGER_ber_, &RslChannelNr_tn_raw_, &INTEGER_text_, &RslChannelNr_tn_xer_, &INTEGER_json_, &RslChannelNr_tn_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChannelNr_tn_default_coding("RAW"); const TTCN_RAWdescriptor_t RslChannelNr_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslChannelNr const TTCN_Typedescriptor_t RslChannelNr_descr_ = { "@GSM_Types.RslChannelNr", NULL, &RslChannelNr_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslChannelNr_default_coding("RAW"); const TTCN_RAWdescriptor_t RslLinkIdC_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslLinkIdC const TTCN_Typedescriptor_t RslLinkIdC_descr_ = { "@GSM_Types.RslLinkIdC", NULL, &RslLinkIdC_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslLinkIdC_default_coding("RAW"); const TTCN_RAWdescriptor_t RslSapi0Prio_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslSapi0Prio const TTCN_Typedescriptor_t RslSapi0Prio_descr_ = { "@GSM_Types.RslSapi0Prio", NULL, &RslSapi0Prio_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslSapi0Prio_default_coding("RAW"); const TTCN_RAWdescriptor_t GsmSapi_raw_ = {3,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmSapi_xer_ = { {"GsmSapi>\n", "GsmSapi>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t GsmSapi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t GsmSapi_descr_ = { "@GSM_Types.GsmSapi", &INTEGER_ber_, &GsmSapi_raw_, &INTEGER_text_, &GsmSapi_xer_, &INTEGER_json_, &GsmSapi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmSapi_default_coding("RAW"); const TTCN_RAWdescriptor_t RslLinkId_c_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslLinkId_c const TTCN_Typedescriptor_t RslLinkId_c_descr_ = { "@GSM_Types.RslLinkId.c", NULL, &RslLinkId_c_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslLinkId_c_default_coding("RAW"); const TTCN_RAWdescriptor_t RslLinkId_na_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RslLinkId_na_xer_ = { {"na>\n", "na>\n"}, {4, 4}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int RslLinkId_na_oer_ext_arr_[0] = {}; const int RslLinkId_na_oer_p_[0] = {}; const TTCN_OERdescriptor_t RslLinkId_na_oer_ = { -1, TRUE, -1, FALSE, 0, 0, RslLinkId_na_oer_ext_arr_, 0, RslLinkId_na_oer_p_}; const TTCN_Typedescriptor_t RslLinkId_na_descr_ = { "@GSM_Types.RslLinkId.na", &BOOLEAN_ber_, &RslLinkId_na_raw_, &BOOLEAN_text_, &RslLinkId_na_xer_, &BOOLEAN_json_, &RslLinkId_na_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslLinkId_na_default_coding("RAW"); const TTCN_RAWdescriptor_t RslLinkId_prio_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslLinkId_prio const TTCN_Typedescriptor_t RslLinkId_prio_descr_ = { "@GSM_Types.RslLinkId.prio", NULL, &RslLinkId_prio_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslLinkId_prio_default_coding("RAW"); const TTCN_RAWdescriptor_t RslLinkId_sapi_raw_ = {3,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RslLinkId_sapi_xer_ = { {"sapi>\n", "sapi>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t RslLinkId_sapi_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t RslLinkId_sapi_descr_ = { "@GSM_Types.RslLinkId.sapi", &INTEGER_ber_, &RslLinkId_sapi_raw_, &INTEGER_text_, &RslLinkId_sapi_xer_, &INTEGER_json_, &RslLinkId_sapi_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslLinkId_sapi_default_coding("RAW"); const TTCN_RAWdescriptor_t RslLinkId_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RslLinkId const TTCN_Typedescriptor_t RslLinkId_descr_ = { "@GSM_Types.RslLinkId", NULL, &RslLinkId_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RslLinkId_default_coding("RAW"); RslLinkId_template template_tr__RslLinkId; const RslLinkId_template& tr__RslLinkId = template_tr__RslLinkId; const TTCN_RAWdescriptor_t CBCH__BlockType_spare_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t CBCH__BlockType_spare_xer_ = { {"spare>\n", "spare>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t CBCH__BlockType_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t CBCH__BlockType_spare_descr_ = { "@GSM_Types.CBCH_BlockType.spare", &BITSTRING_ber_, &CBCH__BlockType_spare_raw_, NULL, &CBCH__BlockType_spare_xer_, &BITSTRING_json_, &CBCH__BlockType_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CBCH__BlockType_spare_default_coding("RAW"); const TTCN_RAWdescriptor_t CBCH__BlockType_lpd_raw_ = {2,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,2,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t CBCH__BlockType_lpd_xer_ = { {"lpd>\n", "lpd>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t CBCH__BlockType_lpd_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t CBCH__BlockType_lpd_descr_ = { "@GSM_Types.CBCH_BlockType.lpd", &BITSTRING_ber_, &CBCH__BlockType_lpd_raw_, NULL, &CBCH__BlockType_lpd_xer_, &BITSTRING_json_, &CBCH__BlockType_lpd_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CBCH__BlockType_lpd_default_coding("RAW"); const TTCN_RAWdescriptor_t CBCH__BlockType_last__block_raw_ = {1,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t CBCH__BlockType_last__block_xer_ = { {"last_block>\n", "last_block>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int CBCH__BlockType_last__block_oer_ext_arr_[0] = {}; const int CBCH__BlockType_last__block_oer_p_[0] = {}; const TTCN_OERdescriptor_t CBCH__BlockType_last__block_oer_ = { -1, TRUE, -1, FALSE, 0, 0, CBCH__BlockType_last__block_oer_ext_arr_, 0, CBCH__BlockType_last__block_oer_p_}; const TTCN_Typedescriptor_t CBCH__BlockType_last__block_descr_ = { "@GSM_Types.CBCH_BlockType.last_block", &BOOLEAN_ber_, &CBCH__BlockType_last__block_raw_, &BOOLEAN_text_, &CBCH__BlockType_last__block_xer_, &BOOLEAN_json_, &CBCH__BlockType_last__block_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CBCH__BlockType_last__block_default_coding("RAW"); const TTCN_RAWdescriptor_t CBCH__BlockType_seq__nr_raw_ = {4,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t CBCH__BlockType_seq__nr_xer_ = { {"seq_nr>\n", "seq_nr>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t CBCH__BlockType_seq__nr_descr_ = { "@GSM_Types.CBCH_BlockType.seq_nr", &INTEGER_ber_, &CBCH__BlockType_seq__nr_raw_, &INTEGER_text_, &CBCH__BlockType_seq__nr_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CBCH__BlockType_seq__nr_default_coding("RAW"); const TTCN_RAWdescriptor_t CBCH__BlockType_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for CBCH__BlockType const TTCN_Typedescriptor_t CBCH__BlockType_descr_ = { "@GSM_Types.CBCH_BlockType", NULL, &CBCH__BlockType_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CBCH__BlockType_default_coding("RAW"); INTEGER_template template_tr__CBCH__BlockType_seq__nr_defval; const INTEGER_template& tr__CBCH__BlockType_seq__nr_defval = template_tr__CBCH__BlockType_seq__nr_defval; BOOLEAN_template template_tr__CBCH__BlockType_last__block_defval; const BOOLEAN_template& tr__CBCH__BlockType_last__block_defval = template_tr__CBCH__BlockType_last__block_defval; const TTCN_RAWdescriptor_t CBCH__Block_block__type_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for CBCH__Block_block__type const TTCN_Typedescriptor_t CBCH__Block_block__type_descr_ = { "@GSM_Types.CBCH_Block.block_type", NULL, &CBCH__Block_block__type_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CBCH__Block_block__type_default_coding("RAW"); const TTCN_RAWdescriptor_t CBCH__Block_payload_raw_ = {176,SG_NO,ORDER_LSB,ORDER_MSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,22,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t CBCH__Block_payload_xer_ = { {"payload>\n", "payload>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int CBCH__Block_payload_oer_ext_arr_[0] = {}; const int CBCH__Block_payload_oer_p_[0] = {}; const TTCN_OERdescriptor_t CBCH__Block_payload_oer_ = { -1, TRUE, 22, FALSE, 0, 0, CBCH__Block_payload_oer_ext_arr_, 0, CBCH__Block_payload_oer_p_}; const TTCN_Typedescriptor_t CBCH__Block_payload_descr_ = { "@GSM_Types.CBCH_Block.payload", &OCTETSTRING_ber_, &CBCH__Block_payload_raw_, &OCTETSTRING_text_, &CBCH__Block_payload_xer_, &OCTETSTRING_json_, &CBCH__Block_payload_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CBCH__Block_payload_default_coding("RAW"); const TTCN_RAWdescriptor_t CBCH__Block_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for CBCH__Block const TTCN_Typedescriptor_t CBCH__Block_descr_ = { "@GSM_Types.CBCH_Block", NULL, &CBCH__Block_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CBCH__Block_default_coding("RAW"); INTEGER_template template_tr__CBCH__Block_seq__nr_defval; const INTEGER_template& tr__CBCH__Block_seq__nr_defval = template_tr__CBCH__Block_seq__nr_defval; BOOLEAN_template template_tr__CBCH__Block_last__block_defval; const BOOLEAN_template& tr__CBCH__Block_last__block_defval = template_tr__CBCH__Block_last__block_defval; OCTETSTRING_template template_tr__CBCH__Block_payload_defval; const OCTETSTRING_template& tr__CBCH__Block_payload_defval = template_tr__CBCH__Block_payload_defval; FLOAT const_GSM__FRAME__DURATION; const FLOAT& GSM__FRAME__DURATION = const_GSM__FRAME__DURATION; FLOAT const_GSM51__MFRAME__DURATION; const FLOAT& GSM51__MFRAME__DURATION = const_GSM51__MFRAME__DURATION; FLOAT const_GSM51__MFRAMES__PER__SEC; const FLOAT& GSM51__MFRAMES__PER__SEC = const_GSM51__MFRAMES__PER__SEC; const TTCN_RAWdescriptor_t GsmBcdString_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t GsmBcdString_xer_ = { {"GsmBcdString>\n", "GsmBcdString>\n"}, {14, 14}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t GsmBcdString_descr_ = { "@GSM_Types.GsmBcdString", NULL, &GsmBcdString_raw_, NULL, &GsmBcdString_xer_, &HEXSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING GsmBcdString_default_coding("RAW"); const TTCN_RAWdescriptor_t BcdMccMnc_raw_ = {24,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t BcdMccMnc_xer_ = { {"BcdMccMnc>\n", "BcdMccMnc>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t BcdMccMnc_descr_ = { "@GSM_Types.BcdMccMnc", NULL, &BcdMccMnc_raw_, NULL, &BcdMccMnc_xer_, &HEXSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING BcdMccMnc_default_coding("RAW"); const TTCN_RAWdescriptor_t LocationAreaIdentification_mcc__mnc_raw_ = {24,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t LocationAreaIdentification_mcc__mnc_xer_ = { {"mcc_mnc>\n", "mcc_mnc>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t LocationAreaIdentification_mcc__mnc_descr_ = { "@GSM_Types.LocationAreaIdentification.mcc_mnc", NULL, &LocationAreaIdentification_mcc__mnc_raw_, NULL, &LocationAreaIdentification_mcc__mnc_xer_, &HEXSTRING_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING LocationAreaIdentification_mcc__mnc_default_coding("RAW"); const TTCN_RAWdescriptor_t LocationAreaIdentification_lac_raw_ = {16,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t LocationAreaIdentification_lac_xer_ = { {"lac>\n", "lac>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t LocationAreaIdentification_lac_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t LocationAreaIdentification_lac_descr_ = { "@GSM_Types.LocationAreaIdentification.lac", &INTEGER_ber_, &LocationAreaIdentification_lac_raw_, &INTEGER_text_, &LocationAreaIdentification_lac_xer_, &INTEGER_json_, &LocationAreaIdentification_lac_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING LocationAreaIdentification_lac_default_coding("RAW"); const TTCN_RAWdescriptor_t LocationAreaIdentification_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for LocationAreaIdentification const TTCN_Typedescriptor_t LocationAreaIdentification_descr_ = { "@GSM_Types.LocationAreaIdentification", NULL, &LocationAreaIdentification_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING LocationAreaIdentification_default_coding("RAW"); const TTCN_RAWdescriptor_t RoutingAreaIdentification_lai_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RoutingAreaIdentification_lai const TTCN_Typedescriptor_t RoutingAreaIdentification_lai_descr_ = { "@GSM_Types.RoutingAreaIdentification.lai", NULL, &RoutingAreaIdentification_lai_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RoutingAreaIdentification_lai_default_coding("RAW"); const TTCN_RAWdescriptor_t RoutingAreaIdentification_rac_raw_ = {8,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t RoutingAreaIdentification_rac_xer_ = { {"rac>\n", "rac>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t RoutingAreaIdentification_rac_descr_ = { "@GSM_Types.RoutingAreaIdentification.rac", &INTEGER_ber_, &RoutingAreaIdentification_rac_raw_, &INTEGER_text_, &RoutingAreaIdentification_rac_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RoutingAreaIdentification_rac_default_coding("RAW"); const TTCN_RAWdescriptor_t RoutingAreaIdentification_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for RoutingAreaIdentification const TTCN_Typedescriptor_t RoutingAreaIdentification_descr_ = { "@GSM_Types.RoutingAreaIdentification", NULL, &RoutingAreaIdentification_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING RoutingAreaIdentification_default_coding("RAW"); const TTCN_RAWdescriptor_t CellIdentity_raw_ = {16,SG_NO,ORDER_MSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_MSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t CellIdentity_xer_ = { {"CellIdentity>\n", "CellIdentity>\n"}, {14, 14}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t CellIdentity_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t CellIdentity_descr_ = { "@GSM_Types.CellIdentity", &INTEGER_ber_, &CellIdentity_raw_, &INTEGER_text_, &CellIdentity_xer_, &INTEGER_json_, &CellIdentity_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CellIdentity_default_coding("RAW"); TTCN_Module module_object("GSM_Types", __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_9, current_runtime_version.requires_minor_version_0, current_runtime_version.requires_patch_level_0, current_runtime_version.requires_runtime_1); /* Member functions of C++ classes */ GsmBandArfcn::GsmBandArfcn() { } GsmBandArfcn::GsmBandArfcn(const BOOLEAN& par_pcs, const BOOLEAN& par_uplink, const BITSTRING& par_spare, const INTEGER& par_arfcn) : field_pcs(par_pcs), field_uplink(par_uplink), field_spare(par_spare), field_arfcn(par_arfcn) { } GsmBandArfcn::GsmBandArfcn(const GsmBandArfcn& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_Types.GsmBandArfcn."); if (other_value.pcs().is_bound()) field_pcs = other_value.pcs(); else field_pcs.clean_up(); if (other_value.uplink().is_bound()) field_uplink = other_value.uplink(); else field_uplink.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn(); else field_arfcn.clean_up(); } void GsmBandArfcn::clean_up() { field_pcs.clean_up(); field_uplink.clean_up(); field_spare.clean_up(); field_arfcn.clean_up(); } const TTCN_Typedescriptor_t* GsmBandArfcn::get_descriptor() const { return &GsmBandArfcn_descr_; } GsmBandArfcn& GsmBandArfcn::operator=(const GsmBandArfcn& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_Types.GsmBandArfcn."); if (other_value.pcs().is_bound()) field_pcs = other_value.pcs(); else field_pcs.clean_up(); if (other_value.uplink().is_bound()) field_uplink = other_value.uplink(); else field_uplink.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.arfcn().is_bound()) field_arfcn = other_value.arfcn(); else field_arfcn.clean_up(); } return *this; } boolean GsmBandArfcn::operator==(const GsmBandArfcn& other_value) const { return field_pcs==other_value.field_pcs && field_uplink==other_value.field_uplink && field_spare==other_value.field_spare && field_arfcn==other_value.field_arfcn; } boolean GsmBandArfcn::is_bound() const { return (field_pcs.is_bound()) || (field_uplink.is_bound()) || (field_spare.is_bound()) || (field_arfcn.is_bound()); } boolean GsmBandArfcn::is_value() const { return field_pcs.is_value() && field_uplink.is_value() && field_spare.is_value() && field_arfcn.is_value(); } void GsmBandArfcn::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ pcs := "); field_pcs.log(); TTCN_Logger::log_event_str(", uplink := "); field_uplink.log(); TTCN_Logger::log_event_str(", spare := "); field_spare.log(); TTCN_Logger::log_event_str(", arfcn := "); field_arfcn.log(); TTCN_Logger::log_event_str(" }"); } void GsmBandArfcn::set_implicit_omit() { if (pcs().is_bound()) pcs().set_implicit_omit(); if (uplink().is_bound()) uplink().set_implicit_omit(); if (spare().is_bound()) spare().set_implicit_omit(); if (arfcn().is_bound()) arfcn().set_implicit_omit(); } void GsmBandArfcn::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (40 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) pcs().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) uplink().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) arfcn().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "pcs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pcs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "arfcn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { arfcn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.GsmBandArfcn: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.GsmBandArfcn"); } } void GsmBandArfcn::encode_text(Text_Buf& text_buf) const { field_pcs.encode_text(text_buf); field_uplink.encode_text(text_buf); field_spare.encode_text(text_buf); field_arfcn.encode_text(text_buf); } void GsmBandArfcn::decode_text(Text_Buf& text_buf) { field_pcs.decode_text(text_buf); field_uplink.decode_text(text_buf); field_spare.decode_text(text_buf); field_arfcn.decode_text(text_buf); } void GsmBandArfcn::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void GsmBandArfcn::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int GsmBandArfcn::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, GsmBandArfcn_pcs_descr_.raw->forceomit); decoded_field_length = field_pcs.RAW_decode(GsmBandArfcn_pcs_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, GsmBandArfcn_uplink_descr_.raw->forceomit); decoded_field_length = field_uplink.RAW_decode(GsmBandArfcn_uplink_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_2_force_omit(2, force_omit, GsmBandArfcn_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(GsmBandArfcn_spare_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, GsmBandArfcn_arfcn_descr_.raw->forceomit); decoded_field_length = field_arfcn.RAW_decode(GsmBandArfcn_arfcn_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int GsmBandArfcn::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 4; myleaf.body.node.nodes = init_nodes_of_enc_tree(4); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, GsmBandArfcn_pcs_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GsmBandArfcn_uplink_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, GsmBandArfcn_spare_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, GsmBandArfcn_arfcn_descr_.raw); encoded_length += field_pcs.RAW_encode(GsmBandArfcn_pcs_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_uplink.RAW_encode(GsmBandArfcn_uplink_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_spare.RAW_encode(GsmBandArfcn_spare_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_arfcn.RAW_encode(GsmBandArfcn_arfcn_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct GsmBandArfcn_template::single_value_struct { BOOLEAN_template field_pcs; BOOLEAN_template field_uplink; BITSTRING_template field_spare; INTEGER_template field_arfcn; }; void GsmBandArfcn_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_pcs = ANY_VALUE; single_value->field_uplink = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_arfcn = ANY_VALUE; } } } void GsmBandArfcn_template::copy_value(const GsmBandArfcn& other_value) { single_value = new single_value_struct; if (other_value.pcs().is_bound()) { single_value->field_pcs = other_value.pcs(); } else { single_value->field_pcs.clean_up(); } if (other_value.uplink().is_bound()) { single_value->field_uplink = other_value.uplink(); } else { single_value->field_uplink.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.arfcn().is_bound()) { single_value->field_arfcn = other_value.arfcn(); } else { single_value->field_arfcn.clean_up(); } set_selection(SPECIFIC_VALUE); } void GsmBandArfcn_template::copy_template(const GsmBandArfcn_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.pcs().get_selection()) { single_value->field_pcs = other_value.pcs(); } else { single_value->field_pcs.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.uplink().get_selection()) { single_value->field_uplink = other_value.uplink(); } else { single_value->field_uplink.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.arfcn().get_selection()) { single_value->field_arfcn = other_value.arfcn(); } else { single_value->field_arfcn.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 GsmBandArfcn_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 GsmBandArfcn_template(*other_value.implication_.precondition); implication_.implied_template = new GsmBandArfcn_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 @GSM_Types.GsmBandArfcn."); break; } set_selection(other_value); } GsmBandArfcn_template::GsmBandArfcn_template() { } GsmBandArfcn_template::GsmBandArfcn_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } GsmBandArfcn_template::GsmBandArfcn_template(const GsmBandArfcn& other_value) { copy_value(other_value); } GsmBandArfcn_template::GsmBandArfcn_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GsmBandArfcn&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.GsmBandArfcn from an unbound optional field."); } } GsmBandArfcn_template::GsmBandArfcn_template(GsmBandArfcn_template* p_precondition, GsmBandArfcn_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } GsmBandArfcn_template::GsmBandArfcn_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; } GsmBandArfcn_template::GsmBandArfcn_template(const GsmBandArfcn_template& other_value) : Base_Template() { copy_template(other_value); } GsmBandArfcn_template::~GsmBandArfcn_template() { clean_up(); } GsmBandArfcn_template& GsmBandArfcn_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } GsmBandArfcn_template& GsmBandArfcn_template::operator=(const GsmBandArfcn& other_value) { clean_up(); copy_value(other_value); return *this; } GsmBandArfcn_template& GsmBandArfcn_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GsmBandArfcn&)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 @GSM_Types.GsmBandArfcn."); } return *this; } GsmBandArfcn_template& GsmBandArfcn_template::operator=(const GsmBandArfcn_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean GsmBandArfcn_template::match(const GsmBandArfcn& 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.pcs().is_bound()) return FALSE; if(!single_value->field_pcs.match(other_value.pcs(), legacy))return FALSE; if(!other_value.uplink().is_bound()) return FALSE; if(!single_value->field_uplink.match(other_value.uplink(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.arfcn().is_bound()) return FALSE; if(!single_value->field_arfcn.match(other_value.arfcn(), 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 @GSM_Types.GsmBandArfcn."); } return FALSE; } boolean GsmBandArfcn_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_pcs.is_bound() || single_value->field_uplink.is_bound() || single_value->field_spare.is_bound() || single_value->field_arfcn.is_bound(); } boolean GsmBandArfcn_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_pcs.is_value() && single_value->field_uplink.is_value() && single_value->field_spare.is_value() && single_value->field_arfcn.is_value(); } void GsmBandArfcn_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; } GsmBandArfcn GsmBandArfcn_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 @GSM_Types.GsmBandArfcn."); GsmBandArfcn ret_val; if (single_value->field_pcs.is_bound()) { ret_val.pcs() = single_value->field_pcs.valueof(); } if (single_value->field_uplink.is_bound()) { ret_val.uplink() = single_value->field_uplink.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_arfcn.is_bound()) { ret_val.arfcn() = single_value->field_arfcn.valueof(); } return ret_val; } void GsmBandArfcn_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 @GSM_Types.GsmBandArfcn."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new GsmBandArfcn_template[list_length]; } GsmBandArfcn_template& GsmBandArfcn_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 @GSM_Types.GsmBandArfcn."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.GsmBandArfcn."); return value_list.list_value[list_index]; } BOOLEAN_template& GsmBandArfcn_template::pcs() { set_specific(); return single_value->field_pcs; } const BOOLEAN_template& GsmBandArfcn_template::pcs() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pcs of a non-specific template of type @GSM_Types.GsmBandArfcn."); return single_value->field_pcs; } BOOLEAN_template& GsmBandArfcn_template::uplink() { set_specific(); return single_value->field_uplink; } const BOOLEAN_template& GsmBandArfcn_template::uplink() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field uplink of a non-specific template of type @GSM_Types.GsmBandArfcn."); return single_value->field_uplink; } BITSTRING_template& GsmBandArfcn_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& GsmBandArfcn_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GSM_Types.GsmBandArfcn."); return single_value->field_spare; } INTEGER_template& GsmBandArfcn_template::arfcn() { set_specific(); return single_value->field_arfcn; } const INTEGER_template& GsmBandArfcn_template::arfcn() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field arfcn of a non-specific template of type @GSM_Types.GsmBandArfcn."); return single_value->field_arfcn; } int GsmBandArfcn_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.GsmBandArfcn which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 4; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.GsmBandArfcn 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 @GSM_Types.GsmBandArfcn containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.GsmBandArfcn containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.GsmBandArfcn containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.GsmBandArfcn containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.GsmBandArfcn containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.GsmBandArfcn containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.GsmBandArfcn containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.GsmBandArfcn."); } return 0; } void GsmBandArfcn_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ pcs := "); single_value->field_pcs.log(); TTCN_Logger::log_event_str(", uplink := "); single_value->field_uplink.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", arfcn := "); single_value->field_arfcn.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 GsmBandArfcn_template::log_match(const GsmBandArfcn& 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_pcs.match(match_value.pcs(), legacy)){ TTCN_Logger::log_logmatch_info(".pcs"); single_value->field_pcs.log_match(match_value.pcs(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_uplink.match(match_value.uplink(), legacy)){ TTCN_Logger::log_logmatch_info(".uplink"); single_value->field_uplink.log_match(match_value.uplink(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_arfcn.match(match_value.arfcn(), legacy)){ TTCN_Logger::log_logmatch_info(".arfcn"); single_value->field_arfcn.log_match(match_value.arfcn(), 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("{ pcs := "); single_value->field_pcs.log_match(match_value.pcs(), legacy); TTCN_Logger::log_event_str(", uplink := "); single_value->field_uplink.log_match(match_value.uplink(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", arfcn := "); single_value->field_arfcn.log_match(match_value.arfcn(), 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 GsmBandArfcn_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_pcs.encode_text(text_buf); single_value->field_uplink.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_arfcn.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 @GSM_Types.GsmBandArfcn."); } } void GsmBandArfcn_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_pcs.decode_text(text_buf); single_value->field_uplink.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_arfcn.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 GsmBandArfcn_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 @GSM_Types.GsmBandArfcn."); } } void GsmBandArfcn_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: { GsmBandArfcn_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) pcs().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) uplink().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) arfcn().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "pcs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pcs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "arfcn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { arfcn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.GsmBandArfcn: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { GsmBandArfcn_template* precondition = new GsmBandArfcn_template; precondition->set_param(*param.get_elem(0)); GsmBandArfcn_template* implied_template = new GsmBandArfcn_template; implied_template->set_param(*param.get_elem(1)); *this = GsmBandArfcn_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.GsmBandArfcn"); } is_ifpresent = param.get_ifpresent(); } void GsmBandArfcn_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_pcs.check_restriction(t_res, t_name ? t_name : "@GSM_Types.GsmBandArfcn"); single_value->field_uplink.check_restriction(t_res, t_name ? t_name : "@GSM_Types.GsmBandArfcn"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GSM_Types.GsmBandArfcn"); single_value->field_arfcn.check_restriction(t_res, t_name ? t_name : "@GSM_Types.GsmBandArfcn"); 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 : "@GSM_Types.GsmBandArfcn"); } boolean GsmBandArfcn_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean GsmBandArfcn_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(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.PchanConfig."); return enum_value > other_value; } boolean PchanConfig::operator>(const PchanConfig& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.PchanConfig."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.PchanConfig."); return enum_value > other_value.enum_value; } const char *PchanConfig::enum_to_str(enum_type enum_par) { switch (enum_par) { case GSM__PCHAN__NONE: return "GSM_PCHAN_NONE"; case GSM__PCHAN__CCCH: return "GSM_PCHAN_CCCH"; case GSM__PCHAN__CCCH__SDCCH4: return "GSM_PCHAN_CCCH_SDCCH4"; case GSM__PCHAN__CCCH__SDCCH4__CBCH: return "GSM_PCHAN_CCCH_SDCCH4_CBCH"; case GSM__PCHAN__SDCCH8: return "GSM_PCHAN_SDCCH8"; case GSM__PCHAN__SDCCH8__CBCH: return "GSM_PCHAN_SDCCH8_CBCH"; case GSM__PCHAN__TCHF: return "GSM_PCHAN_TCHF"; case GSM__PCHAN__TCHH: return "GSM_PCHAN_TCHH"; case GSM__PCHAN__PDCH: return "GSM_PCHAN_PDCH"; case GSM__PCHAN__TCHF__PDCH: return "GSM_PCHAN_TCHF_PDCH"; case GSM__PCHAN__TCHH__TCHF__PDCH: return "GSM_PCHAN_TCHH_TCHF_PDCH"; default: return ""; } } PchanConfig::enum_type PchanConfig::str_to_enum(const char *str_par) { if (!strcmp(str_par, "GSM_PCHAN_NONE")) return GSM__PCHAN__NONE; else if (!strcmp(str_par, "GSM_PCHAN_CCCH")) return GSM__PCHAN__CCCH; else if (!strcmp(str_par, "GSM_PCHAN_CCCH_SDCCH4")) return GSM__PCHAN__CCCH__SDCCH4; else if (!strcmp(str_par, "GSM_PCHAN_CCCH_SDCCH4_CBCH")) return GSM__PCHAN__CCCH__SDCCH4__CBCH; else if (!strcmp(str_par, "GSM_PCHAN_SDCCH8")) return GSM__PCHAN__SDCCH8; else if (!strcmp(str_par, "GSM_PCHAN_SDCCH8_CBCH")) return GSM__PCHAN__SDCCH8__CBCH; else if (!strcmp(str_par, "GSM_PCHAN_TCHF")) return GSM__PCHAN__TCHF; else if (!strcmp(str_par, "GSM_PCHAN_TCHH")) return GSM__PCHAN__TCHH; else if (!strcmp(str_par, "GSM_PCHAN_PDCH")) return GSM__PCHAN__PDCH; else if (!strcmp(str_par, "GSM_PCHAN_TCHF_PDCH")) return GSM__PCHAN__TCHF__PDCH; else if (!strcmp(str_par, "GSM_PCHAN_TCHH_TCHF_PDCH")) return GSM__PCHAN__TCHH__TCHF__PDCH; else return UNKNOWN_VALUE; } boolean PchanConfig::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: return TRUE; default: return FALSE; } } int PchanConfig::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 @GSM_Types.PchanConfig.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PchanConfig::enum2int(const PchanConfig& 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 @GSM_Types.PchanConfig.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PchanConfig::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @GSM_Types.PchanConfig.", int_val); enum_value = (enum_type)int_val; } PchanConfig::operator PchanConfig::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @GSM_Types.PchanConfig."); return enum_value; } void PchanConfig::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 PchanConfig::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", "@GSM_Types.PchanConfig"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @GSM_Types.PchanConfig."); } } void PchanConfig::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @GSM_Types.PchanConfig."); text_buf.push_int(enum_value); } void PchanConfig::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 @GSM_Types.PchanConfig.", enum_value); } void PchanConfig::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PchanConfig::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PchanConfig::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, 4, 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 PchanConfig::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 4); } void PchanConfig_template::copy_template(const PchanConfig_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 PchanConfig_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 PchanConfig_template(*other_value.implication_.precondition); implication_.implied_template = new PchanConfig_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 @GSM_Types.PchanConfig."); } } PchanConfig_template::PchanConfig_template() { } PchanConfig_template::PchanConfig_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PchanConfig_template::PchanConfig_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PchanConfig::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @GSM_Types.PchanConfig with unknown numeric value %d.", other_value); single_value = (PchanConfig::enum_type)other_value; } PchanConfig_template::PchanConfig_template(PchanConfig::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PchanConfig_template::PchanConfig_template(const PchanConfig& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PchanConfig::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @GSM_Types.PchanConfig."); single_value = other_value.enum_value; } PchanConfig_template::PchanConfig_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PchanConfig::enum_type)(const PchanConfig&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @GSM_Types.PchanConfig from an unbound optional field."); } } PchanConfig_template::PchanConfig_template(PchanConfig_template* p_precondition, PchanConfig_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PchanConfig_template::PchanConfig_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; } PchanConfig_template::PchanConfig_template(const PchanConfig_template& other_value) : Base_Template() { copy_template(other_value); } PchanConfig_template::~PchanConfig_template() { clean_up(); } boolean PchanConfig_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PchanConfig_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PchanConfig::UNBOUND_VALUE; } void PchanConfig_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; } PchanConfig_template& PchanConfig_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PchanConfig_template& PchanConfig_template::operator=(int other_value) { if (!PchanConfig::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @GSM_Types.PchanConfig.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PchanConfig::enum_type)other_value; return *this; } PchanConfig_template& PchanConfig_template::operator=(PchanConfig::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PchanConfig_template& PchanConfig_template::operator=(const PchanConfig& other_value) { if (other_value.enum_value == PchanConfig::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @GSM_Types.PchanConfig to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PchanConfig_template& PchanConfig_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PchanConfig::enum_type)(const PchanConfig&)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 @GSM_Types.PchanConfig."); } return *this; } PchanConfig_template& PchanConfig_template::operator=(const PchanConfig_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PchanConfig_template::match(PchanConfig::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 @GSM_Types.PchanConfig."); } return FALSE; } boolean PchanConfig_template::match(const PchanConfig& other_value, boolean) const { if (other_value.enum_value == PchanConfig::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @GSM_Types.PchanConfig with an unbound value."); return match(other_value.enum_value); } PchanConfig::enum_type PchanConfig_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 @GSM_Types.PchanConfig."); return single_value; } void PchanConfig_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @GSM_Types.PchanConfig."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PchanConfig_template[list_length]; } PchanConfig_template& PchanConfig_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 @GSM_Types.PchanConfig."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @GSM_Types.PchanConfig."); return value_list.list_value[list_index]; } void PchanConfig_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PchanConfig::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 PchanConfig_template::log_match(const PchanConfig& 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 PchanConfig_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 @GSM_Types.PchanConfig."); } } void PchanConfig_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PchanConfig::enum_type)text_buf.pull_int().get_val(); if (!PchanConfig::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @GSM_Types.PchanConfig.", 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 PchanConfig_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 @GSM_Types.PchanConfig."); } } boolean PchanConfig_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PchanConfig_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: { PchanConfig_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: { PchanConfig::enum_type enum_val = PchanConfig::str_to_enum(m_p->get_enumerated()); if (!PchanConfig::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @GSM_Types.PchanConfig."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PchanConfig_template* precondition = new PchanConfig_template; precondition->set_param(*m_p->get_elem(0)); PchanConfig_template* implied_template = new PchanConfig_template; implied_template->set_param(*m_p->get_elem(1)); *this = PchanConfig_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@GSM_Types.PchanConfig"); } is_ifpresent = param.get_ifpresent(); } void PchanConfig_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 : "@GSM_Types.PchanConfig"); } GprsCodingScheme::GprsCodingScheme() { enum_value = UNBOUND_VALUE; } GprsCodingScheme::GprsCodingScheme(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @GSM_Types.GprsCodingScheme with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } GprsCodingScheme::GprsCodingScheme(enum_type other_value) { enum_value = other_value; } GprsCodingScheme::GprsCodingScheme(const GprsCodingScheme& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); enum_value = other_value.enum_value; } GprsCodingScheme& GprsCodingScheme::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @GSM_Types.GprsCodingScheme.", other_value); enum_value = (enum_type)other_value; return *this; } GprsCodingScheme& GprsCodingScheme::operator=(enum_type other_value) { enum_value = other_value; return *this; } GprsCodingScheme& GprsCodingScheme::operator=(const GprsCodingScheme& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); enum_value = other_value.enum_value; return *this; } boolean GprsCodingScheme::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 @GSM_Types.GprsCodingScheme."); return enum_value == other_value; } boolean GprsCodingScheme::operator==(const GprsCodingScheme& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); return enum_value == other_value.enum_value; } boolean GprsCodingScheme::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 @GSM_Types.GprsCodingScheme."); return enum_value < other_value; } boolean GprsCodingScheme::operator<(const GprsCodingScheme& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); return enum_value < other_value.enum_value; } boolean GprsCodingScheme::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 @GSM_Types.GprsCodingScheme."); return enum_value > other_value; } boolean GprsCodingScheme::operator>(const GprsCodingScheme& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); return enum_value > other_value.enum_value; } const char *GprsCodingScheme::enum_to_str(enum_type enum_par) { switch (enum_par) { case CS1: return "CS1"; case CS2: return "CS2"; case CS3: return "CS3"; case CS4: return "CS4"; default: return ""; } } GprsCodingScheme::enum_type GprsCodingScheme::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CS1")) return CS1; else if (!strcmp(str_par, "CS2")) return CS2; else if (!strcmp(str_par, "CS3")) return CS3; else if (!strcmp(str_par, "CS4")) return CS4; else return UNKNOWN_VALUE; } boolean GprsCodingScheme::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int GprsCodingScheme::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 @GSM_Types.GprsCodingScheme.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int GprsCodingScheme::enum2int(const GprsCodingScheme& 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 @GSM_Types.GprsCodingScheme.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void GprsCodingScheme::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @GSM_Types.GprsCodingScheme.", int_val); enum_value = (enum_type)int_val; } GprsCodingScheme::operator GprsCodingScheme::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @GSM_Types.GprsCodingScheme."); return enum_value; } void GprsCodingScheme::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 GprsCodingScheme::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", "@GSM_Types.GprsCodingScheme"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @GSM_Types.GprsCodingScheme."); } } void GprsCodingScheme::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); text_buf.push_int(enum_value); } void GprsCodingScheme::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 @GSM_Types.GprsCodingScheme.", enum_value); } void GprsCodingScheme::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void GprsCodingScheme::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int GprsCodingScheme::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, 3, 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 GprsCodingScheme::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void GprsCodingScheme_template::copy_template(const GprsCodingScheme_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 GprsCodingScheme_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 GprsCodingScheme_template(*other_value.implication_.precondition); implication_.implied_template = new GprsCodingScheme_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 @GSM_Types.GprsCodingScheme."); } } GprsCodingScheme_template::GprsCodingScheme_template() { } GprsCodingScheme_template::GprsCodingScheme_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } GprsCodingScheme_template::GprsCodingScheme_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!GprsCodingScheme::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @GSM_Types.GprsCodingScheme with unknown numeric value %d.", other_value); single_value = (GprsCodingScheme::enum_type)other_value; } GprsCodingScheme_template::GprsCodingScheme_template(GprsCodingScheme::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } GprsCodingScheme_template::GprsCodingScheme_template(const GprsCodingScheme& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == GprsCodingScheme::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @GSM_Types.GprsCodingScheme."); single_value = other_value.enum_value; } GprsCodingScheme_template::GprsCodingScheme_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (GprsCodingScheme::enum_type)(const GprsCodingScheme&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @GSM_Types.GprsCodingScheme from an unbound optional field."); } } GprsCodingScheme_template::GprsCodingScheme_template(GprsCodingScheme_template* p_precondition, GprsCodingScheme_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } GprsCodingScheme_template::GprsCodingScheme_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; } GprsCodingScheme_template::GprsCodingScheme_template(const GprsCodingScheme_template& other_value) : Base_Template() { copy_template(other_value); } GprsCodingScheme_template::~GprsCodingScheme_template() { clean_up(); } boolean GprsCodingScheme_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean GprsCodingScheme_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != GprsCodingScheme::UNBOUND_VALUE; } void GprsCodingScheme_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; } GprsCodingScheme_template& GprsCodingScheme_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } GprsCodingScheme_template& GprsCodingScheme_template::operator=(int other_value) { if (!GprsCodingScheme::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @GSM_Types.GprsCodingScheme.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (GprsCodingScheme::enum_type)other_value; return *this; } GprsCodingScheme_template& GprsCodingScheme_template::operator=(GprsCodingScheme::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } GprsCodingScheme_template& GprsCodingScheme_template::operator=(const GprsCodingScheme& other_value) { if (other_value.enum_value == GprsCodingScheme::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @GSM_Types.GprsCodingScheme to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } GprsCodingScheme_template& GprsCodingScheme_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (GprsCodingScheme::enum_type)(const GprsCodingScheme&)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 @GSM_Types.GprsCodingScheme."); } return *this; } GprsCodingScheme_template& GprsCodingScheme_template::operator=(const GprsCodingScheme_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean GprsCodingScheme_template::match(GprsCodingScheme::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 @GSM_Types.GprsCodingScheme."); } return FALSE; } boolean GprsCodingScheme_template::match(const GprsCodingScheme& other_value, boolean) const { if (other_value.enum_value == GprsCodingScheme::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @GSM_Types.GprsCodingScheme with an unbound value."); return match(other_value.enum_value); } GprsCodingScheme::enum_type GprsCodingScheme_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 @GSM_Types.GprsCodingScheme."); return single_value; } void GprsCodingScheme_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @GSM_Types.GprsCodingScheme."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new GprsCodingScheme_template[list_length]; } GprsCodingScheme_template& GprsCodingScheme_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 @GSM_Types.GprsCodingScheme."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @GSM_Types.GprsCodingScheme."); return value_list.list_value[list_index]; } void GprsCodingScheme_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(GprsCodingScheme::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 GprsCodingScheme_template::log_match(const GprsCodingScheme& 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 GprsCodingScheme_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 @GSM_Types.GprsCodingScheme."); } } void GprsCodingScheme_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (GprsCodingScheme::enum_type)text_buf.pull_int().get_val(); if (!GprsCodingScheme::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @GSM_Types.GprsCodingScheme.", 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 GprsCodingScheme_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 @GSM_Types.GprsCodingScheme."); } } boolean GprsCodingScheme_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean GprsCodingScheme_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: { GprsCodingScheme_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: { GprsCodingScheme::enum_type enum_val = GprsCodingScheme::str_to_enum(m_p->get_enumerated()); if (!GprsCodingScheme::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @GSM_Types.GprsCodingScheme."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { GprsCodingScheme_template* precondition = new GprsCodingScheme_template; precondition->set_param(*m_p->get_elem(0)); GprsCodingScheme_template* implied_template = new GprsCodingScheme_template; implied_template->set_param(*m_p->get_elem(1)); *this = GprsCodingScheme_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@GSM_Types.GprsCodingScheme"); } is_ifpresent = param.get_ifpresent(); } void GprsCodingScheme_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 : "@GSM_Types.GprsCodingScheme"); } ChannelNeeded::ChannelNeeded() { enum_value = UNBOUND_VALUE; } ChannelNeeded::ChannelNeeded(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @GSM_Types.ChannelNeeded with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } ChannelNeeded::ChannelNeeded(enum_type other_value) { enum_value = other_value; } ChannelNeeded::ChannelNeeded(const ChannelNeeded& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @GSM_Types.ChannelNeeded."); enum_value = other_value.enum_value; } ChannelNeeded& ChannelNeeded::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @GSM_Types.ChannelNeeded.", other_value); enum_value = (enum_type)other_value; return *this; } ChannelNeeded& ChannelNeeded::operator=(enum_type other_value) { enum_value = other_value; return *this; } ChannelNeeded& ChannelNeeded::operator=(const ChannelNeeded& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @GSM_Types.ChannelNeeded."); enum_value = other_value.enum_value; return *this; } boolean ChannelNeeded::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 @GSM_Types.ChannelNeeded."); return enum_value == other_value; } boolean ChannelNeeded::operator==(const ChannelNeeded& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.ChannelNeeded."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.ChannelNeeded."); return enum_value == other_value.enum_value; } boolean ChannelNeeded::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 @GSM_Types.ChannelNeeded."); return enum_value < other_value; } boolean ChannelNeeded::operator<(const ChannelNeeded& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.ChannelNeeded."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.ChannelNeeded."); return enum_value < other_value.enum_value; } boolean ChannelNeeded::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 @GSM_Types.ChannelNeeded."); return enum_value > other_value; } boolean ChannelNeeded::operator>(const ChannelNeeded& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.ChannelNeeded."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.ChannelNeeded."); return enum_value > other_value.enum_value; } const char *ChannelNeeded::enum_to_str(enum_type enum_par) { switch (enum_par) { case CHAN__NEED__ANY: return "CHAN_NEED_ANY"; case CHAN__NEED__SDCCH: return "CHAN_NEED_SDCCH"; case CHAN__NEED__TCH__F: return "CHAN_NEED_TCH_F"; case CHAN__NEED__TCH__H: return "CHAN_NEED_TCH_H"; default: return ""; } } ChannelNeeded::enum_type ChannelNeeded::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CHAN_NEED_ANY")) return CHAN__NEED__ANY; else if (!strcmp(str_par, "CHAN_NEED_SDCCH")) return CHAN__NEED__SDCCH; else if (!strcmp(str_par, "CHAN_NEED_TCH_F")) return CHAN__NEED__TCH__F; else if (!strcmp(str_par, "CHAN_NEED_TCH_H")) return CHAN__NEED__TCH__H; else return UNKNOWN_VALUE; } boolean ChannelNeeded::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int ChannelNeeded::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 @GSM_Types.ChannelNeeded.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int ChannelNeeded::enum2int(const ChannelNeeded& 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 @GSM_Types.ChannelNeeded.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void ChannelNeeded::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @GSM_Types.ChannelNeeded.", int_val); enum_value = (enum_type)int_val; } ChannelNeeded::operator ChannelNeeded::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @GSM_Types.ChannelNeeded."); return enum_value; } void ChannelNeeded::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 ChannelNeeded::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", "@GSM_Types.ChannelNeeded"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @GSM_Types.ChannelNeeded."); } } void ChannelNeeded::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @GSM_Types.ChannelNeeded."); text_buf.push_int(enum_value); } void ChannelNeeded::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 @GSM_Types.ChannelNeeded.", enum_value); } void ChannelNeeded::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void ChannelNeeded::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int ChannelNeeded::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, 3, 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 ChannelNeeded::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void ChannelNeeded_template::copy_template(const ChannelNeeded_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 ChannelNeeded_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 ChannelNeeded_template(*other_value.implication_.precondition); implication_.implied_template = new ChannelNeeded_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 @GSM_Types.ChannelNeeded."); } } ChannelNeeded_template::ChannelNeeded_template() { } ChannelNeeded_template::ChannelNeeded_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ChannelNeeded_template::ChannelNeeded_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!ChannelNeeded::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @GSM_Types.ChannelNeeded with unknown numeric value %d.", other_value); single_value = (ChannelNeeded::enum_type)other_value; } ChannelNeeded_template::ChannelNeeded_template(ChannelNeeded::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } ChannelNeeded_template::ChannelNeeded_template(const ChannelNeeded& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == ChannelNeeded::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @GSM_Types.ChannelNeeded."); single_value = other_value.enum_value; } ChannelNeeded_template::ChannelNeeded_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (ChannelNeeded::enum_type)(const ChannelNeeded&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @GSM_Types.ChannelNeeded from an unbound optional field."); } } ChannelNeeded_template::ChannelNeeded_template(ChannelNeeded_template* p_precondition, ChannelNeeded_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ChannelNeeded_template::ChannelNeeded_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; } ChannelNeeded_template::ChannelNeeded_template(const ChannelNeeded_template& other_value) : Base_Template() { copy_template(other_value); } ChannelNeeded_template::~ChannelNeeded_template() { clean_up(); } boolean ChannelNeeded_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean ChannelNeeded_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != ChannelNeeded::UNBOUND_VALUE; } void ChannelNeeded_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; } ChannelNeeded_template& ChannelNeeded_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ChannelNeeded_template& ChannelNeeded_template::operator=(int other_value) { if (!ChannelNeeded::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @GSM_Types.ChannelNeeded.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (ChannelNeeded::enum_type)other_value; return *this; } ChannelNeeded_template& ChannelNeeded_template::operator=(ChannelNeeded::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } ChannelNeeded_template& ChannelNeeded_template::operator=(const ChannelNeeded& other_value) { if (other_value.enum_value == ChannelNeeded::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @GSM_Types.ChannelNeeded to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } ChannelNeeded_template& ChannelNeeded_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (ChannelNeeded::enum_type)(const ChannelNeeded&)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 @GSM_Types.ChannelNeeded."); } return *this; } ChannelNeeded_template& ChannelNeeded_template::operator=(const ChannelNeeded_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ChannelNeeded_template::match(ChannelNeeded::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 @GSM_Types.ChannelNeeded."); } return FALSE; } boolean ChannelNeeded_template::match(const ChannelNeeded& other_value, boolean) const { if (other_value.enum_value == ChannelNeeded::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @GSM_Types.ChannelNeeded with an unbound value."); return match(other_value.enum_value); } ChannelNeeded::enum_type ChannelNeeded_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 @GSM_Types.ChannelNeeded."); return single_value; } void ChannelNeeded_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @GSM_Types.ChannelNeeded."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ChannelNeeded_template[list_length]; } ChannelNeeded_template& ChannelNeeded_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 @GSM_Types.ChannelNeeded."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @GSM_Types.ChannelNeeded."); return value_list.list_value[list_index]; } void ChannelNeeded_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(ChannelNeeded::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 ChannelNeeded_template::log_match(const ChannelNeeded& 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 ChannelNeeded_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 @GSM_Types.ChannelNeeded."); } } void ChannelNeeded_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (ChannelNeeded::enum_type)text_buf.pull_int().get_val(); if (!ChannelNeeded::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @GSM_Types.ChannelNeeded.", 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 ChannelNeeded_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 @GSM_Types.ChannelNeeded."); } } boolean ChannelNeeded_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ChannelNeeded_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: { ChannelNeeded_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: { ChannelNeeded::enum_type enum_val = ChannelNeeded::str_to_enum(m_p->get_enumerated()); if (!ChannelNeeded::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @GSM_Types.ChannelNeeded."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { ChannelNeeded_template* precondition = new ChannelNeeded_template; precondition->set_param(*m_p->get_elem(0)); ChannelNeeded_template* implied_template = new ChannelNeeded_template; implied_template->set_param(*m_p->get_elem(1)); *this = ChannelNeeded_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@GSM_Types.ChannelNeeded"); } is_ifpresent = param.get_ifpresent(); } void ChannelNeeded_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 : "@GSM_Types.ChannelNeeded"); } ChannelNeeded12::ChannelNeeded12() { } ChannelNeeded12::ChannelNeeded12(const ChannelNeeded& par_second, const ChannelNeeded& par_first) : field_second(par_second), field_first(par_first) { } ChannelNeeded12::ChannelNeeded12(const ChannelNeeded12& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_Types.ChannelNeeded12."); if (other_value.second().is_bound()) field_second = other_value.second(); else field_second.clean_up(); if (other_value.first().is_bound()) field_first = other_value.first(); else field_first.clean_up(); } void ChannelNeeded12::clean_up() { field_second.clean_up(); field_first.clean_up(); } const TTCN_Typedescriptor_t* ChannelNeeded12::get_descriptor() const { return &ChannelNeeded12_descr_; } ChannelNeeded12& ChannelNeeded12::operator=(const ChannelNeeded12& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_Types.ChannelNeeded12."); if (other_value.second().is_bound()) field_second = other_value.second(); else field_second.clean_up(); if (other_value.first().is_bound()) field_first = other_value.first(); else field_first.clean_up(); } return *this; } boolean ChannelNeeded12::operator==(const ChannelNeeded12& other_value) const { return field_second==other_value.field_second && field_first==other_value.field_first; } boolean ChannelNeeded12::is_bound() const { return (field_second.is_bound()) || (field_first.is_bound()); } boolean ChannelNeeded12::is_value() const { return field_second.is_value() && field_first.is_value(); } void ChannelNeeded12::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ second := "); field_second.log(); TTCN_Logger::log_event_str(", first := "); field_first.log(); TTCN_Logger::log_event_str(" }"); } void ChannelNeeded12::set_implicit_omit() { if (second().is_bound()) second().set_implicit_omit(); if (first().is_bound()) first().set_implicit_omit(); } void ChannelNeeded12::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (20 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) second().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) first().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "second")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { second().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "first")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { first().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.ChannelNeeded12: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.ChannelNeeded12"); } } void ChannelNeeded12::encode_text(Text_Buf& text_buf) const { field_second.encode_text(text_buf); field_first.encode_text(text_buf); } void ChannelNeeded12::decode_text(Text_Buf& text_buf) { field_second.decode_text(text_buf); field_first.decode_text(text_buf); } void ChannelNeeded12::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void ChannelNeeded12::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int ChannelNeeded12::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, ChannelNeeded12_second_descr_.raw->forceomit); decoded_field_length = field_second.RAW_decode(ChannelNeeded12_second_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, ChannelNeeded12_first_descr_.raw->forceomit); decoded_field_length = field_first.RAW_decode(ChannelNeeded12_first_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ChannelNeeded12::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 = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, ChannelNeeded12_second_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, ChannelNeeded12_first_descr_.raw); encoded_length += field_second.RAW_encode(ChannelNeeded12_second_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_first.RAW_encode(ChannelNeeded12_first_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct ChannelNeeded12_template::single_value_struct { ChannelNeeded_template field_second; ChannelNeeded_template field_first; }; void ChannelNeeded12_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_second = ANY_VALUE; single_value->field_first = ANY_VALUE; } } } void ChannelNeeded12_template::copy_value(const ChannelNeeded12& other_value) { single_value = new single_value_struct; if (other_value.second().is_bound()) { single_value->field_second = other_value.second(); } else { single_value->field_second.clean_up(); } if (other_value.first().is_bound()) { single_value->field_first = other_value.first(); } else { single_value->field_first.clean_up(); } set_selection(SPECIFIC_VALUE); } void ChannelNeeded12_template::copy_template(const ChannelNeeded12_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.second().get_selection()) { single_value->field_second = other_value.second(); } else { single_value->field_second.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.first().get_selection()) { single_value->field_first = other_value.first(); } else { single_value->field_first.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 ChannelNeeded12_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 ChannelNeeded12_template(*other_value.implication_.precondition); implication_.implied_template = new ChannelNeeded12_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 @GSM_Types.ChannelNeeded12."); break; } set_selection(other_value); } ChannelNeeded12_template::ChannelNeeded12_template() { } ChannelNeeded12_template::ChannelNeeded12_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ChannelNeeded12_template::ChannelNeeded12_template(const ChannelNeeded12& other_value) { copy_value(other_value); } ChannelNeeded12_template::ChannelNeeded12_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ChannelNeeded12&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.ChannelNeeded12 from an unbound optional field."); } } ChannelNeeded12_template::ChannelNeeded12_template(ChannelNeeded12_template* p_precondition, ChannelNeeded12_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ChannelNeeded12_template::ChannelNeeded12_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; } ChannelNeeded12_template::ChannelNeeded12_template(const ChannelNeeded12_template& other_value) : Base_Template() { copy_template(other_value); } ChannelNeeded12_template::~ChannelNeeded12_template() { clean_up(); } ChannelNeeded12_template& ChannelNeeded12_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ChannelNeeded12_template& ChannelNeeded12_template::operator=(const ChannelNeeded12& other_value) { clean_up(); copy_value(other_value); return *this; } ChannelNeeded12_template& ChannelNeeded12_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ChannelNeeded12&)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 @GSM_Types.ChannelNeeded12."); } return *this; } ChannelNeeded12_template& ChannelNeeded12_template::operator=(const ChannelNeeded12_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ChannelNeeded12_template::match(const ChannelNeeded12& 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.second().is_bound()) return FALSE; if(!single_value->field_second.match(other_value.second(), legacy))return FALSE; if(!other_value.first().is_bound()) return FALSE; if(!single_value->field_first.match(other_value.first(), 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 @GSM_Types.ChannelNeeded12."); } return FALSE; } boolean ChannelNeeded12_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_second.is_bound() || single_value->field_first.is_bound(); } boolean ChannelNeeded12_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_second.is_value() && single_value->field_first.is_value(); } void ChannelNeeded12_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; } ChannelNeeded12 ChannelNeeded12_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 @GSM_Types.ChannelNeeded12."); ChannelNeeded12 ret_val; if (single_value->field_second.is_bound()) { ret_val.second() = single_value->field_second.valueof(); } if (single_value->field_first.is_bound()) { ret_val.first() = single_value->field_first.valueof(); } return ret_val; } void ChannelNeeded12_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 @GSM_Types.ChannelNeeded12."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ChannelNeeded12_template[list_length]; } ChannelNeeded12_template& ChannelNeeded12_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 @GSM_Types.ChannelNeeded12."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.ChannelNeeded12."); return value_list.list_value[list_index]; } ChannelNeeded_template& ChannelNeeded12_template::second() { set_specific(); return single_value->field_second; } const ChannelNeeded_template& ChannelNeeded12_template::second() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field second of a non-specific template of type @GSM_Types.ChannelNeeded12."); return single_value->field_second; } ChannelNeeded_template& ChannelNeeded12_template::first() { set_specific(); return single_value->field_first; } const ChannelNeeded_template& ChannelNeeded12_template::first() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field first of a non-specific template of type @GSM_Types.ChannelNeeded12."); return single_value->field_first; } int ChannelNeeded12_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.ChannelNeeded12 which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.ChannelNeeded12 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 @GSM_Types.ChannelNeeded12 containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.ChannelNeeded12 containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.ChannelNeeded12 containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.ChannelNeeded12 containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.ChannelNeeded12 containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.ChannelNeeded12 containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.ChannelNeeded12 containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.ChannelNeeded12."); } return 0; } void ChannelNeeded12_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ second := "); single_value->field_second.log(); TTCN_Logger::log_event_str(", first := "); single_value->field_first.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 ChannelNeeded12_template::log_match(const ChannelNeeded12& 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_second.match(match_value.second(), legacy)){ TTCN_Logger::log_logmatch_info(".second"); single_value->field_second.log_match(match_value.second(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_first.match(match_value.first(), legacy)){ TTCN_Logger::log_logmatch_info(".first"); single_value->field_first.log_match(match_value.first(), 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("{ second := "); single_value->field_second.log_match(match_value.second(), legacy); TTCN_Logger::log_event_str(", first := "); single_value->field_first.log_match(match_value.first(), 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 ChannelNeeded12_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_second.encode_text(text_buf); single_value->field_first.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 @GSM_Types.ChannelNeeded12."); } } void ChannelNeeded12_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_second.decode_text(text_buf); single_value->field_first.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 ChannelNeeded12_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 @GSM_Types.ChannelNeeded12."); } } void ChannelNeeded12_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: { ChannelNeeded12_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) second().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) first().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "second")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { second().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "first")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { first().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.ChannelNeeded12: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ChannelNeeded12_template* precondition = new ChannelNeeded12_template; precondition->set_param(*param.get_elem(0)); ChannelNeeded12_template* implied_template = new ChannelNeeded12_template; implied_template->set_param(*param.get_elem(1)); *this = ChannelNeeded12_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.ChannelNeeded12"); } is_ifpresent = param.get_ifpresent(); } void ChannelNeeded12_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_second.check_restriction(t_res, t_name ? t_name : "@GSM_Types.ChannelNeeded12"); single_value->field_first.check_restriction(t_res, t_name ? t_name : "@GSM_Types.ChannelNeeded12"); 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 : "@GSM_Types.ChannelNeeded12"); } boolean ChannelNeeded12_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ChannelNeeded12_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(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.RslChanNr0."); return enum_value > other_value; } boolean RslChanNr0::operator>(const RslChanNr0& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.RslChanNr0."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.RslChanNr0."); return enum_value > other_value.enum_value; } const char *RslChanNr0::enum_to_str(enum_type enum_par) { switch (enum_par) { case RSL__CHAN__NR__INVALID: return "RSL_CHAN_NR_INVALID"; case RSL__CHAN__NR__Bm__ACCH: return "RSL_CHAN_NR_Bm_ACCH"; case RSL__CHAN__NR__BCCH: return "RSL_CHAN_NR_BCCH"; case RSL__CHAN__NR__RACH: return "RSL_CHAN_NR_RACH"; case RSL__CHAN__NR__PCH__AGCH: return "RSL_CHAN_NR_PCH_AGCH"; case RSL__CHAN__NR__OSMO__PDCH: return "RSL_CHAN_NR_OSMO_PDCH"; case RSL__CHAN__NR__OSMO__CBCH4: return "RSL_CHAN_NR_OSMO_CBCH4"; case RSL__CHAN__NR__OSMO__CBCH8: return "RSL_CHAN_NR_OSMO_CBCH8"; case RSL__CHAN__NR__OSMO__VAMOS__Bm__ACCH: return "RSL_CHAN_NR_OSMO_VAMOS_Bm_ACCH"; default: return ""; } } RslChanNr0::enum_type RslChanNr0::str_to_enum(const char *str_par) { if (!strcmp(str_par, "RSL_CHAN_NR_INVALID")) return RSL__CHAN__NR__INVALID; else if (!strcmp(str_par, "RSL_CHAN_NR_Bm_ACCH")) return RSL__CHAN__NR__Bm__ACCH; else if (!strcmp(str_par, "RSL_CHAN_NR_BCCH")) return RSL__CHAN__NR__BCCH; else if (!strcmp(str_par, "RSL_CHAN_NR_RACH")) return RSL__CHAN__NR__RACH; else if (!strcmp(str_par, "RSL_CHAN_NR_PCH_AGCH")) return RSL__CHAN__NR__PCH__AGCH; else if (!strcmp(str_par, "RSL_CHAN_NR_OSMO_PDCH")) return RSL__CHAN__NR__OSMO__PDCH; else if (!strcmp(str_par, "RSL_CHAN_NR_OSMO_CBCH4")) return RSL__CHAN__NR__OSMO__CBCH4; else if (!strcmp(str_par, "RSL_CHAN_NR_OSMO_CBCH8")) return RSL__CHAN__NR__OSMO__CBCH8; else if (!strcmp(str_par, "RSL_CHAN_NR_OSMO_VAMOS_Bm_ACCH")) return RSL__CHAN__NR__OSMO__VAMOS__Bm__ACCH; else return UNKNOWN_VALUE; } boolean RslChanNr0::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 16: case 17: case 18: case 24: case 25: case 26: case 29: return TRUE; default: return FALSE; } } int RslChanNr0::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 @GSM_Types.RslChanNr0.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int RslChanNr0::enum2int(const RslChanNr0& 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 @GSM_Types.RslChanNr0.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void RslChanNr0::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @GSM_Types.RslChanNr0.", int_val); enum_value = (enum_type)int_val; } RslChanNr0::operator RslChanNr0::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @GSM_Types.RslChanNr0."); return enum_value; } void RslChanNr0::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 RslChanNr0::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", "@GSM_Types.RslChanNr0"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @GSM_Types.RslChanNr0."); } } void RslChanNr0::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @GSM_Types.RslChanNr0."); text_buf.push_int(enum_value); } void RslChanNr0::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 @GSM_Types.RslChanNr0.", enum_value); } void RslChanNr0::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RslChanNr0::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RslChanNr0::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, 5, 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 RslChanNr0::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 5); } void RslChanNr0_template::copy_template(const RslChanNr0_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 RslChanNr0_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 RslChanNr0_template(*other_value.implication_.precondition); implication_.implied_template = new RslChanNr0_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 @GSM_Types.RslChanNr0."); } } RslChanNr0_template::RslChanNr0_template() { } RslChanNr0_template::RslChanNr0_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RslChanNr0_template::RslChanNr0_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!RslChanNr0::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @GSM_Types.RslChanNr0 with unknown numeric value %d.", other_value); single_value = (RslChanNr0::enum_type)other_value; } RslChanNr0_template::RslChanNr0_template(RslChanNr0::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } RslChanNr0_template::RslChanNr0_template(const RslChanNr0& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == RslChanNr0::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @GSM_Types.RslChanNr0."); single_value = other_value.enum_value; } RslChanNr0_template::RslChanNr0_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RslChanNr0::enum_type)(const RslChanNr0&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @GSM_Types.RslChanNr0 from an unbound optional field."); } } RslChanNr0_template::RslChanNr0_template(RslChanNr0_template* p_precondition, RslChanNr0_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RslChanNr0_template::RslChanNr0_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; } RslChanNr0_template::RslChanNr0_template(const RslChanNr0_template& other_value) : Base_Template() { copy_template(other_value); } RslChanNr0_template::~RslChanNr0_template() { clean_up(); } boolean RslChanNr0_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean RslChanNr0_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != RslChanNr0::UNBOUND_VALUE; } void RslChanNr0_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; } RslChanNr0_template& RslChanNr0_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RslChanNr0_template& RslChanNr0_template::operator=(int other_value) { if (!RslChanNr0::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @GSM_Types.RslChanNr0.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (RslChanNr0::enum_type)other_value; return *this; } RslChanNr0_template& RslChanNr0_template::operator=(RslChanNr0::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } RslChanNr0_template& RslChanNr0_template::operator=(const RslChanNr0& other_value) { if (other_value.enum_value == RslChanNr0::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @GSM_Types.RslChanNr0 to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } RslChanNr0_template& RslChanNr0_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RslChanNr0::enum_type)(const RslChanNr0&)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 @GSM_Types.RslChanNr0."); } return *this; } RslChanNr0_template& RslChanNr0_template::operator=(const RslChanNr0_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RslChanNr0_template::match(RslChanNr0::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 @GSM_Types.RslChanNr0."); } return FALSE; } boolean RslChanNr0_template::match(const RslChanNr0& other_value, boolean) const { if (other_value.enum_value == RslChanNr0::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @GSM_Types.RslChanNr0 with an unbound value."); return match(other_value.enum_value); } RslChanNr0::enum_type RslChanNr0_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 @GSM_Types.RslChanNr0."); return single_value; } void RslChanNr0_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @GSM_Types.RslChanNr0."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RslChanNr0_template[list_length]; } RslChanNr0_template& RslChanNr0_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 @GSM_Types.RslChanNr0."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @GSM_Types.RslChanNr0."); return value_list.list_value[list_index]; } void RslChanNr0_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(RslChanNr0::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 RslChanNr0_template::log_match(const RslChanNr0& 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 RslChanNr0_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 @GSM_Types.RslChanNr0."); } } void RslChanNr0_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (RslChanNr0::enum_type)text_buf.pull_int().get_val(); if (!RslChanNr0::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @GSM_Types.RslChanNr0.", 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 RslChanNr0_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 @GSM_Types.RslChanNr0."); } } boolean RslChanNr0_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RslChanNr0_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: { RslChanNr0_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: { RslChanNr0::enum_type enum_val = RslChanNr0::str_to_enum(m_p->get_enumerated()); if (!RslChanNr0::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @GSM_Types.RslChanNr0."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { RslChanNr0_template* precondition = new RslChanNr0_template; precondition->set_param(*m_p->get_elem(0)); RslChanNr0_template* implied_template = new RslChanNr0_template; implied_template->set_param(*m_p->get_elem(1)); *this = RslChanNr0_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@GSM_Types.RslChanNr0"); } is_ifpresent = param.get_ifpresent(); } void RslChanNr0_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 : "@GSM_Types.RslChanNr0"); } RslChanNr2::RslChanNr2() { } RslChanNr2::RslChanNr2(const BITSTRING& par_tag, const INTEGER& par_sub__chan) : field_tag(par_tag), field_sub__chan(par_sub__chan) { } RslChanNr2::RslChanNr2(const RslChanNr2& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_Types.RslChanNr2."); if (other_value.tag().is_bound()) field_tag = other_value.tag(); else field_tag.clean_up(); if (other_value.sub__chan().is_bound()) field_sub__chan = other_value.sub__chan(); else field_sub__chan.clean_up(); } void RslChanNr2::clean_up() { field_tag.clean_up(); field_sub__chan.clean_up(); } const TTCN_Typedescriptor_t* RslChanNr2::get_descriptor() const { return &RslChanNr2_descr_; } RslChanNr2& RslChanNr2::operator=(const RslChanNr2& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_Types.RslChanNr2."); if (other_value.tag().is_bound()) field_tag = other_value.tag(); else field_tag.clean_up(); if (other_value.sub__chan().is_bound()) field_sub__chan = other_value.sub__chan(); else field_sub__chan.clean_up(); } return *this; } boolean RslChanNr2::operator==(const RslChanNr2& other_value) const { return field_tag==other_value.field_tag && field_sub__chan==other_value.field_sub__chan; } boolean RslChanNr2::is_bound() const { return (field_tag.is_bound()) || (field_sub__chan.is_bound()); } boolean RslChanNr2::is_value() const { return field_tag.is_value() && field_sub__chan.is_value(); } void RslChanNr2::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ tag := "); field_tag.log(); TTCN_Logger::log_event_str(", sub_chan := "); field_sub__chan.log(); TTCN_Logger::log_event_str(" }"); } void RslChanNr2::set_implicit_omit() { if (tag().is_bound()) tag().set_implicit_omit(); if (sub__chan().is_bound()) sub__chan().set_implicit_omit(); } void RslChanNr2::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (20 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) tag().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sub__chan().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "tag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sub_chan")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sub__chan().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslChanNr2: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.RslChanNr2"); } } void RslChanNr2::encode_text(Text_Buf& text_buf) const { field_tag.encode_text(text_buf); field_sub__chan.encode_text(text_buf); } void RslChanNr2::decode_text(Text_Buf& text_buf) { field_tag.decode_text(text_buf); field_sub__chan.decode_text(text_buf); } void RslChanNr2::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RslChanNr2::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RslChanNr2::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, RslChanNr2_tag_descr_.raw->forceomit); decoded_field_length = field_tag.RAW_decode(RslChanNr2_tag_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, RslChanNr2_sub__chan_descr_.raw->forceomit); decoded_field_length = field_sub__chan.RAW_decode(RslChanNr2_sub__chan_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int RslChanNr2::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 = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, RslChanNr2_tag_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RslChanNr2_sub__chan_descr_.raw); encoded_length += field_tag.RAW_encode(RslChanNr2_tag_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_sub__chan.RAW_encode(RslChanNr2_sub__chan_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct RslChanNr2_template::single_value_struct { BITSTRING_template field_tag; INTEGER_template field_sub__chan; }; void RslChanNr2_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_tag = ANY_VALUE; single_value->field_sub__chan = ANY_VALUE; } } } void RslChanNr2_template::copy_value(const RslChanNr2& other_value) { single_value = new single_value_struct; if (other_value.tag().is_bound()) { single_value->field_tag = other_value.tag(); } else { single_value->field_tag.clean_up(); } if (other_value.sub__chan().is_bound()) { single_value->field_sub__chan = other_value.sub__chan(); } else { single_value->field_sub__chan.clean_up(); } set_selection(SPECIFIC_VALUE); } void RslChanNr2_template::copy_template(const RslChanNr2_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.tag().get_selection()) { single_value->field_tag = other_value.tag(); } else { single_value->field_tag.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sub__chan().get_selection()) { single_value->field_sub__chan = other_value.sub__chan(); } else { single_value->field_sub__chan.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 RslChanNr2_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 RslChanNr2_template(*other_value.implication_.precondition); implication_.implied_template = new RslChanNr2_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 @GSM_Types.RslChanNr2."); break; } set_selection(other_value); } RslChanNr2_template::RslChanNr2_template() { } RslChanNr2_template::RslChanNr2_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RslChanNr2_template::RslChanNr2_template(const RslChanNr2& other_value) { copy_value(other_value); } RslChanNr2_template::RslChanNr2_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChanNr2&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.RslChanNr2 from an unbound optional field."); } } RslChanNr2_template::RslChanNr2_template(RslChanNr2_template* p_precondition, RslChanNr2_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RslChanNr2_template::RslChanNr2_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; } RslChanNr2_template::RslChanNr2_template(const RslChanNr2_template& other_value) : Base_Template() { copy_template(other_value); } RslChanNr2_template::~RslChanNr2_template() { clean_up(); } RslChanNr2_template& RslChanNr2_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RslChanNr2_template& RslChanNr2_template::operator=(const RslChanNr2& other_value) { clean_up(); copy_value(other_value); return *this; } RslChanNr2_template& RslChanNr2_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChanNr2&)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 @GSM_Types.RslChanNr2."); } return *this; } RslChanNr2_template& RslChanNr2_template::operator=(const RslChanNr2_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RslChanNr2_template::match(const RslChanNr2& 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.tag().is_bound()) return FALSE; if(!single_value->field_tag.match(other_value.tag(), legacy))return FALSE; if(!other_value.sub__chan().is_bound()) return FALSE; if(!single_value->field_sub__chan.match(other_value.sub__chan(), 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 @GSM_Types.RslChanNr2."); } return FALSE; } boolean RslChanNr2_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_tag.is_bound() || single_value->field_sub__chan.is_bound(); } boolean RslChanNr2_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_tag.is_value() && single_value->field_sub__chan.is_value(); } void RslChanNr2_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; } RslChanNr2 RslChanNr2_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 @GSM_Types.RslChanNr2."); RslChanNr2 ret_val; if (single_value->field_tag.is_bound()) { ret_val.tag() = single_value->field_tag.valueof(); } if (single_value->field_sub__chan.is_bound()) { ret_val.sub__chan() = single_value->field_sub__chan.valueof(); } return ret_val; } void RslChanNr2_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 @GSM_Types.RslChanNr2."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RslChanNr2_template[list_length]; } RslChanNr2_template& RslChanNr2_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 @GSM_Types.RslChanNr2."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.RslChanNr2."); return value_list.list_value[list_index]; } BITSTRING_template& RslChanNr2_template::tag() { set_specific(); return single_value->field_tag; } const BITSTRING_template& RslChanNr2_template::tag() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tag of a non-specific template of type @GSM_Types.RslChanNr2."); return single_value->field_tag; } INTEGER_template& RslChanNr2_template::sub__chan() { set_specific(); return single_value->field_sub__chan; } const INTEGER_template& RslChanNr2_template::sub__chan() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sub_chan of a non-specific template of type @GSM_Types.RslChanNr2."); return single_value->field_sub__chan; } int RslChanNr2_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr2 which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.RslChanNr2 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 @GSM_Types.RslChanNr2 containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr2 containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr2 containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr2 containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr2 containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr2 containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr2 containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.RslChanNr2."); } return 0; } void RslChanNr2_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ tag := "); single_value->field_tag.log(); TTCN_Logger::log_event_str(", sub_chan := "); single_value->field_sub__chan.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 RslChanNr2_template::log_match(const RslChanNr2& 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_tag.match(match_value.tag(), legacy)){ TTCN_Logger::log_logmatch_info(".tag"); single_value->field_tag.log_match(match_value.tag(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sub__chan.match(match_value.sub__chan(), legacy)){ TTCN_Logger::log_logmatch_info(".sub_chan"); single_value->field_sub__chan.log_match(match_value.sub__chan(), 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("{ tag := "); single_value->field_tag.log_match(match_value.tag(), legacy); TTCN_Logger::log_event_str(", sub_chan := "); single_value->field_sub__chan.log_match(match_value.sub__chan(), 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 RslChanNr2_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_tag.encode_text(text_buf); single_value->field_sub__chan.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 @GSM_Types.RslChanNr2."); } } void RslChanNr2_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_tag.decode_text(text_buf); single_value->field_sub__chan.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 RslChanNr2_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 @GSM_Types.RslChanNr2."); } } void RslChanNr2_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: { RslChanNr2_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) tag().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sub__chan().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "tag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sub_chan")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sub__chan().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslChanNr2: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { RslChanNr2_template* precondition = new RslChanNr2_template; precondition->set_param(*param.get_elem(0)); RslChanNr2_template* implied_template = new RslChanNr2_template; implied_template->set_param(*param.get_elem(1)); *this = RslChanNr2_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.RslChanNr2"); } is_ifpresent = param.get_ifpresent(); } void RslChanNr2_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_tag.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNr2"); single_value->field_sub__chan.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNr2"); 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 : "@GSM_Types.RslChanNr2"); } boolean RslChanNr2_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RslChanNr2_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) tag().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sub__chan().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "tag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sub_chan")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sub__chan().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslChanNr4: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.RslChanNr4"); } } void RslChanNr4::encode_text(Text_Buf& text_buf) const { field_tag.encode_text(text_buf); field_sub__chan.encode_text(text_buf); } void RslChanNr4::decode_text(Text_Buf& text_buf) { field_tag.decode_text(text_buf); field_sub__chan.decode_text(text_buf); } void RslChanNr4::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RslChanNr4::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RslChanNr4::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, RslChanNr4_tag_descr_.raw->forceomit); decoded_field_length = field_tag.RAW_decode(RslChanNr4_tag_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, RslChanNr4_sub__chan_descr_.raw->forceomit); decoded_field_length = field_sub__chan.RAW_decode(RslChanNr4_sub__chan_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int RslChanNr4::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 = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, RslChanNr4_tag_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RslChanNr4_sub__chan_descr_.raw); encoded_length += field_tag.RAW_encode(RslChanNr4_tag_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_sub__chan.RAW_encode(RslChanNr4_sub__chan_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct RslChanNr4_template::single_value_struct { BITSTRING_template field_tag; INTEGER_template field_sub__chan; }; void RslChanNr4_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_tag = ANY_VALUE; single_value->field_sub__chan = ANY_VALUE; } } } void RslChanNr4_template::copy_value(const RslChanNr4& other_value) { single_value = new single_value_struct; if (other_value.tag().is_bound()) { single_value->field_tag = other_value.tag(); } else { single_value->field_tag.clean_up(); } if (other_value.sub__chan().is_bound()) { single_value->field_sub__chan = other_value.sub__chan(); } else { single_value->field_sub__chan.clean_up(); } set_selection(SPECIFIC_VALUE); } void RslChanNr4_template::copy_template(const RslChanNr4_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.tag().get_selection()) { single_value->field_tag = other_value.tag(); } else { single_value->field_tag.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sub__chan().get_selection()) { single_value->field_sub__chan = other_value.sub__chan(); } else { single_value->field_sub__chan.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 RslChanNr4_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 RslChanNr4_template(*other_value.implication_.precondition); implication_.implied_template = new RslChanNr4_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 @GSM_Types.RslChanNr4."); break; } set_selection(other_value); } RslChanNr4_template::RslChanNr4_template() { } RslChanNr4_template::RslChanNr4_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RslChanNr4_template::RslChanNr4_template(const RslChanNr4& other_value) { copy_value(other_value); } RslChanNr4_template::RslChanNr4_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChanNr4&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.RslChanNr4 from an unbound optional field."); } } RslChanNr4_template::RslChanNr4_template(RslChanNr4_template* p_precondition, RslChanNr4_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RslChanNr4_template::RslChanNr4_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; } RslChanNr4_template::RslChanNr4_template(const RslChanNr4_template& other_value) : Base_Template() { copy_template(other_value); } RslChanNr4_template::~RslChanNr4_template() { clean_up(); } RslChanNr4_template& RslChanNr4_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RslChanNr4_template& RslChanNr4_template::operator=(const RslChanNr4& other_value) { clean_up(); copy_value(other_value); return *this; } RslChanNr4_template& RslChanNr4_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChanNr4&)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 @GSM_Types.RslChanNr4."); } return *this; } RslChanNr4_template& RslChanNr4_template::operator=(const RslChanNr4_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RslChanNr4_template::match(const RslChanNr4& 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.tag().is_bound()) return FALSE; if(!single_value->field_tag.match(other_value.tag(), legacy))return FALSE; if(!other_value.sub__chan().is_bound()) return FALSE; if(!single_value->field_sub__chan.match(other_value.sub__chan(), 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 @GSM_Types.RslChanNr4."); } return FALSE; } boolean RslChanNr4_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_tag.is_bound() || single_value->field_sub__chan.is_bound(); } boolean RslChanNr4_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_tag.is_value() && single_value->field_sub__chan.is_value(); } void RslChanNr4_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; } RslChanNr4 RslChanNr4_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 @GSM_Types.RslChanNr4."); RslChanNr4 ret_val; if (single_value->field_tag.is_bound()) { ret_val.tag() = single_value->field_tag.valueof(); } if (single_value->field_sub__chan.is_bound()) { ret_val.sub__chan() = single_value->field_sub__chan.valueof(); } return ret_val; } void RslChanNr4_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 @GSM_Types.RslChanNr4."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RslChanNr4_template[list_length]; } RslChanNr4_template& RslChanNr4_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 @GSM_Types.RslChanNr4."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.RslChanNr4."); return value_list.list_value[list_index]; } BITSTRING_template& RslChanNr4_template::tag() { set_specific(); return single_value->field_tag; } const BITSTRING_template& RslChanNr4_template::tag() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tag of a non-specific template of type @GSM_Types.RslChanNr4."); return single_value->field_tag; } INTEGER_template& RslChanNr4_template::sub__chan() { set_specific(); return single_value->field_sub__chan; } const INTEGER_template& RslChanNr4_template::sub__chan() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sub_chan of a non-specific template of type @GSM_Types.RslChanNr4."); return single_value->field_sub__chan; } int RslChanNr4_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr4 which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.RslChanNr4 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 @GSM_Types.RslChanNr4 containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr4 containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr4 containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr4 containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr4 containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr4 containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr4 containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.RslChanNr4."); } return 0; } void RslChanNr4_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ tag := "); single_value->field_tag.log(); TTCN_Logger::log_event_str(", sub_chan := "); single_value->field_sub__chan.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 RslChanNr4_template::log_match(const RslChanNr4& 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_tag.match(match_value.tag(), legacy)){ TTCN_Logger::log_logmatch_info(".tag"); single_value->field_tag.log_match(match_value.tag(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sub__chan.match(match_value.sub__chan(), legacy)){ TTCN_Logger::log_logmatch_info(".sub_chan"); single_value->field_sub__chan.log_match(match_value.sub__chan(), 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("{ tag := "); single_value->field_tag.log_match(match_value.tag(), legacy); TTCN_Logger::log_event_str(", sub_chan := "); single_value->field_sub__chan.log_match(match_value.sub__chan(), 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 RslChanNr4_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_tag.encode_text(text_buf); single_value->field_sub__chan.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 @GSM_Types.RslChanNr4."); } } void RslChanNr4_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_tag.decode_text(text_buf); single_value->field_sub__chan.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 RslChanNr4_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 @GSM_Types.RslChanNr4."); } } void RslChanNr4_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: { RslChanNr4_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) tag().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sub__chan().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "tag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sub_chan")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sub__chan().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslChanNr4: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { RslChanNr4_template* precondition = new RslChanNr4_template; precondition->set_param(*param.get_elem(0)); RslChanNr4_template* implied_template = new RslChanNr4_template; implied_template->set_param(*param.get_elem(1)); *this = RslChanNr4_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.RslChanNr4"); } is_ifpresent = param.get_ifpresent(); } void RslChanNr4_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_tag.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNr4"); single_value->field_sub__chan.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNr4"); 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 : "@GSM_Types.RslChanNr4"); } boolean RslChanNr4_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RslChanNr4_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) tag().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sub__chan().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "tag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sub_chan")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sub__chan().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslChanNr8: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.RslChanNr8"); } } void RslChanNr8::encode_text(Text_Buf& text_buf) const { field_tag.encode_text(text_buf); field_sub__chan.encode_text(text_buf); } void RslChanNr8::decode_text(Text_Buf& text_buf) { field_tag.decode_text(text_buf); field_sub__chan.decode_text(text_buf); } void RslChanNr8::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RslChanNr8::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RslChanNr8::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, RslChanNr8_tag_descr_.raw->forceomit); decoded_field_length = field_tag.RAW_decode(RslChanNr8_tag_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, RslChanNr8_sub__chan_descr_.raw->forceomit); decoded_field_length = field_sub__chan.RAW_decode(RslChanNr8_sub__chan_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int RslChanNr8::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 = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, RslChanNr8_tag_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RslChanNr8_sub__chan_descr_.raw); encoded_length += field_tag.RAW_encode(RslChanNr8_tag_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_sub__chan.RAW_encode(RslChanNr8_sub__chan_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct RslChanNr8_template::single_value_struct { BITSTRING_template field_tag; INTEGER_template field_sub__chan; }; void RslChanNr8_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_tag = ANY_VALUE; single_value->field_sub__chan = ANY_VALUE; } } } void RslChanNr8_template::copy_value(const RslChanNr8& other_value) { single_value = new single_value_struct; if (other_value.tag().is_bound()) { single_value->field_tag = other_value.tag(); } else { single_value->field_tag.clean_up(); } if (other_value.sub__chan().is_bound()) { single_value->field_sub__chan = other_value.sub__chan(); } else { single_value->field_sub__chan.clean_up(); } set_selection(SPECIFIC_VALUE); } void RslChanNr8_template::copy_template(const RslChanNr8_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.tag().get_selection()) { single_value->field_tag = other_value.tag(); } else { single_value->field_tag.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sub__chan().get_selection()) { single_value->field_sub__chan = other_value.sub__chan(); } else { single_value->field_sub__chan.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 RslChanNr8_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 RslChanNr8_template(*other_value.implication_.precondition); implication_.implied_template = new RslChanNr8_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 @GSM_Types.RslChanNr8."); break; } set_selection(other_value); } RslChanNr8_template::RslChanNr8_template() { } RslChanNr8_template::RslChanNr8_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RslChanNr8_template::RslChanNr8_template(const RslChanNr8& other_value) { copy_value(other_value); } RslChanNr8_template::RslChanNr8_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChanNr8&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.RslChanNr8 from an unbound optional field."); } } RslChanNr8_template::RslChanNr8_template(RslChanNr8_template* p_precondition, RslChanNr8_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RslChanNr8_template::RslChanNr8_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; } RslChanNr8_template::RslChanNr8_template(const RslChanNr8_template& other_value) : Base_Template() { copy_template(other_value); } RslChanNr8_template::~RslChanNr8_template() { clean_up(); } RslChanNr8_template& RslChanNr8_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RslChanNr8_template& RslChanNr8_template::operator=(const RslChanNr8& other_value) { clean_up(); copy_value(other_value); return *this; } RslChanNr8_template& RslChanNr8_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChanNr8&)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 @GSM_Types.RslChanNr8."); } return *this; } RslChanNr8_template& RslChanNr8_template::operator=(const RslChanNr8_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RslChanNr8_template::match(const RslChanNr8& 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.tag().is_bound()) return FALSE; if(!single_value->field_tag.match(other_value.tag(), legacy))return FALSE; if(!other_value.sub__chan().is_bound()) return FALSE; if(!single_value->field_sub__chan.match(other_value.sub__chan(), 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 @GSM_Types.RslChanNr8."); } return FALSE; } boolean RslChanNr8_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_tag.is_bound() || single_value->field_sub__chan.is_bound(); } boolean RslChanNr8_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_tag.is_value() && single_value->field_sub__chan.is_value(); } void RslChanNr8_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; } RslChanNr8 RslChanNr8_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 @GSM_Types.RslChanNr8."); RslChanNr8 ret_val; if (single_value->field_tag.is_bound()) { ret_val.tag() = single_value->field_tag.valueof(); } if (single_value->field_sub__chan.is_bound()) { ret_val.sub__chan() = single_value->field_sub__chan.valueof(); } return ret_val; } void RslChanNr8_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 @GSM_Types.RslChanNr8."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RslChanNr8_template[list_length]; } RslChanNr8_template& RslChanNr8_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 @GSM_Types.RslChanNr8."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.RslChanNr8."); return value_list.list_value[list_index]; } BITSTRING_template& RslChanNr8_template::tag() { set_specific(); return single_value->field_tag; } const BITSTRING_template& RslChanNr8_template::tag() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tag of a non-specific template of type @GSM_Types.RslChanNr8."); return single_value->field_tag; } INTEGER_template& RslChanNr8_template::sub__chan() { set_specific(); return single_value->field_sub__chan; } const INTEGER_template& RslChanNr8_template::sub__chan() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sub_chan of a non-specific template of type @GSM_Types.RslChanNr8."); return single_value->field_sub__chan; } int RslChanNr8_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr8 which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.RslChanNr8 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 @GSM_Types.RslChanNr8 containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr8 containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr8 containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr8 containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr8 containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr8 containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChanNr8 containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.RslChanNr8."); } return 0; } void RslChanNr8_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ tag := "); single_value->field_tag.log(); TTCN_Logger::log_event_str(", sub_chan := "); single_value->field_sub__chan.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 RslChanNr8_template::log_match(const RslChanNr8& 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_tag.match(match_value.tag(), legacy)){ TTCN_Logger::log_logmatch_info(".tag"); single_value->field_tag.log_match(match_value.tag(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sub__chan.match(match_value.sub__chan(), legacy)){ TTCN_Logger::log_logmatch_info(".sub_chan"); single_value->field_sub__chan.log_match(match_value.sub__chan(), 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("{ tag := "); single_value->field_tag.log_match(match_value.tag(), legacy); TTCN_Logger::log_event_str(", sub_chan := "); single_value->field_sub__chan.log_match(match_value.sub__chan(), 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 RslChanNr8_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_tag.encode_text(text_buf); single_value->field_sub__chan.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 @GSM_Types.RslChanNr8."); } } void RslChanNr8_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_tag.decode_text(text_buf); single_value->field_sub__chan.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 RslChanNr8_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 @GSM_Types.RslChanNr8."); } } void RslChanNr8_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: { RslChanNr8_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) tag().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) sub__chan().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "tag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sub_chan")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sub__chan().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslChanNr8: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { RslChanNr8_template* precondition = new RslChanNr8_template; precondition->set_param(*param.get_elem(0)); RslChanNr8_template* implied_template = new RslChanNr8_template; implied_template->set_param(*param.get_elem(1)); *this = RslChanNr8_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.RslChanNr8"); } is_ifpresent = param.get_ifpresent(); } void RslChanNr8_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_tag.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNr8"); single_value->field_sub__chan.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNr8"); 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 : "@GSM_Types.RslChanNr8"); } boolean RslChanNr8_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RslChanNr8_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_lm: return field_lm->is_value(); case ALT_sdcch4: return field_sdcch4->is_value(); case ALT_sdcch8: return field_sdcch8->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void RslChanNrU::clean_up() { switch (union_selection) { case ALT_ch0: delete field_ch0; break; case ALT_lm: delete field_lm; break; case ALT_sdcch4: delete field_sdcch4; break; case ALT_sdcch8: delete field_sdcch8; break; default: break; } union_selection = UNBOUND_VALUE; } void RslChanNrU::log() const { switch (union_selection) { case ALT_ch0: TTCN_Logger::log_event_str("{ ch0 := "); field_ch0->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_lm: TTCN_Logger::log_event_str("{ lm := "); field_lm->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_sdcch4: TTCN_Logger::log_event_str("{ sdcch4 := "); field_sdcch4->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_sdcch8: TTCN_Logger::log_event_str("{ sdcch8 := "); field_sdcch8->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void RslChanNrU::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, "ch0")) { ch0().set_param(*mp_last); if (!ch0().is_bound()) clean_up(); return; } if (!strcmp(last_name, "lm")) { lm().set_param(*mp_last); if (!lm().is_bound()) clean_up(); return; } if (!strcmp(last_name, "sdcch4")) { sdcch4().set_param(*mp_last); if (!sdcch4().is_bound()) clean_up(); return; } if (!strcmp(last_name, "sdcch8")) { sdcch8().set_param(*mp_last); if (!sdcch8().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @GSM_Types.RslChanNrU.", last_name); } void RslChanNrU::set_implicit_omit() { switch (union_selection) { case ALT_ch0: field_ch0->set_implicit_omit(); break; case ALT_lm: field_lm->set_implicit_omit(); break; case ALT_sdcch4: field_sdcch4->set_implicit_omit(); break; case ALT_sdcch8: field_sdcch8->set_implicit_omit(); break; default: break; } } void RslChanNrU::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_ch0: field_ch0->encode_text(text_buf); break; case ALT_lm: field_lm->encode_text(text_buf); break; case ALT_sdcch4: field_sdcch4->encode_text(text_buf); break; case ALT_sdcch8: field_sdcch8->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @GSM_Types.RslChanNrU."); } } void RslChanNrU::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_ch0: ch0().decode_text(text_buf); break; case ALT_lm: lm().decode_text(text_buf); break; case ALT_sdcch4: sdcch4().decode_text(text_buf); break; case ALT_sdcch8: sdcch8().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @GSM_Types.RslChanNrU."); } } void RslChanNrU::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RslChanNrU::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RslChanNrU::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, RslChanNrU_ch0_descr_.raw->forceomit); decoded_length = ch0().RAW_decode(RslChanNrU_ch0_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, RslChanNrU_lm_descr_.raw->forceomit); decoded_length = lm().RAW_decode(RslChanNrU_lm_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 2: { RAW_Force_Omit field_force_omit(2, force_omit, RslChanNrU_sdcch4_descr_.raw->forceomit); decoded_length = sdcch4().RAW_decode(RslChanNrU_sdcch4_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 3: { RAW_Force_Omit field_force_omit(3, force_omit, RslChanNrU_sdcch8_descr_.raw->forceomit); decoded_length = sdcch8().RAW_decode(RslChanNrU_sdcch8_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 { boolean already_failed = FALSE; BITSTRING temporal_0; int decoded_0_length; already_failed = FALSE; if (!already_failed) { p_buf.set_pos_bit(starting_pos + 0); decoded_0_length = temporal_0.RAW_decode(RslChanNr2_tag_descr_, p_buf, limit, top_bit_ord, TRUE); if (decoded_0_length > 0) { if (temporal_0 == bs_0 || temporal_0 == bs_1) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(1, force_omit, RslChanNrU_lm_descr_.raw->forceomit); decoded_length = lm().RAW_decode(RslChanNrU_lm_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_lm).tag() == bs_0 || (*field_lm).tag() == bs_1) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { BITSTRING temporal_1; int decoded_1_length; p_buf.set_pos_bit(starting_pos + 0); decoded_1_length = temporal_1.RAW_decode(RslChanNr4_tag_descr_, p_buf, limit, top_bit_ord, TRUE); if (decoded_1_length > 0) { if (temporal_1 == bs_2) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(2, force_omit, RslChanNrU_sdcch4_descr_.raw->forceomit); decoded_length = sdcch4().RAW_decode(RslChanNrU_sdcch4_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_sdcch4).tag() == bs_2) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { BITSTRING temporal_2; int decoded_2_length; p_buf.set_pos_bit(starting_pos + 0); decoded_2_length = temporal_2.RAW_decode(RslChanNr8_tag_descr_, p_buf, limit, top_bit_ord, TRUE); if (decoded_2_length > 0) { if (temporal_2 == bs_3) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(3, force_omit, RslChanNrU_sdcch8_descr_.raw->forceomit); decoded_length = sdcch8().RAW_decode(RslChanNrU_sdcch8_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_sdcch8).tag() == bs_3) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_0_force_omit(0, force_omit, RslChanNrU_ch0_descr_.raw->forceomit); decoded_length = ch0().RAW_decode(RslChanNrU_ch0_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; } } clean_up(); return -1; } int RslChanNrU::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 4; myleaf.body.node.nodes = init_nodes_of_enc_tree(4); memset(myleaf.body.node.nodes, 0, 4 * sizeof(RAW_enc_tree *)); switch (union_selection) { case ALT_ch0: myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, RslChanNrU_ch0_descr_.raw); encoded_length = field_ch0->RAW_encode(RslChanNrU_ch0_descr_, *myleaf.body.node.nodes[0]); myleaf.body.node.nodes[0]->coding_descr = &RslChanNrU_ch0_descr_; break; case ALT_lm: myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, RslChanNrU_lm_descr_.raw); encoded_length = field_lm->RAW_encode(RslChanNrU_lm_descr_, *myleaf.body.node.nodes[1]); myleaf.body.node.nodes[1]->coding_descr = &RslChanNrU_lm_descr_; if ((*field_lm).tag() != bs_0 && (*field_lm).tag() != bs_1) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={1,0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(RslChanNr2_tag_descr_,*temp_leaf); } else { RAW_enc_tr_pos pr_pos1; pr_pos1.level=myleaf.curr_pos.level+2; int new_pos1[]={1,0}; pr_pos1.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos1); temp_leaf = myleaf.get_node(pr_pos1); if(temp_leaf != NULL){ bs_1.RAW_encode(RslChanNr2_tag_descr_,*temp_leaf); } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); } free_tree_pos(pr_pos1.pos); } free_tree_pos(pr_pos0.pos); } } break; case ALT_sdcch4: myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, RslChanNrU_sdcch4_descr_.raw); encoded_length = field_sdcch4->RAW_encode(RslChanNrU_sdcch4_descr_, *myleaf.body.node.nodes[2]); myleaf.body.node.nodes[2]->coding_descr = &RslChanNrU_sdcch4_descr_; if ((*field_sdcch4).tag() != bs_2) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={2,0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_2.RAW_encode(RslChanNr4_tag_descr_,*temp_leaf); } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); } free_tree_pos(pr_pos0.pos); } } break; case ALT_sdcch8: myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 3, RslChanNrU_sdcch8_descr_.raw); encoded_length = field_sdcch8->RAW_encode(RslChanNrU_sdcch8_descr_, *myleaf.body.node.nodes[3]); myleaf.body.node.nodes[3]->coding_descr = &RslChanNrU_sdcch8_descr_; if ((*field_sdcch8).tag() != bs_3) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={3,0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_3.RAW_encode(RslChanNr8_tag_descr_,*temp_leaf); } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); } free_tree_pos(pr_pos0.pos); } } break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); } return encoded_length; } void RslChanNrU_template::copy_value(const RslChanNrU& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case RslChanNrU::ALT_ch0: single_value.field_ch0 = new RslChanNr0_template(other_value.ch0()); break; case RslChanNrU::ALT_lm: single_value.field_lm = new RslChanNr2_template(other_value.lm()); break; case RslChanNrU::ALT_sdcch4: single_value.field_sdcch4 = new RslChanNr4_template(other_value.sdcch4()); break; case RslChanNrU::ALT_sdcch8: single_value.field_sdcch8 = new RslChanNr8_template(other_value.sdcch8()); break; default: TTCN_error("Initializing a template with an unbound value of type @GSM_Types.RslChanNrU."); } set_selection(SPECIFIC_VALUE); } void RslChanNrU_template::copy_template(const RslChanNrU_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 RslChanNrU::ALT_ch0: single_value.field_ch0 = new RslChanNr0_template(*other_value.single_value.field_ch0); break; case RslChanNrU::ALT_lm: single_value.field_lm = new RslChanNr2_template(*other_value.single_value.field_lm); break; case RslChanNrU::ALT_sdcch4: single_value.field_sdcch4 = new RslChanNr4_template(*other_value.single_value.field_sdcch4); break; case RslChanNrU::ALT_sdcch8: single_value.field_sdcch8 = new RslChanNr8_template(*other_value.single_value.field_sdcch8); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @GSM_Types.RslChanNrU."); } 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 RslChanNrU_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 RslChanNrU_template(*other_value.implication_.precondition); implication_.implied_template = new RslChanNrU_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 @GSM_Types.RslChanNrU."); } set_selection(other_value); } RslChanNrU_template::RslChanNrU_template() { } RslChanNrU_template::RslChanNrU_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RslChanNrU_template::RslChanNrU_template(const RslChanNrU& other_value) { copy_value(other_value); } RslChanNrU_template::RslChanNrU_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChanNrU&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @GSM_Types.RslChanNrU from an unbound optional field."); } } RslChanNrU_template::RslChanNrU_template(RslChanNrU_template* p_precondition, RslChanNrU_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RslChanNrU_template::RslChanNrU_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; } RslChanNrU_template::RslChanNrU_template(const RslChanNrU_template& other_value) : Base_Template(){ copy_template(other_value); } RslChanNrU_template::~RslChanNrU_template() { clean_up(); } void RslChanNrU_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case RslChanNrU::ALT_ch0: delete single_value.field_ch0; break; case RslChanNrU::ALT_lm: delete single_value.field_lm; break; case RslChanNrU::ALT_sdcch4: delete single_value.field_sdcch4; break; case RslChanNrU::ALT_sdcch8: delete single_value.field_sdcch8; 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; } RslChanNrU_template& RslChanNrU_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RslChanNrU_template& RslChanNrU_template::operator=(const RslChanNrU& other_value) { clean_up(); copy_value(other_value); return *this; } RslChanNrU_template& RslChanNrU_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChanNrU&)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 @GSM_Types.RslChanNrU."); } return *this; } RslChanNrU_template& RslChanNrU_template::operator=(const RslChanNrU_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RslChanNrU_template::match(const RslChanNrU& 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: { RslChanNrU::union_selection_type value_selection = other_value.get_selection(); if (value_selection == RslChanNrU::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case RslChanNrU::ALT_ch0: return single_value.field_ch0->match(other_value.ch0(), legacy); case RslChanNrU::ALT_lm: return single_value.field_lm->match(other_value.lm(), legacy); case RslChanNrU::ALT_sdcch4: return single_value.field_sdcch4->match(other_value.sdcch4(), legacy); case RslChanNrU::ALT_sdcch8: return single_value.field_sdcch8->match(other_value.sdcch8(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @GSM_Types.RslChanNrU."); } } 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 @GSM_Types.RslChanNrU."); } return FALSE; } boolean RslChanNrU_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case RslChanNrU::ALT_ch0: return single_value.field_ch0->is_value(); case RslChanNrU::ALT_lm: return single_value.field_lm->is_value(); case RslChanNrU::ALT_sdcch4: return single_value.field_sdcch4->is_value(); case RslChanNrU::ALT_sdcch8: return single_value.field_sdcch8->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @GSM_Types.RslChanNrU."); } } RslChanNrU RslChanNrU_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 @GSM_Types.RslChanNrU."); RslChanNrU ret_val; switch (single_value.union_selection) { case RslChanNrU::ALT_ch0: ret_val.ch0() = single_value.field_ch0->valueof(); break; case RslChanNrU::ALT_lm: ret_val.lm() = single_value.field_lm->valueof(); break; case RslChanNrU::ALT_sdcch4: ret_val.sdcch4() = single_value.field_sdcch4->valueof(); break; case RslChanNrU::ALT_sdcch8: ret_val.sdcch8() = single_value.field_sdcch8->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @GSM_Types.RslChanNrU."); } return ret_val; } RslChanNrU_template& RslChanNrU_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 @GSM_Types.RslChanNrU."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @GSM_Types.RslChanNrU."); return value_list.list_value[list_index]; } void RslChanNrU_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 @GSM_Types.RslChanNrU."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RslChanNrU_template[list_length]; } RslChanNr0_template& RslChanNrU_template::ch0() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RslChanNrU::ALT_ch0) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ch0 = new RslChanNr0_template(ANY_VALUE); else single_value.field_ch0 = new RslChanNr0_template; single_value.union_selection = RslChanNrU::ALT_ch0; set_selection(SPECIFIC_VALUE); } return *single_value.field_ch0; } const RslChanNr0_template& RslChanNrU_template::ch0() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ch0 in a non-specific template of union type @GSM_Types.RslChanNrU."); if (single_value.union_selection != RslChanNrU::ALT_ch0) TTCN_error("Accessing non-selected field ch0 in a template of union type @GSM_Types.RslChanNrU."); return *single_value.field_ch0; } RslChanNr2_template& RslChanNrU_template::lm() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RslChanNrU::ALT_lm) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_lm = new RslChanNr2_template(ANY_VALUE); else single_value.field_lm = new RslChanNr2_template; single_value.union_selection = RslChanNrU::ALT_lm; set_selection(SPECIFIC_VALUE); } return *single_value.field_lm; } const RslChanNr2_template& RslChanNrU_template::lm() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lm in a non-specific template of union type @GSM_Types.RslChanNrU."); if (single_value.union_selection != RslChanNrU::ALT_lm) TTCN_error("Accessing non-selected field lm in a template of union type @GSM_Types.RslChanNrU."); return *single_value.field_lm; } RslChanNr4_template& RslChanNrU_template::sdcch4() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RslChanNrU::ALT_sdcch4) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_sdcch4 = new RslChanNr4_template(ANY_VALUE); else single_value.field_sdcch4 = new RslChanNr4_template; single_value.union_selection = RslChanNrU::ALT_sdcch4; set_selection(SPECIFIC_VALUE); } return *single_value.field_sdcch4; } const RslChanNr4_template& RslChanNrU_template::sdcch4() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sdcch4 in a non-specific template of union type @GSM_Types.RslChanNrU."); if (single_value.union_selection != RslChanNrU::ALT_sdcch4) TTCN_error("Accessing non-selected field sdcch4 in a template of union type @GSM_Types.RslChanNrU."); return *single_value.field_sdcch4; } RslChanNr8_template& RslChanNrU_template::sdcch8() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != RslChanNrU::ALT_sdcch8) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_sdcch8 = new RslChanNr8_template(ANY_VALUE); else single_value.field_sdcch8 = new RslChanNr8_template; single_value.union_selection = RslChanNrU::ALT_sdcch8; set_selection(SPECIFIC_VALUE); } return *single_value.field_sdcch8; } const RslChanNr8_template& RslChanNrU_template::sdcch8() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sdcch8 in a non-specific template of union type @GSM_Types.RslChanNrU."); if (single_value.union_selection != RslChanNrU::ALT_sdcch8) TTCN_error("Accessing non-selected field sdcch8 in a template of union type @GSM_Types.RslChanNrU."); return *single_value.field_sdcch8; } boolean RslChanNrU_template::ischosen(RslChanNrU::union_selection_type checked_selection) const { if (checked_selection == RslChanNrU::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @GSM_Types.RslChanNrU."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == RslChanNrU::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @GSM_Types.RslChanNrU."); 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 @GSM_Types.RslChanNrU 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 RslChanNrU_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case RslChanNrU::ALT_ch0: TTCN_Logger::log_event_str("{ ch0 := "); single_value.field_ch0->log(); TTCN_Logger::log_event_str(" }"); break; case RslChanNrU::ALT_lm: TTCN_Logger::log_event_str("{ lm := "); single_value.field_lm->log(); TTCN_Logger::log_event_str(" }"); break; case RslChanNrU::ALT_sdcch4: TTCN_Logger::log_event_str("{ sdcch4 := "); single_value.field_sdcch4->log(); TTCN_Logger::log_event_str(" }"); break; case RslChanNrU::ALT_sdcch8: TTCN_Logger::log_event_str("{ sdcch8 := "); single_value.field_sdcch8->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 RslChanNrU_template::log_match(const RslChanNrU& 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 RslChanNrU::ALT_ch0: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".ch0"); single_value.field_ch0->log_match(match_value.ch0(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ ch0 := "); single_value.field_ch0->log_match(match_value.ch0(), legacy); TTCN_Logger::log_event_str(" }"); } break; case RslChanNrU::ALT_lm: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".lm"); single_value.field_lm->log_match(match_value.lm(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ lm := "); single_value.field_lm->log_match(match_value.lm(), legacy); TTCN_Logger::log_event_str(" }"); } break; case RslChanNrU::ALT_sdcch4: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".sdcch4"); single_value.field_sdcch4->log_match(match_value.sdcch4(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ sdcch4 := "); single_value.field_sdcch4->log_match(match_value.sdcch4(), legacy); TTCN_Logger::log_event_str(" }"); } break; case RslChanNrU::ALT_sdcch8: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".sdcch8"); single_value.field_sdcch8->log_match(match_value.sdcch8(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ sdcch8 := "); single_value.field_sdcch8->log_match(match_value.sdcch8(), 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 RslChanNrU_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 RslChanNrU::ALT_ch0: single_value.field_ch0->encode_text(text_buf); break; case RslChanNrU::ALT_lm: single_value.field_lm->encode_text(text_buf); break; case RslChanNrU::ALT_sdcch4: single_value.field_sdcch4->encode_text(text_buf); break; case RslChanNrU::ALT_sdcch8: single_value.field_sdcch8->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @GSM_Types.RslChanNrU."); } 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 @GSM_Types.RslChanNrU."); } } void RslChanNrU_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = RslChanNrU::UNBOUND_VALUE; RslChanNrU::union_selection_type new_selection = (RslChanNrU::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case RslChanNrU::ALT_ch0: single_value.field_ch0 = new RslChanNr0_template; single_value.field_ch0->decode_text(text_buf); break; case RslChanNrU::ALT_lm: single_value.field_lm = new RslChanNr2_template; single_value.field_lm->decode_text(text_buf); break; case RslChanNrU::ALT_sdcch4: single_value.field_sdcch4 = new RslChanNr4_template; single_value.field_sdcch4->decode_text(text_buf); break; case RslChanNrU::ALT_sdcch8: single_value.field_sdcch8 = new RslChanNr8_template; single_value.field_sdcch8->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @GSM_Types.RslChanNrU."); } 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 RslChanNrU_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 @GSM_Types.RslChanNrU."); } } boolean RslChanNrU_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RslChanNrU_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 `@GSM_Types.RslChanNrU'"); } if (strcmp("ch0", param_field) == 0) { ch0().set_param(param); return; } else if (strcmp("lm", param_field) == 0) { lm().set_param(param); return; } else if (strcmp("sdcch4", param_field) == 0) { sdcch4().set_param(param); return; } else if (strcmp("sdcch8", param_field) == 0) { sdcch8().set_param(param); return; } else param.error("Field `%s' not found in union template type `@GSM_Types.RslChanNrU'", 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: { RslChanNrU_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", "@GSM_Types.RslChanNrU"); 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, "ch0")) { ch0().set_param(*mp_last); break; } if (!strcmp(last_name, "lm")) { lm().set_param(*mp_last); break; } if (!strcmp(last_name, "sdcch4")) { sdcch4().set_param(*mp_last); break; } if (!strcmp(last_name, "sdcch8")) { sdcch8().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @GSM_Types.RslChanNrU.", last_name); } break; case Module_Param::MP_Implication_Template: { RslChanNrU_template* precondition = new RslChanNrU_template; precondition->set_param(*m_p->get_elem(0)); RslChanNrU_template* implied_template = new RslChanNrU_template; implied_template->set_param(*m_p->get_elem(1)); *this = RslChanNrU_template(precondition, implied_template); } break; default: param.type_error("union template", "@GSM_Types.RslChanNrU"); } is_ifpresent = param.get_ifpresent(); } void RslChanNrU_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 RslChanNrU::ALT_ch0: single_value.field_ch0->check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNrU"); return; case RslChanNrU::ALT_lm: single_value.field_lm->check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNrU"); return; case RslChanNrU::ALT_sdcch4: single_value.field_sdcch4->check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNrU"); return; case RslChanNrU::ALT_sdcch8: single_value.field_sdcch8->check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChanNrU"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @GSM_Types.RslChanNrU."); } 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 : "@GSM_Types.RslChanNrU"); } RslChannelNr::RslChannelNr() { } RslChannelNr::RslChannelNr(const RslChanNrU& par_u, const INTEGER& par_tn) : field_u(par_u), field_tn(par_tn) { } RslChannelNr::RslChannelNr(const RslChannelNr& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_Types.RslChannelNr."); if (other_value.u().is_bound()) field_u = other_value.u(); else field_u.clean_up(); if (other_value.tn().is_bound()) field_tn = other_value.tn(); else field_tn.clean_up(); } void RslChannelNr::clean_up() { field_u.clean_up(); field_tn.clean_up(); } const TTCN_Typedescriptor_t* RslChannelNr::get_descriptor() const { return &RslChannelNr_descr_; } RslChannelNr& RslChannelNr::operator=(const RslChannelNr& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_Types.RslChannelNr."); if (other_value.u().is_bound()) field_u = other_value.u(); else field_u.clean_up(); if (other_value.tn().is_bound()) field_tn = other_value.tn(); else field_tn.clean_up(); } return *this; } boolean RslChannelNr::operator==(const RslChannelNr& other_value) const { return field_u==other_value.field_u && field_tn==other_value.field_tn; } boolean RslChannelNr::is_bound() const { return (field_u.is_bound()) || (field_tn.is_bound()); } boolean RslChannelNr::is_value() const { return field_u.is_value() && field_tn.is_value(); } void RslChannelNr::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ u := "); field_u.log(); TTCN_Logger::log_event_str(", tn := "); field_tn.log(); TTCN_Logger::log_event_str(" }"); } void RslChannelNr::set_implicit_omit() { if (u().is_bound()) u().set_implicit_omit(); if (tn().is_bound()) tn().set_implicit_omit(); } void RslChannelNr::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (20 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) u().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tn().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "u")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { u().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslChannelNr: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.RslChannelNr"); } } void RslChannelNr::encode_text(Text_Buf& text_buf) const { field_u.encode_text(text_buf); field_tn.encode_text(text_buf); } void RslChannelNr::decode_text(Text_Buf& text_buf) { field_u.decode_text(text_buf); field_tn.decode_text(text_buf); } void RslChannelNr::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RslChannelNr::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RslChannelNr::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, RslChannelNr_u_descr_.raw->forceomit); decoded_field_length = field_u.RAW_decode(RslChannelNr_u_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, RslChannelNr_tn_descr_.raw->forceomit); decoded_field_length = field_tn.RAW_decode(RslChannelNr_tn_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int RslChannelNr::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 = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, RslChannelNr_u_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RslChannelNr_tn_descr_.raw); encoded_length += field_u.RAW_encode(RslChannelNr_u_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_tn.RAW_encode(RslChannelNr_tn_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct RslChannelNr_template::single_value_struct { RslChanNrU_template field_u; INTEGER_template field_tn; }; void RslChannelNr_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_u = ANY_VALUE; single_value->field_tn = ANY_VALUE; } } } void RslChannelNr_template::copy_value(const RslChannelNr& other_value) { single_value = new single_value_struct; if (other_value.u().is_bound()) { single_value->field_u = other_value.u(); } else { single_value->field_u.clean_up(); } if (other_value.tn().is_bound()) { single_value->field_tn = other_value.tn(); } else { single_value->field_tn.clean_up(); } set_selection(SPECIFIC_VALUE); } void RslChannelNr_template::copy_template(const RslChannelNr_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.u().get_selection()) { single_value->field_u = other_value.u(); } else { single_value->field_u.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.tn().get_selection()) { single_value->field_tn = other_value.tn(); } else { single_value->field_tn.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 RslChannelNr_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 RslChannelNr_template(*other_value.implication_.precondition); implication_.implied_template = new RslChannelNr_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 @GSM_Types.RslChannelNr."); break; } set_selection(other_value); } RslChannelNr_template::RslChannelNr_template() { } RslChannelNr_template::RslChannelNr_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RslChannelNr_template::RslChannelNr_template(const RslChannelNr& other_value) { copy_value(other_value); } RslChannelNr_template::RslChannelNr_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChannelNr&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.RslChannelNr from an unbound optional field."); } } RslChannelNr_template::RslChannelNr_template(RslChannelNr_template* p_precondition, RslChannelNr_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RslChannelNr_template::RslChannelNr_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; } RslChannelNr_template::RslChannelNr_template(const RslChannelNr_template& other_value) : Base_Template() { copy_template(other_value); } RslChannelNr_template::~RslChannelNr_template() { clean_up(); } RslChannelNr_template& RslChannelNr_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RslChannelNr_template& RslChannelNr_template::operator=(const RslChannelNr& other_value) { clean_up(); copy_value(other_value); return *this; } RslChannelNr_template& RslChannelNr_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslChannelNr&)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 @GSM_Types.RslChannelNr."); } return *this; } RslChannelNr_template& RslChannelNr_template::operator=(const RslChannelNr_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RslChannelNr_template::match(const RslChannelNr& 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.u().is_bound()) return FALSE; if(!single_value->field_u.match(other_value.u(), legacy))return FALSE; if(!other_value.tn().is_bound()) return FALSE; if(!single_value->field_tn.match(other_value.tn(), 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 @GSM_Types.RslChannelNr."); } return FALSE; } boolean RslChannelNr_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_u.is_bound() || single_value->field_tn.is_bound(); } boolean RslChannelNr_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_u.is_value() && single_value->field_tn.is_value(); } void RslChannelNr_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; } RslChannelNr RslChannelNr_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 @GSM_Types.RslChannelNr."); RslChannelNr ret_val; if (single_value->field_u.is_bound()) { ret_val.u() = single_value->field_u.valueof(); } if (single_value->field_tn.is_bound()) { ret_val.tn() = single_value->field_tn.valueof(); } return ret_val; } void RslChannelNr_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 @GSM_Types.RslChannelNr."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RslChannelNr_template[list_length]; } RslChannelNr_template& RslChannelNr_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 @GSM_Types.RslChannelNr."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.RslChannelNr."); return value_list.list_value[list_index]; } RslChanNrU_template& RslChannelNr_template::u() { set_specific(); return single_value->field_u; } const RslChanNrU_template& RslChannelNr_template::u() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field u of a non-specific template of type @GSM_Types.RslChannelNr."); return single_value->field_u; } INTEGER_template& RslChannelNr_template::tn() { set_specific(); return single_value->field_tn; } const INTEGER_template& RslChannelNr_template::tn() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tn of a non-specific template of type @GSM_Types.RslChannelNr."); return single_value->field_tn; } int RslChannelNr_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChannelNr which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.RslChannelNr 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 @GSM_Types.RslChannelNr containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChannelNr containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChannelNr containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChannelNr containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChannelNr containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChannelNr containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslChannelNr containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.RslChannelNr."); } return 0; } void RslChannelNr_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ u := "); single_value->field_u.log(); TTCN_Logger::log_event_str(", tn := "); single_value->field_tn.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 RslChannelNr_template::log_match(const RslChannelNr& 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_u.match(match_value.u(), legacy)){ TTCN_Logger::log_logmatch_info(".u"); single_value->field_u.log_match(match_value.u(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_tn.match(match_value.tn(), legacy)){ TTCN_Logger::log_logmatch_info(".tn"); single_value->field_tn.log_match(match_value.tn(), 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("{ u := "); single_value->field_u.log_match(match_value.u(), legacy); TTCN_Logger::log_event_str(", tn := "); single_value->field_tn.log_match(match_value.tn(), 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 RslChannelNr_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_u.encode_text(text_buf); single_value->field_tn.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 @GSM_Types.RslChannelNr."); } } void RslChannelNr_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_u.decode_text(text_buf); single_value->field_tn.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 RslChannelNr_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 @GSM_Types.RslChannelNr."); } } void RslChannelNr_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: { RslChannelNr_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) u().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) tn().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "u")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { u().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslChannelNr: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { RslChannelNr_template* precondition = new RslChannelNr_template; precondition->set_param(*param.get_elem(0)); RslChannelNr_template* implied_template = new RslChannelNr_template; implied_template->set_param(*param.get_elem(1)); *this = RslChannelNr_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.RslChannelNr"); } is_ifpresent = param.get_ifpresent(); } void RslChannelNr_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_u.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChannelNr"); single_value->field_tn.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslChannelNr"); 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 : "@GSM_Types.RslChannelNr"); } boolean RslChannelNr_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RslChannelNr_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(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.RslLinkIdC."); return enum_value > other_value; } boolean RslLinkIdC::operator>(const RslLinkIdC& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.RslLinkIdC."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.RslLinkIdC."); return enum_value > other_value.enum_value; } const char *RslLinkIdC::enum_to_str(enum_type enum_par) { switch (enum_par) { case FACCH__SDCCH: return "FACCH_SDCCH"; case SACCH: return "SACCH"; case OSMO__PTCCH: return "OSMO_PTCCH"; default: return ""; } } RslLinkIdC::enum_type RslLinkIdC::str_to_enum(const char *str_par) { if (!strcmp(str_par, "FACCH_SDCCH")) return FACCH__SDCCH; else if (!strcmp(str_par, "SACCH")) return SACCH; else if (!strcmp(str_par, "OSMO_PTCCH")) return OSMO__PTCCH; else return UNKNOWN_VALUE; } boolean RslLinkIdC::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int RslLinkIdC::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 @GSM_Types.RslLinkIdC.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int RslLinkIdC::enum2int(const RslLinkIdC& 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 @GSM_Types.RslLinkIdC.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void RslLinkIdC::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @GSM_Types.RslLinkIdC.", int_val); enum_value = (enum_type)int_val; } RslLinkIdC::operator RslLinkIdC::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @GSM_Types.RslLinkIdC."); return enum_value; } void RslLinkIdC::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 RslLinkIdC::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", "@GSM_Types.RslLinkIdC"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @GSM_Types.RslLinkIdC."); } } void RslLinkIdC::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @GSM_Types.RslLinkIdC."); text_buf.push_int(enum_value); } void RslLinkIdC::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 @GSM_Types.RslLinkIdC.", enum_value); } void RslLinkIdC::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RslLinkIdC::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RslLinkIdC::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 RslLinkIdC::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 RslLinkIdC_template::copy_template(const RslLinkIdC_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 RslLinkIdC_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 RslLinkIdC_template(*other_value.implication_.precondition); implication_.implied_template = new RslLinkIdC_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 @GSM_Types.RslLinkIdC."); } } RslLinkIdC_template::RslLinkIdC_template() { } RslLinkIdC_template::RslLinkIdC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RslLinkIdC_template::RslLinkIdC_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!RslLinkIdC::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @GSM_Types.RslLinkIdC with unknown numeric value %d.", other_value); single_value = (RslLinkIdC::enum_type)other_value; } RslLinkIdC_template::RslLinkIdC_template(RslLinkIdC::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } RslLinkIdC_template::RslLinkIdC_template(const RslLinkIdC& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == RslLinkIdC::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @GSM_Types.RslLinkIdC."); single_value = other_value.enum_value; } RslLinkIdC_template::RslLinkIdC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RslLinkIdC::enum_type)(const RslLinkIdC&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @GSM_Types.RslLinkIdC from an unbound optional field."); } } RslLinkIdC_template::RslLinkIdC_template(RslLinkIdC_template* p_precondition, RslLinkIdC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RslLinkIdC_template::RslLinkIdC_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; } RslLinkIdC_template::RslLinkIdC_template(const RslLinkIdC_template& other_value) : Base_Template() { copy_template(other_value); } RslLinkIdC_template::~RslLinkIdC_template() { clean_up(); } boolean RslLinkIdC_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean RslLinkIdC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != RslLinkIdC::UNBOUND_VALUE; } void RslLinkIdC_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; } RslLinkIdC_template& RslLinkIdC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RslLinkIdC_template& RslLinkIdC_template::operator=(int other_value) { if (!RslLinkIdC::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @GSM_Types.RslLinkIdC.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (RslLinkIdC::enum_type)other_value; return *this; } RslLinkIdC_template& RslLinkIdC_template::operator=(RslLinkIdC::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } RslLinkIdC_template& RslLinkIdC_template::operator=(const RslLinkIdC& other_value) { if (other_value.enum_value == RslLinkIdC::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @GSM_Types.RslLinkIdC to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } RslLinkIdC_template& RslLinkIdC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RslLinkIdC::enum_type)(const RslLinkIdC&)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 @GSM_Types.RslLinkIdC."); } return *this; } RslLinkIdC_template& RslLinkIdC_template::operator=(const RslLinkIdC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RslLinkIdC_template::match(RslLinkIdC::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 @GSM_Types.RslLinkIdC."); } return FALSE; } boolean RslLinkIdC_template::match(const RslLinkIdC& other_value, boolean) const { if (other_value.enum_value == RslLinkIdC::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @GSM_Types.RslLinkIdC with an unbound value."); return match(other_value.enum_value); } RslLinkIdC::enum_type RslLinkIdC_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 @GSM_Types.RslLinkIdC."); return single_value; } void RslLinkIdC_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @GSM_Types.RslLinkIdC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RslLinkIdC_template[list_length]; } RslLinkIdC_template& RslLinkIdC_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 @GSM_Types.RslLinkIdC."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @GSM_Types.RslLinkIdC."); return value_list.list_value[list_index]; } void RslLinkIdC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(RslLinkIdC::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 RslLinkIdC_template::log_match(const RslLinkIdC& 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 RslLinkIdC_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 @GSM_Types.RslLinkIdC."); } } void RslLinkIdC_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (RslLinkIdC::enum_type)text_buf.pull_int().get_val(); if (!RslLinkIdC::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @GSM_Types.RslLinkIdC.", 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 RslLinkIdC_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 @GSM_Types.RslLinkIdC."); } } boolean RslLinkIdC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RslLinkIdC_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: { RslLinkIdC_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: { RslLinkIdC::enum_type enum_val = RslLinkIdC::str_to_enum(m_p->get_enumerated()); if (!RslLinkIdC::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @GSM_Types.RslLinkIdC."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { RslLinkIdC_template* precondition = new RslLinkIdC_template; precondition->set_param(*m_p->get_elem(0)); RslLinkIdC_template* implied_template = new RslLinkIdC_template; implied_template->set_param(*m_p->get_elem(1)); *this = RslLinkIdC_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@GSM_Types.RslLinkIdC"); } is_ifpresent = param.get_ifpresent(); } void RslLinkIdC_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 : "@GSM_Types.RslLinkIdC"); } RslSapi0Prio::RslSapi0Prio() { enum_value = UNBOUND_VALUE; } RslSapi0Prio::RslSapi0Prio(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @GSM_Types.RslSapi0Prio with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } RslSapi0Prio::RslSapi0Prio(enum_type other_value) { enum_value = other_value; } RslSapi0Prio::RslSapi0Prio(const RslSapi0Prio& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); enum_value = other_value.enum_value; } RslSapi0Prio& RslSapi0Prio::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @GSM_Types.RslSapi0Prio.", other_value); enum_value = (enum_type)other_value; return *this; } RslSapi0Prio& RslSapi0Prio::operator=(enum_type other_value) { enum_value = other_value; return *this; } RslSapi0Prio& RslSapi0Prio::operator=(const RslSapi0Prio& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); enum_value = other_value.enum_value; return *this; } boolean RslSapi0Prio::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 @GSM_Types.RslSapi0Prio."); return enum_value == other_value; } boolean RslSapi0Prio::operator==(const RslSapi0Prio& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); return enum_value == other_value.enum_value; } boolean RslSapi0Prio::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 @GSM_Types.RslSapi0Prio."); return enum_value < other_value; } boolean RslSapi0Prio::operator<(const RslSapi0Prio& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); return enum_value < other_value.enum_value; } boolean RslSapi0Prio::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 @GSM_Types.RslSapi0Prio."); return enum_value > other_value; } boolean RslSapi0Prio::operator>(const RslSapi0Prio& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); return enum_value > other_value.enum_value; } const char *RslSapi0Prio::enum_to_str(enum_type enum_par) { switch (enum_par) { case SAPI0__PRIO__NORMAL: return "SAPI0_PRIO_NORMAL"; case SAPI0__PRIO__HIGH: return "SAPI0_PRIO_HIGH"; case SAPI0__PRIO__LOW: return "SAPI0_PRIO_LOW"; default: return ""; } } RslSapi0Prio::enum_type RslSapi0Prio::str_to_enum(const char *str_par) { if (!strcmp(str_par, "SAPI0_PRIO_NORMAL")) return SAPI0__PRIO__NORMAL; else if (!strcmp(str_par, "SAPI0_PRIO_HIGH")) return SAPI0__PRIO__HIGH; else if (!strcmp(str_par, "SAPI0_PRIO_LOW")) return SAPI0__PRIO__LOW; else return UNKNOWN_VALUE; } boolean RslSapi0Prio::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int RslSapi0Prio::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 @GSM_Types.RslSapi0Prio.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int RslSapi0Prio::enum2int(const RslSapi0Prio& 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 @GSM_Types.RslSapi0Prio.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void RslSapi0Prio::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @GSM_Types.RslSapi0Prio.", int_val); enum_value = (enum_type)int_val; } RslSapi0Prio::operator RslSapi0Prio::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @GSM_Types.RslSapi0Prio."); return enum_value; } void RslSapi0Prio::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 RslSapi0Prio::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", "@GSM_Types.RslSapi0Prio"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @GSM_Types.RslSapi0Prio."); } } void RslSapi0Prio::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); text_buf.push_int(enum_value); } void RslSapi0Prio::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 @GSM_Types.RslSapi0Prio.", enum_value); } void RslSapi0Prio::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RslSapi0Prio::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RslSapi0Prio::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 RslSapi0Prio::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 RslSapi0Prio_template::copy_template(const RslSapi0Prio_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 RslSapi0Prio_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 RslSapi0Prio_template(*other_value.implication_.precondition); implication_.implied_template = new RslSapi0Prio_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 @GSM_Types.RslSapi0Prio."); } } RslSapi0Prio_template::RslSapi0Prio_template() { } RslSapi0Prio_template::RslSapi0Prio_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RslSapi0Prio_template::RslSapi0Prio_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!RslSapi0Prio::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @GSM_Types.RslSapi0Prio with unknown numeric value %d.", other_value); single_value = (RslSapi0Prio::enum_type)other_value; } RslSapi0Prio_template::RslSapi0Prio_template(RslSapi0Prio::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } RslSapi0Prio_template::RslSapi0Prio_template(const RslSapi0Prio& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == RslSapi0Prio::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @GSM_Types.RslSapi0Prio."); single_value = other_value.enum_value; } RslSapi0Prio_template::RslSapi0Prio_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RslSapi0Prio::enum_type)(const RslSapi0Prio&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @GSM_Types.RslSapi0Prio from an unbound optional field."); } } RslSapi0Prio_template::RslSapi0Prio_template(RslSapi0Prio_template* p_precondition, RslSapi0Prio_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RslSapi0Prio_template::RslSapi0Prio_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; } RslSapi0Prio_template::RslSapi0Prio_template(const RslSapi0Prio_template& other_value) : Base_Template() { copy_template(other_value); } RslSapi0Prio_template::~RslSapi0Prio_template() { clean_up(); } boolean RslSapi0Prio_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean RslSapi0Prio_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != RslSapi0Prio::UNBOUND_VALUE; } void RslSapi0Prio_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; } RslSapi0Prio_template& RslSapi0Prio_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RslSapi0Prio_template& RslSapi0Prio_template::operator=(int other_value) { if (!RslSapi0Prio::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @GSM_Types.RslSapi0Prio.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (RslSapi0Prio::enum_type)other_value; return *this; } RslSapi0Prio_template& RslSapi0Prio_template::operator=(RslSapi0Prio::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } RslSapi0Prio_template& RslSapi0Prio_template::operator=(const RslSapi0Prio& other_value) { if (other_value.enum_value == RslSapi0Prio::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @GSM_Types.RslSapi0Prio to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } RslSapi0Prio_template& RslSapi0Prio_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RslSapi0Prio::enum_type)(const RslSapi0Prio&)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 @GSM_Types.RslSapi0Prio."); } return *this; } RslSapi0Prio_template& RslSapi0Prio_template::operator=(const RslSapi0Prio_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RslSapi0Prio_template::match(RslSapi0Prio::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 @GSM_Types.RslSapi0Prio."); } return FALSE; } boolean RslSapi0Prio_template::match(const RslSapi0Prio& other_value, boolean) const { if (other_value.enum_value == RslSapi0Prio::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @GSM_Types.RslSapi0Prio with an unbound value."); return match(other_value.enum_value); } RslSapi0Prio::enum_type RslSapi0Prio_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 @GSM_Types.RslSapi0Prio."); return single_value; } void RslSapi0Prio_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @GSM_Types.RslSapi0Prio."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RslSapi0Prio_template[list_length]; } RslSapi0Prio_template& RslSapi0Prio_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 @GSM_Types.RslSapi0Prio."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @GSM_Types.RslSapi0Prio."); return value_list.list_value[list_index]; } void RslSapi0Prio_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(RslSapi0Prio::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 RslSapi0Prio_template::log_match(const RslSapi0Prio& 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 RslSapi0Prio_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 @GSM_Types.RslSapi0Prio."); } } void RslSapi0Prio_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (RslSapi0Prio::enum_type)text_buf.pull_int().get_val(); if (!RslSapi0Prio::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @GSM_Types.RslSapi0Prio.", 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 RslSapi0Prio_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 @GSM_Types.RslSapi0Prio."); } } boolean RslSapi0Prio_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RslSapi0Prio_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: { RslSapi0Prio_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: { RslSapi0Prio::enum_type enum_val = RslSapi0Prio::str_to_enum(m_p->get_enumerated()); if (!RslSapi0Prio::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @GSM_Types.RslSapi0Prio."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { RslSapi0Prio_template* precondition = new RslSapi0Prio_template; precondition->set_param(*m_p->get_elem(0)); RslSapi0Prio_template* implied_template = new RslSapi0Prio_template; implied_template->set_param(*m_p->get_elem(1)); *this = RslSapi0Prio_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@GSM_Types.RslSapi0Prio"); } is_ifpresent = param.get_ifpresent(); } void RslSapi0Prio_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 : "@GSM_Types.RslSapi0Prio"); } RslLinkId::RslLinkId() { } RslLinkId::RslLinkId(const RslLinkIdC& par_c, const BOOLEAN& par_na, const RslSapi0Prio& par_prio, const INTEGER& par_sapi) : field_c(par_c), field_na(par_na), field_prio(par_prio), field_sapi(par_sapi) { } RslLinkId::RslLinkId(const RslLinkId& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_Types.RslLinkId."); if (other_value.c().is_bound()) field_c = other_value.c(); else field_c.clean_up(); if (other_value.na().is_bound()) field_na = other_value.na(); else field_na.clean_up(); if (other_value.prio().is_bound()) field_prio = other_value.prio(); else field_prio.clean_up(); if (other_value.sapi().is_bound()) field_sapi = other_value.sapi(); else field_sapi.clean_up(); } void RslLinkId::clean_up() { field_c.clean_up(); field_na.clean_up(); field_prio.clean_up(); field_sapi.clean_up(); } const TTCN_Typedescriptor_t* RslLinkId::get_descriptor() const { return &RslLinkId_descr_; } RslLinkId& RslLinkId::operator=(const RslLinkId& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_Types.RslLinkId."); if (other_value.c().is_bound()) field_c = other_value.c(); else field_c.clean_up(); if (other_value.na().is_bound()) field_na = other_value.na(); else field_na.clean_up(); if (other_value.prio().is_bound()) field_prio = other_value.prio(); else field_prio.clean_up(); if (other_value.sapi().is_bound()) field_sapi = other_value.sapi(); else field_sapi.clean_up(); } return *this; } boolean RslLinkId::operator==(const RslLinkId& other_value) const { return field_c==other_value.field_c && field_na==other_value.field_na && field_prio==other_value.field_prio && field_sapi==other_value.field_sapi; } boolean RslLinkId::is_bound() const { return (field_c.is_bound()) || (field_na.is_bound()) || (field_prio.is_bound()) || (field_sapi.is_bound()); } boolean RslLinkId::is_value() const { return field_c.is_value() && field_na.is_value() && field_prio.is_value() && field_sapi.is_value(); } void RslLinkId::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ c := "); field_c.log(); TTCN_Logger::log_event_str(", na := "); field_na.log(); TTCN_Logger::log_event_str(", prio := "); field_prio.log(); TTCN_Logger::log_event_str(", sapi := "); field_sapi.log(); TTCN_Logger::log_event_str(" }"); } void RslLinkId::set_implicit_omit() { if (c().is_bound()) c().set_implicit_omit(); if (na().is_bound()) na().set_implicit_omit(); if (prio().is_bound()) prio().set_implicit_omit(); if (sapi().is_bound()) sapi().set_implicit_omit(); } void RslLinkId::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (40 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) c().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) na().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) prio().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) sapi().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "c")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { c().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "na")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { na().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prio().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslLinkId: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.RslLinkId"); } } void RslLinkId::encode_text(Text_Buf& text_buf) const { field_c.encode_text(text_buf); field_na.encode_text(text_buf); field_prio.encode_text(text_buf); field_sapi.encode_text(text_buf); } void RslLinkId::decode_text(Text_Buf& text_buf) { field_c.decode_text(text_buf); field_na.decode_text(text_buf); field_prio.decode_text(text_buf); field_sapi.decode_text(text_buf); } void RslLinkId::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RslLinkId::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RslLinkId::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, RslLinkId_c_descr_.raw->forceomit); decoded_field_length = field_c.RAW_decode(RslLinkId_c_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, RslLinkId_na_descr_.raw->forceomit); decoded_field_length = field_na.RAW_decode(RslLinkId_na_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_2_force_omit(2, force_omit, RslLinkId_prio_descr_.raw->forceomit); decoded_field_length = field_prio.RAW_decode(RslLinkId_prio_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, RslLinkId_sapi_descr_.raw->forceomit); decoded_field_length = field_sapi.RAW_decode(RslLinkId_sapi_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int RslLinkId::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 4; myleaf.body.node.nodes = init_nodes_of_enc_tree(4); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, RslLinkId_c_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RslLinkId_na_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, RslLinkId_prio_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, RslLinkId_sapi_descr_.raw); encoded_length += field_c.RAW_encode(RslLinkId_c_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_na.RAW_encode(RslLinkId_na_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_prio.RAW_encode(RslLinkId_prio_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_sapi.RAW_encode(RslLinkId_sapi_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct RslLinkId_template::single_value_struct { RslLinkIdC_template field_c; BOOLEAN_template field_na; RslSapi0Prio_template field_prio; INTEGER_template field_sapi; }; void RslLinkId_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_c = ANY_VALUE; single_value->field_na = ANY_VALUE; single_value->field_prio = ANY_VALUE; single_value->field_sapi = ANY_VALUE; } } } void RslLinkId_template::copy_value(const RslLinkId& other_value) { single_value = new single_value_struct; if (other_value.c().is_bound()) { single_value->field_c = other_value.c(); } else { single_value->field_c.clean_up(); } if (other_value.na().is_bound()) { single_value->field_na = other_value.na(); } else { single_value->field_na.clean_up(); } if (other_value.prio().is_bound()) { single_value->field_prio = other_value.prio(); } else { single_value->field_prio.clean_up(); } if (other_value.sapi().is_bound()) { single_value->field_sapi = other_value.sapi(); } else { single_value->field_sapi.clean_up(); } set_selection(SPECIFIC_VALUE); } void RslLinkId_template::copy_template(const RslLinkId_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.c().get_selection()) { single_value->field_c = other_value.c(); } else { single_value->field_c.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.na().get_selection()) { single_value->field_na = other_value.na(); } else { single_value->field_na.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.prio().get_selection()) { single_value->field_prio = other_value.prio(); } else { single_value->field_prio.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sapi().get_selection()) { single_value->field_sapi = other_value.sapi(); } else { single_value->field_sapi.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 RslLinkId_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 RslLinkId_template(*other_value.implication_.precondition); implication_.implied_template = new RslLinkId_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 @GSM_Types.RslLinkId."); break; } set_selection(other_value); } RslLinkId_template::RslLinkId_template() { } RslLinkId_template::RslLinkId_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RslLinkId_template::RslLinkId_template(const RslLinkId& other_value) { copy_value(other_value); } RslLinkId_template::RslLinkId_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslLinkId&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.RslLinkId from an unbound optional field."); } } RslLinkId_template::RslLinkId_template(RslLinkId_template* p_precondition, RslLinkId_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RslLinkId_template::RslLinkId_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; } RslLinkId_template::RslLinkId_template(const RslLinkId_template& other_value) : Base_Template() { copy_template(other_value); } RslLinkId_template::~RslLinkId_template() { clean_up(); } RslLinkId_template& RslLinkId_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RslLinkId_template& RslLinkId_template::operator=(const RslLinkId& other_value) { clean_up(); copy_value(other_value); return *this; } RslLinkId_template& RslLinkId_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RslLinkId&)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 @GSM_Types.RslLinkId."); } return *this; } RslLinkId_template& RslLinkId_template::operator=(const RslLinkId_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RslLinkId_template::match(const RslLinkId& 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.c().is_bound()) return FALSE; if(!single_value->field_c.match(other_value.c(), legacy))return FALSE; if(!other_value.na().is_bound()) return FALSE; if(!single_value->field_na.match(other_value.na(), legacy))return FALSE; if(!other_value.prio().is_bound()) return FALSE; if(!single_value->field_prio.match(other_value.prio(), legacy))return FALSE; if(!other_value.sapi().is_bound()) return FALSE; if(!single_value->field_sapi.match(other_value.sapi(), 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 @GSM_Types.RslLinkId."); } return FALSE; } boolean RslLinkId_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_c.is_bound() || single_value->field_na.is_bound() || single_value->field_prio.is_bound() || single_value->field_sapi.is_bound(); } boolean RslLinkId_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_c.is_value() && single_value->field_na.is_value() && single_value->field_prio.is_value() && single_value->field_sapi.is_value(); } void RslLinkId_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; } RslLinkId RslLinkId_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 @GSM_Types.RslLinkId."); RslLinkId ret_val; if (single_value->field_c.is_bound()) { ret_val.c() = single_value->field_c.valueof(); } if (single_value->field_na.is_bound()) { ret_val.na() = single_value->field_na.valueof(); } if (single_value->field_prio.is_bound()) { ret_val.prio() = single_value->field_prio.valueof(); } if (single_value->field_sapi.is_bound()) { ret_val.sapi() = single_value->field_sapi.valueof(); } return ret_val; } void RslLinkId_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 @GSM_Types.RslLinkId."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RslLinkId_template[list_length]; } RslLinkId_template& RslLinkId_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 @GSM_Types.RslLinkId."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.RslLinkId."); return value_list.list_value[list_index]; } RslLinkIdC_template& RslLinkId_template::c() { set_specific(); return single_value->field_c; } const RslLinkIdC_template& RslLinkId_template::c() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field c of a non-specific template of type @GSM_Types.RslLinkId."); return single_value->field_c; } BOOLEAN_template& RslLinkId_template::na() { set_specific(); return single_value->field_na; } const BOOLEAN_template& RslLinkId_template::na() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field na of a non-specific template of type @GSM_Types.RslLinkId."); return single_value->field_na; } RslSapi0Prio_template& RslLinkId_template::prio() { set_specific(); return single_value->field_prio; } const RslSapi0Prio_template& RslLinkId_template::prio() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field prio of a non-specific template of type @GSM_Types.RslLinkId."); return single_value->field_prio; } INTEGER_template& RslLinkId_template::sapi() { set_specific(); return single_value->field_sapi; } const INTEGER_template& RslLinkId_template::sapi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sapi of a non-specific template of type @GSM_Types.RslLinkId."); return single_value->field_sapi; } int RslLinkId_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslLinkId which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 4; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.RslLinkId 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 @GSM_Types.RslLinkId containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslLinkId containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslLinkId containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslLinkId containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslLinkId containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslLinkId containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RslLinkId containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.RslLinkId."); } return 0; } void RslLinkId_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ c := "); single_value->field_c.log(); TTCN_Logger::log_event_str(", na := "); single_value->field_na.log(); TTCN_Logger::log_event_str(", prio := "); single_value->field_prio.log(); TTCN_Logger::log_event_str(", sapi := "); single_value->field_sapi.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 RslLinkId_template::log_match(const RslLinkId& 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_c.match(match_value.c(), legacy)){ TTCN_Logger::log_logmatch_info(".c"); single_value->field_c.log_match(match_value.c(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_na.match(match_value.na(), legacy)){ TTCN_Logger::log_logmatch_info(".na"); single_value->field_na.log_match(match_value.na(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_prio.match(match_value.prio(), legacy)){ TTCN_Logger::log_logmatch_info(".prio"); single_value->field_prio.log_match(match_value.prio(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sapi.match(match_value.sapi(), legacy)){ TTCN_Logger::log_logmatch_info(".sapi"); single_value->field_sapi.log_match(match_value.sapi(), 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("{ c := "); single_value->field_c.log_match(match_value.c(), legacy); TTCN_Logger::log_event_str(", na := "); single_value->field_na.log_match(match_value.na(), legacy); TTCN_Logger::log_event_str(", prio := "); single_value->field_prio.log_match(match_value.prio(), legacy); TTCN_Logger::log_event_str(", sapi := "); single_value->field_sapi.log_match(match_value.sapi(), 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 RslLinkId_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_c.encode_text(text_buf); single_value->field_na.encode_text(text_buf); single_value->field_prio.encode_text(text_buf); single_value->field_sapi.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 @GSM_Types.RslLinkId."); } } void RslLinkId_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_c.decode_text(text_buf); single_value->field_na.decode_text(text_buf); single_value->field_prio.decode_text(text_buf); single_value->field_sapi.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 RslLinkId_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 @GSM_Types.RslLinkId."); } } void RslLinkId_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: { RslLinkId_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) c().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) na().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) prio().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) sapi().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "c")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { c().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "na")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { na().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prio().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RslLinkId: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { RslLinkId_template* precondition = new RslLinkId_template; precondition->set_param(*param.get_elem(0)); RslLinkId_template* implied_template = new RslLinkId_template; implied_template->set_param(*param.get_elem(1)); *this = RslLinkId_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.RslLinkId"); } is_ifpresent = param.get_ifpresent(); } void RslLinkId_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_c.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslLinkId"); single_value->field_na.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslLinkId"); single_value->field_prio.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslLinkId"); single_value->field_sapi.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RslLinkId"); 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 : "@GSM_Types.RslLinkId"); } boolean RslLinkId_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RslLinkId_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lpd().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) last__block().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) seq__nr().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lpd")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lpd().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "last_block")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { last__block().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "seq_nr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { seq__nr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.CBCH_BlockType: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.CBCH_BlockType"); } } void CBCH__BlockType::encode_text(Text_Buf& text_buf) const { field_spare.encode_text(text_buf); field_lpd.encode_text(text_buf); field_last__block.encode_text(text_buf); field_seq__nr.encode_text(text_buf); } void CBCH__BlockType::decode_text(Text_Buf& text_buf) { field_spare.decode_text(text_buf); field_lpd.decode_text(text_buf); field_last__block.decode_text(text_buf); field_seq__nr.decode_text(text_buf); } void CBCH__BlockType::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void CBCH__BlockType::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int CBCH__BlockType::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, CBCH__BlockType_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(CBCH__BlockType_spare_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, CBCH__BlockType_lpd_descr_.raw->forceomit); decoded_field_length = field_lpd.RAW_decode(CBCH__BlockType_lpd_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_2_force_omit(2, force_omit, CBCH__BlockType_last__block_descr_.raw->forceomit); decoded_field_length = field_last__block.RAW_decode(CBCH__BlockType_last__block_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, CBCH__BlockType_seq__nr_descr_.raw->forceomit); decoded_field_length = field_seq__nr.RAW_decode(CBCH__BlockType_seq__nr_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int CBCH__BlockType::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 4; myleaf.body.node.nodes = init_nodes_of_enc_tree(4); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, CBCH__BlockType_spare_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CBCH__BlockType_lpd_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, CBCH__BlockType_last__block_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, CBCH__BlockType_seq__nr_descr_.raw); encoded_length += field_spare.RAW_encode(CBCH__BlockType_spare_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_lpd.RAW_encode(CBCH__BlockType_lpd_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_last__block.RAW_encode(CBCH__BlockType_last__block_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_seq__nr.RAW_encode(CBCH__BlockType_seq__nr_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct CBCH__BlockType_template::single_value_struct { BITSTRING_template field_spare; BITSTRING_template field_lpd; BOOLEAN_template field_last__block; INTEGER_template field_seq__nr; }; void CBCH__BlockType_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_spare = ANY_VALUE; single_value->field_lpd = ANY_VALUE; single_value->field_last__block = ANY_VALUE; single_value->field_seq__nr = ANY_VALUE; } } } void CBCH__BlockType_template::copy_value(const CBCH__BlockType& other_value) { single_value = new single_value_struct; if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.lpd().is_bound()) { single_value->field_lpd = other_value.lpd(); } else { single_value->field_lpd.clean_up(); } if (other_value.last__block().is_bound()) { single_value->field_last__block = other_value.last__block(); } else { single_value->field_last__block.clean_up(); } if (other_value.seq__nr().is_bound()) { single_value->field_seq__nr = other_value.seq__nr(); } else { single_value->field_seq__nr.clean_up(); } set_selection(SPECIFIC_VALUE); } void CBCH__BlockType_template::copy_template(const CBCH__BlockType_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lpd().get_selection()) { single_value->field_lpd = other_value.lpd(); } else { single_value->field_lpd.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.last__block().get_selection()) { single_value->field_last__block = other_value.last__block(); } else { single_value->field_last__block.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.seq__nr().get_selection()) { single_value->field_seq__nr = other_value.seq__nr(); } else { single_value->field_seq__nr.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 CBCH__BlockType_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 CBCH__BlockType_template(*other_value.implication_.precondition); implication_.implied_template = new CBCH__BlockType_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 @GSM_Types.CBCH_BlockType."); break; } set_selection(other_value); } CBCH__BlockType_template::CBCH__BlockType_template() { } CBCH__BlockType_template::CBCH__BlockType_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CBCH__BlockType_template::CBCH__BlockType_template(const CBCH__BlockType& other_value) { copy_value(other_value); } CBCH__BlockType_template::CBCH__BlockType_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CBCH__BlockType&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.CBCH_BlockType from an unbound optional field."); } } CBCH__BlockType_template::CBCH__BlockType_template(CBCH__BlockType_template* p_precondition, CBCH__BlockType_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CBCH__BlockType_template::CBCH__BlockType_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; } CBCH__BlockType_template::CBCH__BlockType_template(const CBCH__BlockType_template& other_value) : Base_Template() { copy_template(other_value); } CBCH__BlockType_template::~CBCH__BlockType_template() { clean_up(); } CBCH__BlockType_template& CBCH__BlockType_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CBCH__BlockType_template& CBCH__BlockType_template::operator=(const CBCH__BlockType& other_value) { clean_up(); copy_value(other_value); return *this; } CBCH__BlockType_template& CBCH__BlockType_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CBCH__BlockType&)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 @GSM_Types.CBCH_BlockType."); } return *this; } CBCH__BlockType_template& CBCH__BlockType_template::operator=(const CBCH__BlockType_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CBCH__BlockType_template::match(const CBCH__BlockType& 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.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.lpd().is_bound()) return FALSE; if(!single_value->field_lpd.match(other_value.lpd(), legacy))return FALSE; if(!other_value.last__block().is_bound()) return FALSE; if(!single_value->field_last__block.match(other_value.last__block(), legacy))return FALSE; if(!other_value.seq__nr().is_bound()) return FALSE; if(!single_value->field_seq__nr.match(other_value.seq__nr(), 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 @GSM_Types.CBCH_BlockType."); } return FALSE; } boolean CBCH__BlockType_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_spare.is_bound() || single_value->field_lpd.is_bound() || single_value->field_last__block.is_bound() || single_value->field_seq__nr.is_bound(); } boolean CBCH__BlockType_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_spare.is_value() && single_value->field_lpd.is_value() && single_value->field_last__block.is_value() && single_value->field_seq__nr.is_value(); } void CBCH__BlockType_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; } CBCH__BlockType CBCH__BlockType_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 @GSM_Types.CBCH_BlockType."); CBCH__BlockType ret_val; if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_lpd.is_bound()) { ret_val.lpd() = single_value->field_lpd.valueof(); } if (single_value->field_last__block.is_bound()) { ret_val.last__block() = single_value->field_last__block.valueof(); } if (single_value->field_seq__nr.is_bound()) { ret_val.seq__nr() = single_value->field_seq__nr.valueof(); } return ret_val; } void CBCH__BlockType_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 @GSM_Types.CBCH_BlockType."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CBCH__BlockType_template[list_length]; } CBCH__BlockType_template& CBCH__BlockType_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 @GSM_Types.CBCH_BlockType."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.CBCH_BlockType."); return value_list.list_value[list_index]; } BITSTRING_template& CBCH__BlockType_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& CBCH__BlockType_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GSM_Types.CBCH_BlockType."); return single_value->field_spare; } BITSTRING_template& CBCH__BlockType_template::lpd() { set_specific(); return single_value->field_lpd; } const BITSTRING_template& CBCH__BlockType_template::lpd() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lpd of a non-specific template of type @GSM_Types.CBCH_BlockType."); return single_value->field_lpd; } BOOLEAN_template& CBCH__BlockType_template::last__block() { set_specific(); return single_value->field_last__block; } const BOOLEAN_template& CBCH__BlockType_template::last__block() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field last_block of a non-specific template of type @GSM_Types.CBCH_BlockType."); return single_value->field_last__block; } INTEGER_template& CBCH__BlockType_template::seq__nr() { set_specific(); return single_value->field_seq__nr; } const INTEGER_template& CBCH__BlockType_template::seq__nr() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field seq_nr of a non-specific template of type @GSM_Types.CBCH_BlockType."); return single_value->field_seq__nr; } int CBCH__BlockType_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_BlockType which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 4; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.CBCH_BlockType 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 @GSM_Types.CBCH_BlockType containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_BlockType containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_BlockType containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_BlockType containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_BlockType containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_BlockType containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_BlockType containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.CBCH_BlockType."); } return 0; } void CBCH__BlockType_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", lpd := "); single_value->field_lpd.log(); TTCN_Logger::log_event_str(", last_block := "); single_value->field_last__block.log(); TTCN_Logger::log_event_str(", seq_nr := "); single_value->field_seq__nr.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 CBCH__BlockType_template::log_match(const CBCH__BlockType& 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_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lpd.match(match_value.lpd(), legacy)){ TTCN_Logger::log_logmatch_info(".lpd"); single_value->field_lpd.log_match(match_value.lpd(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_last__block.match(match_value.last__block(), legacy)){ TTCN_Logger::log_logmatch_info(".last_block"); single_value->field_last__block.log_match(match_value.last__block(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_seq__nr.match(match_value.seq__nr(), legacy)){ TTCN_Logger::log_logmatch_info(".seq_nr"); single_value->field_seq__nr.log_match(match_value.seq__nr(), 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("{ spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", lpd := "); single_value->field_lpd.log_match(match_value.lpd(), legacy); TTCN_Logger::log_event_str(", last_block := "); single_value->field_last__block.log_match(match_value.last__block(), legacy); TTCN_Logger::log_event_str(", seq_nr := "); single_value->field_seq__nr.log_match(match_value.seq__nr(), 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 CBCH__BlockType_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_spare.encode_text(text_buf); single_value->field_lpd.encode_text(text_buf); single_value->field_last__block.encode_text(text_buf); single_value->field_seq__nr.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 @GSM_Types.CBCH_BlockType."); } } void CBCH__BlockType_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_spare.decode_text(text_buf); single_value->field_lpd.decode_text(text_buf); single_value->field_last__block.decode_text(text_buf); single_value->field_seq__nr.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 CBCH__BlockType_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 @GSM_Types.CBCH_BlockType."); } } void CBCH__BlockType_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: { CBCH__BlockType_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) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lpd().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) last__block().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) seq__nr().set_param(*param.get_elem(3)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lpd")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lpd().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "last_block")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { last__block().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "seq_nr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { seq__nr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.CBCH_BlockType: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CBCH__BlockType_template* precondition = new CBCH__BlockType_template; precondition->set_param(*param.get_elem(0)); CBCH__BlockType_template* implied_template = new CBCH__BlockType_template; implied_template->set_param(*param.get_elem(1)); *this = CBCH__BlockType_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.CBCH_BlockType"); } is_ifpresent = param.get_ifpresent(); } void CBCH__BlockType_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_spare.check_restriction(t_res, t_name ? t_name : "@GSM_Types.CBCH_BlockType"); single_value->field_lpd.check_restriction(t_res, t_name ? t_name : "@GSM_Types.CBCH_BlockType"); single_value->field_last__block.check_restriction(t_res, t_name ? t_name : "@GSM_Types.CBCH_BlockType"); single_value->field_seq__nr.check_restriction(t_res, t_name ? t_name : "@GSM_Types.CBCH_BlockType"); 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 : "@GSM_Types.CBCH_BlockType"); } boolean CBCH__BlockType_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CBCH__BlockType_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) block__type().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "block_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { block__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "payload")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { payload().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.CBCH_Block: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.CBCH_Block"); } } void CBCH__Block::encode_text(Text_Buf& text_buf) const { field_block__type.encode_text(text_buf); field_payload.encode_text(text_buf); } void CBCH__Block::decode_text(Text_Buf& text_buf) { field_block__type.decode_text(text_buf); field_payload.decode_text(text_buf); } void CBCH__Block::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void CBCH__Block::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int CBCH__Block::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, CBCH__Block_block__type_descr_.raw->forceomit); decoded_field_length = field_block__type.RAW_decode(CBCH__Block_block__type_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, CBCH__Block_payload_descr_.raw->forceomit); decoded_field_length = field_payload.RAW_decode(CBCH__Block_payload_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int CBCH__Block::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 = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, CBCH__Block_block__type_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CBCH__Block_payload_descr_.raw); encoded_length += field_block__type.RAW_encode(CBCH__Block_block__type_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_payload.RAW_encode(CBCH__Block_payload_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct CBCH__Block_template::single_value_struct { CBCH__BlockType_template field_block__type; OCTETSTRING_template field_payload; }; void CBCH__Block_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_block__type = ANY_VALUE; single_value->field_payload = ANY_VALUE; } } } void CBCH__Block_template::copy_value(const CBCH__Block& other_value) { single_value = new single_value_struct; if (other_value.block__type().is_bound()) { single_value->field_block__type = other_value.block__type(); } else { single_value->field_block__type.clean_up(); } if (other_value.payload().is_bound()) { single_value->field_payload = other_value.payload(); } else { single_value->field_payload.clean_up(); } set_selection(SPECIFIC_VALUE); } void CBCH__Block_template::copy_template(const CBCH__Block_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.block__type().get_selection()) { single_value->field_block__type = other_value.block__type(); } else { single_value->field_block__type.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.payload().get_selection()) { single_value->field_payload = other_value.payload(); } else { single_value->field_payload.clean_up(); } case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new CBCH__Block_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 CBCH__Block_template(*other_value.implication_.precondition); implication_.implied_template = new CBCH__Block_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 @GSM_Types.CBCH_Block."); break; } set_selection(other_value); } CBCH__Block_template::CBCH__Block_template() { } CBCH__Block_template::CBCH__Block_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CBCH__Block_template::CBCH__Block_template(const CBCH__Block& other_value) { copy_value(other_value); } CBCH__Block_template::CBCH__Block_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CBCH__Block&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.CBCH_Block from an unbound optional field."); } } CBCH__Block_template::CBCH__Block_template(CBCH__Block_template* p_precondition, CBCH__Block_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CBCH__Block_template::CBCH__Block_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; } CBCH__Block_template::CBCH__Block_template(const CBCH__Block_template& other_value) : Base_Template() { copy_template(other_value); } CBCH__Block_template::~CBCH__Block_template() { clean_up(); } CBCH__Block_template& CBCH__Block_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CBCH__Block_template& CBCH__Block_template::operator=(const CBCH__Block& other_value) { clean_up(); copy_value(other_value); return *this; } CBCH__Block_template& CBCH__Block_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CBCH__Block&)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 @GSM_Types.CBCH_Block."); } return *this; } CBCH__Block_template& CBCH__Block_template::operator=(const CBCH__Block_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CBCH__Block_template::match(const CBCH__Block& 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.block__type().is_bound()) return FALSE; if(!single_value->field_block__type.match(other_value.block__type(), legacy))return FALSE; if(!other_value.payload().is_bound()) return FALSE; if(!single_value->field_payload.match(other_value.payload(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_Types.CBCH_Block."); } return FALSE; } boolean CBCH__Block_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_block__type.is_bound() || single_value->field_payload.is_bound(); } boolean CBCH__Block_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_block__type.is_value() && single_value->field_payload.is_value(); } void CBCH__Block_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; } CBCH__Block CBCH__Block_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 @GSM_Types.CBCH_Block."); CBCH__Block ret_val; if (single_value->field_block__type.is_bound()) { ret_val.block__type() = single_value->field_block__type.valueof(); } if (single_value->field_payload.is_bound()) { ret_val.payload() = single_value->field_payload.valueof(); } return ret_val; } void CBCH__Block_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 @GSM_Types.CBCH_Block."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CBCH__Block_template[list_length]; } CBCH__Block_template& CBCH__Block_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 @GSM_Types.CBCH_Block."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.CBCH_Block."); return value_list.list_value[list_index]; } CBCH__BlockType_template& CBCH__Block_template::block__type() { set_specific(); return single_value->field_block__type; } const CBCH__BlockType_template& CBCH__Block_template::block__type() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field block_type of a non-specific template of type @GSM_Types.CBCH_Block."); return single_value->field_block__type; } OCTETSTRING_template& CBCH__Block_template::payload() { set_specific(); return single_value->field_payload; } const OCTETSTRING_template& CBCH__Block_template::payload() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field payload of a non-specific template of type @GSM_Types.CBCH_Block."); return single_value->field_payload; } int CBCH__Block_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_Block which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.CBCH_Block 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 @GSM_Types.CBCH_Block containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_Block containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_Block containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_Block containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_Block containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_Block containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.CBCH_Block containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.CBCH_Block."); } return 0; } void CBCH__Block_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ block_type := "); single_value->field_block__type.log(); TTCN_Logger::log_event_str(", payload := "); single_value->field_payload.log(); TTCN_Logger::log_event_str(" }"); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void CBCH__Block_template::log_match(const CBCH__Block& 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_block__type.match(match_value.block__type(), legacy)){ TTCN_Logger::log_logmatch_info(".block_type"); single_value->field_block__type.log_match(match_value.block__type(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_payload.match(match_value.payload(), legacy)){ TTCN_Logger::log_logmatch_info(".payload"); single_value->field_payload.log_match(match_value.payload(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ block_type := "); single_value->field_block__type.log_match(match_value.block__type(), legacy); TTCN_Logger::log_event_str(", payload := "); single_value->field_payload.log_match(match_value.payload(), legacy); TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void CBCH__Block_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_block__type.encode_text(text_buf); single_value->field_payload.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_Types.CBCH_Block."); } } void CBCH__Block_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_block__type.decode_text(text_buf); single_value->field_payload.decode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new CBCH__Block_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 @GSM_Types.CBCH_Block."); } } void CBCH__Block_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: { CBCH__Block_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) block__type().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) payload().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "block_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { block__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "payload")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { payload().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.CBCH_Block: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CBCH__Block_template* precondition = new CBCH__Block_template; precondition->set_param(*param.get_elem(0)); CBCH__Block_template* implied_template = new CBCH__Block_template; implied_template->set_param(*param.get_elem(1)); *this = CBCH__Block_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.CBCH_Block"); } is_ifpresent = param.get_ifpresent(); } void CBCH__Block_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_block__type.check_restriction(t_res, t_name ? t_name : "@GSM_Types.CBCH_Block"); single_value->field_payload.check_restriction(t_res, t_name ? t_name : "@GSM_Types.CBCH_Block"); 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 : "@GSM_Types.CBCH_Block"); } boolean CBCH__Block_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CBCH__Block_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) mcc__mnc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lac().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc_mnc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc__mnc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.LocationAreaIdentification: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.LocationAreaIdentification"); } } void LocationAreaIdentification::encode_text(Text_Buf& text_buf) const { field_mcc__mnc.encode_text(text_buf); field_lac.encode_text(text_buf); } void LocationAreaIdentification::decode_text(Text_Buf& text_buf) { field_mcc__mnc.decode_text(text_buf); field_lac.decode_text(text_buf); } void LocationAreaIdentification::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void LocationAreaIdentification::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int LocationAreaIdentification::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, LocationAreaIdentification_mcc__mnc_descr_.raw->forceomit); decoded_field_length = field_mcc__mnc.RAW_decode(LocationAreaIdentification_mcc__mnc_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, LocationAreaIdentification_lac_descr_.raw->forceomit); decoded_field_length = field_lac.RAW_decode(LocationAreaIdentification_lac_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int LocationAreaIdentification::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 = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, LocationAreaIdentification_mcc__mnc_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, LocationAreaIdentification_lac_descr_.raw); encoded_length += field_mcc__mnc.RAW_encode(LocationAreaIdentification_mcc__mnc_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_lac.RAW_encode(LocationAreaIdentification_lac_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct LocationAreaIdentification_template::single_value_struct { HEXSTRING_template field_mcc__mnc; INTEGER_template field_lac; }; void LocationAreaIdentification_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_mcc__mnc = ANY_VALUE; single_value->field_lac = ANY_VALUE; } } } void LocationAreaIdentification_template::copy_value(const LocationAreaIdentification& other_value) { single_value = new single_value_struct; if (other_value.mcc__mnc().is_bound()) { single_value->field_mcc__mnc = other_value.mcc__mnc(); } else { single_value->field_mcc__mnc.clean_up(); } if (other_value.lac().is_bound()) { single_value->field_lac = other_value.lac(); } else { single_value->field_lac.clean_up(); } set_selection(SPECIFIC_VALUE); } void LocationAreaIdentification_template::copy_template(const LocationAreaIdentification_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.mcc__mnc().get_selection()) { single_value->field_mcc__mnc = other_value.mcc__mnc(); } else { single_value->field_mcc__mnc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lac().get_selection()) { single_value->field_lac = other_value.lac(); } else { single_value->field_lac.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 LocationAreaIdentification_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 LocationAreaIdentification_template(*other_value.implication_.precondition); implication_.implied_template = new LocationAreaIdentification_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 @GSM_Types.LocationAreaIdentification."); break; } set_selection(other_value); } LocationAreaIdentification_template::LocationAreaIdentification_template() { } LocationAreaIdentification_template::LocationAreaIdentification_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } LocationAreaIdentification_template::LocationAreaIdentification_template(const LocationAreaIdentification& other_value) { copy_value(other_value); } LocationAreaIdentification_template::LocationAreaIdentification_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const LocationAreaIdentification&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.LocationAreaIdentification from an unbound optional field."); } } LocationAreaIdentification_template::LocationAreaIdentification_template(LocationAreaIdentification_template* p_precondition, LocationAreaIdentification_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } LocationAreaIdentification_template::LocationAreaIdentification_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; } LocationAreaIdentification_template::LocationAreaIdentification_template(const LocationAreaIdentification_template& other_value) : Base_Template() { copy_template(other_value); } LocationAreaIdentification_template::~LocationAreaIdentification_template() { clean_up(); } LocationAreaIdentification_template& LocationAreaIdentification_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } LocationAreaIdentification_template& LocationAreaIdentification_template::operator=(const LocationAreaIdentification& other_value) { clean_up(); copy_value(other_value); return *this; } LocationAreaIdentification_template& LocationAreaIdentification_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const LocationAreaIdentification&)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 @GSM_Types.LocationAreaIdentification."); } return *this; } LocationAreaIdentification_template& LocationAreaIdentification_template::operator=(const LocationAreaIdentification_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean LocationAreaIdentification_template::match(const LocationAreaIdentification& 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.mcc__mnc().is_bound()) return FALSE; if(!single_value->field_mcc__mnc.match(other_value.mcc__mnc(), legacy))return FALSE; if(!other_value.lac().is_bound()) return FALSE; if(!single_value->field_lac.match(other_value.lac(), 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 @GSM_Types.LocationAreaIdentification."); } return FALSE; } boolean LocationAreaIdentification_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_mcc__mnc.is_bound() || single_value->field_lac.is_bound(); } boolean LocationAreaIdentification_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_mcc__mnc.is_value() && single_value->field_lac.is_value(); } void LocationAreaIdentification_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; } LocationAreaIdentification LocationAreaIdentification_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 @GSM_Types.LocationAreaIdentification."); LocationAreaIdentification ret_val; if (single_value->field_mcc__mnc.is_bound()) { ret_val.mcc__mnc() = single_value->field_mcc__mnc.valueof(); } if (single_value->field_lac.is_bound()) { ret_val.lac() = single_value->field_lac.valueof(); } return ret_val; } void LocationAreaIdentification_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 @GSM_Types.LocationAreaIdentification."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new LocationAreaIdentification_template[list_length]; } LocationAreaIdentification_template& LocationAreaIdentification_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 @GSM_Types.LocationAreaIdentification."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.LocationAreaIdentification."); return value_list.list_value[list_index]; } HEXSTRING_template& LocationAreaIdentification_template::mcc__mnc() { set_specific(); return single_value->field_mcc__mnc; } const HEXSTRING_template& LocationAreaIdentification_template::mcc__mnc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mcc_mnc of a non-specific template of type @GSM_Types.LocationAreaIdentification."); return single_value->field_mcc__mnc; } INTEGER_template& LocationAreaIdentification_template::lac() { set_specific(); return single_value->field_lac; } const INTEGER_template& LocationAreaIdentification_template::lac() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lac of a non-specific template of type @GSM_Types.LocationAreaIdentification."); return single_value->field_lac; } int LocationAreaIdentification_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.LocationAreaIdentification which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.LocationAreaIdentification 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 @GSM_Types.LocationAreaIdentification containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.LocationAreaIdentification containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.LocationAreaIdentification containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.LocationAreaIdentification containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.LocationAreaIdentification containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.LocationAreaIdentification containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.LocationAreaIdentification containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.LocationAreaIdentification."); } return 0; } void LocationAreaIdentification_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ mcc_mnc := "); single_value->field_mcc__mnc.log(); TTCN_Logger::log_event_str(", lac := "); single_value->field_lac.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 LocationAreaIdentification_template::log_match(const LocationAreaIdentification& 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_mcc__mnc.match(match_value.mcc__mnc(), legacy)){ TTCN_Logger::log_logmatch_info(".mcc_mnc"); single_value->field_mcc__mnc.log_match(match_value.mcc__mnc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lac.match(match_value.lac(), legacy)){ TTCN_Logger::log_logmatch_info(".lac"); single_value->field_lac.log_match(match_value.lac(), 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("{ mcc_mnc := "); single_value->field_mcc__mnc.log_match(match_value.mcc__mnc(), legacy); TTCN_Logger::log_event_str(", lac := "); single_value->field_lac.log_match(match_value.lac(), 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 LocationAreaIdentification_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_mcc__mnc.encode_text(text_buf); single_value->field_lac.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 @GSM_Types.LocationAreaIdentification."); } } void LocationAreaIdentification_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_mcc__mnc.decode_text(text_buf); single_value->field_lac.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 LocationAreaIdentification_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 @GSM_Types.LocationAreaIdentification."); } } void LocationAreaIdentification_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: { LocationAreaIdentification_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) mcc__mnc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lac().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc_mnc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc__mnc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.LocationAreaIdentification: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { LocationAreaIdentification_template* precondition = new LocationAreaIdentification_template; precondition->set_param(*param.get_elem(0)); LocationAreaIdentification_template* implied_template = new LocationAreaIdentification_template; implied_template->set_param(*param.get_elem(1)); *this = LocationAreaIdentification_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.LocationAreaIdentification"); } is_ifpresent = param.get_ifpresent(); } void LocationAreaIdentification_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_mcc__mnc.check_restriction(t_res, t_name ? t_name : "@GSM_Types.LocationAreaIdentification"); single_value->field_lac.check_restriction(t_res, t_name ? t_name : "@GSM_Types.LocationAreaIdentification"); 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 : "@GSM_Types.LocationAreaIdentification"); } boolean LocationAreaIdentification_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean LocationAreaIdentification_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) lai().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rac().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "lai")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lai().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RoutingAreaIdentification: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_Types.RoutingAreaIdentification"); } } void RoutingAreaIdentification::encode_text(Text_Buf& text_buf) const { field_lai.encode_text(text_buf); field_rac.encode_text(text_buf); } void RoutingAreaIdentification::decode_text(Text_Buf& text_buf) { field_lai.decode_text(text_buf); field_rac.decode_text(text_buf); } void RoutingAreaIdentification::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;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RoutingAreaIdentification::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;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RoutingAreaIdentification::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, RoutingAreaIdentification_lai_descr_.raw->forceomit); decoded_field_length = field_lai.RAW_decode(RoutingAreaIdentification_lai_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, RoutingAreaIdentification_rac_descr_.raw->forceomit); decoded_field_length = field_rac.RAW_decode(RoutingAreaIdentification_rac_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int RoutingAreaIdentification::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 = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, RoutingAreaIdentification_lai_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, RoutingAreaIdentification_rac_descr_.raw); encoded_length += field_lai.RAW_encode(RoutingAreaIdentification_lai_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_rac.RAW_encode(RoutingAreaIdentification_rac_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct RoutingAreaIdentification_template::single_value_struct { LocationAreaIdentification_template field_lai; INTEGER_template field_rac; }; void RoutingAreaIdentification_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_lai = ANY_VALUE; single_value->field_rac = ANY_VALUE; } } } void RoutingAreaIdentification_template::copy_value(const RoutingAreaIdentification& other_value) { single_value = new single_value_struct; if (other_value.lai().is_bound()) { single_value->field_lai = other_value.lai(); } else { single_value->field_lai.clean_up(); } if (other_value.rac().is_bound()) { single_value->field_rac = other_value.rac(); } else { single_value->field_rac.clean_up(); } set_selection(SPECIFIC_VALUE); } void RoutingAreaIdentification_template::copy_template(const RoutingAreaIdentification_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.lai().get_selection()) { single_value->field_lai = other_value.lai(); } else { single_value->field_lai.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rac().get_selection()) { single_value->field_rac = other_value.rac(); } else { single_value->field_rac.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 RoutingAreaIdentification_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 RoutingAreaIdentification_template(*other_value.implication_.precondition); implication_.implied_template = new RoutingAreaIdentification_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 @GSM_Types.RoutingAreaIdentification."); break; } set_selection(other_value); } RoutingAreaIdentification_template::RoutingAreaIdentification_template() { } RoutingAreaIdentification_template::RoutingAreaIdentification_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RoutingAreaIdentification_template::RoutingAreaIdentification_template(const RoutingAreaIdentification& other_value) { copy_value(other_value); } RoutingAreaIdentification_template::RoutingAreaIdentification_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RoutingAreaIdentification&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_Types.RoutingAreaIdentification from an unbound optional field."); } } RoutingAreaIdentification_template::RoutingAreaIdentification_template(RoutingAreaIdentification_template* p_precondition, RoutingAreaIdentification_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RoutingAreaIdentification_template::RoutingAreaIdentification_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; } RoutingAreaIdentification_template::RoutingAreaIdentification_template(const RoutingAreaIdentification_template& other_value) : Base_Template() { copy_template(other_value); } RoutingAreaIdentification_template::~RoutingAreaIdentification_template() { clean_up(); } RoutingAreaIdentification_template& RoutingAreaIdentification_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RoutingAreaIdentification_template& RoutingAreaIdentification_template::operator=(const RoutingAreaIdentification& other_value) { clean_up(); copy_value(other_value); return *this; } RoutingAreaIdentification_template& RoutingAreaIdentification_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RoutingAreaIdentification&)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 @GSM_Types.RoutingAreaIdentification."); } return *this; } RoutingAreaIdentification_template& RoutingAreaIdentification_template::operator=(const RoutingAreaIdentification_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RoutingAreaIdentification_template::match(const RoutingAreaIdentification& 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.lai().is_bound()) return FALSE; if(!single_value->field_lai.match(other_value.lai(), legacy))return FALSE; if(!other_value.rac().is_bound()) return FALSE; if(!single_value->field_rac.match(other_value.rac(), 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 @GSM_Types.RoutingAreaIdentification."); } return FALSE; } boolean RoutingAreaIdentification_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_lai.is_bound() || single_value->field_rac.is_bound(); } boolean RoutingAreaIdentification_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_lai.is_value() && single_value->field_rac.is_value(); } void RoutingAreaIdentification_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; } RoutingAreaIdentification RoutingAreaIdentification_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 @GSM_Types.RoutingAreaIdentification."); RoutingAreaIdentification ret_val; if (single_value->field_lai.is_bound()) { ret_val.lai() = single_value->field_lai.valueof(); } if (single_value->field_rac.is_bound()) { ret_val.rac() = single_value->field_rac.valueof(); } return ret_val; } void RoutingAreaIdentification_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 @GSM_Types.RoutingAreaIdentification."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RoutingAreaIdentification_template[list_length]; } RoutingAreaIdentification_template& RoutingAreaIdentification_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 @GSM_Types.RoutingAreaIdentification."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_Types.RoutingAreaIdentification."); return value_list.list_value[list_index]; } LocationAreaIdentification_template& RoutingAreaIdentification_template::lai() { set_specific(); return single_value->field_lai; } const LocationAreaIdentification_template& RoutingAreaIdentification_template::lai() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lai of a non-specific template of type @GSM_Types.RoutingAreaIdentification."); return single_value->field_lai; } INTEGER_template& RoutingAreaIdentification_template::rac() { set_specific(); return single_value->field_rac; } const INTEGER_template& RoutingAreaIdentification_template::rac() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rac of a non-specific template of type @GSM_Types.RoutingAreaIdentification."); return single_value->field_rac; } int RoutingAreaIdentification_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RoutingAreaIdentification which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_Types.RoutingAreaIdentification 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 @GSM_Types.RoutingAreaIdentification containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RoutingAreaIdentification containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RoutingAreaIdentification containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RoutingAreaIdentification containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RoutingAreaIdentification containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RoutingAreaIdentification containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_Types.RoutingAreaIdentification containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_Types.RoutingAreaIdentification."); } return 0; } void RoutingAreaIdentification_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ lai := "); single_value->field_lai.log(); TTCN_Logger::log_event_str(", rac := "); single_value->field_rac.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 RoutingAreaIdentification_template::log_match(const RoutingAreaIdentification& 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_lai.match(match_value.lai(), legacy)){ TTCN_Logger::log_logmatch_info(".lai"); single_value->field_lai.log_match(match_value.lai(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rac.match(match_value.rac(), legacy)){ TTCN_Logger::log_logmatch_info(".rac"); single_value->field_rac.log_match(match_value.rac(), 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("{ lai := "); single_value->field_lai.log_match(match_value.lai(), legacy); TTCN_Logger::log_event_str(", rac := "); single_value->field_rac.log_match(match_value.rac(), 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 RoutingAreaIdentification_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_lai.encode_text(text_buf); single_value->field_rac.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 @GSM_Types.RoutingAreaIdentification."); } } void RoutingAreaIdentification_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_lai.decode_text(text_buf); single_value->field_rac.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 RoutingAreaIdentification_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 @GSM_Types.RoutingAreaIdentification."); } } void RoutingAreaIdentification_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: { RoutingAreaIdentification_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) lai().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rac().set_param(*param.get_elem(1)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "lai")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lai().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_Types.RoutingAreaIdentification: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { RoutingAreaIdentification_template* precondition = new RoutingAreaIdentification_template; precondition->set_param(*param.get_elem(0)); RoutingAreaIdentification_template* implied_template = new RoutingAreaIdentification_template; implied_template->set_param(*param.get_elem(1)); *this = RoutingAreaIdentification_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_Types.RoutingAreaIdentification"); } is_ifpresent = param.get_ifpresent(); } void RoutingAreaIdentification_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_lai.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RoutingAreaIdentification"); single_value->field_rac.check_restriction(t_res, t_name ? t_name : "@GSM_Types.RoutingAreaIdentification"); 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 : "@GSM_Types.RoutingAreaIdentification"); } boolean RoutingAreaIdentification_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RoutingAreaIdentification_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 63)) { current_location.update_lineno(357); /* GSM_Types.ttcn, line 357 */ rxlev = 63; } else { current_location.update_lineno(358); /* GSM_Types.ttcn, line 358 */ if ((rxlev < 0)) { current_location.update_lineno(359); /* GSM_Types.ttcn, line 359 */ rxlev = 0; } } current_location.update_lineno(361); /* GSM_Types.ttcn, line 361 */ return rxlev; } INTEGER rxlev2dbm(const INTEGER& rxlev) { TTCN_Location current_location("GSM_Types.ttcn", 364, TTCN_Location::LOCATION_FUNCTION, "rxlev2dbm"); current_location.update_lineno(365); /* GSM_Types.ttcn, line 365 */ return (-110 + rxlev); } INTEGER ber2rxqual(const FLOAT& ber) { TTCN_Location current_location("GSM_Types.ttcn", 369, TTCN_Location::LOCATION_FUNCTION, "ber2rxqual"); current_location.update_lineno(370); /* GSM_Types.ttcn, line 370 */ if ((ber < 2.0e-1)) { current_location.update_lineno(371); /* GSM_Types.ttcn, line 371 */ return 0; } else { current_location.update_lineno(372); /* GSM_Types.ttcn, line 372 */ if ((ber < 4.0e-1)) { current_location.update_lineno(373); /* GSM_Types.ttcn, line 373 */ return 1; } else { current_location.update_lineno(374); /* GSM_Types.ttcn, line 374 */ if ((ber < 8.0e-1)) { current_location.update_lineno(375); /* GSM_Types.ttcn, line 375 */ return 2; } else { current_location.update_lineno(376); /* GSM_Types.ttcn, line 376 */ if ((ber < 1.6)) { current_location.update_lineno(377); /* GSM_Types.ttcn, line 377 */ return 3; } else { current_location.update_lineno(378); /* GSM_Types.ttcn, line 378 */ if ((ber < 3.2)) { current_location.update_lineno(379); /* GSM_Types.ttcn, line 379 */ return 4; } else { current_location.update_lineno(380); /* GSM_Types.ttcn, line 380 */ if ((ber < 6.4)) { current_location.update_lineno(381); /* GSM_Types.ttcn, line 381 */ return 5; } else { current_location.update_lineno(382); /* GSM_Types.ttcn, line 382 */ if ((ber < 1.28e1)) { current_location.update_lineno(383); /* GSM_Types.ttcn, line 383 */ return 6; } else { current_location.update_lineno(385); /* GSM_Types.ttcn, line 385 */ return 7; } } } } } } } } FLOAT rxqual2ber(const INTEGER& rxqual) { TTCN_Location current_location("GSM_Types.ttcn", 390, TTCN_Location::LOCATION_FUNCTION, "rxqual2ber"); { const INTEGER &tmp_14 = rxqual; switch(tmp_14.get_long_long_val()) { case(0): { current_location.update_lineno(392); /* GSM_Types.ttcn, line 392 */ return 1.4e-1; break; } case(1): { current_location.update_lineno(393); /* GSM_Types.ttcn, line 393 */ return 2.8e-1; break; } case(2): { current_location.update_lineno(394); /* GSM_Types.ttcn, line 394 */ return 5.7e-1; break; } case(3): { current_location.update_lineno(395); /* GSM_Types.ttcn, line 395 */ return 1.13; break; } case(4): { current_location.update_lineno(396); /* GSM_Types.ttcn, line 396 */ return 2.26; break; } case(5): { current_location.update_lineno(397); /* GSM_Types.ttcn, line 397 */ return 4.53; break; } case(6): { current_location.update_lineno(398); /* GSM_Types.ttcn, line 398 */ return 9.05; break; } case(7): { current_location.update_lineno(399); /* GSM_Types.ttcn, line 399 */ return 1.81e1; break; } default: { current_location.update_lineno(400); /* GSM_Types.ttcn, line 400 */ return 1.0e3; break; } };} } INTEGER f__ccch__blocks__per__mframe(const BOOLEAN& combined__ccch) { TTCN_Location current_location("GSM_Types.ttcn", 409, TTCN_Location::LOCATION_FUNCTION, "f_ccch_blocks_per_mframe"); current_location.update_lineno(410); /* GSM_Types.ttcn, line 410 */ if ((!(combined__ccch))) { current_location.update_lineno(412); /* GSM_Types.ttcn, line 412 */ return 9; } else { current_location.update_lineno(415); /* GSM_Types.ttcn, line 415 */ return 3; } } FLOAT f__pch__block__rate__est(const BOOLEAN& combined__ccch, const INTEGER& bs__ag__blks__res) { TTCN_Location current_location("GSM_Types.ttcn", 420, TTCN_Location::LOCATION_FUNCTION, "f_pch_block_rate_est"); current_location.update_lineno(421); /* GSM_Types.ttcn, line 421 */ INTEGER ccch__per__mframe(f__ccch__blocks__per__mframe(combined__ccch)); current_location.update_lineno(422); /* GSM_Types.ttcn, line 422 */ INTEGER pch__per__mframe((ccch__per__mframe - bs__ag__blks__res)); current_location.update_lineno(423); /* GSM_Types.ttcn, line 423 */ return (4.2483660130719 * int2float(pch__per__mframe)); } FLOAT f__agch__block__rate__est(const BOOLEAN& combined__ccch, const INTEGER& bs__ag__blks__res) { TTCN_Location current_location("GSM_Types.ttcn", 427, TTCN_Location::LOCATION_FUNCTION, "f_agch_block_rate_est"); current_location.update_lineno(428); /* GSM_Types.ttcn, line 428 */ INTEGER ccch__per__mframe(f__ccch__blocks__per__mframe(combined__ccch)); current_location.update_lineno(429); /* GSM_Types.ttcn, line 429 */ return (4.2483660130719 * int2float(bs__ag__blks__res)); } INTEGER f__gsm__compute__tc(const INTEGER& fn) { TTCN_Location current_location("GSM_Types.ttcn", 433, TTCN_Location::LOCATION_FUNCTION, "f_gsm_compute_tc"); current_location.update_lineno(434); /* GSM_Types.ttcn, line 434 */ return mod((fn / 51), 8); } void GsmBcdString_encoder(const HEXSTRING& 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 `hexstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(GsmBcdString_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER GsmBcdString_decoder(OCTETSTRING& input_stream, HEXSTRING& 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 `hexstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(GsmBcdString_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 BcdMccMnc_encoder(const HEXSTRING& 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 `hexstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(BcdMccMnc_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER BcdMccMnc_decoder(OCTETSTRING& input_stream, HEXSTRING& 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 `hexstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(BcdMccMnc_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; } } OCTETSTRING enc__BcdMccMnc(const HEXSTRING& str) { if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); TTCN_Logger::log_event_str("enc_BcdMccMnc(): Encoding hexstring: "); str.log(); TTCN_Logger::end_event(); } TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); TTCN_Buffer ttcn_buffer; str.encode(BcdMccMnc_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0); OCTETSTRING ret_val; ttcn_buffer.get_string(ret_val); if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); TTCN_Logger::log_event_str("enc_BcdMccMnc(): Stream after encoding: "); ret_val.log(); TTCN_Logger::end_event(); } return ret_val; } HEXSTRING dec__BcdMccMnc(const OCTETSTRING& str) { if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); TTCN_Logger::log_event_str("dec_BcdMccMnc(): Stream before decoding: "); str.log(); TTCN_Logger::end_event(); } TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); TTCN_EncDec::clear_error(); TTCN_Buffer ttcn_buffer(str); HEXSTRING ret_val; ret_val.decode(BcdMccMnc_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW); if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); TTCN_Logger::log_event_str("dec_BcdMccMnc(): Decoded hexstring: "); ret_val.log(); TTCN_Logger::end_event(); } if (TTCN_EncDec::get_last_error_type() == TTCN_EncDec::ET_NONE) { if (ttcn_buffer.get_pos() < ttcn_buffer.get_len()) { ttcn_buffer.cut(); OCTETSTRING tmp_os; ttcn_buffer.get_string(tmp_os); TTCN_Logger::begin_event_log2str(); tmp_os.log(); CHARSTRING remaining_stream = TTCN_Logger::end_event_log2str(); TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_EXTRA_DATA, "dec_BcdMccMnc(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream); } } return ret_val; } HEXSTRING f__build__BcdMccMnc(const HEXSTRING& mcc, const HEXSTRING& mnc) { HEXSTRING mnc_shadow(mnc); TTCN_Location current_location("GSM_Types.ttcn", 448, TTCN_Location::LOCATION_FUNCTION, "f_build_BcdMccMnc"); current_location.update_lineno(449); /* GSM_Types.ttcn, line 449 */ if ((mnc_shadow.lengthof() == 2)) { current_location.update_lineno(450); /* GSM_Types.ttcn, line 450 */ { HEXSTRING tmp_15; tmp_15 = ((const_cast< const HEXSTRING&>(mnc_shadow)[0] + const_cast< const HEXSTRING&>(mnc_shadow)[1]) + hs_0); mnc_shadow = tmp_15; } } current_location.update_lineno(459); /* GSM_Types.ttcn, line 459 */ return (((((const_cast< const HEXSTRING&>(mcc)[0] + const_cast< const HEXSTRING&>(mcc)[1]) + const_cast< const HEXSTRING&>(mcc)[2]) + const_cast< const HEXSTRING&>(mnc_shadow)[2]) + const_cast< const HEXSTRING&>(mnc_shadow)[0]) + const_cast< const HEXSTRING&>(mnc_shadow)[1]); } HEXSTRING f__build__BcdMccMnc__int(const INTEGER& mcc, const INTEGER& mnc, const BOOLEAN& mnc__3__digits) { TTCN_Location current_location("GSM_Types.ttcn", 463, TTCN_Location::LOCATION_FUNCTION, "f_build_BcdMccMnc_int"); current_location.update_lineno(464); /* GSM_Types.ttcn, line 464 */ HEXSTRING mcc__str(str2hex(int2str(mcc))); current_location.update_lineno(465); /* GSM_Types.ttcn, line 465 */ HEXSTRING mnc__str(str2hex(int2str(mnc))); current_location.update_lineno(466); /* GSM_Types.ttcn, line 466 */ if ((mnc__3__digits == TRUE)) { current_location.update_lineno(467); /* GSM_Types.ttcn, line 467 */ return f__build__BcdMccMnc(((const_cast< const HEXSTRING&>(mcc__str)[0] + const_cast< const HEXSTRING&>(mcc__str)[1]) + const_cast< const HEXSTRING&>(mcc__str)[2]), ((const_cast< const HEXSTRING&>(mnc__str)[0] + const_cast< const HEXSTRING&>(mnc__str)[1]) + const_cast< const HEXSTRING&>(mnc__str)[2])); } else { current_location.update_lineno(470); /* GSM_Types.ttcn, line 470 */ return f__build__BcdMccMnc(((const_cast< const HEXSTRING&>(mcc__str)[0] + const_cast< const HEXSTRING&>(mcc__str)[1]) + const_cast< const HEXSTRING&>(mcc__str)[2]), (const_cast< const HEXSTRING&>(mnc__str)[0] + const_cast< const HEXSTRING&>(mnc__str)[1])); } } verdicttype testcase_TC__selftest__BcdMccMnc(boolean has_timer, double timer_value) { TTCN_Runtime::check_begin_testcase(has_timer, timer_value); TTCN_Location current_location("GSM_Types.ttcn", 475, TTCN_Location::LOCATION_TESTCASE, "TC_selftest_BcdMccMnc"); try { TTCN_Runtime::begin_testcase("GSM_Types", "TC_selftest_BcdMccMnc", "General_Types", "Dummy_CT", "General_Types", "Dummy_CT", has_timer, timer_value); current_location.update_lineno(476); /* GSM_Types.ttcn, line 476 */ { boolean tmp_19; { OCTETSTRING_template tmp_16; class Dec_Match_tmp_17 : public Dec_Match_Interface { HEXSTRING_template target; HEXSTRING* dec_val; public: Dec_Match_tmp_17(HEXSTRING_template p_target): target(p_target), dec_val(NULL) { } ~Dec_Match_tmp_17() { if (dec_val != NULL) delete dec_val; } virtual boolean match(TTCN_Buffer& buff) { if (dec_val != NULL) delete dec_val; dec_val = new HEXSTRING; boolean ret_val; OCTETSTRING os; buff.get_string(os); if (BcdMccMnc_decoder(os, *dec_val, BcdMccMnc_default_coding) != 0) { TTCN_warning("Decoded content matching failed, because the data could not be decoded."); ret_val = FALSE; } else if (os.lengthof() != 0) { TTCN_warning("Decoded content matching failed, because the buffer was not empty after decoding. Remaining octets: %d.", os.lengthof()); ret_val = FALSE; } else ret_val = target.match(*dec_val); if (!ret_val) { delete dec_val; dec_val = NULL; } return ret_val; } virtual void log() const { TTCN_Logger::log_event_str("hexstring: "); target.log(); } void* get_dec_res() const { return dec_val; } const TTCN_Typedescriptor_t* get_type_descr() const { return &BcdMccMnc_descr_; } }; tmp_16.set_type(DECODE_MATCH); { HEXSTRING_template tmp_18; tmp_18 = hs_1; tmp_16.set_decmatch(new Dec_Match_tmp_17(tmp_18)); } tmp_19 = (!(tmp_16.match(os_2))); } if (tmp_19) { current_location.update_lineno(476); /* GSM_Types.ttcn, line 476 */ TTCN_Runtime::setverdict(FAIL); } } current_location.update_lineno(477); /* GSM_Types.ttcn, line 477 */ { boolean tmp_23; { OCTETSTRING_template tmp_20; class Dec_Match_tmp_21 : public Dec_Match_Interface { HEXSTRING_template target; HEXSTRING* dec_val; public: Dec_Match_tmp_21(HEXSTRING_template p_target): target(p_target), dec_val(NULL) { } ~Dec_Match_tmp_21() { if (dec_val != NULL) delete dec_val; } virtual boolean match(TTCN_Buffer& buff) { if (dec_val != NULL) delete dec_val; dec_val = new HEXSTRING; boolean ret_val; OCTETSTRING os; buff.get_string(os); if (BcdMccMnc_decoder(os, *dec_val, BcdMccMnc_default_coding) != 0) { TTCN_warning("Decoded content matching failed, because the data could not be decoded."); ret_val = FALSE; } else if (os.lengthof() != 0) { TTCN_warning("Decoded content matching failed, because the buffer was not empty after decoding. Remaining octets: %d.", os.lengthof()); ret_val = FALSE; } else ret_val = target.match(*dec_val); if (!ret_val) { delete dec_val; dec_val = NULL; } return ret_val; } virtual void log() const { TTCN_Logger::log_event_str("hexstring: "); target.log(); } void* get_dec_res() const { return dec_val; } const TTCN_Typedescriptor_t* get_type_descr() const { return &BcdMccMnc_descr_; } }; tmp_20.set_type(DECODE_MATCH); { HEXSTRING_template tmp_22; tmp_22 = hs_2; tmp_20.set_decmatch(new Dec_Match_tmp_21(tmp_22)); } tmp_23 = (!(tmp_20.match(os_3))); } if (tmp_23) { current_location.update_lineno(477); /* GSM_Types.ttcn, line 477 */ TTCN_Runtime::setverdict(FAIL); } } current_location.update_lineno(478); /* GSM_Types.ttcn, line 478 */ { boolean tmp_27; { OCTETSTRING_template tmp_24; class Dec_Match_tmp_25 : public Dec_Match_Interface { HEXSTRING_template target; HEXSTRING* dec_val; public: Dec_Match_tmp_25(HEXSTRING_template p_target): target(p_target), dec_val(NULL) { } ~Dec_Match_tmp_25() { if (dec_val != NULL) delete dec_val; } virtual boolean match(TTCN_Buffer& buff) { if (dec_val != NULL) delete dec_val; dec_val = new HEXSTRING; boolean ret_val; OCTETSTRING os; buff.get_string(os); if (BcdMccMnc_decoder(os, *dec_val, BcdMccMnc_default_coding) != 0) { TTCN_warning("Decoded content matching failed, because the data could not be decoded."); ret_val = FALSE; } else if (os.lengthof() != 0) { TTCN_warning("Decoded content matching failed, because the buffer was not empty after decoding. Remaining octets: %d.", os.lengthof()); ret_val = FALSE; } else ret_val = target.match(*dec_val); if (!ret_val) { delete dec_val; dec_val = NULL; } return ret_val; } virtual void log() const { TTCN_Logger::log_event_str("hexstring: "); target.log(); } void* get_dec_res() const { return dec_val; } const TTCN_Typedescriptor_t* get_type_descr() const { return &BcdMccMnc_descr_; } }; tmp_24.set_type(DECODE_MATCH); { HEXSTRING_template tmp_26; tmp_26 = hs_3; tmp_24.set_decmatch(new Dec_Match_tmp_25(tmp_26)); } tmp_27 = (!(tmp_24.match(os_4))); } if (tmp_27) { current_location.update_lineno(478); /* GSM_Types.ttcn, line 478 */ TTCN_Runtime::setverdict(FAIL); } } current_location.update_lineno(480); /* GSM_Types.ttcn, line 480 */ if ((!(OCTETSTRING_template(os_2).match(enc__BcdMccMnc(hs_1))))) { current_location.update_lineno(480); /* GSM_Types.ttcn, line 480 */ TTCN_Runtime::setverdict(FAIL); } current_location.update_lineno(481); /* GSM_Types.ttcn, line 481 */ if ((!(OCTETSTRING_template(os_3).match(enc__BcdMccMnc(hs_2))))) { current_location.update_lineno(481); /* GSM_Types.ttcn, line 481 */ TTCN_Runtime::setverdict(FAIL); } current_location.update_lineno(482); /* GSM_Types.ttcn, line 482 */ if ((!(OCTETSTRING_template(os_4).match(enc__BcdMccMnc(hs_3))))) { current_location.update_lineno(482); /* GSM_Types.ttcn, line 482 */ TTCN_Runtime::setverdict(FAIL); } current_location.update_lineno(484); /* GSM_Types.ttcn, line 484 */ if ((!(HEXSTRING_template(hs_1).match(f__build__BcdMccMnc(hs_4, hs_5))))) { current_location.update_lineno(484); /* GSM_Types.ttcn, line 484 */ TTCN_Runtime::setverdict(FAIL); } current_location.update_lineno(485); /* GSM_Types.ttcn, line 485 */ if ((!(HEXSTRING_template(hs_2).match(f__build__BcdMccMnc(hs_6, hs_7))))) { current_location.update_lineno(485); /* GSM_Types.ttcn, line 485 */ TTCN_Runtime::setverdict(FAIL); } current_location.update_lineno(486); /* GSM_Types.ttcn, line 486 */ if ((!(HEXSTRING_template(hs_3).match(f__build__BcdMccMnc(hs_6, hs_8))))) { current_location.update_lineno(486); /* GSM_Types.ttcn, line 486 */ TTCN_Runtime::setverdict(FAIL); } current_location.update_lineno(488); /* GSM_Types.ttcn, line 488 */ if ((!(HEXSTRING_template(hs_1).match(f__build__BcdMccMnc__int(262, 42, FALSE))))) { current_location.update_lineno(488); /* GSM_Types.ttcn, line 488 */ TTCN_Runtime::setverdict(FAIL); } current_location.update_lineno(489); /* GSM_Types.ttcn, line 489 */ if ((!(HEXSTRING_template(hs_2).match(f__build__BcdMccMnc__int(123, 45, FALSE))))) { current_location.update_lineno(489); /* GSM_Types.ttcn, line 489 */ TTCN_Runtime::setverdict(FAIL); } current_location.update_lineno(490); /* GSM_Types.ttcn, line 490 */ if ((!(HEXSTRING_template(hs_3).match(f__build__BcdMccMnc__int(123, 456, TRUE))))) { current_location.update_lineno(490); /* GSM_Types.ttcn, line 490 */ TTCN_Runtime::setverdict(FAIL); } current_location.update_lineno(492); /* GSM_Types.ttcn, line 492 */ TTCN_Runtime::setverdict(PASS); } catch (const TC_Error& tc_error) { } catch (const TC_End& tc_end) { TTCN_Logger::log_str(TTCN_FUNCTION, "Test case TC_selftest_BcdMccMnc was stopped."); } return TTCN_Runtime::end_testcase(); } void LocationAreaIdentification_mcc__mnc_encoder(const HEXSTRING& 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 `hexstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(LocationAreaIdentification_mcc__mnc_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER LocationAreaIdentification_mcc__mnc_decoder(OCTETSTRING& input_stream, HEXSTRING& 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 `hexstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(LocationAreaIdentification_mcc__mnc_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 LocationAreaIdentification_lac_encoder(const INTEGER& 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 `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(LocationAreaIdentification_lac_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER LocationAreaIdentification_lac_decoder(OCTETSTRING& input_stream, INTEGER& 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 `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(LocationAreaIdentification_lac_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 LocationAreaIdentification_encoder(const LocationAreaIdentification& 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 `@GSM_Types.LocationAreaIdentification' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(LocationAreaIdentification_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER LocationAreaIdentification_decoder(OCTETSTRING& input_stream, LocationAreaIdentification& 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 `@GSM_Types.LocationAreaIdentification' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(LocationAreaIdentification_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; } } LocationAreaIdentification_template ts__LAI(const HEXSTRING& mcc__mnc, const INTEGER& lac) { TTCN_Location current_location("GSM_Types.ttcn", 500, TTCN_Location::LOCATION_TEMPLATE, "ts_LAI"); LocationAreaIdentification_template ret_val; ret_val.mcc__mnc() = mcc__mnc; ret_val.lac() = lac; return ret_val; } void RoutingAreaIdentification_lai_encoder(const LocationAreaIdentification& 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 `@GSM_Types.LocationAreaIdentification' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(RoutingAreaIdentification_lai_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER RoutingAreaIdentification_lai_decoder(OCTETSTRING& input_stream, LocationAreaIdentification& 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 `@GSM_Types.LocationAreaIdentification' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(RoutingAreaIdentification_lai_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 RoutingAreaIdentification_rac_encoder(const INTEGER& 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 `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(RoutingAreaIdentification_rac_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER RoutingAreaIdentification_rac_decoder(OCTETSTRING& input_stream, INTEGER& 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 `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(RoutingAreaIdentification_rac_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 RoutingAreaIdentification_encoder(const RoutingAreaIdentification& 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 `@GSM_Types.RoutingAreaIdentification' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(RoutingAreaIdentification_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER RoutingAreaIdentification_decoder(OCTETSTRING& input_stream, RoutingAreaIdentification& 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 `@GSM_Types.RoutingAreaIdentification' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(RoutingAreaIdentification_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; } } RoutingAreaIdentification_template ts__RAI(const LocationAreaIdentification_template& lai, const INTEGER& rac) { TTCN_Location current_location("GSM_Types.ttcn", 510, TTCN_Location::LOCATION_TEMPLATE, "ts_RAI"); RoutingAreaIdentification_template ret_val; ret_val.lai() = lai; ret_val.rac() = rac; return ret_val; } OCTETSTRING enc__RoutingAreaIdentification(const RoutingAreaIdentification& rai) { if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); TTCN_Logger::log_event_str("enc_RoutingAreaIdentification(): Encoding @GSM_Types.RoutingAreaIdentification: "); rai.log(); TTCN_Logger::end_event(); } TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); TTCN_Buffer ttcn_buffer; rai.encode(RoutingAreaIdentification_descr_, ttcn_buffer, TTCN_EncDec::CT_RAW, 0); OCTETSTRING ret_val; ttcn_buffer.get_string(ret_val); if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); TTCN_Logger::log_event_str("enc_RoutingAreaIdentification(): Stream after encoding: "); ret_val.log(); TTCN_Logger::end_event(); } return ret_val; } void CellIdentity_encoder(const INTEGER& 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 `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(CellIdentity_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER CellIdentity_decoder(OCTETSTRING& input_stream, INTEGER& 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 `integer' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(CellIdentity_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; } } /* Bodies of static functions */ void pre_init_module() { TTCN_Location current_location("GSM_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "GSM_Types"); Osmocom__Types::module_object.pre_init_module(); Misc__Helpers::module_object.pre_init_module(); current_location.update_lineno(22); /* GSM_Types.ttcn, line 22 */ const_GsmMaxFrameNumber = 2715648; module_object.add_function("f_gprs_blocksize", (genericfunc_t)&f__gprs__blocksize, NULL); current_location.update_lineno(98); /* GSM_Types.ttcn, line 98 */ const_TLLI__UNUSED = os_0; module_object.add_function("f_gen_tlli", (genericfunc_t)&f__gen__tlli, NULL); module_object.add_function("f_hex_is_odd_length", (genericfunc_t)&f__hex__is__odd__length, NULL); module_object.add_function("enc_CBCH_Block", (genericfunc_t)&enc__CBCH__Block, NULL); module_object.add_function("dec_CBCH_Block", (genericfunc_t)&dec__CBCH__Block, NULL); module_object.add_function("dbm2rxlev", (genericfunc_t)&dbm2rxlev, NULL); module_object.add_function("rxlev2dbm", (genericfunc_t)&rxlev2dbm, NULL); module_object.add_function("ber2rxqual", (genericfunc_t)&ber2rxqual, NULL); module_object.add_function("rxqual2ber", (genericfunc_t)&rxqual2ber, NULL); current_location.update_lineno(404); /* GSM_Types.ttcn, line 404 */ const_GSM__FRAME__DURATION = 4.61538461538461e-3; current_location.update_lineno(405); /* GSM_Types.ttcn, line 405 */ const_GSM51__MFRAME__DURATION = 2.35384615384615e-1; current_location.update_lineno(406); /* GSM_Types.ttcn, line 406 */ const_GSM51__MFRAMES__PER__SEC = 4.2483660130719; module_object.add_function("f_ccch_blocks_per_mframe", (genericfunc_t)&f__ccch__blocks__per__mframe, NULL); module_object.add_function("f_pch_block_rate_est", (genericfunc_t)&f__pch__block__rate__est, NULL); module_object.add_function("f_agch_block_rate_est", (genericfunc_t)&f__agch__block__rate__est, NULL); module_object.add_function("f_gsm_compute_tc", (genericfunc_t)&f__gsm__compute__tc, NULL); module_object.add_function("enc_BcdMccMnc", (genericfunc_t)&enc__BcdMccMnc, NULL); module_object.add_function("dec_BcdMccMnc", (genericfunc_t)&dec__BcdMccMnc, NULL); module_object.add_function("f_build_BcdMccMnc", (genericfunc_t)&f__build__BcdMccMnc, NULL); module_object.add_function("f_build_BcdMccMnc_int", (genericfunc_t)&f__build__BcdMccMnc__int, NULL); module_object.add_testcase_nonpard("TC_selftest_BcdMccMnc", testcase_TC__selftest__BcdMccMnc); module_object.add_function("enc_RoutingAreaIdentification", (genericfunc_t)&enc__RoutingAreaIdentification, NULL); } void post_init_module() { TTCN_Location current_location("GSM_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "GSM_Types"); Osmocom__Types::module_object.post_init_module(); Misc__Helpers::module_object.post_init_module(); current_location.update_lineno(48); /* GSM_Types.ttcn, line 48 */ template_ts__GsmBandArfcn_pcs_defval = FALSE; current_location.update_lineno(49); /* GSM_Types.ttcn, line 49 */ template_ts__GsmBandArfcn_uplink_defval = FALSE; current_location.update_lineno(57); /* GSM_Types.ttcn, line 57 */ template_tr__GsmBandArfcn_pcs_defval = ANY_VALUE; current_location.update_lineno(58); /* GSM_Types.ttcn, line 58 */ template_tr__GsmBandArfcn_uplink_defval = ANY_VALUE; current_location.update_lineno(257); /* GSM_Types.ttcn, line 257 */ template_tr__RslLinkId.c() = ANY_VALUE; template_tr__RslLinkId.na() = ANY_VALUE; template_tr__RslLinkId.prio() = ANY_VALUE; template_tr__RslLinkId.sapi() = ANY_VALUE; current_location.update_lineno(325); /* GSM_Types.ttcn, line 325 */ template_tr__CBCH__BlockType_seq__nr_defval = ANY_VALUE; current_location.update_lineno(325); /* GSM_Types.ttcn, line 325 */ template_tr__CBCH__BlockType_last__block_defval = ANY_VALUE; current_location.update_lineno(341); /* GSM_Types.ttcn, line 341 */ template_tr__CBCH__Block_seq__nr_defval = ANY_VALUE; current_location.update_lineno(341); /* GSM_Types.ttcn, line 341 */ template_tr__CBCH__Block_last__block_defval = ANY_VALUE; current_location.update_lineno(341); /* GSM_Types.ttcn, line 341 */ template_tr__CBCH__Block_payload_defval = ANY_VALUE; } } /* end of namespace */