// 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 "NS_Types.hh" namespace NS__Types { /* Literal string constants */ const unsigned char bs_1_bits[] = { 0 }, bs_0_bits[] = { 1 }; extern const BITSTRING bs_1(1, bs_1_bits), bs_0(1, bs_0_bits); const unsigned char os_5_octets[] = { 0 }, os_0_octets[] = { 1 }, os_1_octets[] = { 2 }, os_2_octets[] = { 3 }, os_10_octets[] = { 4 }, os_3_octets[] = { 5 }, os_4_octets[] = { 6 }, os_11_octets[] = { 7 }, os_7_octets[] = { 8 }, os_8_octets[] = { 9 }, os_9_octets[] = { 10 }, os_6_octets[] = { 11 }, os_12_octets[] = { 12 }, os_13_octets[] = { 13 }, os_14_octets[] = { 14 }, os_15_octets[] = { 15 }, os_16_octets[] = { 16 }, os_17_octets[] = { 17 }, os_18_octets[] = { 18 }, os_19_octets[] = { 19 }; extern const OCTETSTRING os_5(1, os_5_octets), os_0(1, os_0_octets), os_1(1, os_1_octets), os_2(1, os_2_octets), os_10(1, os_10_octets), os_3(1, os_3_octets), os_4(1, os_4_octets), os_11(1, os_11_octets), os_7(1, os_7_octets), os_8(1, os_8_octets), os_9(1, os_9_octets), os_6(1, os_6_octets), os_12(1, os_12_octets), os_13(1, os_13_octets), os_14(1, os_14_octets), os_15(1, os_15_octets), os_16(1, os_16_octets), os_17(1, os_17_octets), os_18(1, os_18_octets), os_19(1, os_19_octets); const unsigned char module_checksum[] = { 0x42, 0x15, 0x3d, 0x31, 0x84, 0x8d, 0xc4, 0x6f, 0xea, 0xc8, 0x66, 0x87, 0x72, 0x28, 0x9d, 0x4f }; /* Global variable definitions */ const XERdescriptor_t CauseNS_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int CauseNS_iEI_oer_ext_arr_[0] = {}; const int CauseNS_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t CauseNS_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, CauseNS_iEI_oer_ext_arr_, 0, CauseNS_iEI_oer_p_}; const TTCN_Typedescriptor_t CauseNS_iEI_descr_ = { "@NS_Types.CauseNS.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &CauseNS_iEI_xer_, &OCTETSTRING_json_, &CauseNS_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CauseNS_iEI_default_coding("RAW"); const TTCN_RAWdescriptor_t CauseNS_ext_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 CauseNS_ext_xer_ = { {"ext>\n", "ext>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t CauseNS_ext_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t CauseNS_ext_descr_ = { "@NS_Types.CauseNS.ext", &BITSTRING_ber_, &CauseNS_ext_raw_, NULL, &CauseNS_ext_xer_, &BITSTRING_json_, &CauseNS_ext_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CauseNS_ext_default_coding("RAW"); const TTCN_RAWdescriptor_t LIN1__2_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for LIN1__2 const TTCN_Typedescriptor_t LIN1__2_descr_ = { "@NS_Types.LIN1_2", NULL, &LIN1__2_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const TTCN_RAWdescriptor_t LIN1__2_length1_raw_ = {7,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 LIN1__2_length1_xer_ = { {"length1>\n", "length1>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t LIN1__2_length1_descr_ = { "@NS_Types.LIN1_2.length1", &INTEGER_ber_, &LIN1__2_length1_raw_, &INTEGER_text_, &LIN1__2_length1_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING LIN1__2_length1_default_coding("RAW"); const TTCN_RAWdescriptor_t LIN1__2_length2_raw_ = {15,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 LIN1__2_length2_xer_ = { {"length2>\n", "length2>\n"}, {9, 9}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t LIN1__2_length2_descr_ = { "@NS_Types.LIN1_2.length2", &INTEGER_ber_, &LIN1__2_length2_raw_, &INTEGER_text_, &LIN1__2_length2_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING LIN1__2_length2_default_coding("RAW"); UNIVERSAL_CHARSTRING LIN1__2_default_coding("RAW"); const TTCN_RAWdescriptor_t CauseNS_lengthIndicator_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 CauseNS_lengthIndicator const TTCN_Typedescriptor_t CauseNS_lengthIndicator_descr_ = { "@NS_Types.CauseNS.lengthIndicator", NULL, &CauseNS_lengthIndicator_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CauseNS_lengthIndicator_default_coding("RAW"); const XERdescriptor_t CauseNS_cause_xer_ = { {"cause>\n", "cause>\n"}, {7, 7}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int CauseNS_cause_oer_ext_arr_[0] = {}; const int CauseNS_cause_oer_p_[0] = {}; const TTCN_OERdescriptor_t CauseNS_cause_oer_ = { -1, TRUE, 1, FALSE, 0, 0, CauseNS_cause_oer_ext_arr_, 0, CauseNS_cause_oer_p_}; const TTCN_Typedescriptor_t CauseNS_cause_descr_ = { "@NS_Types.CauseNS.cause", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &CauseNS_cause_xer_, &OCTETSTRING_json_, &CauseNS_cause_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CauseNS_cause_default_coding("RAW"); const TTCN_RAWdescriptor_t CauseNS_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for CauseNS const TTCN_Typedescriptor_t CauseNS_descr_ = { "@NS_Types.CauseNS", NULL, &CauseNS_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING CauseNS_default_coding("RAW"); const XERdescriptor_t NS__VCI_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int NS__VCI_iEI_oer_ext_arr_[0] = {}; const int NS__VCI_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t NS__VCI_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, NS__VCI_iEI_oer_ext_arr_, 0, NS__VCI_iEI_oer_p_}; const TTCN_Typedescriptor_t NS__VCI_iEI_descr_ = { "@NS_Types.NS_VCI.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &NS__VCI_iEI_xer_, &OCTETSTRING_json_, &NS__VCI_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__VCI_iEI_default_coding("RAW"); const TTCN_RAWdescriptor_t NS__VCI_ext_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 NS__VCI_ext_xer_ = { {"ext>\n", "ext>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t NS__VCI_ext_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t NS__VCI_ext_descr_ = { "@NS_Types.NS_VCI.ext", &BITSTRING_ber_, &NS__VCI_ext_raw_, NULL, &NS__VCI_ext_xer_, &BITSTRING_json_, &NS__VCI_ext_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__VCI_ext_default_coding("RAW"); const TTCN_RAWdescriptor_t NS__VCI_lengthIndicator_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 NS__VCI_lengthIndicator const TTCN_Typedescriptor_t NS__VCI_lengthIndicator_descr_ = { "@NS_Types.NS_VCI.lengthIndicator", NULL, &NS__VCI_lengthIndicator_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__VCI_lengthIndicator_default_coding("RAW"); const XERdescriptor_t NS__VCI_nS__VCI_xer_ = { {"nS_VCI>\n", "nS_VCI>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int NS__VCI_nS__VCI_oer_ext_arr_[0] = {}; const int NS__VCI_nS__VCI_oer_p_[0] = {}; const TTCN_OERdescriptor_t NS__VCI_nS__VCI_oer_ = { -1, TRUE, 2, FALSE, 0, 0, NS__VCI_nS__VCI_oer_ext_arr_, 0, NS__VCI_nS__VCI_oer_p_}; const TTCN_Typedescriptor_t NS__VCI_nS__VCI_descr_ = { "@NS_Types.NS_VCI.nS_VCI", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &NS__VCI_nS__VCI_xer_, &OCTETSTRING_json_, &NS__VCI_nS__VCI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__VCI_nS__VCI_default_coding("RAW"); const TTCN_RAWdescriptor_t NS__VCI_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for NS__VCI const TTCN_Typedescriptor_t NS__VCI_descr_ = { "@NS_Types.NS_VCI", NULL, &NS__VCI_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__VCI_default_coding("RAW"); const XERdescriptor_t NS__PDU_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int NS__PDU_iEI_oer_ext_arr_[0] = {}; const int NS__PDU_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t NS__PDU_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, NS__PDU_iEI_oer_ext_arr_, 0, NS__PDU_iEI_oer_p_}; const TTCN_Typedescriptor_t NS__PDU_iEI_descr_ = { "@NS_Types.NS_PDU.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &NS__PDU_iEI_xer_, &OCTETSTRING_json_, &NS__PDU_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__PDU_iEI_default_coding("RAW"); const TTCN_RAWdescriptor_t NS__PDU_ext_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 NS__PDU_ext_xer_ = { {"ext>\n", "ext>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t NS__PDU_ext_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t NS__PDU_ext_descr_ = { "@NS_Types.NS_PDU.ext", &BITSTRING_ber_, &NS__PDU_ext_raw_, NULL, &NS__PDU_ext_xer_, &BITSTRING_json_, &NS__PDU_ext_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__PDU_ext_default_coding("RAW"); const TTCN_RAWdescriptor_t NS__PDU_lengthIndicator_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 NS__PDU_lengthIndicator const TTCN_Typedescriptor_t NS__PDU_lengthIndicator_descr_ = { "@NS_Types.NS_PDU.lengthIndicator", NULL, &NS__PDU_lengthIndicator_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__PDU_lengthIndicator_default_coding("RAW"); const XERdescriptor_t NS__PDU_ns__PDU_xer_ = { {"ns_PDU>\n", "ns_PDU>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int NS__PDU_ns__PDU_oer_ext_arr_[0] = {}; const int NS__PDU_ns__PDU_oer_p_[0] = {}; const TTCN_OERdescriptor_t NS__PDU_ns__PDU_oer_ = { -1, TRUE, -1, FALSE, 0, 0, NS__PDU_ns__PDU_oer_ext_arr_, 0, NS__PDU_ns__PDU_oer_p_}; const TTCN_Typedescriptor_t NS__PDU_ns__PDU_descr_ = { "@NS_Types.NS_PDU.ns_PDU", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &NS__PDU_ns__PDU_xer_, &OCTETSTRING_json_, &NS__PDU_ns__PDU_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__PDU_ns__PDU_default_coding("RAW"); const TTCN_RAWdescriptor_t NS__PDU_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for NS__PDU const TTCN_Typedescriptor_t NS__PDU_descr_ = { "@NS_Types.NS_PDU", NULL, &NS__PDU_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__PDU_default_coding("RAW"); const XERdescriptor_t BVCI__NS_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int BVCI__NS_iEI_oer_ext_arr_[0] = {}; const int BVCI__NS_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t BVCI__NS_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, BVCI__NS_iEI_oer_ext_arr_, 0, BVCI__NS_iEI_oer_p_}; const TTCN_Typedescriptor_t BVCI__NS_iEI_descr_ = { "@NS_Types.BVCI_NS.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &BVCI__NS_iEI_xer_, &OCTETSTRING_json_, &BVCI__NS_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING BVCI__NS_iEI_default_coding("RAW"); const TTCN_RAWdescriptor_t BVCI__NS_ext_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 BVCI__NS_ext_xer_ = { {"ext>\n", "ext>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t BVCI__NS_ext_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t BVCI__NS_ext_descr_ = { "@NS_Types.BVCI_NS.ext", &BITSTRING_ber_, &BVCI__NS_ext_raw_, NULL, &BVCI__NS_ext_xer_, &BITSTRING_json_, &BVCI__NS_ext_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING BVCI__NS_ext_default_coding("RAW"); const TTCN_RAWdescriptor_t BVCI__NS_lengthIndicator_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 BVCI__NS_lengthIndicator const TTCN_Typedescriptor_t BVCI__NS_lengthIndicator_descr_ = { "@NS_Types.BVCI_NS.lengthIndicator", NULL, &BVCI__NS_lengthIndicator_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING BVCI__NS_lengthIndicator_default_coding("RAW"); const XERdescriptor_t BVCI__NS_bVCI_xer_ = { {"bVCI>\n", "bVCI>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int BVCI__NS_bVCI_oer_ext_arr_[0] = {}; const int BVCI__NS_bVCI_oer_p_[0] = {}; const TTCN_OERdescriptor_t BVCI__NS_bVCI_oer_ = { -1, TRUE, 2, FALSE, 0, 0, BVCI__NS_bVCI_oer_ext_arr_, 0, BVCI__NS_bVCI_oer_p_}; const TTCN_Typedescriptor_t BVCI__NS_bVCI_descr_ = { "@NS_Types.BVCI_NS.bVCI", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &BVCI__NS_bVCI_xer_, &OCTETSTRING_json_, &BVCI__NS_bVCI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING BVCI__NS_bVCI_default_coding("RAW"); const TTCN_RAWdescriptor_t BVCI__NS_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for BVCI__NS const TTCN_Typedescriptor_t BVCI__NS_descr_ = { "@NS_Types.BVCI_NS", NULL, &BVCI__NS_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING BVCI__NS_default_coding("RAW"); const XERdescriptor_t ListofIP4Elements_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int ListofIP4Elements_iEI_oer_ext_arr_[0] = {}; const int ListofIP4Elements_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t ListofIP4Elements_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, ListofIP4Elements_iEI_oer_ext_arr_, 0, ListofIP4Elements_iEI_oer_p_}; const TTCN_Typedescriptor_t ListofIP4Elements_iEI_descr_ = { "@NS_Types.ListofIP4Elements.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &ListofIP4Elements_iEI_xer_, &OCTETSTRING_json_, &ListofIP4Elements_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ListofIP4Elements_iEI_default_coding("RAW"); const TTCN_RAWdescriptor_t ListofIP4Elements_ext_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 ListofIP4Elements_ext_xer_ = { {"ext>\n", "ext>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t ListofIP4Elements_ext_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t ListofIP4Elements_ext_descr_ = { "@NS_Types.ListofIP4Elements.ext", &BITSTRING_ber_, &ListofIP4Elements_ext_raw_, NULL, &ListofIP4Elements_ext_xer_, &BITSTRING_json_, &ListofIP4Elements_ext_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ListofIP4Elements_ext_default_coding("RAW"); const TTCN_RAWdescriptor_t ListofIP4Elements_lengthIndicator_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 ListofIP4Elements_lengthIndicator const TTCN_Typedescriptor_t ListofIP4Elements_lengthIndicator_descr_ = { "@NS_Types.ListofIP4Elements.lengthIndicator", NULL, &ListofIP4Elements_lengthIndicator_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ListofIP4Elements_lengthIndicator_default_coding("RAW"); const TTCN_RAWdescriptor_t IP4__Elements_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for IP4__Elements const TTCN_Typedescriptor_t IP4__Elements_descr_ = { "@NS_Types.IP4_Elements", NULL, &IP4__Elements_raw_, NULL, NULL, NULL, NULL, NULL, &IP4__Element_descr_, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t IP4__Element_ipAddress_xer_ = { {"ipAddress>\n", "ipAddress>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP4__Element_ipAddress_oer_ext_arr_[0] = {}; const int IP4__Element_ipAddress_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP4__Element_ipAddress_oer_ = { -1, TRUE, 4, FALSE, 0, 0, IP4__Element_ipAddress_oer_ext_arr_, 0, IP4__Element_ipAddress_oer_p_}; const TTCN_Typedescriptor_t IP4__Element_ipAddress_descr_ = { "@NS_Types.IP4_Element.ipAddress", &OCTETSTRING_ber_, &General__Types::OCT4_raw_, &OCTETSTRING_text_, &IP4__Element_ipAddress_xer_, &OCTETSTRING_json_, &IP4__Element_ipAddress_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP4__Element_ipAddress_default_coding("RAW"); const XERdescriptor_t IP4__Element_uDP__Port_xer_ = { {"uDP_Port>\n", "uDP_Port>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP4__Element_uDP__Port_oer_ext_arr_[0] = {}; const int IP4__Element_uDP__Port_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP4__Element_uDP__Port_oer_ = { -1, TRUE, 2, FALSE, 0, 0, IP4__Element_uDP__Port_oer_ext_arr_, 0, IP4__Element_uDP__Port_oer_p_}; const TTCN_Typedescriptor_t IP4__Element_uDP__Port_descr_ = { "@NS_Types.IP4_Element.uDP_Port", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &IP4__Element_uDP__Port_xer_, &OCTETSTRING_json_, &IP4__Element_uDP__Port_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP4__Element_uDP__Port_default_coding("RAW"); const XERdescriptor_t IP4__Element_signallingWeight_xer_ = { {"signallingWeight>\n", "signallingWeight>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP4__Element_signallingWeight_oer_ext_arr_[0] = {}; const int IP4__Element_signallingWeight_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP4__Element_signallingWeight_oer_ = { -1, TRUE, 1, FALSE, 0, 0, IP4__Element_signallingWeight_oer_ext_arr_, 0, IP4__Element_signallingWeight_oer_p_}; const TTCN_Typedescriptor_t IP4__Element_signallingWeight_descr_ = { "@NS_Types.IP4_Element.signallingWeight", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &IP4__Element_signallingWeight_xer_, &OCTETSTRING_json_, &IP4__Element_signallingWeight_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP4__Element_signallingWeight_default_coding("RAW"); const XERdescriptor_t IP4__Element_dataWeight_xer_ = { {"dataWeight>\n", "dataWeight>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP4__Element_dataWeight_oer_ext_arr_[0] = {}; const int IP4__Element_dataWeight_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP4__Element_dataWeight_oer_ = { -1, TRUE, 1, FALSE, 0, 0, IP4__Element_dataWeight_oer_ext_arr_, 0, IP4__Element_dataWeight_oer_p_}; const TTCN_Typedescriptor_t IP4__Element_dataWeight_descr_ = { "@NS_Types.IP4_Element.dataWeight", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &IP4__Element_dataWeight_xer_, &OCTETSTRING_json_, &IP4__Element_dataWeight_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP4__Element_dataWeight_default_coding("RAW"); const TTCN_RAWdescriptor_t IP4__Element_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for IP4__Element const TTCN_Typedescriptor_t IP4__Element_descr_ = { "@NS_Types.IP4_Element", NULL, &IP4__Element_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP4__Element_default_coding("RAW"); UNIVERSAL_CHARSTRING IP4__Elements_0_default_coding("RAW"); UNIVERSAL_CHARSTRING IP4__Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING ListofIP4Elements_iP4__Elements_default_coding("RAW"); const TTCN_RAWdescriptor_t ListofIP4Elements_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for ListofIP4Elements const TTCN_Typedescriptor_t ListofIP4Elements_descr_ = { "@NS_Types.ListofIP4Elements", NULL, &ListofIP4Elements_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ListofIP4Elements_default_coding("RAW"); const XERdescriptor_t ListofIP6Elements_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int ListofIP6Elements_iEI_oer_ext_arr_[0] = {}; const int ListofIP6Elements_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t ListofIP6Elements_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, ListofIP6Elements_iEI_oer_ext_arr_, 0, ListofIP6Elements_iEI_oer_p_}; const TTCN_Typedescriptor_t ListofIP6Elements_iEI_descr_ = { "@NS_Types.ListofIP6Elements.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &ListofIP6Elements_iEI_xer_, &OCTETSTRING_json_, &ListofIP6Elements_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ListofIP6Elements_iEI_default_coding("RAW"); const TTCN_RAWdescriptor_t ListofIP6Elements_ext_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 ListofIP6Elements_ext_xer_ = { {"ext>\n", "ext>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t ListofIP6Elements_ext_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t ListofIP6Elements_ext_descr_ = { "@NS_Types.ListofIP6Elements.ext", &BITSTRING_ber_, &ListofIP6Elements_ext_raw_, NULL, &ListofIP6Elements_ext_xer_, &BITSTRING_json_, &ListofIP6Elements_ext_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ListofIP6Elements_ext_default_coding("RAW"); const TTCN_RAWdescriptor_t ListofIP6Elements_lengthIndicator_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 ListofIP6Elements_lengthIndicator const TTCN_Typedescriptor_t ListofIP6Elements_lengthIndicator_descr_ = { "@NS_Types.ListofIP6Elements.lengthIndicator", NULL, &ListofIP6Elements_lengthIndicator_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ListofIP6Elements_lengthIndicator_default_coding("RAW"); const TTCN_RAWdescriptor_t IP6__Elements_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for IP6__Elements const TTCN_Typedescriptor_t IP6__Elements_descr_ = { "@NS_Types.IP6_Elements", NULL, &IP6__Elements_raw_, NULL, NULL, NULL, NULL, NULL, &IP6__Element_descr_, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t IP6__Element_ipAddress_xer_ = { {"ipAddress>\n", "ipAddress>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP6__Element_ipAddress_oer_ext_arr_[0] = {}; const int IP6__Element_ipAddress_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP6__Element_ipAddress_oer_ = { -1, TRUE, 16, FALSE, 0, 0, IP6__Element_ipAddress_oer_ext_arr_, 0, IP6__Element_ipAddress_oer_p_}; const TTCN_Typedescriptor_t IP6__Element_ipAddress_descr_ = { "@NS_Types.IP6_Element.ipAddress", &OCTETSTRING_ber_, &General__Types::OCT16_raw_, &OCTETSTRING_text_, &IP6__Element_ipAddress_xer_, &OCTETSTRING_json_, &IP6__Element_ipAddress_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP6__Element_ipAddress_default_coding("RAW"); const XERdescriptor_t IP6__Element_uDP__Port_xer_ = { {"uDP_Port>\n", "uDP_Port>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP6__Element_uDP__Port_oer_ext_arr_[0] = {}; const int IP6__Element_uDP__Port_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP6__Element_uDP__Port_oer_ = { -1, TRUE, 2, FALSE, 0, 0, IP6__Element_uDP__Port_oer_ext_arr_, 0, IP6__Element_uDP__Port_oer_p_}; const TTCN_Typedescriptor_t IP6__Element_uDP__Port_descr_ = { "@NS_Types.IP6_Element.uDP_Port", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &IP6__Element_uDP__Port_xer_, &OCTETSTRING_json_, &IP6__Element_uDP__Port_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP6__Element_uDP__Port_default_coding("RAW"); const XERdescriptor_t IP6__Element_signallingWeight_xer_ = { {"signallingWeight>\n", "signallingWeight>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP6__Element_signallingWeight_oer_ext_arr_[0] = {}; const int IP6__Element_signallingWeight_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP6__Element_signallingWeight_oer_ = { -1, TRUE, 1, FALSE, 0, 0, IP6__Element_signallingWeight_oer_ext_arr_, 0, IP6__Element_signallingWeight_oer_p_}; const TTCN_Typedescriptor_t IP6__Element_signallingWeight_descr_ = { "@NS_Types.IP6_Element.signallingWeight", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &IP6__Element_signallingWeight_xer_, &OCTETSTRING_json_, &IP6__Element_signallingWeight_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP6__Element_signallingWeight_default_coding("RAW"); const XERdescriptor_t IP6__Element_dataWeight_xer_ = { {"dataWeight>\n", "dataWeight>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP6__Element_dataWeight_oer_ext_arr_[0] = {}; const int IP6__Element_dataWeight_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP6__Element_dataWeight_oer_ = { -1, TRUE, 1, FALSE, 0, 0, IP6__Element_dataWeight_oer_ext_arr_, 0, IP6__Element_dataWeight_oer_p_}; const TTCN_Typedescriptor_t IP6__Element_dataWeight_descr_ = { "@NS_Types.IP6_Element.dataWeight", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &IP6__Element_dataWeight_xer_, &OCTETSTRING_json_, &IP6__Element_dataWeight_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP6__Element_dataWeight_default_coding("RAW"); const TTCN_RAWdescriptor_t IP6__Element_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for IP6__Element const TTCN_Typedescriptor_t IP6__Element_descr_ = { "@NS_Types.IP6_Element", NULL, &IP6__Element_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP6__Element_default_coding("RAW"); UNIVERSAL_CHARSTRING IP6__Elements_0_default_coding("RAW"); UNIVERSAL_CHARSTRING IP6__Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING ListofIP6Elements_iP6__Elements_default_coding("RAW"); const TTCN_RAWdescriptor_t ListofIP6Elements_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for ListofIP6Elements const TTCN_Typedescriptor_t ListofIP6Elements_descr_ = { "@NS_Types.ListofIP6Elements", NULL, &ListofIP6Elements_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ListofIP6Elements_default_coding("RAW"); const XERdescriptor_t IP__Address__NS_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP__Address__NS_iEI_oer_ext_arr_[0] = {}; const int IP__Address__NS_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP__Address__NS_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, IP__Address__NS_iEI_oer_ext_arr_, 0, IP__Address__NS_iEI_oer_p_}; const TTCN_Typedescriptor_t IP__Address__NS_iEI_descr_ = { "@NS_Types.IP_Address_NS.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &IP__Address__NS_iEI_xer_, &OCTETSTRING_json_, &IP__Address__NS_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP__Address__NS_iEI_default_coding("RAW"); const XERdescriptor_t IP__Address__NS_addressType_xer_ = { {"addressType>\n", "addressType>\n"}, {13, 13}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IP__Address__NS_addressType_oer_ext_arr_[0] = {}; const int IP__Address__NS_addressType_oer_p_[0] = {}; const TTCN_OERdescriptor_t IP__Address__NS_addressType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, IP__Address__NS_addressType_oer_ext_arr_, 0, IP__Address__NS_addressType_oer_p_}; const TTCN_Typedescriptor_t IP__Address__NS_addressType_descr_ = { "@NS_Types.IP_Address_NS.addressType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &IP__Address__NS_addressType_xer_, &OCTETSTRING_json_, &IP__Address__NS_addressType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP__Address__NS_addressType_default_coding("RAW"); const TTCN_RAWdescriptor_t IPAddress_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for IPAddress const TTCN_Typedescriptor_t IPAddress_descr_ = { "@NS_Types.IPAddress", NULL, &IPAddress_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; const XERdescriptor_t IPAddress_ip4Address_xer_ = { {"ip4Address>\n", "ip4Address>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IPAddress_ip4Address_oer_ext_arr_[0] = {}; const int IPAddress_ip4Address_oer_p_[0] = {}; const TTCN_OERdescriptor_t IPAddress_ip4Address_oer_ = { -1, TRUE, 4, FALSE, 0, 0, IPAddress_ip4Address_oer_ext_arr_, 0, IPAddress_ip4Address_oer_p_}; const TTCN_Typedescriptor_t IPAddress_ip4Address_descr_ = { "@NS_Types.IPAddress.ip4Address", &OCTETSTRING_ber_, &General__Types::OCT4_raw_, &OCTETSTRING_text_, &IPAddress_ip4Address_xer_, &OCTETSTRING_json_, &IPAddress_ip4Address_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IPAddress_ip4Address_default_coding("RAW"); const XERdescriptor_t IPAddress_ip6Address_xer_ = { {"ip6Address>\n", "ip6Address>\n"}, {12, 12}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int IPAddress_ip6Address_oer_ext_arr_[0] = {}; const int IPAddress_ip6Address_oer_p_[0] = {}; const TTCN_OERdescriptor_t IPAddress_ip6Address_oer_ = { -1, TRUE, 16, FALSE, 0, 0, IPAddress_ip6Address_oer_ext_arr_, 0, IPAddress_ip6Address_oer_p_}; const TTCN_Typedescriptor_t IPAddress_ip6Address_descr_ = { "@NS_Types.IPAddress.ip6Address", &OCTETSTRING_ber_, &General__Types::OCT16_raw_, &OCTETSTRING_text_, &IPAddress_ip6Address_xer_, &OCTETSTRING_json_, &IPAddress_ip6Address_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IPAddress_ip6Address_default_coding("RAW"); UNIVERSAL_CHARSTRING IPAddress_default_coding("RAW"); const TTCN_RAWdescriptor_t IP__Address__NS_ipAddress_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for IP__Address__NS_ipAddress const TTCN_Typedescriptor_t IP__Address__NS_ipAddress_descr_ = { "@NS_Types.IP_Address_NS.ipAddress", NULL, &IP__Address__NS_ipAddress_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP__Address__NS_ipAddress_default_coding("RAW"); const TTCN_RAWdescriptor_t IP__Address__NS_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for IP__Address__NS const TTCN_Typedescriptor_t IP__Address__NS_descr_ = { "@NS_Types.IP_Address_NS", NULL, &IP__Address__NS_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING IP__Address__NS_default_coding("RAW"); const XERdescriptor_t EndFlag_eBIT_xer_ = { {"eBIT>\n", "eBIT>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t EndFlag_eBIT_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t EndFlag_eBIT_descr_ = { "@NS_Types.EndFlag.eBIT", &BITSTRING_ber_, &General__Types::BIT1_raw_, NULL, &EndFlag_eBIT_xer_, &BITSTRING_json_, &EndFlag_eBIT_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING EndFlag_eBIT_default_coding("RAW"); const XERdescriptor_t EndFlag_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 EndFlag_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t EndFlag_spare_descr_ = { "@NS_Types.EndFlag.spare", &BITSTRING_ber_, &General__Types::BIT7_raw_, NULL, &EndFlag_spare_xer_, &BITSTRING_json_, &EndFlag_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING EndFlag_spare_default_coding("RAW"); const TTCN_RAWdescriptor_t EndFlag_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for EndFlag const TTCN_Typedescriptor_t EndFlag_descr_ = { "@NS_Types.EndFlag", NULL, &EndFlag_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING EndFlag_default_coding("RAW"); const XERdescriptor_t ResetFlag_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int ResetFlag_iEI_oer_ext_arr_[0] = {}; const int ResetFlag_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t ResetFlag_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, ResetFlag_iEI_oer_ext_arr_, 0, ResetFlag_iEI_oer_p_}; const TTCN_Typedescriptor_t ResetFlag_iEI_descr_ = { "@NS_Types.ResetFlag.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &ResetFlag_iEI_xer_, &OCTETSTRING_json_, &ResetFlag_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ResetFlag_iEI_default_coding("RAW"); const XERdescriptor_t ResetFlag_resetBIT_xer_ = { {"resetBIT>\n", "resetBIT>\n"}, {10, 10}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t ResetFlag_resetBIT_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t ResetFlag_resetBIT_descr_ = { "@NS_Types.ResetFlag.resetBIT", &BITSTRING_ber_, &General__Types::BIT1_raw_, NULL, &ResetFlag_resetBIT_xer_, &BITSTRING_json_, &ResetFlag_resetBIT_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ResetFlag_resetBIT_default_coding("RAW"); const XERdescriptor_t ResetFlag_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 ResetFlag_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t ResetFlag_spare_descr_ = { "@NS_Types.ResetFlag.spare", &BITSTRING_ber_, &General__Types::BIT7_raw_, NULL, &ResetFlag_spare_xer_, &BITSTRING_json_, &ResetFlag_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ResetFlag_spare_default_coding("RAW"); const TTCN_RAWdescriptor_t ResetFlag_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for ResetFlag const TTCN_Typedescriptor_t ResetFlag_descr_ = { "@NS_Types.ResetFlag", NULL, &ResetFlag_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING ResetFlag_default_coding("RAW"); const XERdescriptor_t MaxNumberOfNSVCs_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int MaxNumberOfNSVCs_iEI_oer_ext_arr_[0] = {}; const int MaxNumberOfNSVCs_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t MaxNumberOfNSVCs_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, MaxNumberOfNSVCs_iEI_oer_ext_arr_, 0, MaxNumberOfNSVCs_iEI_oer_p_}; const TTCN_Typedescriptor_t MaxNumberOfNSVCs_iEI_descr_ = { "@NS_Types.MaxNumberOfNSVCs.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &MaxNumberOfNSVCs_iEI_xer_, &OCTETSTRING_json_, &MaxNumberOfNSVCs_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING MaxNumberOfNSVCs_iEI_default_coding("RAW"); const XERdescriptor_t MaxNumberOfNSVCs_maxNumberOfNSVCs_xer_ = { {"maxNumberOfNSVCs>\n", "maxNumberOfNSVCs>\n"}, {18, 18}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int MaxNumberOfNSVCs_maxNumberOfNSVCs_oer_ext_arr_[0] = {}; const int MaxNumberOfNSVCs_maxNumberOfNSVCs_oer_p_[0] = {}; const TTCN_OERdescriptor_t MaxNumberOfNSVCs_maxNumberOfNSVCs_oer_ = { -1, TRUE, 2, FALSE, 0, 0, MaxNumberOfNSVCs_maxNumberOfNSVCs_oer_ext_arr_, 0, MaxNumberOfNSVCs_maxNumberOfNSVCs_oer_p_}; const TTCN_Typedescriptor_t MaxNumberOfNSVCs_maxNumberOfNSVCs_descr_ = { "@NS_Types.MaxNumberOfNSVCs.maxNumberOfNSVCs", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &MaxNumberOfNSVCs_maxNumberOfNSVCs_xer_, &OCTETSTRING_json_, &MaxNumberOfNSVCs_maxNumberOfNSVCs_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING MaxNumberOfNSVCs_maxNumberOfNSVCs_default_coding("RAW"); const TTCN_RAWdescriptor_t MaxNumberOfNSVCs_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for MaxNumberOfNSVCs const TTCN_Typedescriptor_t MaxNumberOfNSVCs_descr_ = { "@NS_Types.MaxNumberOfNSVCs", NULL, &MaxNumberOfNSVCs_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING MaxNumberOfNSVCs_default_coding("RAW"); const XERdescriptor_t NumberOfIP__Endpoints_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int NumberOfIP__Endpoints_iEI_oer_ext_arr_[0] = {}; const int NumberOfIP__Endpoints_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t NumberOfIP__Endpoints_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, NumberOfIP__Endpoints_iEI_oer_ext_arr_, 0, NumberOfIP__Endpoints_iEI_oer_p_}; const TTCN_Typedescriptor_t NumberOfIP__Endpoints_iEI_descr_ = { "@NS_Types.NumberOfIP_Endpoints.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &NumberOfIP__Endpoints_iEI_xer_, &OCTETSTRING_json_, &NumberOfIP__Endpoints_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NumberOfIP__Endpoints_iEI_default_coding("RAW"); const XERdescriptor_t NumberOfIP__Endpoints_numberOfIP__Endpoints_xer_ = { {"numberOfIP_Endpoints>\n", "numberOfIP_Endpoints>\n"}, {22, 22}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int NumberOfIP__Endpoints_numberOfIP__Endpoints_oer_ext_arr_[0] = {}; const int NumberOfIP__Endpoints_numberOfIP__Endpoints_oer_p_[0] = {}; const TTCN_OERdescriptor_t NumberOfIP__Endpoints_numberOfIP__Endpoints_oer_ = { -1, TRUE, 2, FALSE, 0, 0, NumberOfIP__Endpoints_numberOfIP__Endpoints_oer_ext_arr_, 0, NumberOfIP__Endpoints_numberOfIP__Endpoints_oer_p_}; const TTCN_Typedescriptor_t NumberOfIP__Endpoints_numberOfIP__Endpoints_descr_ = { "@NS_Types.NumberOfIP_Endpoints.numberOfIP_Endpoints", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &NumberOfIP__Endpoints_numberOfIP__Endpoints_xer_, &OCTETSTRING_json_, &NumberOfIP__Endpoints_numberOfIP__Endpoints_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NumberOfIP__Endpoints_numberOfIP__Endpoints_default_coding("RAW"); const TTCN_RAWdescriptor_t NumberOfIP__Endpoints_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for NumberOfIP__Endpoints const TTCN_Typedescriptor_t NumberOfIP__Endpoints_descr_ = { "@NS_Types.NumberOfIP_Endpoints", NULL, &NumberOfIP__Endpoints_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NumberOfIP__Endpoints_default_coding("RAW"); const XERdescriptor_t NSEI__NS_iEI_xer_ = { {"iEI>\n", "iEI>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int NSEI__NS_iEI_oer_ext_arr_[0] = {}; const int NSEI__NS_iEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t NSEI__NS_iEI_oer_ = { -1, TRUE, 1, FALSE, 0, 0, NSEI__NS_iEI_oer_ext_arr_, 0, NSEI__NS_iEI_oer_p_}; const TTCN_Typedescriptor_t NSEI__NS_iEI_descr_ = { "@NS_Types.NSEI_NS.iEI", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &NSEI__NS_iEI_xer_, &OCTETSTRING_json_, &NSEI__NS_iEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NSEI__NS_iEI_default_coding("RAW"); const TTCN_RAWdescriptor_t NSEI__NS_ext_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 NSEI__NS_ext_xer_ = { {"ext>\n", "ext>\n"}, {5, 5}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t NSEI__NS_ext_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t NSEI__NS_ext_descr_ = { "@NS_Types.NSEI_NS.ext", &BITSTRING_ber_, &NSEI__NS_ext_raw_, NULL, &NSEI__NS_ext_xer_, &BITSTRING_json_, &NSEI__NS_ext_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NSEI__NS_ext_default_coding("RAW"); const TTCN_RAWdescriptor_t NSEI__NS_lengthIndicator_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 NSEI__NS_lengthIndicator const TTCN_Typedescriptor_t NSEI__NS_lengthIndicator_descr_ = { "@NS_Types.NSEI_NS.lengthIndicator", NULL, &NSEI__NS_lengthIndicator_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NSEI__NS_lengthIndicator_default_coding("RAW"); const XERdescriptor_t NSEI__NS_nSEI_xer_ = { {"nSEI>\n", "nSEI>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int NSEI__NS_nSEI_oer_ext_arr_[0] = {}; const int NSEI__NS_nSEI_oer_p_[0] = {}; const TTCN_OERdescriptor_t NSEI__NS_nSEI_oer_ = { -1, TRUE, 2, FALSE, 0, 0, NSEI__NS_nSEI_oer_ext_arr_, 0, NSEI__NS_nSEI_oer_p_}; const TTCN_Typedescriptor_t NSEI__NS_nSEI_descr_ = { "@NS_Types.NSEI_NS.nSEI", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &NSEI__NS_nSEI_xer_, &OCTETSTRING_json_, &NSEI__NS_nSEI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NSEI__NS_nSEI_default_coding("RAW"); const TTCN_RAWdescriptor_t NSEI__NS_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for NSEI__NS const TTCN_Typedescriptor_t NSEI__NS_descr_ = { "@NS_Types.NSEI_NS", NULL, &NSEI__NS_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NSEI__NS_default_coding("RAW"); const XERdescriptor_t NS__SDU__ControlBits_rBit_xer_ = { {"rBit>\n", "rBit>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t NS__SDU__ControlBits_rBit_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t NS__SDU__ControlBits_rBit_descr_ = { "@NS_Types.NS_SDU_ControlBits.rBit", &BITSTRING_ber_, &General__Types::BIT1_raw_, NULL, &NS__SDU__ControlBits_rBit_xer_, &BITSTRING_json_, &NS__SDU__ControlBits_rBit_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__SDU__ControlBits_rBit_default_coding("RAW"); const XERdescriptor_t NS__SDU__ControlBits_cBit_xer_ = { {"cBit>\n", "cBit>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_OERdescriptor_t NS__SDU__ControlBits_cBit_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t NS__SDU__ControlBits_cBit_descr_ = { "@NS_Types.NS_SDU_ControlBits.cBit", &BITSTRING_ber_, &General__Types::BIT1_raw_, NULL, &NS__SDU__ControlBits_cBit_xer_, &BITSTRING_json_, &NS__SDU__ControlBits_cBit_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__SDU__ControlBits_cBit_default_coding("RAW"); const XERdescriptor_t NS__SDU__ControlBits_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 NS__SDU__ControlBits_spare_oer_ = { -1, FALSE, -1, FALSE, 0, 0, NULL, 0, NULL }; const TTCN_Typedescriptor_t NS__SDU__ControlBits_spare_descr_ = { "@NS_Types.NS_SDU_ControlBits.spare", &BITSTRING_ber_, &General__Types::BIT6_raw_, NULL, &NS__SDU__ControlBits_spare_xer_, &BITSTRING_json_, &NS__SDU__ControlBits_spare_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__SDU__ControlBits_spare_default_coding("RAW"); const TTCN_RAWdescriptor_t NS__SDU__ControlBits_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for NS__SDU__ControlBits const TTCN_Typedescriptor_t NS__SDU__ControlBits_descr_ = { "@NS_Types.NS_SDU_ControlBits", NULL, &NS__SDU__ControlBits_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING NS__SDU__ControlBits_default_coding("RAW"); const XERdescriptor_t PDU__NS__Alive_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Alive_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Alive_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Alive_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Alive_nsPduType_oer_ext_arr_, 0, PDU__NS__Alive_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Alive_nsPduType_descr_ = { "@NS_Types.PDU_NS_Alive.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Alive_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Alive_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Alive_nsPduType_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Alive_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Alive const TTCN_Typedescriptor_t PDU__NS__Alive_descr_ = { "@NS_Types.PDU_NS_Alive", NULL, &PDU__NS__Alive_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Alive_default_coding("RAW"); const XERdescriptor_t PDU__NS__Alive__Ack_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Alive__Ack_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Alive__Ack_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Alive__Ack_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Alive__Ack_nsPduType_oer_ext_arr_, 0, PDU__NS__Alive__Ack_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Alive__Ack_nsPduType_descr_ = { "@NS_Types.PDU_NS_Alive_Ack.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Alive__Ack_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Alive__Ack_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Alive__Ack_nsPduType_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Alive__Ack_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Alive__Ack const TTCN_Typedescriptor_t PDU__NS__Alive__Ack_descr_ = { "@NS_Types.PDU_NS_Alive_Ack", NULL, &PDU__NS__Alive__Ack_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Alive__Ack_default_coding("RAW"); const XERdescriptor_t PDU__NS__Block_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Block_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Block_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Block_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Block_nsPduType_oer_ext_arr_, 0, PDU__NS__Block_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Block_nsPduType_descr_ = { "@NS_Types.PDU_NS_Block.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Block_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Block_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Block_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Block_causeNS_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Block_nS__VCI_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Block_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Block const TTCN_Typedescriptor_t PDU__NS__Block_descr_ = { "@NS_Types.PDU_NS_Block", NULL, &PDU__NS__Block_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Block_default_coding("RAW"); const XERdescriptor_t PDU__NS__Block__Ack_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Block__Ack_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Block__Ack_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Block__Ack_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Block__Ack_nsPduType_oer_ext_arr_, 0, PDU__NS__Block__Ack_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Block__Ack_nsPduType_descr_ = { "@NS_Types.PDU_NS_Block_Ack.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Block__Ack_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Block__Ack_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Block__Ack_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Block__Ack_nS__VCI_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Block__Ack_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Block__Ack const TTCN_Typedescriptor_t PDU__NS__Block__Ack_descr_ = { "@NS_Types.PDU_NS_Block_Ack", NULL, &PDU__NS__Block__Ack_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Block__Ack_default_coding("RAW"); const XERdescriptor_t PDU__NS__Reset_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Reset_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Reset_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Reset_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Reset_nsPduType_oer_ext_arr_, 0, PDU__NS__Reset_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Reset_nsPduType_descr_ = { "@NS_Types.PDU_NS_Reset.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Reset_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Reset_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Reset_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Reset_causeNS_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Reset_nS__VCI_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Reset_nSEI__NS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Reset_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Reset const TTCN_Typedescriptor_t PDU__NS__Reset_descr_ = { "@NS_Types.PDU_NS_Reset", NULL, &PDU__NS__Reset_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Reset_default_coding("RAW"); const XERdescriptor_t PDU__NS__Reset__Ack_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Reset__Ack_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Reset__Ack_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Reset__Ack_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Reset__Ack_nsPduType_oer_ext_arr_, 0, PDU__NS__Reset__Ack_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Reset__Ack_nsPduType_descr_ = { "@NS_Types.PDU_NS_Reset_Ack.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Reset__Ack_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Reset__Ack_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Reset__Ack_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Reset__Ack_nS__VCI_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Reset__Ack_nSEI__NS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Reset__Ack_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Reset__Ack const TTCN_Typedescriptor_t PDU__NS__Reset__Ack_descr_ = { "@NS_Types.PDU_NS_Reset_Ack", NULL, &PDU__NS__Reset__Ack_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Reset__Ack_default_coding("RAW"); const XERdescriptor_t PDU__NS__Status_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Status_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Status_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Status_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Status_nsPduType_oer_ext_arr_, 0, PDU__NS__Status_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Status_nsPduType_descr_ = { "@NS_Types.PDU_NS_Status.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Status_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Status_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Status_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Status_causeNS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Status_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Status const TTCN_Typedescriptor_t PDU__NS__Status_descr_ = { "@NS_Types.PDU_NS_Status", NULL, &PDU__NS__Status_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Status_nS__VCI_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Status_nS__PDU_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Status_bVCI__NS_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Status_listofIP4Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Status_listofIP6Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Status_default_coding("RAW"); const XERdescriptor_t PDU__NS__Unblock_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Unblock_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Unblock_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Unblock_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Unblock_nsPduType_oer_ext_arr_, 0, PDU__NS__Unblock_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Unblock_nsPduType_descr_ = { "@NS_Types.PDU_NS_Unblock.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Unblock_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Unblock_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Unblock_nsPduType_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Unblock_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Unblock const TTCN_Typedescriptor_t PDU__NS__Unblock_descr_ = { "@NS_Types.PDU_NS_Unblock", NULL, &PDU__NS__Unblock_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Unblock_default_coding("RAW"); const XERdescriptor_t PDU__NS__Unblock__Ack_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Unblock__Ack_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Unblock__Ack_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Unblock__Ack_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Unblock__Ack_nsPduType_oer_ext_arr_, 0, PDU__NS__Unblock__Ack_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Unblock__Ack_nsPduType_descr_ = { "@NS_Types.PDU_NS_Unblock_Ack.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Unblock__Ack_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Unblock__Ack_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Unblock__Ack_nsPduType_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Unblock__Ack_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Unblock__Ack const TTCN_Typedescriptor_t PDU__NS__Unblock__Ack_descr_ = { "@NS_Types.PDU_NS_Unblock_Ack", NULL, &PDU__NS__Unblock__Ack_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Unblock__Ack_default_coding("RAW"); const XERdescriptor_t PDU__NS__Unitdata_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Unitdata_nsPduType_oer_ext_arr_[0] = {}; const int PDU__NS__Unitdata_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Unitdata_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__NS__Unitdata_nsPduType_oer_ext_arr_, 0, PDU__NS__Unitdata_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Unitdata_nsPduType_descr_ = { "@NS_Types.PDU_NS_Unitdata.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__NS__Unitdata_nsPduType_xer_, &OCTETSTRING_json_, &PDU__NS__Unitdata_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Unitdata_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS__Unitdata_nS__SDU__ControlBits_default_coding("RAW"); const XERdescriptor_t PDU__NS__Unitdata_bVCI_xer_ = { {"bVCI>\n", "bVCI>\n"}, {6, 6}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Unitdata_bVCI_oer_ext_arr_[0] = {}; const int PDU__NS__Unitdata_bVCI_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Unitdata_bVCI_oer_ = { -1, TRUE, 2, FALSE, 0, 0, PDU__NS__Unitdata_bVCI_oer_ext_arr_, 0, PDU__NS__Unitdata_bVCI_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Unitdata_bVCI_descr_ = { "@NS_Types.PDU_NS_Unitdata.bVCI", &OCTETSTRING_ber_, &General__Types::OCT2_raw_, &OCTETSTRING_text_, &PDU__NS__Unitdata_bVCI_xer_, &OCTETSTRING_json_, &PDU__NS__Unitdata_bVCI_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Unitdata_bVCI_default_coding("RAW"); const XERdescriptor_t PDU__NS__Unitdata_nS__SDU_xer_ = { {"nS_SDU>\n", "nS_SDU>\n"}, {8, 8}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__NS__Unitdata_nS__SDU_oer_ext_arr_[0] = {}; const int PDU__NS__Unitdata_nS__SDU_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__NS__Unitdata_nS__SDU_oer_ = { -1, TRUE, -1, FALSE, 0, 0, PDU__NS__Unitdata_nS__SDU_oer_ext_arr_, 0, PDU__NS__Unitdata_nS__SDU_oer_p_}; const TTCN_Typedescriptor_t PDU__NS__Unitdata_nS__SDU_descr_ = { "@NS_Types.PDU_NS_Unitdata.nS_SDU", &OCTETSTRING_ber_, &OCTETSTRING_raw_, &OCTETSTRING_text_, &PDU__NS__Unitdata_nS__SDU_xer_, &OCTETSTRING_json_, &PDU__NS__Unitdata_nS__SDU_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Unitdata_nS__SDU_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS__Unitdata_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS__Unitdata const TTCN_Typedescriptor_t PDU__NS__Unitdata_descr_ = { "@NS_Types.PDU_NS_Unitdata", NULL, &PDU__NS__Unitdata_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS__Unitdata_default_coding("RAW"); const XERdescriptor_t PDU__SNS__Ack_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__SNS__Ack_nsPduType_oer_ext_arr_[0] = {}; const int PDU__SNS__Ack_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__SNS__Ack_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__SNS__Ack_nsPduType_oer_ext_arr_, 0, PDU__SNS__Ack_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__SNS__Ack_nsPduType_descr_ = { "@NS_Types.PDU_SNS_Ack.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__SNS__Ack_nsPduType_xer_, &OCTETSTRING_json_, &PDU__SNS__Ack_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Ack_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Ack_nSEI__NS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Ack_transactionID_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t PDU__SNS__Ack_transactionID_xer_ = { {"transactionID>\n", "transactionID>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t PDU__SNS__Ack_transactionID_descr_ = { "@NS_Types.PDU_SNS_Ack.transactionID", &INTEGER_ber_, &PDU__SNS__Ack_transactionID_raw_, &INTEGER_text_, &PDU__SNS__Ack_transactionID_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Ack_transactionID_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Ack_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__SNS__Ack const TTCN_Typedescriptor_t PDU__SNS__Ack_descr_ = { "@NS_Types.PDU_SNS_Ack", NULL, &PDU__SNS__Ack_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Ack_causeNS_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Ack_iP__Address__NS_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Ack_listofIP4Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Ack_listofIP6Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Ack_default_coding("RAW"); const XERdescriptor_t PDU__SNS__Add_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__SNS__Add_nsPduType_oer_ext_arr_[0] = {}; const int PDU__SNS__Add_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__SNS__Add_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__SNS__Add_nsPduType_oer_ext_arr_, 0, PDU__SNS__Add_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__SNS__Add_nsPduType_descr_ = { "@NS_Types.PDU_SNS_Add.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__SNS__Add_nsPduType_xer_, &OCTETSTRING_json_, &PDU__SNS__Add_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Add_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Add_nSEI__NS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Add_transactionID_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t PDU__SNS__Add_transactionID_xer_ = { {"transactionID>\n", "transactionID>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t PDU__SNS__Add_transactionID_descr_ = { "@NS_Types.PDU_SNS_Add.transactionID", &INTEGER_ber_, &PDU__SNS__Add_transactionID_raw_, &INTEGER_text_, &PDU__SNS__Add_transactionID_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Add_transactionID_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Add_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__SNS__Add const TTCN_Typedescriptor_t PDU__SNS__Add_descr_ = { "@NS_Types.PDU_SNS_Add", NULL, &PDU__SNS__Add_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Add_listofIP4Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Add_listofIP6Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Add_default_coding("RAW"); const XERdescriptor_t PDU__SNS__ChangeWeight_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__SNS__ChangeWeight_nsPduType_oer_ext_arr_[0] = {}; const int PDU__SNS__ChangeWeight_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__SNS__ChangeWeight_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__SNS__ChangeWeight_nsPduType_oer_ext_arr_, 0, PDU__SNS__ChangeWeight_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__SNS__ChangeWeight_nsPduType_descr_ = { "@NS_Types.PDU_SNS_ChangeWeight.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__SNS__ChangeWeight_nsPduType_xer_, &OCTETSTRING_json_, &PDU__SNS__ChangeWeight_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__ChangeWeight_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__ChangeWeight_nSEI__NS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__ChangeWeight_transactionID_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t PDU__SNS__ChangeWeight_transactionID_xer_ = { {"transactionID>\n", "transactionID>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t PDU__SNS__ChangeWeight_transactionID_descr_ = { "@NS_Types.PDU_SNS_ChangeWeight.transactionID", &INTEGER_ber_, &PDU__SNS__ChangeWeight_transactionID_raw_, &INTEGER_text_, &PDU__SNS__ChangeWeight_transactionID_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__ChangeWeight_transactionID_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__ChangeWeight_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__SNS__ChangeWeight const TTCN_Typedescriptor_t PDU__SNS__ChangeWeight_descr_ = { "@NS_Types.PDU_SNS_ChangeWeight", NULL, &PDU__SNS__ChangeWeight_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__ChangeWeight_listofIP4Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__ChangeWeight_listofIP6Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__ChangeWeight_default_coding("RAW"); const XERdescriptor_t PDU__SNS__Config_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__SNS__Config_nsPduType_oer_ext_arr_[0] = {}; const int PDU__SNS__Config_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__SNS__Config_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__SNS__Config_nsPduType_oer_ext_arr_, 0, PDU__SNS__Config_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__SNS__Config_nsPduType_descr_ = { "@NS_Types.PDU_SNS_Config.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__SNS__Config_nsPduType_xer_, &OCTETSTRING_json_, &PDU__SNS__Config_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Config_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Config_endFlag_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Config_nSEI__NS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Config_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__SNS__Config const TTCN_Typedescriptor_t PDU__SNS__Config_descr_ = { "@NS_Types.PDU_SNS_Config", NULL, &PDU__SNS__Config_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Config_listofIP4Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Config_listofIP6Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Config_default_coding("RAW"); const XERdescriptor_t PDU__SNS__Config__Ack_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__SNS__Config__Ack_nsPduType_oer_ext_arr_[0] = {}; const int PDU__SNS__Config__Ack_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__SNS__Config__Ack_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__SNS__Config__Ack_nsPduType_oer_ext_arr_, 0, PDU__SNS__Config__Ack_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__SNS__Config__Ack_nsPduType_descr_ = { "@NS_Types.PDU_SNS_Config_Ack.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__SNS__Config__Ack_nsPduType_xer_, &OCTETSTRING_json_, &PDU__SNS__Config__Ack_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Config__Ack_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Config__Ack_nSEI__NS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Config__Ack_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__SNS__Config__Ack const TTCN_Typedescriptor_t PDU__SNS__Config__Ack_descr_ = { "@NS_Types.PDU_SNS_Config_Ack", NULL, &PDU__SNS__Config__Ack_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Config__Ack_causeNS_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Config__Ack_default_coding("RAW"); const XERdescriptor_t PDU__SNS__Delete_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__SNS__Delete_nsPduType_oer_ext_arr_[0] = {}; const int PDU__SNS__Delete_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__SNS__Delete_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__SNS__Delete_nsPduType_oer_ext_arr_, 0, PDU__SNS__Delete_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__SNS__Delete_nsPduType_descr_ = { "@NS_Types.PDU_SNS_Delete.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__SNS__Delete_nsPduType_xer_, &OCTETSTRING_json_, &PDU__SNS__Delete_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Delete_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Delete_nSEI__NS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Delete_transactionID_raw_ = {8,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; const XERdescriptor_t PDU__SNS__Delete_transactionID_xer_ = { {"transactionID>\n", "transactionID>\n"}, {15, 15}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const TTCN_Typedescriptor_t PDU__SNS__Delete_transactionID_descr_ = { "@NS_Types.PDU_SNS_Delete.transactionID", &INTEGER_ber_, &PDU__SNS__Delete_transactionID_raw_, &INTEGER_text_, &PDU__SNS__Delete_transactionID_xer_, &INTEGER_json_, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Delete_transactionID_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Delete_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__SNS__Delete const TTCN_Typedescriptor_t PDU__SNS__Delete_descr_ = { "@NS_Types.PDU_SNS_Delete", NULL, &PDU__SNS__Delete_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Delete_iP__Address__NS_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Delete_listofIP4Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Delete_listofIP6Elements_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Delete_default_coding("RAW"); const XERdescriptor_t PDU__SNS__Size_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__SNS__Size_nsPduType_oer_ext_arr_[0] = {}; const int PDU__SNS__Size_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__SNS__Size_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__SNS__Size_nsPduType_oer_ext_arr_, 0, PDU__SNS__Size_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__SNS__Size_nsPduType_descr_ = { "@NS_Types.PDU_SNS_Size.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__SNS__Size_nsPduType_xer_, &OCTETSTRING_json_, &PDU__SNS__Size_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Size_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Size_nSEI__NS_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Size_resetFlag_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Size_maxNumberOfNSVCs_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Size_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__SNS__Size const TTCN_Typedescriptor_t PDU__SNS__Size_descr_ = { "@NS_Types.PDU_SNS_Size", NULL, &PDU__SNS__Size_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Size_numberOfIP4__Endpoints_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Size_numberOfIP6__Endpoints_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Size_default_coding("RAW"); const XERdescriptor_t PDU__SNS__Size__Ack_nsPduType_xer_ = { {"nsPduType>\n", "nsPduType>\n"}, {11, 11}, 0 |FORM_UNQUALIFIED, WHITESPACE_PRESERVE, NULL, &module_object, -1, 0, NULL, NULL, -1, XSD_NONE }; const int PDU__SNS__Size__Ack_nsPduType_oer_ext_arr_[0] = {}; const int PDU__SNS__Size__Ack_nsPduType_oer_p_[0] = {}; const TTCN_OERdescriptor_t PDU__SNS__Size__Ack_nsPduType_oer_ = { -1, TRUE, 1, FALSE, 0, 0, PDU__SNS__Size__Ack_nsPduType_oer_ext_arr_, 0, PDU__SNS__Size__Ack_nsPduType_oer_p_}; const TTCN_Typedescriptor_t PDU__SNS__Size__Ack_nsPduType_descr_ = { "@NS_Types.PDU_SNS_Size_Ack.nsPduType", &OCTETSTRING_ber_, &General__Types::OCT1_raw_, &OCTETSTRING_text_, &PDU__SNS__Size__Ack_nsPduType_xer_, &OCTETSTRING_json_, &PDU__SNS__Size__Ack_nsPduType_oer_, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Size__Ack_nsPduType_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Size__Ack_nSEI__NS_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__SNS__Size__Ack_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__SNS__Size__Ack const TTCN_Typedescriptor_t PDU__SNS__Size__Ack_descr_ = { "@NS_Types.PDU_SNS_Size_Ack", NULL, &PDU__SNS__Size__Ack_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__SNS__Size__Ack_causeNS_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__SNS__Size__Ack_default_coding("RAW"); const TTCN_RAWdescriptor_t PDU__NS_raw_ = {0,SG_NO,ORDER_LSB,ORDER_LSB,ORDER_LSB,ORDER_LSB,EXT_BIT_NO,ORDER_LSB,ORDER_LSB,TOP_BIT_INHERITED,0,0,0,8,0,NULL,-1,CharCoding::UNKNOWN,NULL,false}; // No XER for PDU__NS const TTCN_Typedescriptor_t PDU__NS_descr_ = { "@NS_Types.PDU_NS", NULL, &PDU__NS_raw_, NULL, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE }; UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Alive_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Alive__Ack_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Block_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Block__Ack_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Reset_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Reset__Ack_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Status_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Unblock_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Unblock__Ack_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__NS__Unitdata_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__SNS__Ack_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__SNS__Add_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__SNS__ChangeWeight_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__SNS__Config_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__SNS__Config__Ack_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__SNS__Delete_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__SNS__Size_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_pDU__SNS__Size__Ack_default_coding("RAW"); UNIVERSAL_CHARSTRING PDU__NS_default_coding("RAW"); TTCN_Module module_object("NS_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 */ void LIN1__2::copy_value(const LIN1__2& other_value) { switch (other_value.union_selection) { case ALT_length1: field_length1 = new INTEGER(*other_value.field_length1); break; case ALT_length2: field_length2 = new INTEGER(*other_value.field_length2); break; default: TTCN_error("Assignment of an unbound union value of type @NS_Types.LIN1_2."); } union_selection = other_value.union_selection; } LIN1__2::LIN1__2() { union_selection = UNBOUND_VALUE; } LIN1__2::LIN1__2(const LIN1__2& other_value) : Base_Type(){ copy_value(other_value); } LIN1__2::~LIN1__2() { clean_up(); } LIN1__2& LIN1__2::operator=(const LIN1__2& other_value) { if (this != &other_value) { clean_up(); copy_value(other_value); } return *this; } boolean LIN1__2::operator==(const LIN1__2& other_value) const { if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @NS_Types.LIN1_2."); if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @NS_Types.LIN1_2."); if (union_selection != other_value.union_selection) return FALSE; switch (union_selection) { case ALT_length1: return *field_length1 == *other_value.field_length1; case ALT_length2: return *field_length2 == *other_value.field_length2; default: return FALSE; } } INTEGER& LIN1__2::length1() { if (union_selection != ALT_length1) { clean_up(); field_length1 = new INTEGER; union_selection = ALT_length1; } return *field_length1; } const INTEGER& LIN1__2::length1() const { if (union_selection != ALT_length1) TTCN_error("Using non-selected field length1 in a value of union type @NS_Types.LIN1_2."); return *field_length1; } INTEGER& LIN1__2::length2() { if (union_selection != ALT_length2) { clean_up(); field_length2 = new INTEGER; union_selection = ALT_length2; } return *field_length2; } const INTEGER& LIN1__2::length2() const { if (union_selection != ALT_length2) TTCN_error("Using non-selected field length2 in a value of union type @NS_Types.LIN1_2."); return *field_length2; } boolean LIN1__2::ischosen(union_selection_type checked_selection) const { if (checked_selection == UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @NS_Types.LIN1_2."); return union_selection == checked_selection; } boolean LIN1__2::is_bound() const { return union_selection != UNBOUND_VALUE; } boolean LIN1__2::is_value() const { switch (union_selection) { case UNBOUND_VALUE: return FALSE; case ALT_length1: return field_length1->is_value(); case ALT_length2: return field_length2->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void LIN1__2::clean_up() { switch (union_selection) { case ALT_length1: delete field_length1; break; case ALT_length2: delete field_length2; break; default: break; } union_selection = UNBOUND_VALUE; } void LIN1__2::log() const { switch (union_selection) { case ALT_length1: TTCN_Logger::log_event_str("{ length1 := "); field_length1->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_length2: TTCN_Logger::log_event_str("{ length2 := "); field_length2->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void LIN1__2::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, "length1")) { length1().set_param(*mp_last); if (!length1().is_bound()) clean_up(); return; } if (!strcmp(last_name, "length2")) { length2().set_param(*mp_last); if (!length2().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @NS_Types.LIN1_2.", last_name); } void LIN1__2::set_implicit_omit() { switch (union_selection) { case ALT_length1: field_length1->set_implicit_omit(); break; case ALT_length2: field_length2->set_implicit_omit(); break; default: break; } } void LIN1__2::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_length1: field_length1->encode_text(text_buf); break; case ALT_length2: field_length2->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @NS_Types.LIN1_2."); } } void LIN1__2::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_length1: length1().decode_text(text_buf); break; case ALT_length2: length2().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @NS_Types.LIN1_2."); } } void LIN1__2::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 LIN1__2::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 LIN1__2::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, LIN1__2_length1_descr_.raw->forceomit); decoded_length = length1().RAW_decode(LIN1__2_length1_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, LIN1__2_length2_descr_.raw->forceomit); decoded_length = length2().RAW_decode(LIN1__2_length2_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } default: break; } return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } else { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_0_force_omit(0, force_omit, LIN1__2_length1_descr_.raw->forceomit); decoded_length = length1().RAW_decode(LIN1__2_length1_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_0_force_omit); if (decoded_length >= 0) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_1_force_omit(1, force_omit, LIN1__2_length2_descr_.raw->forceomit); decoded_length = length2().RAW_decode(LIN1__2_length2_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_length >= 0) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } } clean_up(); return -1; } int LIN1__2::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); memset(myleaf.body.node.nodes, 0, 2 * sizeof(RAW_enc_tree *)); switch (union_selection) { case ALT_length1: myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, LIN1__2_length1_descr_.raw); encoded_length = field_length1->RAW_encode(LIN1__2_length1_descr_, *myleaf.body.node.nodes[0]); myleaf.body.node.nodes[0]->coding_descr = &LIN1__2_length1_descr_; break; case ALT_length2: myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, LIN1__2_length2_descr_.raw); encoded_length = field_length2->RAW_encode(LIN1__2_length2_descr_, *myleaf.body.node.nodes[1]); myleaf.body.node.nodes[1]->coding_descr = &LIN1__2_length2_descr_; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); } return encoded_length; } void LIN1__2_template::copy_value(const LIN1__2& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case LIN1__2::ALT_length1: single_value.field_length1 = new INTEGER_template(other_value.length1()); break; case LIN1__2::ALT_length2: single_value.field_length2 = new INTEGER_template(other_value.length2()); break; default: TTCN_error("Initializing a template with an unbound value of type @NS_Types.LIN1_2."); } set_selection(SPECIFIC_VALUE); } void LIN1__2_template::copy_template(const LIN1__2_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 LIN1__2::ALT_length1: single_value.field_length1 = new INTEGER_template(*other_value.single_value.field_length1); break; case LIN1__2::ALT_length2: single_value.field_length2 = new INTEGER_template(*other_value.single_value.field_length2); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @NS_Types.LIN1_2."); } 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 LIN1__2_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 LIN1__2_template(*other_value.implication_.precondition); implication_.implied_template = new LIN1__2_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 @NS_Types.LIN1_2."); } set_selection(other_value); } LIN1__2_template::LIN1__2_template() { } LIN1__2_template::LIN1__2_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } LIN1__2_template::LIN1__2_template(const LIN1__2& other_value) { copy_value(other_value); } LIN1__2_template::LIN1__2_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const LIN1__2&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @NS_Types.LIN1_2 from an unbound optional field."); } } LIN1__2_template::LIN1__2_template(LIN1__2_template* p_precondition, LIN1__2_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } LIN1__2_template::LIN1__2_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; } LIN1__2_template::LIN1__2_template(const LIN1__2_template& other_value) : Base_Template(){ copy_template(other_value); } LIN1__2_template::~LIN1__2_template() { clean_up(); } void LIN1__2_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case LIN1__2::ALT_length1: delete single_value.field_length1; break; case LIN1__2::ALT_length2: delete single_value.field_length2; 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; } LIN1__2_template& LIN1__2_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } LIN1__2_template& LIN1__2_template::operator=(const LIN1__2& other_value) { clean_up(); copy_value(other_value); return *this; } LIN1__2_template& LIN1__2_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const LIN1__2&)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 @NS_Types.LIN1_2."); } return *this; } LIN1__2_template& LIN1__2_template::operator=(const LIN1__2_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean LIN1__2_template::match(const LIN1__2& 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: { LIN1__2::union_selection_type value_selection = other_value.get_selection(); if (value_selection == LIN1__2::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case LIN1__2::ALT_length1: return single_value.field_length1->match(other_value.length1(), legacy); case LIN1__2::ALT_length2: return single_value.field_length2->match(other_value.length2(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @NS_Types.LIN1_2."); } } 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 @NS_Types.LIN1_2."); } return FALSE; } boolean LIN1__2_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case LIN1__2::ALT_length1: return single_value.field_length1->is_value(); case LIN1__2::ALT_length2: return single_value.field_length2->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @NS_Types.LIN1_2."); } } LIN1__2 LIN1__2_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 @NS_Types.LIN1_2."); LIN1__2 ret_val; switch (single_value.union_selection) { case LIN1__2::ALT_length1: ret_val.length1() = single_value.field_length1->valueof(); break; case LIN1__2::ALT_length2: ret_val.length2() = single_value.field_length2->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @NS_Types.LIN1_2."); } return ret_val; } LIN1__2_template& LIN1__2_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 @NS_Types.LIN1_2."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @NS_Types.LIN1_2."); return value_list.list_value[list_index]; } void LIN1__2_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 @NS_Types.LIN1_2."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new LIN1__2_template[list_length]; } INTEGER_template& LIN1__2_template::length1() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LIN1__2::ALT_length1) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_length1 = new INTEGER_template(ANY_VALUE); else single_value.field_length1 = new INTEGER_template; single_value.union_selection = LIN1__2::ALT_length1; set_selection(SPECIFIC_VALUE); } return *single_value.field_length1; } const INTEGER_template& LIN1__2_template::length1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field length1 in a non-specific template of union type @NS_Types.LIN1_2."); if (single_value.union_selection != LIN1__2::ALT_length1) TTCN_error("Accessing non-selected field length1 in a template of union type @NS_Types.LIN1_2."); return *single_value.field_length1; } INTEGER_template& LIN1__2_template::length2() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != LIN1__2::ALT_length2) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_length2 = new INTEGER_template(ANY_VALUE); else single_value.field_length2 = new INTEGER_template; single_value.union_selection = LIN1__2::ALT_length2; set_selection(SPECIFIC_VALUE); } return *single_value.field_length2; } const INTEGER_template& LIN1__2_template::length2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field length2 in a non-specific template of union type @NS_Types.LIN1_2."); if (single_value.union_selection != LIN1__2::ALT_length2) TTCN_error("Accessing non-selected field length2 in a template of union type @NS_Types.LIN1_2."); return *single_value.field_length2; } boolean LIN1__2_template::ischosen(LIN1__2::union_selection_type checked_selection) const { if (checked_selection == LIN1__2::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @NS_Types.LIN1_2."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == LIN1__2::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @NS_Types.LIN1_2."); 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 @NS_Types.LIN1_2 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 LIN1__2_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case LIN1__2::ALT_length1: TTCN_Logger::log_event_str("{ length1 := "); single_value.field_length1->log(); TTCN_Logger::log_event_str(" }"); break; case LIN1__2::ALT_length2: TTCN_Logger::log_event_str("{ length2 := "); single_value.field_length2->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 LIN1__2_template::log_match(const LIN1__2& 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 LIN1__2::ALT_length1: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".length1"); single_value.field_length1->log_match(match_value.length1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ length1 := "); single_value.field_length1->log_match(match_value.length1(), legacy); TTCN_Logger::log_event_str(" }"); } break; case LIN1__2::ALT_length2: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".length2"); single_value.field_length2->log_match(match_value.length2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ length2 := "); single_value.field_length2->log_match(match_value.length2(), 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 LIN1__2_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 LIN1__2::ALT_length1: single_value.field_length1->encode_text(text_buf); break; case LIN1__2::ALT_length2: single_value.field_length2->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @NS_Types.LIN1_2."); } 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 @NS_Types.LIN1_2."); } } void LIN1__2_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = LIN1__2::UNBOUND_VALUE; LIN1__2::union_selection_type new_selection = (LIN1__2::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case LIN1__2::ALT_length1: single_value.field_length1 = new INTEGER_template; single_value.field_length1->decode_text(text_buf); break; case LIN1__2::ALT_length2: single_value.field_length2 = new INTEGER_template; single_value.field_length2->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @NS_Types.LIN1_2."); } 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 LIN1__2_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 @NS_Types.LIN1_2."); } } boolean LIN1__2_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean LIN1__2_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 `@NS_Types.LIN1_2'"); } if (strcmp("length1", param_field) == 0) { length1().set_param(param); return; } else if (strcmp("length2", param_field) == 0) { length2().set_param(param); return; } else param.error("Field `%s' not found in union template type `@NS_Types.LIN1_2'", 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: { LIN1__2_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", "@NS_Types.LIN1_2"); 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, "length1")) { length1().set_param(*mp_last); break; } if (!strcmp(last_name, "length2")) { length2().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @NS_Types.LIN1_2.", last_name); } break; case Module_Param::MP_Implication_Template: { LIN1__2_template* precondition = new LIN1__2_template; precondition->set_param(*m_p->get_elem(0)); LIN1__2_template* implied_template = new LIN1__2_template; implied_template->set_param(*m_p->get_elem(1)); *this = LIN1__2_template(precondition, implied_template); } break; default: param.type_error("union template", "@NS_Types.LIN1_2"); } is_ifpresent = param.get_ifpresent(); } void LIN1__2_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 LIN1__2::ALT_length1: single_value.field_length1->check_restriction(t_res, t_name ? t_name : "@NS_Types.LIN1_2"); return; case LIN1__2::ALT_length2: single_value.field_length2->check_restriction(t_res, t_name ? t_name : "@NS_Types.LIN1_2"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @NS_Types.LIN1_2."); } 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 : "@NS_Types.LIN1_2"); } CauseNS::CauseNS() { } CauseNS::CauseNS(const OCTETSTRING& par_iEI, const BITSTRING& par_ext, const LIN1__2& par_lengthIndicator, const OCTETSTRING& par_cause) : field_iEI(par_iEI), field_ext(par_ext), field_lengthIndicator(par_lengthIndicator), field_cause(par_cause) { } CauseNS::CauseNS(const CauseNS& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.CauseNS."); if (other_value.iEI().is_bound()) field_iEI = other_value.iEI(); else field_iEI.clean_up(); if (other_value.ext().is_bound()) field_ext = other_value.ext(); else field_ext.clean_up(); if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator(); else field_lengthIndicator.clean_up(); if (other_value.cause().is_bound()) field_cause = other_value.cause(); else field_cause.clean_up(); } void CauseNS::clean_up() { field_iEI.clean_up(); field_ext.clean_up(); field_lengthIndicator.clean_up(); field_cause.clean_up(); } const TTCN_Typedescriptor_t* CauseNS::get_descriptor() const { return &CauseNS_descr_; } CauseNS& CauseNS::operator=(const CauseNS& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.CauseNS."); if (other_value.iEI().is_bound()) field_iEI = other_value.iEI(); else field_iEI.clean_up(); if (other_value.ext().is_bound()) field_ext = other_value.ext(); else field_ext.clean_up(); if (other_value.lengthIndicator().is_bound()) field_lengthIndicator = other_value.lengthIndicator(); else field_lengthIndicator.clean_up(); if (other_value.cause().is_bound()) field_cause = other_value.cause(); else field_cause.clean_up(); } return *this; } boolean CauseNS::operator==(const CauseNS& other_value) const { return field_iEI==other_value.field_iEI && field_ext==other_value.field_ext && field_lengthIndicator==other_value.field_lengthIndicator && field_cause==other_value.field_cause; } boolean CauseNS::is_bound() const { return (field_iEI.is_bound()) || (field_ext.is_bound()) || (field_lengthIndicator.is_bound()) || (field_cause.is_bound()); } boolean CauseNS::is_value() const { return field_iEI.is_value() && field_ext.is_value() && field_lengthIndicator.is_value() && field_cause.is_value(); } void CauseNS::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ iEI := "); field_iEI.log(); TTCN_Logger::log_event_str(", ext := "); field_ext.log(); TTCN_Logger::log_event_str(", lengthIndicator := "); field_lengthIndicator.log(); TTCN_Logger::log_event_str(", cause := "); field_cause.log(); TTCN_Logger::log_event_str(" }"); } void CauseNS::set_implicit_omit() { if (iEI().is_bound()) iEI().set_implicit_omit(); if (ext().is_bound()) ext().set_implicit_omit(); if (lengthIndicator().is_bound()) lengthIndicator().set_implicit_omit(); if (cause().is_bound()) cause().set_implicit_omit(); } void CauseNS::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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cause().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cause")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cause().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.CauseNS: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.CauseNS"); } } void CauseNS::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_ext.encode_text(text_buf); field_lengthIndicator.encode_text(text_buf); field_cause.encode_text(text_buf); } void CauseNS::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_ext.decode_text(text_buf); field_lengthIndicator.decode_text(text_buf); field_cause.decode_text(text_buf); } void CauseNS::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 CauseNS::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 CauseNS::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; int selected_field = -1; if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord; else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB; else local_top_order=ORDER_LSB; int value_of_length_field2 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, CauseNS_ext_descr_.raw->forceomit); decoded_field_length = field_ext.RAW_decode(CauseNS_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_ext == bs_0) selected_field = 0; else if (field_ext == bs_1) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_2_force_omit(2, force_omit, CauseNS_lengthIndicator_descr_.raw->forceomit); decoded_field_length = field_lengthIndicator.RAW_decode(CauseNS_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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()); switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: { INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN1__2_length1_descr_); field_lengthIndicator.length1() = tmp1; value_of_length_field2 += tmp1.get_long_long_val() * 8; break; } case LIN1__2::ALT_length2: { INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN1__2_length2_descr_); field_lengthIndicator.length2() = tmp2; value_of_length_field2 += tmp2.get_long_long_val() * 8; break; } default: value_of_length_field2 = 0; } RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_cause.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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()); value_of_length_field2 -= decoded_field_length; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int CauseNS::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CauseNS_ext_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, CauseNS_lengthIndicator_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_ext.RAW_encode(CauseNS_ext_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_lengthIndicator.RAW_encode(CauseNS_lengthIndicator_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_cause.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]); { int sel_field = 0; while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; } const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr; int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length; delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field]; myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos; } switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: if (field_ext != bs_0) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_0.RAW_encode(CauseNS_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; case LIN1__2::ALT_length2: if (field_ext != bs_1) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_1.RAW_encode(CauseNS_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; default:; } return myleaf.length = encoded_length; } struct CauseNS_template::single_value_struct { OCTETSTRING_template field_iEI; BITSTRING_template field_ext; LIN1__2_template field_lengthIndicator; OCTETSTRING_template field_cause; }; void CauseNS_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_iEI = ANY_VALUE; single_value->field_ext = ANY_VALUE; single_value->field_lengthIndicator = ANY_VALUE; single_value->field_cause = ANY_VALUE; } } } void CauseNS_template::copy_value(const CauseNS& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.ext().is_bound()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (other_value.lengthIndicator().is_bound()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (other_value.cause().is_bound()) { single_value->field_cause = other_value.cause(); } else { single_value->field_cause.clean_up(); } set_selection(SPECIFIC_VALUE); } void CauseNS_template::copy_template(const CauseNS_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cause().get_selection()) { single_value->field_cause = other_value.cause(); } else { single_value->field_cause.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 CauseNS_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 CauseNS_template(*other_value.implication_.precondition); implication_.implied_template = new CauseNS_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 @NS_Types.CauseNS."); break; } set_selection(other_value); } CauseNS_template::CauseNS_template() { } CauseNS_template::CauseNS_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CauseNS_template::CauseNS_template(const CauseNS& other_value) { copy_value(other_value); } CauseNS_template::CauseNS_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CauseNS&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.CauseNS from an unbound optional field."); } } CauseNS_template::CauseNS_template(CauseNS_template* p_precondition, CauseNS_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CauseNS_template::CauseNS_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; } CauseNS_template::CauseNS_template(const CauseNS_template& other_value) : Base_Template() { copy_template(other_value); } CauseNS_template::~CauseNS_template() { clean_up(); } CauseNS_template& CauseNS_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CauseNS_template& CauseNS_template::operator=(const CauseNS& other_value) { clean_up(); copy_value(other_value); return *this; } CauseNS_template& CauseNS_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CauseNS&)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 @NS_Types.CauseNS."); } return *this; } CauseNS_template& CauseNS_template::operator=(const CauseNS_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CauseNS_template::match(const CauseNS& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.ext().is_bound()) return FALSE; if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE; if(!other_value.lengthIndicator().is_bound()) return FALSE; if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE; if(!other_value.cause().is_bound()) return FALSE; if(!single_value->field_cause.match(other_value.cause(), 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 @NS_Types.CauseNS."); } return FALSE; } boolean CauseNS_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_ext.is_bound() || single_value->field_lengthIndicator.is_bound() || single_value->field_cause.is_bound(); } boolean CauseNS_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_ext.is_value() && single_value->field_lengthIndicator.is_value() && single_value->field_cause.is_value(); } void CauseNS_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; } CauseNS CauseNS_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 @NS_Types.CauseNS."); CauseNS ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_ext.is_bound()) { ret_val.ext() = single_value->field_ext.valueof(); } if (single_value->field_lengthIndicator.is_bound()) { ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof(); } if (single_value->field_cause.is_bound()) { ret_val.cause() = single_value->field_cause.valueof(); } return ret_val; } void CauseNS_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 @NS_Types.CauseNS."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CauseNS_template[list_length]; } CauseNS_template& CauseNS_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 @NS_Types.CauseNS."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.CauseNS."); return value_list.list_value[list_index]; } OCTETSTRING_template& CauseNS_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& CauseNS_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.CauseNS."); return single_value->field_iEI; } BITSTRING_template& CauseNS_template::ext() { set_specific(); return single_value->field_ext; } const BITSTRING_template& CauseNS_template::ext() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ext of a non-specific template of type @NS_Types.CauseNS."); return single_value->field_ext; } LIN1__2_template& CauseNS_template::lengthIndicator() { set_specific(); return single_value->field_lengthIndicator; } const LIN1__2_template& CauseNS_template::lengthIndicator() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthIndicator of a non-specific template of type @NS_Types.CauseNS."); return single_value->field_lengthIndicator; } OCTETSTRING_template& CauseNS_template::cause() { set_specific(); return single_value->field_cause; } const OCTETSTRING_template& CauseNS_template::cause() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cause of a non-specific template of type @NS_Types.CauseNS."); return single_value->field_cause; } int CauseNS_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.CauseNS 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 @NS_Types.CauseNS 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 @NS_Types.CauseNS containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.CauseNS containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.CauseNS containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.CauseNS containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.CauseNS containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.CauseNS containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.CauseNS containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.CauseNS."); } return 0; } void CauseNS_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log(); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log(); TTCN_Logger::log_event_str(", cause := "); single_value->field_cause.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 CauseNS_template::log_match(const CauseNS& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ext.match(match_value.ext(), legacy)){ TTCN_Logger::log_logmatch_info(".ext"); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthIndicator"); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cause.match(match_value.cause(), legacy)){ TTCN_Logger::log_logmatch_info(".cause"); single_value->field_cause.log_match(match_value.cause(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::log_event_str(", cause := "); single_value->field_cause.log_match(match_value.cause(), 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 CauseNS_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_ext.encode_text(text_buf); single_value->field_lengthIndicator.encode_text(text_buf); single_value->field_cause.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 @NS_Types.CauseNS."); } } void CauseNS_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_iEI.decode_text(text_buf); single_value->field_ext.decode_text(text_buf); single_value->field_lengthIndicator.decode_text(text_buf); single_value->field_cause.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 CauseNS_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 @NS_Types.CauseNS."); } } void CauseNS_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: { CauseNS_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cause().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cause")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cause().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.CauseNS: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CauseNS_template* precondition = new CauseNS_template; precondition->set_param(*param.get_elem(0)); CauseNS_template* implied_template = new CauseNS_template; implied_template->set_param(*param.get_elem(1)); *this = CauseNS_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.CauseNS"); } is_ifpresent = param.get_ifpresent(); } void CauseNS_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.CauseNS"); single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@NS_Types.CauseNS"); single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@NS_Types.CauseNS"); single_value->field_cause.check_restriction(t_res, t_name ? t_name : "@NS_Types.CauseNS"); 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 : "@NS_Types.CauseNS"); } boolean CauseNS_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CauseNS_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.NS_VCI: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.NS_VCI"); } } void NS__VCI::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_ext.encode_text(text_buf); field_lengthIndicator.encode_text(text_buf); field_nS__VCI.encode_text(text_buf); } void NS__VCI::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_ext.decode_text(text_buf); field_lengthIndicator.decode_text(text_buf); field_nS__VCI.decode_text(text_buf); } void NS__VCI::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 NS__VCI::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 NS__VCI::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; int selected_field = -1; if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord; else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB; else local_top_order=ORDER_LSB; int value_of_length_field2 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, NS__VCI_ext_descr_.raw->forceomit); decoded_field_length = field_ext.RAW_decode(NS__VCI_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_ext == bs_0) selected_field = 0; else if (field_ext == bs_1) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_2_force_omit(2, force_omit, NS__VCI_lengthIndicator_descr_.raw->forceomit); decoded_field_length = field_lengthIndicator.RAW_decode(NS__VCI_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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()); switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: { INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN1__2_length1_descr_); field_lengthIndicator.length1() = tmp1; value_of_length_field2 += tmp1.get_long_long_val() * 8; break; } case LIN1__2::ALT_length2: { INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN1__2_length2_descr_); field_lengthIndicator.length2() = tmp2; value_of_length_field2 += tmp2.get_long_long_val() * 8; break; } default: value_of_length_field2 = 0; } RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_nS__VCI.RAW_decode(General__Types::OCT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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()); value_of_length_field2 -= decoded_field_length; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int NS__VCI::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NS__VCI_ext_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NS__VCI_lengthIndicator_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT2_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_ext.RAW_encode(NS__VCI_ext_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_lengthIndicator.RAW_encode(NS__VCI_lengthIndicator_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_nS__VCI.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[3]); { int sel_field = 0; while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; } const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr; int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length; delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field]; myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos; } switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: if (field_ext != bs_0) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_0.RAW_encode(NS__VCI_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; case LIN1__2::ALT_length2: if (field_ext != bs_1) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_1.RAW_encode(NS__VCI_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; default:; } return myleaf.length = encoded_length; } struct NS__VCI_template::single_value_struct { OCTETSTRING_template field_iEI; BITSTRING_template field_ext; LIN1__2_template field_lengthIndicator; OCTETSTRING_template field_nS__VCI; }; void NS__VCI_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_iEI = ANY_VALUE; single_value->field_ext = ANY_VALUE; single_value->field_lengthIndicator = ANY_VALUE; single_value->field_nS__VCI = ANY_VALUE; } } } void NS__VCI_template::copy_value(const NS__VCI& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.ext().is_bound()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (other_value.lengthIndicator().is_bound()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (other_value.nS__VCI().is_bound()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.clean_up(); } set_selection(SPECIFIC_VALUE); } void NS__VCI_template::copy_template(const NS__VCI_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nS__VCI().get_selection()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.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 NS__VCI_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 NS__VCI_template(*other_value.implication_.precondition); implication_.implied_template = new NS__VCI_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 @NS_Types.NS_VCI."); break; } set_selection(other_value); } NS__VCI_template::NS__VCI_template() { } NS__VCI_template::NS__VCI_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } NS__VCI_template::NS__VCI_template(const NS__VCI& other_value) { copy_value(other_value); } NS__VCI_template::NS__VCI_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NS__VCI&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.NS_VCI from an unbound optional field."); } } NS__VCI_template::NS__VCI_template(NS__VCI_template* p_precondition, NS__VCI_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } NS__VCI_template::NS__VCI_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; } NS__VCI_template::NS__VCI_template(const NS__VCI_template& other_value) : Base_Template() { copy_template(other_value); } NS__VCI_template::~NS__VCI_template() { clean_up(); } NS__VCI_template& NS__VCI_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } NS__VCI_template& NS__VCI_template::operator=(const NS__VCI& other_value) { clean_up(); copy_value(other_value); return *this; } NS__VCI_template& NS__VCI_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NS__VCI&)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 @NS_Types.NS_VCI."); } return *this; } NS__VCI_template& NS__VCI_template::operator=(const NS__VCI_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean NS__VCI_template::match(const NS__VCI& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.ext().is_bound()) return FALSE; if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE; if(!other_value.lengthIndicator().is_bound()) return FALSE; if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE; if(!other_value.nS__VCI().is_bound()) return FALSE; if(!single_value->field_nS__VCI.match(other_value.nS__VCI(), 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 @NS_Types.NS_VCI."); } return FALSE; } boolean NS__VCI_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_ext.is_bound() || single_value->field_lengthIndicator.is_bound() || single_value->field_nS__VCI.is_bound(); } boolean NS__VCI_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_ext.is_value() && single_value->field_lengthIndicator.is_value() && single_value->field_nS__VCI.is_value(); } void NS__VCI_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; } NS__VCI NS__VCI_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 @NS_Types.NS_VCI."); NS__VCI ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_ext.is_bound()) { ret_val.ext() = single_value->field_ext.valueof(); } if (single_value->field_lengthIndicator.is_bound()) { ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof(); } if (single_value->field_nS__VCI.is_bound()) { ret_val.nS__VCI() = single_value->field_nS__VCI.valueof(); } return ret_val; } void NS__VCI_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 @NS_Types.NS_VCI."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new NS__VCI_template[list_length]; } NS__VCI_template& NS__VCI_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 @NS_Types.NS_VCI."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.NS_VCI."); return value_list.list_value[list_index]; } OCTETSTRING_template& NS__VCI_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& NS__VCI_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.NS_VCI."); return single_value->field_iEI; } BITSTRING_template& NS__VCI_template::ext() { set_specific(); return single_value->field_ext; } const BITSTRING_template& NS__VCI_template::ext() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ext of a non-specific template of type @NS_Types.NS_VCI."); return single_value->field_ext; } LIN1__2_template& NS__VCI_template::lengthIndicator() { set_specific(); return single_value->field_lengthIndicator; } const LIN1__2_template& NS__VCI_template::lengthIndicator() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthIndicator of a non-specific template of type @NS_Types.NS_VCI."); return single_value->field_lengthIndicator; } OCTETSTRING_template& NS__VCI_template::nS__VCI() { set_specific(); return single_value->field_nS__VCI; } const OCTETSTRING_template& NS__VCI_template::nS__VCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nS_VCI of a non-specific template of type @NS_Types.NS_VCI."); return single_value->field_nS__VCI; } int NS__VCI_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_VCI 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 @NS_Types.NS_VCI 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 @NS_Types.NS_VCI containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_VCI containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_VCI containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_VCI containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_VCI containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_VCI containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_VCI containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.NS_VCI."); } return 0; } void NS__VCI_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log(); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log(); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.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 NS__VCI_template::log_match(const NS__VCI& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ext.match(match_value.ext(), legacy)){ TTCN_Logger::log_logmatch_info(".ext"); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthIndicator"); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nS__VCI.match(match_value.nS__VCI(), legacy)){ TTCN_Logger::log_logmatch_info(".nS_VCI"); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), 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 NS__VCI_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_ext.encode_text(text_buf); single_value->field_lengthIndicator.encode_text(text_buf); single_value->field_nS__VCI.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 @NS_Types.NS_VCI."); } } void NS__VCI_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_iEI.decode_text(text_buf); single_value->field_ext.decode_text(text_buf); single_value->field_lengthIndicator.decode_text(text_buf); single_value->field_nS__VCI.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 NS__VCI_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 @NS_Types.NS_VCI."); } } void NS__VCI_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: { NS__VCI_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.NS_VCI: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { NS__VCI_template* precondition = new NS__VCI_template; precondition->set_param(*param.get_elem(0)); NS__VCI_template* implied_template = new NS__VCI_template; implied_template->set_param(*param.get_elem(1)); *this = NS__VCI_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.NS_VCI"); } is_ifpresent = param.get_ifpresent(); } void NS__VCI_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_VCI"); single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_VCI"); single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_VCI"); single_value->field_nS__VCI.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_VCI"); 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 : "@NS_Types.NS_VCI"); } boolean NS__VCI_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean NS__VCI_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ns__PDU().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ns_PDU")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ns__PDU().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.NS_PDU: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.NS_PDU"); } } void NS__PDU::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_ext.encode_text(text_buf); field_lengthIndicator.encode_text(text_buf); field_ns__PDU.encode_text(text_buf); } void NS__PDU::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_ext.decode_text(text_buf); field_lengthIndicator.decode_text(text_buf); field_ns__PDU.decode_text(text_buf); } void NS__PDU::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 NS__PDU::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 NS__PDU::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; int selected_field = -1; if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord; else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB; else local_top_order=ORDER_LSB; int value_of_length_field2 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, NS__PDU_ext_descr_.raw->forceomit); decoded_field_length = field_ext.RAW_decode(NS__PDU_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_ext == bs_0) selected_field = 0; else if (field_ext == bs_1) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_2_force_omit(2, force_omit, NS__PDU_lengthIndicator_descr_.raw->forceomit); decoded_field_length = field_lengthIndicator.RAW_decode(NS__PDU_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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()); switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: { INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN1__2_length1_descr_); field_lengthIndicator.length1() = tmp1; value_of_length_field2 += tmp1.get_long_long_val() * 8; break; } case LIN1__2::ALT_length2: { INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN1__2_length2_descr_); field_lengthIndicator.length2() = tmp2; value_of_length_field2 += tmp2.get_long_long_val() * 8; break; } default: value_of_length_field2 = 0; } RAW_Force_Omit field_3_force_omit(3, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_ns__PDU.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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()); value_of_length_field2 -= decoded_field_length; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int NS__PDU::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NS__PDU_ext_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NS__PDU_lengthIndicator_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, OCTETSTRING_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_ext.RAW_encode(NS__PDU_ext_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_lengthIndicator.RAW_encode(NS__PDU_lengthIndicator_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_ns__PDU.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[3]); { int sel_field = 0; while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; } const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr; int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length; delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field]; myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos; } switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: if (field_ext != bs_0) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_0.RAW_encode(NS__PDU_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; case LIN1__2::ALT_length2: if (field_ext != bs_1) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_1.RAW_encode(NS__PDU_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; default:; } return myleaf.length = encoded_length; } struct NS__PDU_template::single_value_struct { OCTETSTRING_template field_iEI; BITSTRING_template field_ext; LIN1__2_template field_lengthIndicator; OCTETSTRING_template field_ns__PDU; }; void NS__PDU_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_iEI = ANY_VALUE; single_value->field_ext = ANY_VALUE; single_value->field_lengthIndicator = ANY_VALUE; single_value->field_ns__PDU = ANY_VALUE; } } } void NS__PDU_template::copy_value(const NS__PDU& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.ext().is_bound()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (other_value.lengthIndicator().is_bound()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (other_value.ns__PDU().is_bound()) { single_value->field_ns__PDU = other_value.ns__PDU(); } else { single_value->field_ns__PDU.clean_up(); } set_selection(SPECIFIC_VALUE); } void NS__PDU_template::copy_template(const NS__PDU_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ns__PDU().get_selection()) { single_value->field_ns__PDU = other_value.ns__PDU(); } else { single_value->field_ns__PDU.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 NS__PDU_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 NS__PDU_template(*other_value.implication_.precondition); implication_.implied_template = new NS__PDU_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 @NS_Types.NS_PDU."); break; } set_selection(other_value); } NS__PDU_template::NS__PDU_template() { } NS__PDU_template::NS__PDU_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } NS__PDU_template::NS__PDU_template(const NS__PDU& other_value) { copy_value(other_value); } NS__PDU_template::NS__PDU_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NS__PDU&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.NS_PDU from an unbound optional field."); } } NS__PDU_template::NS__PDU_template(NS__PDU_template* p_precondition, NS__PDU_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } NS__PDU_template::NS__PDU_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; } NS__PDU_template::NS__PDU_template(const NS__PDU_template& other_value) : Base_Template() { copy_template(other_value); } NS__PDU_template::~NS__PDU_template() { clean_up(); } NS__PDU_template& NS__PDU_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } NS__PDU_template& NS__PDU_template::operator=(const NS__PDU& other_value) { clean_up(); copy_value(other_value); return *this; } NS__PDU_template& NS__PDU_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NS__PDU&)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 @NS_Types.NS_PDU."); } return *this; } NS__PDU_template& NS__PDU_template::operator=(const NS__PDU_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean NS__PDU_template::match(const NS__PDU& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.ext().is_bound()) return FALSE; if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE; if(!other_value.lengthIndicator().is_bound()) return FALSE; if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE; if(!other_value.ns__PDU().is_bound()) return FALSE; if(!single_value->field_ns__PDU.match(other_value.ns__PDU(), 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 @NS_Types.NS_PDU."); } return FALSE; } boolean NS__PDU_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_ext.is_bound() || single_value->field_lengthIndicator.is_bound() || single_value->field_ns__PDU.is_bound(); } boolean NS__PDU_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_ext.is_value() && single_value->field_lengthIndicator.is_value() && single_value->field_ns__PDU.is_value(); } void NS__PDU_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; } NS__PDU NS__PDU_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 @NS_Types.NS_PDU."); NS__PDU ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_ext.is_bound()) { ret_val.ext() = single_value->field_ext.valueof(); } if (single_value->field_lengthIndicator.is_bound()) { ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof(); } if (single_value->field_ns__PDU.is_bound()) { ret_val.ns__PDU() = single_value->field_ns__PDU.valueof(); } return ret_val; } void NS__PDU_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 @NS_Types.NS_PDU."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new NS__PDU_template[list_length]; } NS__PDU_template& NS__PDU_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 @NS_Types.NS_PDU."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.NS_PDU."); return value_list.list_value[list_index]; } OCTETSTRING_template& NS__PDU_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& NS__PDU_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.NS_PDU."); return single_value->field_iEI; } BITSTRING_template& NS__PDU_template::ext() { set_specific(); return single_value->field_ext; } const BITSTRING_template& NS__PDU_template::ext() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ext of a non-specific template of type @NS_Types.NS_PDU."); return single_value->field_ext; } LIN1__2_template& NS__PDU_template::lengthIndicator() { set_specific(); return single_value->field_lengthIndicator; } const LIN1__2_template& NS__PDU_template::lengthIndicator() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthIndicator of a non-specific template of type @NS_Types.NS_PDU."); return single_value->field_lengthIndicator; } OCTETSTRING_template& NS__PDU_template::ns__PDU() { set_specific(); return single_value->field_ns__PDU; } const OCTETSTRING_template& NS__PDU_template::ns__PDU() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ns_PDU of a non-specific template of type @NS_Types.NS_PDU."); return single_value->field_ns__PDU; } int NS__PDU_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_PDU 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 @NS_Types.NS_PDU 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 @NS_Types.NS_PDU containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_PDU containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_PDU containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_PDU containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_PDU containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_PDU containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_PDU containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.NS_PDU."); } return 0; } void NS__PDU_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log(); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log(); TTCN_Logger::log_event_str(", ns_PDU := "); single_value->field_ns__PDU.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 NS__PDU_template::log_match(const NS__PDU& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ext.match(match_value.ext(), legacy)){ TTCN_Logger::log_logmatch_info(".ext"); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthIndicator"); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ns__PDU.match(match_value.ns__PDU(), legacy)){ TTCN_Logger::log_logmatch_info(".ns_PDU"); single_value->field_ns__PDU.log_match(match_value.ns__PDU(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::log_event_str(", ns_PDU := "); single_value->field_ns__PDU.log_match(match_value.ns__PDU(), 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 NS__PDU_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_ext.encode_text(text_buf); single_value->field_lengthIndicator.encode_text(text_buf); single_value->field_ns__PDU.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 @NS_Types.NS_PDU."); } } void NS__PDU_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_iEI.decode_text(text_buf); single_value->field_ext.decode_text(text_buf); single_value->field_lengthIndicator.decode_text(text_buf); single_value->field_ns__PDU.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 NS__PDU_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 @NS_Types.NS_PDU."); } } void NS__PDU_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: { NS__PDU_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ns__PDU().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ns_PDU")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ns__PDU().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.NS_PDU: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { NS__PDU_template* precondition = new NS__PDU_template; precondition->set_param(*param.get_elem(0)); NS__PDU_template* implied_template = new NS__PDU_template; implied_template->set_param(*param.get_elem(1)); *this = NS__PDU_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.NS_PDU"); } is_ifpresent = param.get_ifpresent(); } void NS__PDU_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_PDU"); single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_PDU"); single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_PDU"); single_value->field_ns__PDU.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_PDU"); 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 : "@NS_Types.NS_PDU"); } boolean NS__PDU_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean NS__PDU_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) bVCI().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bVCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bVCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.BVCI_NS: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.BVCI_NS"); } } void BVCI__NS::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_ext.encode_text(text_buf); field_lengthIndicator.encode_text(text_buf); field_bVCI.encode_text(text_buf); } void BVCI__NS::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_ext.decode_text(text_buf); field_lengthIndicator.decode_text(text_buf); field_bVCI.decode_text(text_buf); } void BVCI__NS::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 BVCI__NS::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 BVCI__NS::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; int selected_field = -1; if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord; else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB; else local_top_order=ORDER_LSB; int value_of_length_field2 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, BVCI__NS_ext_descr_.raw->forceomit); decoded_field_length = field_ext.RAW_decode(BVCI__NS_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_ext == bs_0) selected_field = 0; else if (field_ext == bs_1) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_2_force_omit(2, force_omit, BVCI__NS_lengthIndicator_descr_.raw->forceomit); decoded_field_length = field_lengthIndicator.RAW_decode(BVCI__NS_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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()); switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: { INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN1__2_length1_descr_); field_lengthIndicator.length1() = tmp1; value_of_length_field2 += tmp1.get_long_long_val() * 8; break; } case LIN1__2::ALT_length2: { INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN1__2_length2_descr_); field_lengthIndicator.length2() = tmp2; value_of_length_field2 += tmp2.get_long_long_val() * 8; break; } default: value_of_length_field2 = 0; } RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_bVCI.RAW_decode(General__Types::OCT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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()); value_of_length_field2 -= decoded_field_length; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int BVCI__NS::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, BVCI__NS_ext_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, BVCI__NS_lengthIndicator_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT2_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_ext.RAW_encode(BVCI__NS_ext_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_lengthIndicator.RAW_encode(BVCI__NS_lengthIndicator_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_bVCI.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[3]); { int sel_field = 0; while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; } const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr; int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length; delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field]; myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos; } switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: if (field_ext != bs_0) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_0.RAW_encode(BVCI__NS_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; case LIN1__2::ALT_length2: if (field_ext != bs_1) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_1.RAW_encode(BVCI__NS_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; default:; } return myleaf.length = encoded_length; } struct BVCI__NS_template::single_value_struct { OCTETSTRING_template field_iEI; BITSTRING_template field_ext; LIN1__2_template field_lengthIndicator; OCTETSTRING_template field_bVCI; }; void BVCI__NS_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_iEI = ANY_VALUE; single_value->field_ext = ANY_VALUE; single_value->field_lengthIndicator = ANY_VALUE; single_value->field_bVCI = ANY_VALUE; } } } void BVCI__NS_template::copy_value(const BVCI__NS& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.ext().is_bound()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (other_value.lengthIndicator().is_bound()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (other_value.bVCI().is_bound()) { single_value->field_bVCI = other_value.bVCI(); } else { single_value->field_bVCI.clean_up(); } set_selection(SPECIFIC_VALUE); } void BVCI__NS_template::copy_template(const BVCI__NS_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.bVCI().get_selection()) { single_value->field_bVCI = other_value.bVCI(); } else { single_value->field_bVCI.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 BVCI__NS_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 BVCI__NS_template(*other_value.implication_.precondition); implication_.implied_template = new BVCI__NS_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 @NS_Types.BVCI_NS."); break; } set_selection(other_value); } BVCI__NS_template::BVCI__NS_template() { } BVCI__NS_template::BVCI__NS_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } BVCI__NS_template::BVCI__NS_template(const BVCI__NS& other_value) { copy_value(other_value); } BVCI__NS_template::BVCI__NS_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const BVCI__NS&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.BVCI_NS from an unbound optional field."); } } BVCI__NS_template::BVCI__NS_template(BVCI__NS_template* p_precondition, BVCI__NS_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } BVCI__NS_template::BVCI__NS_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; } BVCI__NS_template::BVCI__NS_template(const BVCI__NS_template& other_value) : Base_Template() { copy_template(other_value); } BVCI__NS_template::~BVCI__NS_template() { clean_up(); } BVCI__NS_template& BVCI__NS_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } BVCI__NS_template& BVCI__NS_template::operator=(const BVCI__NS& other_value) { clean_up(); copy_value(other_value); return *this; } BVCI__NS_template& BVCI__NS_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const BVCI__NS&)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 @NS_Types.BVCI_NS."); } return *this; } BVCI__NS_template& BVCI__NS_template::operator=(const BVCI__NS_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean BVCI__NS_template::match(const BVCI__NS& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.ext().is_bound()) return FALSE; if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE; if(!other_value.lengthIndicator().is_bound()) return FALSE; if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE; if(!other_value.bVCI().is_bound()) return FALSE; if(!single_value->field_bVCI.match(other_value.bVCI(), 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 @NS_Types.BVCI_NS."); } return FALSE; } boolean BVCI__NS_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_ext.is_bound() || single_value->field_lengthIndicator.is_bound() || single_value->field_bVCI.is_bound(); } boolean BVCI__NS_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_ext.is_value() && single_value->field_lengthIndicator.is_value() && single_value->field_bVCI.is_value(); } void BVCI__NS_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; } BVCI__NS BVCI__NS_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 @NS_Types.BVCI_NS."); BVCI__NS ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_ext.is_bound()) { ret_val.ext() = single_value->field_ext.valueof(); } if (single_value->field_lengthIndicator.is_bound()) { ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof(); } if (single_value->field_bVCI.is_bound()) { ret_val.bVCI() = single_value->field_bVCI.valueof(); } return ret_val; } void BVCI__NS_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 @NS_Types.BVCI_NS."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new BVCI__NS_template[list_length]; } BVCI__NS_template& BVCI__NS_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 @NS_Types.BVCI_NS."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.BVCI_NS."); return value_list.list_value[list_index]; } OCTETSTRING_template& BVCI__NS_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& BVCI__NS_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.BVCI_NS."); return single_value->field_iEI; } BITSTRING_template& BVCI__NS_template::ext() { set_specific(); return single_value->field_ext; } const BITSTRING_template& BVCI__NS_template::ext() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ext of a non-specific template of type @NS_Types.BVCI_NS."); return single_value->field_ext; } LIN1__2_template& BVCI__NS_template::lengthIndicator() { set_specific(); return single_value->field_lengthIndicator; } const LIN1__2_template& BVCI__NS_template::lengthIndicator() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthIndicator of a non-specific template of type @NS_Types.BVCI_NS."); return single_value->field_lengthIndicator; } OCTETSTRING_template& BVCI__NS_template::bVCI() { set_specific(); return single_value->field_bVCI; } const OCTETSTRING_template& BVCI__NS_template::bVCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bVCI of a non-specific template of type @NS_Types.BVCI_NS."); return single_value->field_bVCI; } int BVCI__NS_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.BVCI_NS 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 @NS_Types.BVCI_NS 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 @NS_Types.BVCI_NS containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.BVCI_NS containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.BVCI_NS containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.BVCI_NS containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.BVCI_NS containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.BVCI_NS containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.BVCI_NS containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.BVCI_NS."); } return 0; } void BVCI__NS_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log(); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log(); TTCN_Logger::log_event_str(", bVCI := "); single_value->field_bVCI.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 BVCI__NS_template::log_match(const BVCI__NS& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ext.match(match_value.ext(), legacy)){ TTCN_Logger::log_logmatch_info(".ext"); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthIndicator"); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_bVCI.match(match_value.bVCI(), legacy)){ TTCN_Logger::log_logmatch_info(".bVCI"); single_value->field_bVCI.log_match(match_value.bVCI(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::log_event_str(", bVCI := "); single_value->field_bVCI.log_match(match_value.bVCI(), 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 BVCI__NS_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_ext.encode_text(text_buf); single_value->field_lengthIndicator.encode_text(text_buf); single_value->field_bVCI.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 @NS_Types.BVCI_NS."); } } void BVCI__NS_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_iEI.decode_text(text_buf); single_value->field_ext.decode_text(text_buf); single_value->field_lengthIndicator.decode_text(text_buf); single_value->field_bVCI.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 BVCI__NS_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 @NS_Types.BVCI_NS."); } } void BVCI__NS_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: { BVCI__NS_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) bVCI().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bVCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bVCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.BVCI_NS: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { BVCI__NS_template* precondition = new BVCI__NS_template; precondition->set_param(*param.get_elem(0)); BVCI__NS_template* implied_template = new BVCI__NS_template; implied_template->set_param(*param.get_elem(1)); *this = BVCI__NS_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.BVCI_NS"); } is_ifpresent = param.get_ifpresent(); } void BVCI__NS_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.BVCI_NS"); single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@NS_Types.BVCI_NS"); single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@NS_Types.BVCI_NS"); single_value->field_bVCI.check_restriction(t_res, t_name ? t_name : "@NS_Types.BVCI_NS"); 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 : "@NS_Types.BVCI_NS"); } boolean BVCI__NS_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean BVCI__NS_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idxref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } IP4__Elements::IP4__Elements(const IP4__Elements& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.IP4_Elements."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } IP4__Elements::~IP4__Elements() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void IP4__Elements::clean_up() { if (val_ptr != NULL) { if (val_ptr->ref_count > 1) { val_ptr->ref_count--; val_ptr = NULL; } else if (val_ptr->ref_count == 1) { for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) if (val_ptr->value_elements[elem_count] != NULL) delete val_ptr->value_elements[elem_count]; free_pointers((void**)val_ptr->value_elements); delete val_ptr; val_ptr = NULL; } else TTCN_error("Internal error: Invalid reference counter in a record of/set of value."); } } IP4__Elements& IP4__Elements::operator=(null_type) { clean_up(); val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; return *this; } IP4__Elements& IP4__Elements::operator=(const IP4__Elements& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @NS_Types.IP4_Elements."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean IP4__Elements::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @NS_Types.IP4_Elements."); return val_ptr->n_elements == 0 ; } boolean IP4__Elements::operator==(const IP4__Elements& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @NS_Types.IP4_Elements."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @NS_Types.IP4_Elements."); if (val_ptr == other_value.val_ptr) return TRUE; if (val_ptr->n_elements != (other_value.val_ptr)->n_elements) return FALSE; for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){ if (val_ptr->value_elements[elem_count] != NULL){ if ((other_value.val_ptr)->value_elements[elem_count] != NULL){ if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE; } else return FALSE; } else { if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE; } } return TRUE; } IP4__Element& IP4__Elements::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @NS_Types.IP4_Elements using a negative index: %d.", index_value); if (val_ptr == NULL) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } else if (val_ptr->ref_count > 1) { struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct; new_val_ptr->ref_count = 1; new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements; new_val_ptr->value_elements = (IP4__Element**)allocate_pointers(new_val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){ if (val_ptr->value_elements[elem_count] != NULL){ new_val_ptr->value_elements[elem_count] = new IP4__Element(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (index_value >= val_ptr->n_elements) set_size(index_value + 1); if (val_ptr->value_elements[index_value] == NULL) { val_ptr->value_elements[index_value] = new IP4__Element; } return *val_ptr->value_elements[index_value]; } IP4__Element& IP4__Elements::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @NS_Types.IP4_Elements."); return (*this)[(int)index_value]; } const IP4__Element& IP4__Elements::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @NS_Types.IP4_Elements."); if (index_value < 0) TTCN_error("Accessing an element of type @NS_Types.IP4_Elements using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @NS_Types.IP4_Elements: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements); return (val_ptr->value_elements[index_value] == NULL) ? UNBOUND_ELEM : *val_ptr->value_elements[index_value]; } const IP4__Element& IP4__Elements::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @NS_Types.IP4_Elements."); return (*this)[(int)index_value]; } IP4__Elements IP4__Elements::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } IP4__Elements IP4__Elements::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } IP4__Elements IP4__Elements::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } IP4__Elements IP4__Elements::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @NS_Types.IP4_Elements."); if (val_ptr->n_elements == 0) return *this; int rc; if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements; else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements); if (rc == 0) return *this; IP4__Elements ret_val; ret_val.set_size(val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new IP4__Element(*val_ptr->value_elements[i]); } } return ret_val; } IP4__Elements IP4__Elements::operator+(const IP4__Elements& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @NS_Types.IP4_Elements concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; IP4__Elements ret_val; ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i] = new IP4__Element(*val_ptr->value_elements[i]); } } for (int i=0; in_elements; i++) { if (other_value.val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new IP4__Element(*other_value.val_ptr->value_elements[i]); } } return ret_val; } IP4__Elements IP4__Elements::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @NS_Types.IP4_Elements."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@NS_Types.IP4_Elements","element"); IP4__Elements ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new IP4__Element(*val_ptr->value_elements[i+index]); } } return ret_val; } IP4__Elements IP4__Elements::replace(int index, int len, const IP4__Elements& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @NS_Types.IP4_Elements."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @NS_Types.IP4_Elements."); check_replace_arguments(val_ptr->n_elements, index, len, "@NS_Types.IP4_Elements","element"); IP4__Elements ret_val; ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len); for (int i = 0; i < index; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i] = new IP4__Element(*val_ptr->value_elements[i]); } } for (int i = 0; i < repl.val_ptr->n_elements; i++) { if (repl.val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i+index] = new IP4__Element(*repl.val_ptr->value_elements[i]); } } for (int i = 0; i < val_ptr->n_elements - index - len; i++) { if (val_ptr->value_elements[index+i+len] != NULL) { ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new IP4__Element(*val_ptr->value_elements[index+i+len]); } } return ret_val; } IP4__Elements IP4__Elements::replace(int index, int len, const IP4__Elements_template& repl) const { if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value."); return replace(index, len, repl.valueof()); } void IP4__Elements::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @NS_Types.IP4_Elements."); if (val_ptr == NULL) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } else if (val_ptr->ref_count > 1) { struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct; new_val_ptr->ref_count = 1; new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements; new_val_ptr->value_elements = (IP4__Element**)allocate_pointers(new_val_ptr->n_elements); for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) { if (val_ptr->value_elements[elem_count] != NULL){ new_val_ptr->value_elements[elem_count] = new IP4__Element(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (IP4__Element**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); #ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @NS_Types.IP4_Elements: %d",new_size); #endif val_ptr->n_elements = new_size; } else if (new_size < val_ptr->n_elements) { for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++) if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count]; val_ptr->value_elements = (IP4__Element**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean IP4__Elements::is_value() const { if (val_ptr == NULL) return FALSE; for(int i = 0; i < val_ptr->n_elements; ++i) { if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE; } return TRUE; } int IP4__Elements::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @NS_Types.IP4_Elements."); return val_ptr->n_elements; } int IP4__Elements::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @NS_Types.IP4_Elements."); for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length; return 0; } void IP4__Elements::log() const { if (val_ptr == NULL) {; TTCN_Logger::log_event_unbound(); return; } switch (val_ptr->n_elements) { case 0: TTCN_Logger::log_event_str("{ }"); break; default: TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); (*this)[elem_count].log(); } TTCN_Logger::log_event_str(" }"); } } void IP4__Elements::set_implicit_omit() { if (val_ptr == NULL) return; for (int i = 0; i < val_ptr->n_elements; i++) { if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit(); } } void IP4__Elements::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value"); switch (param.get_operation_type()) { case Module_Param::OT_ASSIGN: if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) { *this = NULL_VALUE; return; } switch (param.get_type()) { case Module_Param::MP_Value_List: set_size(param.get_size()); for (size_t i=0; iget_type()!=Module_Param::MP_NotUsed) { (*this)[i].set_param(*curr); if (!(*this)[i].is_bound()) { delete val_ptr->value_elements[i]; val_ptr->value_elements[i] = NULL; } } } break; case Module_Param::MP_Indexed_List: for (size_t i=0; iget_id()->get_index()].set_param(*curr); if (!(*this)[curr->get_id()->get_index()].is_bound()) { delete val_ptr->value_elements[curr->get_id()->get_index()]; val_ptr->value_elements[curr->get_id()->get_index()] = NULL; } } break; default: param.type_error("record of value", "@NS_Types.IP4_Elements"); } break; case Module_Param::OT_CONCAT: switch (param.get_type()) { case Module_Param::MP_Value_List: { if (!is_bound()) *this = NULL_VALUE; int start_idx = lengthof(); for (size_t i=0; iget_type()!=Module_Param::MP_NotUsed)) { (*this)[start_idx+(int)i].set_param(*curr); } } } break; case Module_Param::MP_Indexed_List: param.error("Cannot concatenate an indexed value list"); break; default: param.type_error("record of value", "@NS_Types.IP4_Elements"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void IP4__Elements::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @NS_Types.IP4_Elements."); text_buf.push_int(val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) (*this)[elem_count].encode_text(text_buf); } void IP4__Elements::decode_text(Text_Buf& text_buf) { clean_up(); val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = text_buf.pull_int().get_val(); if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @NS_Types.IP4_Elements."); val_ptr->value_elements = (IP4__Element**)allocate_pointers(val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) { val_ptr->value_elements[elem_count] = new IP4__Element; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void IP4__Elements::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 IP4__Elements::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 IP4__Elements::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean /*no_err*/, int sel_field, boolean first_call, const RAW_Force_Omit*){ int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; int decoded_length=0; int decoded_field_length=0; size_t start_of_field=0; if(first_call) { clean_up(); val_ptr=new recordof_setof_struct; val_ptr->ref_count=1; val_ptr->n_elements=0; val_ptr->value_elements=NULL; } int start_field=val_ptr->n_elements; if(p_td.raw->fieldlength || sel_field!=-1){ int a=0; if(sel_field==-1) sel_field=p_td.raw->fieldlength; start_of_field=p_buf.get_pos_bit(); for(a=0;a=0){ delete &(*this)[a+start_field]; a--; val_ptr->n_elements--; } p_buf.set_pos_bit(start_of_field); return decoded_field_length; } decoded_length+=decoded_field_length; limit-=decoded_field_length; } if(a==0) val_ptr->n_elements=0; } else { if(limit==0){ if(!first_call) return -1; val_ptr->n_elements=0; return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength; } int a=start_field; while(limit>0){ start_of_field=p_buf.get_pos_bit(); decoded_field_length=(*this)[a].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE); if(decoded_field_length < 0){ delete &(*this)[a]; val_ptr->n_elements--; p_buf.set_pos_bit(start_of_field); if(a>start_field){ return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength; } else return -1; } decoded_length+=decoded_field_length; limit-=decoded_field_length; a++; } } return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength; } int IP4__Elements::RAW_encode(const TTCN_Typedescriptor_t& p_td,RAW_enc_tree& myleaf) const{ int encoded_length=0; int encoded_num_of_records=p_td.raw->fieldlength?smaller(val_ptr->n_elements, p_td.raw->fieldlength):val_ptr->n_elements; myleaf.isleaf=FALSE; myleaf.rec_of=TRUE; myleaf.body.node.num_of_nodes=encoded_num_of_records; myleaf.body.node.nodes=init_nodes_of_enc_tree(encoded_num_of_records); for(int a=0;araw); encoded_length+=(*this)[a].RAW_encode(*p_td.oftype_descr,*myleaf.body.node.nodes[a]); } return myleaf.length=encoded_length; } void IP4__Elements_template::copy_value(const IP4__Elements& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @NS_Types.IP4_Elements with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (IP4__Element_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (other_value[elem_count].is_bound()) { single_value.value_elements[elem_count] = new IP4__Element_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new IP4__Element_template; } } set_selection(SPECIFIC_VALUE); } void IP4__Elements_template::copy_template(const IP4__Elements_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value.n_elements = other_value.single_value.n_elements; single_value.value_elements = (IP4__Element_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) { single_value.value_elements[elem_count] = new IP4__Element_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new IP4__Element_template; } } case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new IP4__Elements_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 IP4__Elements_template(*other_value.implication_.precondition); implication_.implied_template = new IP4__Elements_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 @NS_Types.IP4_Elements."); break; } set_selection(other_value); } boolean IP4__Elements_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy) { if (value_index >= 0) return ((const IP4__Elements_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const IP4__Elements*)value_ptr)[value_index], legacy); else return ((const IP4__Elements_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } IP4__Elements_template::IP4__Elements_template() { } IP4__Elements_template::IP4__Elements_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } IP4__Elements_template::IP4__Elements_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } IP4__Elements_template::IP4__Elements_template(const IP4__Elements& other_value) { copy_value(other_value); } IP4__Elements_template::IP4__Elements_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP4__Elements&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.IP4_Elements from an unbound optional field."); } } IP4__Elements_template::IP4__Elements_template(IP4__Elements_template* p_precondition, IP4__Elements_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IP4__Elements_template::IP4__Elements_template(Dynamic_Match_Interface* p_dyn_match) : Base_Record_Of_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } IP4__Elements_template::IP4__Elements_template(const IP4__Elements_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } IP4__Elements_template::~IP4__Elements_template() { clean_up(); } void IP4__Elements_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) delete single_value.value_elements[elem_count]; free_pointers((void**)single_value.value_elements); break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } IP4__Elements_template& IP4__Elements_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IP4__Elements_template& IP4__Elements_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } IP4__Elements_template& IP4__Elements_template::operator=(const IP4__Elements& other_value) { clean_up(); copy_value(other_value); return *this; } IP4__Elements_template& IP4__Elements_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP4__Elements&)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 @NS_Types.IP4_Elements."); } return *this; } IP4__Elements_template& IP4__Elements_template::operator=(const IP4__Elements_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } IP4__Element_template& IP4__Elements_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Types.IP4_Elements using a negative index: %d.", index_value); switch (template_selection) { case SPECIFIC_VALUE: if(index_value < single_value.n_elements) break; // no break case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case UNINITIALIZED_TEMPLATE: set_size(index_value + 1); break; default: TTCN_error("Accessing an element of a non-specific template for type @NS_Types.IP4_Elements."); break; } return *single_value.value_elements[index_value]; } IP4__Element_template& IP4__Elements_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @NS_Types.IP4_Elements."); return (*this)[(int)index_value]; } const IP4__Element_template& IP4__Elements_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Types.IP4_Elements using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @NS_Types.IP4_Elements."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @NS_Types.IP4_Elements: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements); return *single_value.value_elements[index_value]; } const IP4__Element_template& IP4__Elements_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @NS_Types.IP4_Elements."); return (*this)[(int)index_value]; } void IP4__Elements_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @NS_Types.IP4_Elements."); template_sel old_selection = template_selection; if (old_selection != SPECIFIC_VALUE) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; } if (new_size > single_value.n_elements) { single_value.value_elements = (IP4__Element_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++) single_value.value_elements[elem_count] = new IP4__Element_template(ANY_VALUE); } else { for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++) single_value.value_elements[elem_count] = new IP4__Element_template; } single_value.n_elements = new_size; } else if (new_size < single_value.n_elements) { for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++) delete single_value.value_elements[elem_count]; single_value.value_elements = (IP4__Element_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int IP4__Elements_template::n_elem() const { switch (template_selection) { case SPECIFIC_VALUE: return single_value.n_elements; break; case VALUE_LIST: return value_list.n_values; break; default: TTCN_error("Performing n_elem"); } } int IP4__Elements_template::size_of(boolean is_size) const { const char* op_name = is_size ? "size" : "length"; int min_size; boolean has_any_or_none; if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP4_Elements which has an ifpresent attribute.", op_name); switch (template_selection) { case SPECIFIC_VALUE: { min_size = 0; has_any_or_none = FALSE; int elem_count = single_value.n_elements; if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; } for (int i=0; iget_selection()) { case OMIT_VALUE: TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP4_Elements containing omit element.", op_name); case ANY_OR_OMIT: has_any_or_none = TRUE; break; default: min_size++; break; } } } break; case OMIT_VALUE: TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP4_Elements containing omit value.", op_name); case ANY_VALUE: case ANY_OR_OMIT: min_size = 0; has_any_or_none = TRUE; break; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP4_Elements containing an empty list.", op_name); int item_size = value_list.list_value[0].size_of(is_size); for (unsigned int i = 1; i < value_list.n_values; i++) { if (value_list.list_value[i].size_of(is_size)!=item_size) TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP4_Elements containing a value list with different sizes.", op_name); } min_size = item_size; has_any_or_none = FALSE; break; } case COMPLEMENTED_LIST: TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP4_Elements containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @NS_Types.IP4_Elements.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @NS_Types.IP4_Elements"); } boolean IP4__Elements_template::match(const IP4__Elements& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; int value_length = other_value.size_of(); if (!match_length(value_length)) return FALSE; switch (template_selection) { case SPECIFIC_VALUE: return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy); case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching with an uninitialized/unsupported template of type @NS_Types.IP4_Elements."); } return FALSE; } boolean IP4__Elements_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) if (!single_value.value_elements[elem_count]->is_value()) return FALSE; return TRUE; } IP4__Elements IP4__Elements_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 @NS_Types.IP4_Elements."); IP4__Elements ret_val; ret_val.set_size(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) if (single_value.value_elements[elem_count]->is_bound()) { ret_val[elem_count] = single_value.value_elements[elem_count]->valueof(); } return ret_val; } IP4__Elements IP4__Elements_template::substr(int index, int returncount) const { if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value."); return valueof().substr(index, returncount); } IP4__Elements IP4__Elements_template::replace(int index, int len, const IP4__Elements_template& repl) const { if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value."); if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value."); return valueof().replace(index, len, repl.valueof()); } IP4__Elements IP4__Elements_template::replace(int index, int len, const IP4__Elements& repl) const { if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value."); return valueof().replace(index, len, repl); } void IP4__Elements_template::set_type(template_sel template_type, unsigned int list_length) { clean_up(); switch (template_type) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = list_length; value_list.list_value = new IP4__Elements_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @NS_Types.IP4_Elements."); } set_selection(template_type); } IP4__Elements_template& IP4__Elements_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of type @NS_Types.IP4_Elements."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @NS_Types.IP4_Elements."); return value_list.list_value[list_index]; } void IP4__Elements_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: if (single_value.n_elements > 0) { TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); if (permutation_starts_at(elem_count)) TTCN_Logger::log_event_str("permutation("); single_value.value_elements[elem_count]->log(); if (permutation_ends_at(elem_count)) TTCN_Logger::log_char(')'); } TTCN_Logger::log_event_str(" }"); } else TTCN_Logger::log_event_str("{ }"); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_restricted(); log_ifpresent(); } void IP4__Elements_template::log_match(const IP4__Elements& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); }else{ if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){ TTCN_Logger::log_logmatch_info("[%d]", elem_count); single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } log_match_length(single_value.n_elements); } else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) { TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy); } TTCN_Logger::log_event_str(" }"); log_match_length(single_value.n_elements); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void IP4__Elements_template::encode_text(Text_Buf& text_buf) const { encode_text_permutation(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) single_value.value_elements[elem_count]->encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @NS_Types.IP4_Elements."); } } void IP4__Elements_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_permutation(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value.n_elements = text_buf.pull_int().get_val(); if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @NS_Types.IP4_Elements."); single_value.value_elements = (IP4__Element_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { single_value.value_elements[elem_count] = new IP4__Element_template; single_value.value_elements[elem_count]->decode_text(text_buf); } case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new IP4__Elements_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @NS_Types.IP4_Elements."); } } boolean IP4__Elements_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IP4__Elements_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_id()->get_index())].set_param(*param.get_elem(p_i)); } break; case Module_Param::MP_Value_List: { set_size(param.get_size()); int curr_idx = 0; for (size_t p_i=0; p_iget_type()) { case Module_Param::MP_NotUsed: curr_idx++; break; case Module_Param::MP_Permutation_Template: { int perm_start_idx = curr_idx; Module_Param* param_i = param.get_elem(p_i); for (size_t perm_i=0; perm_iget_size(); perm_i++) { (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i))); curr_idx++; } int perm_end_idx = curr_idx - 1; add_permutation(perm_start_idx, perm_end_idx); } break; default: (*this)[curr_idx].set_param(*param.get_elem(p_i)); curr_idx++; } } } break; case Module_Param::MP_Implication_Template: { IP4__Elements_template* precondition = new IP4__Elements_template; precondition->set_param(*param.get_elem(0)); IP4__Elements_template* implied_template = new IP4__Elements_template; implied_template->set_param(*param.get_elem(1)); *this = IP4__Elements_template(precondition, implied_template); } break; default: param.type_error("record of template", "@NS_Types.IP4_Elements"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void IP4__Elements_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; for (int i=0; icheck_restriction(t_res, t_name ? t_name : "@NS_Types.IP4_Elements"); 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 : "@NS_Types.IP4_Elements"); } boolean IP4__Elements_template::get_istemplate_kind(const char* type) const { if (!strcmp(type, "AnyElement")) { if (template_selection != SPECIFIC_VALUE) { return FALSE; } for (int i = 0; i < single_value.n_elements; i++) { if (single_value.value_elements[i]->get_selection() == ANY_VALUE) { return TRUE; } } return FALSE; } else if (!strcmp(type, "AnyElementsOrNone")) { if (template_selection != SPECIFIC_VALUE) { return FALSE; } for (int i = 0; i < single_value.n_elements; i++) { if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) { return TRUE; } } return FALSE; } else if (!strcmp(type, "permutation")) { return number_of_permutations; } else if (!strcmp(type, "length")) { return length_restriction_type != NO_LENGTH_RESTRICTION; } else { return Base_Template::get_istemplate_kind(type); } } IP4__Element::IP4__Element() { } IP4__Element::IP4__Element(const OCTETSTRING& par_ipAddress, const OCTETSTRING& par_uDP__Port, const OCTETSTRING& par_signallingWeight, const OCTETSTRING& par_dataWeight) : field_ipAddress(par_ipAddress), field_uDP__Port(par_uDP__Port), field_signallingWeight(par_signallingWeight), field_dataWeight(par_dataWeight) { } IP4__Element::IP4__Element(const IP4__Element& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.IP4_Element."); if (other_value.ipAddress().is_bound()) field_ipAddress = other_value.ipAddress(); else field_ipAddress.clean_up(); if (other_value.uDP__Port().is_bound()) field_uDP__Port = other_value.uDP__Port(); else field_uDP__Port.clean_up(); if (other_value.signallingWeight().is_bound()) field_signallingWeight = other_value.signallingWeight(); else field_signallingWeight.clean_up(); if (other_value.dataWeight().is_bound()) field_dataWeight = other_value.dataWeight(); else field_dataWeight.clean_up(); } void IP4__Element::clean_up() { field_ipAddress.clean_up(); field_uDP__Port.clean_up(); field_signallingWeight.clean_up(); field_dataWeight.clean_up(); } const TTCN_Typedescriptor_t* IP4__Element::get_descriptor() const { return &IP4__Element_descr_; } IP4__Element& IP4__Element::operator=(const IP4__Element& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.IP4_Element."); if (other_value.ipAddress().is_bound()) field_ipAddress = other_value.ipAddress(); else field_ipAddress.clean_up(); if (other_value.uDP__Port().is_bound()) field_uDP__Port = other_value.uDP__Port(); else field_uDP__Port.clean_up(); if (other_value.signallingWeight().is_bound()) field_signallingWeight = other_value.signallingWeight(); else field_signallingWeight.clean_up(); if (other_value.dataWeight().is_bound()) field_dataWeight = other_value.dataWeight(); else field_dataWeight.clean_up(); } return *this; } boolean IP4__Element::operator==(const IP4__Element& other_value) const { return field_ipAddress==other_value.field_ipAddress && field_uDP__Port==other_value.field_uDP__Port && field_signallingWeight==other_value.field_signallingWeight && field_dataWeight==other_value.field_dataWeight; } boolean IP4__Element::is_bound() const { return (field_ipAddress.is_bound()) || (field_uDP__Port.is_bound()) || (field_signallingWeight.is_bound()) || (field_dataWeight.is_bound()); } boolean IP4__Element::is_value() const { return field_ipAddress.is_value() && field_uDP__Port.is_value() && field_signallingWeight.is_value() && field_dataWeight.is_value(); } void IP4__Element::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ ipAddress := "); field_ipAddress.log(); TTCN_Logger::log_event_str(", uDP_Port := "); field_uDP__Port.log(); TTCN_Logger::log_event_str(", signallingWeight := "); field_signallingWeight.log(); TTCN_Logger::log_event_str(", dataWeight := "); field_dataWeight.log(); TTCN_Logger::log_event_str(" }"); } void IP4__Element::set_implicit_omit() { if (ipAddress().is_bound()) ipAddress().set_implicit_omit(); if (uDP__Port().is_bound()) uDP__Port().set_implicit_omit(); if (signallingWeight().is_bound()) signallingWeight().set_implicit_omit(); if (dataWeight().is_bound()) dataWeight().set_implicit_omit(); } void IP4__Element::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) ipAddress().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) uDP__Port().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) signallingWeight().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) dataWeight().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(), "ipAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uDP_Port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uDP__Port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "signallingWeight")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { signallingWeight().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "dataWeight")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { dataWeight().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.IP4_Element: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.IP4_Element"); } } void IP4__Element::encode_text(Text_Buf& text_buf) const { field_ipAddress.encode_text(text_buf); field_uDP__Port.encode_text(text_buf); field_signallingWeight.encode_text(text_buf); field_dataWeight.encode_text(text_buf); } void IP4__Element::decode_text(Text_Buf& text_buf) { field_ipAddress.decode_text(text_buf); field_uDP__Port.decode_text(text_buf); field_signallingWeight.decode_text(text_buf); field_dataWeight.decode_text(text_buf); } void IP4__Element::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 IP4__Element::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 IP4__Element::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, General__Types::OCT4_descr_.raw->forceomit); decoded_field_length = field_ipAddress.RAW_decode(General__Types::OCT4_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, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_uDP__Port.RAW_decode(General__Types::OCT2_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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_signallingWeight.RAW_decode(General__Types::OCT1_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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_dataWeight.RAW_decode(General__Types::OCT1_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 IP4__Element::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, General__Types::OCT4_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::OCT2_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw); encoded_length += field_ipAddress.RAW_encode(General__Types::OCT4_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_uDP__Port.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_signallingWeight.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_dataWeight.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct IP4__Element_template::single_value_struct { OCTETSTRING_template field_ipAddress; OCTETSTRING_template field_uDP__Port; OCTETSTRING_template field_signallingWeight; OCTETSTRING_template field_dataWeight; }; void IP4__Element_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_ipAddress = ANY_VALUE; single_value->field_uDP__Port = ANY_VALUE; single_value->field_signallingWeight = ANY_VALUE; single_value->field_dataWeight = ANY_VALUE; } } } void IP4__Element_template::copy_value(const IP4__Element& other_value) { single_value = new single_value_struct; if (other_value.ipAddress().is_bound()) { single_value->field_ipAddress = other_value.ipAddress(); } else { single_value->field_ipAddress.clean_up(); } if (other_value.uDP__Port().is_bound()) { single_value->field_uDP__Port = other_value.uDP__Port(); } else { single_value->field_uDP__Port.clean_up(); } if (other_value.signallingWeight().is_bound()) { single_value->field_signallingWeight = other_value.signallingWeight(); } else { single_value->field_signallingWeight.clean_up(); } if (other_value.dataWeight().is_bound()) { single_value->field_dataWeight = other_value.dataWeight(); } else { single_value->field_dataWeight.clean_up(); } set_selection(SPECIFIC_VALUE); } void IP4__Element_template::copy_template(const IP4__Element_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.ipAddress().get_selection()) { single_value->field_ipAddress = other_value.ipAddress(); } else { single_value->field_ipAddress.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.uDP__Port().get_selection()) { single_value->field_uDP__Port = other_value.uDP__Port(); } else { single_value->field_uDP__Port.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.signallingWeight().get_selection()) { single_value->field_signallingWeight = other_value.signallingWeight(); } else { single_value->field_signallingWeight.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.dataWeight().get_selection()) { single_value->field_dataWeight = other_value.dataWeight(); } else { single_value->field_dataWeight.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 IP4__Element_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 IP4__Element_template(*other_value.implication_.precondition); implication_.implied_template = new IP4__Element_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 @NS_Types.IP4_Element."); break; } set_selection(other_value); } IP4__Element_template::IP4__Element_template() { } IP4__Element_template::IP4__Element_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IP4__Element_template::IP4__Element_template(const IP4__Element& other_value) { copy_value(other_value); } IP4__Element_template::IP4__Element_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP4__Element&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.IP4_Element from an unbound optional field."); } } IP4__Element_template::IP4__Element_template(IP4__Element_template* p_precondition, IP4__Element_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IP4__Element_template::IP4__Element_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; } IP4__Element_template::IP4__Element_template(const IP4__Element_template& other_value) : Base_Template() { copy_template(other_value); } IP4__Element_template::~IP4__Element_template() { clean_up(); } IP4__Element_template& IP4__Element_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IP4__Element_template& IP4__Element_template::operator=(const IP4__Element& other_value) { clean_up(); copy_value(other_value); return *this; } IP4__Element_template& IP4__Element_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP4__Element&)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 @NS_Types.IP4_Element."); } return *this; } IP4__Element_template& IP4__Element_template::operator=(const IP4__Element_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IP4__Element_template::match(const IP4__Element& 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.ipAddress().is_bound()) return FALSE; if(!single_value->field_ipAddress.match(other_value.ipAddress(), legacy))return FALSE; if(!other_value.uDP__Port().is_bound()) return FALSE; if(!single_value->field_uDP__Port.match(other_value.uDP__Port(), legacy))return FALSE; if(!other_value.signallingWeight().is_bound()) return FALSE; if(!single_value->field_signallingWeight.match(other_value.signallingWeight(), legacy))return FALSE; if(!other_value.dataWeight().is_bound()) return FALSE; if(!single_value->field_dataWeight.match(other_value.dataWeight(), 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 @NS_Types.IP4_Element."); } return FALSE; } boolean IP4__Element_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_ipAddress.is_bound() || single_value->field_uDP__Port.is_bound() || single_value->field_signallingWeight.is_bound() || single_value->field_dataWeight.is_bound(); } boolean IP4__Element_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_ipAddress.is_value() && single_value->field_uDP__Port.is_value() && single_value->field_signallingWeight.is_value() && single_value->field_dataWeight.is_value(); } void IP4__Element_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; } IP4__Element IP4__Element_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 @NS_Types.IP4_Element."); IP4__Element ret_val; if (single_value->field_ipAddress.is_bound()) { ret_val.ipAddress() = single_value->field_ipAddress.valueof(); } if (single_value->field_uDP__Port.is_bound()) { ret_val.uDP__Port() = single_value->field_uDP__Port.valueof(); } if (single_value->field_signallingWeight.is_bound()) { ret_val.signallingWeight() = single_value->field_signallingWeight.valueof(); } if (single_value->field_dataWeight.is_bound()) { ret_val.dataWeight() = single_value->field_dataWeight.valueof(); } return ret_val; } void IP4__Element_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 @NS_Types.IP4_Element."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new IP4__Element_template[list_length]; } IP4__Element_template& IP4__Element_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 @NS_Types.IP4_Element."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.IP4_Element."); return value_list.list_value[list_index]; } OCTETSTRING_template& IP4__Element_template::ipAddress() { set_specific(); return single_value->field_ipAddress; } const OCTETSTRING_template& IP4__Element_template::ipAddress() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ipAddress of a non-specific template of type @NS_Types.IP4_Element."); return single_value->field_ipAddress; } OCTETSTRING_template& IP4__Element_template::uDP__Port() { set_specific(); return single_value->field_uDP__Port; } const OCTETSTRING_template& IP4__Element_template::uDP__Port() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field uDP_Port of a non-specific template of type @NS_Types.IP4_Element."); return single_value->field_uDP__Port; } OCTETSTRING_template& IP4__Element_template::signallingWeight() { set_specific(); return single_value->field_signallingWeight; } const OCTETSTRING_template& IP4__Element_template::signallingWeight() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field signallingWeight of a non-specific template of type @NS_Types.IP4_Element."); return single_value->field_signallingWeight; } OCTETSTRING_template& IP4__Element_template::dataWeight() { set_specific(); return single_value->field_dataWeight; } const OCTETSTRING_template& IP4__Element_template::dataWeight() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field dataWeight of a non-specific template of type @NS_Types.IP4_Element."); return single_value->field_dataWeight; } int IP4__Element_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP4_Element 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 @NS_Types.IP4_Element 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 @NS_Types.IP4_Element containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP4_Element containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP4_Element containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP4_Element containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP4_Element containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP4_Element containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP4_Element containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.IP4_Element."); } return 0; } void IP4__Element_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ ipAddress := "); single_value->field_ipAddress.log(); TTCN_Logger::log_event_str(", uDP_Port := "); single_value->field_uDP__Port.log(); TTCN_Logger::log_event_str(", signallingWeight := "); single_value->field_signallingWeight.log(); TTCN_Logger::log_event_str(", dataWeight := "); single_value->field_dataWeight.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 IP4__Element_template::log_match(const IP4__Element& 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_ipAddress.match(match_value.ipAddress(), legacy)){ TTCN_Logger::log_logmatch_info(".ipAddress"); single_value->field_ipAddress.log_match(match_value.ipAddress(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_uDP__Port.match(match_value.uDP__Port(), legacy)){ TTCN_Logger::log_logmatch_info(".uDP_Port"); single_value->field_uDP__Port.log_match(match_value.uDP__Port(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_signallingWeight.match(match_value.signallingWeight(), legacy)){ TTCN_Logger::log_logmatch_info(".signallingWeight"); single_value->field_signallingWeight.log_match(match_value.signallingWeight(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_dataWeight.match(match_value.dataWeight(), legacy)){ TTCN_Logger::log_logmatch_info(".dataWeight"); single_value->field_dataWeight.log_match(match_value.dataWeight(), 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("{ ipAddress := "); single_value->field_ipAddress.log_match(match_value.ipAddress(), legacy); TTCN_Logger::log_event_str(", uDP_Port := "); single_value->field_uDP__Port.log_match(match_value.uDP__Port(), legacy); TTCN_Logger::log_event_str(", signallingWeight := "); single_value->field_signallingWeight.log_match(match_value.signallingWeight(), legacy); TTCN_Logger::log_event_str(", dataWeight := "); single_value->field_dataWeight.log_match(match_value.dataWeight(), 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 IP4__Element_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_ipAddress.encode_text(text_buf); single_value->field_uDP__Port.encode_text(text_buf); single_value->field_signallingWeight.encode_text(text_buf); single_value->field_dataWeight.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 @NS_Types.IP4_Element."); } } void IP4__Element_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_ipAddress.decode_text(text_buf); single_value->field_uDP__Port.decode_text(text_buf); single_value->field_signallingWeight.decode_text(text_buf); single_value->field_dataWeight.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 IP4__Element_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 @NS_Types.IP4_Element."); } } void IP4__Element_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: { IP4__Element_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) ipAddress().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) uDP__Port().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) signallingWeight().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) dataWeight().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(), "ipAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uDP_Port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uDP__Port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "signallingWeight")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { signallingWeight().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "dataWeight")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { dataWeight().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.IP4_Element: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { IP4__Element_template* precondition = new IP4__Element_template; precondition->set_param(*param.get_elem(0)); IP4__Element_template* implied_template = new IP4__Element_template; implied_template->set_param(*param.get_elem(1)); *this = IP4__Element_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.IP4_Element"); } is_ifpresent = param.get_ifpresent(); } void IP4__Element_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_ipAddress.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP4_Element"); single_value->field_uDP__Port.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP4_Element"); single_value->field_signallingWeight.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP4_Element"); single_value->field_dataWeight.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP4_Element"); 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 : "@NS_Types.IP4_Element"); } boolean IP4__Element_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IP4__Element_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) iP4__Elements().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iP4_Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iP4__Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.ListofIP4Elements: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.ListofIP4Elements"); } } void ListofIP4Elements::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_ext.encode_text(text_buf); field_lengthIndicator.encode_text(text_buf); field_iP4__Elements.encode_text(text_buf); } void ListofIP4Elements::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_ext.decode_text(text_buf); field_lengthIndicator.decode_text(text_buf); field_iP4__Elements.decode_text(text_buf); } void ListofIP4Elements::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 ListofIP4Elements::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 ListofIP4Elements::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; int selected_field = -1; if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord; else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB; else local_top_order=ORDER_LSB; int value_of_length_field2 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, ListofIP4Elements_ext_descr_.raw->forceomit); decoded_field_length = field_ext.RAW_decode(ListofIP4Elements_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_ext == bs_0) selected_field = 0; else if (field_ext == bs_1) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_2_force_omit(2, force_omit, ListofIP4Elements_lengthIndicator_descr_.raw->forceomit); decoded_field_length = field_lengthIndicator.RAW_decode(ListofIP4Elements_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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()); switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: { INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN1__2_length1_descr_); field_lengthIndicator.length1() = tmp1; value_of_length_field2 += tmp1.get_long_long_val() * 8; break; } case LIN1__2::ALT_length2: { INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN1__2_length2_descr_); field_lengthIndicator.length2() = tmp2; value_of_length_field2 += tmp2.get_long_long_val() * 8; break; } default: value_of_length_field2 = 0; } RAW_Force_Omit field_3_force_omit(3, force_omit, IP4__Elements_descr_.raw->forceomit); decoded_field_length = field_iP4__Elements.RAW_decode(IP4__Elements_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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()); value_of_length_field2 -= decoded_field_length; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ListofIP4Elements::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, ListofIP4Elements_ext_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, ListofIP4Elements_lengthIndicator_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, IP4__Elements_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_ext.RAW_encode(ListofIP4Elements_ext_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_lengthIndicator.RAW_encode(ListofIP4Elements_lengthIndicator_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_iP4__Elements.RAW_encode(IP4__Elements_descr_, *myleaf.body.node.nodes[3]); { int sel_field = 0; while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; } const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr; int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length; delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field]; myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos; } switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: if (field_ext != bs_0) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_0.RAW_encode(ListofIP4Elements_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; case LIN1__2::ALT_length2: if (field_ext != bs_1) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_1.RAW_encode(ListofIP4Elements_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; default:; } return myleaf.length = encoded_length; } struct ListofIP4Elements_template::single_value_struct { OCTETSTRING_template field_iEI; BITSTRING_template field_ext; LIN1__2_template field_lengthIndicator; IP4__Elements_template field_iP4__Elements; }; void ListofIP4Elements_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_iEI = ANY_VALUE; single_value->field_ext = ANY_VALUE; single_value->field_lengthIndicator = ANY_VALUE; single_value->field_iP4__Elements = ANY_VALUE; } } } void ListofIP4Elements_template::copy_value(const ListofIP4Elements& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.ext().is_bound()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (other_value.lengthIndicator().is_bound()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (other_value.iP4__Elements().is_bound()) { single_value->field_iP4__Elements = other_value.iP4__Elements(); } else { single_value->field_iP4__Elements.clean_up(); } set_selection(SPECIFIC_VALUE); } void ListofIP4Elements_template::copy_template(const ListofIP4Elements_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.iP4__Elements().get_selection()) { single_value->field_iP4__Elements = other_value.iP4__Elements(); } else { single_value->field_iP4__Elements.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 ListofIP4Elements_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 ListofIP4Elements_template(*other_value.implication_.precondition); implication_.implied_template = new ListofIP4Elements_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 @NS_Types.ListofIP4Elements."); break; } set_selection(other_value); } ListofIP4Elements_template::ListofIP4Elements_template() { } ListofIP4Elements_template::ListofIP4Elements_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ListofIP4Elements_template::ListofIP4Elements_template(const ListofIP4Elements& other_value) { copy_value(other_value); } ListofIP4Elements_template::ListofIP4Elements_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ListofIP4Elements&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.ListofIP4Elements from an unbound optional field."); } } ListofIP4Elements_template::ListofIP4Elements_template(ListofIP4Elements_template* p_precondition, ListofIP4Elements_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ListofIP4Elements_template::ListofIP4Elements_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; } ListofIP4Elements_template::ListofIP4Elements_template(const ListofIP4Elements_template& other_value) : Base_Template() { copy_template(other_value); } ListofIP4Elements_template::~ListofIP4Elements_template() { clean_up(); } ListofIP4Elements_template& ListofIP4Elements_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ListofIP4Elements_template& ListofIP4Elements_template::operator=(const ListofIP4Elements& other_value) { clean_up(); copy_value(other_value); return *this; } ListofIP4Elements_template& ListofIP4Elements_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ListofIP4Elements&)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 @NS_Types.ListofIP4Elements."); } return *this; } ListofIP4Elements_template& ListofIP4Elements_template::operator=(const ListofIP4Elements_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ListofIP4Elements_template::match(const ListofIP4Elements& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.ext().is_bound()) return FALSE; if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE; if(!other_value.lengthIndicator().is_bound()) return FALSE; if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE; if(!other_value.iP4__Elements().is_bound()) return FALSE; if(!single_value->field_iP4__Elements.match(other_value.iP4__Elements(), 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 @NS_Types.ListofIP4Elements."); } return FALSE; } boolean ListofIP4Elements_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_ext.is_bound() || single_value->field_lengthIndicator.is_bound() || single_value->field_iP4__Elements.is_bound(); } boolean ListofIP4Elements_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_ext.is_value() && single_value->field_lengthIndicator.is_value() && single_value->field_iP4__Elements.is_value(); } void ListofIP4Elements_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; } ListofIP4Elements ListofIP4Elements_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 @NS_Types.ListofIP4Elements."); ListofIP4Elements ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_ext.is_bound()) { ret_val.ext() = single_value->field_ext.valueof(); } if (single_value->field_lengthIndicator.is_bound()) { ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof(); } if (single_value->field_iP4__Elements.is_bound()) { ret_val.iP4__Elements() = single_value->field_iP4__Elements.valueof(); } return ret_val; } void ListofIP4Elements_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 @NS_Types.ListofIP4Elements."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ListofIP4Elements_template[list_length]; } ListofIP4Elements_template& ListofIP4Elements_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 @NS_Types.ListofIP4Elements."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.ListofIP4Elements."); return value_list.list_value[list_index]; } OCTETSTRING_template& ListofIP4Elements_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& ListofIP4Elements_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.ListofIP4Elements."); return single_value->field_iEI; } BITSTRING_template& ListofIP4Elements_template::ext() { set_specific(); return single_value->field_ext; } const BITSTRING_template& ListofIP4Elements_template::ext() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ext of a non-specific template of type @NS_Types.ListofIP4Elements."); return single_value->field_ext; } LIN1__2_template& ListofIP4Elements_template::lengthIndicator() { set_specific(); return single_value->field_lengthIndicator; } const LIN1__2_template& ListofIP4Elements_template::lengthIndicator() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthIndicator of a non-specific template of type @NS_Types.ListofIP4Elements."); return single_value->field_lengthIndicator; } IP4__Elements_template& ListofIP4Elements_template::iP4__Elements() { set_specific(); return single_value->field_iP4__Elements; } const IP4__Elements_template& ListofIP4Elements_template::iP4__Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iP4_Elements of a non-specific template of type @NS_Types.ListofIP4Elements."); return single_value->field_iP4__Elements; } int ListofIP4Elements_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP4Elements 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 @NS_Types.ListofIP4Elements 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 @NS_Types.ListofIP4Elements containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP4Elements containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP4Elements containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP4Elements containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP4Elements containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP4Elements containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP4Elements containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.ListofIP4Elements."); } return 0; } void ListofIP4Elements_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log(); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log(); TTCN_Logger::log_event_str(", iP4_Elements := "); single_value->field_iP4__Elements.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 ListofIP4Elements_template::log_match(const ListofIP4Elements& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ext.match(match_value.ext(), legacy)){ TTCN_Logger::log_logmatch_info(".ext"); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthIndicator"); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_iP4__Elements.match(match_value.iP4__Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".iP4_Elements"); single_value->field_iP4__Elements.log_match(match_value.iP4__Elements(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::log_event_str(", iP4_Elements := "); single_value->field_iP4__Elements.log_match(match_value.iP4__Elements(), 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 ListofIP4Elements_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_ext.encode_text(text_buf); single_value->field_lengthIndicator.encode_text(text_buf); single_value->field_iP4__Elements.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 @NS_Types.ListofIP4Elements."); } } void ListofIP4Elements_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_iEI.decode_text(text_buf); single_value->field_ext.decode_text(text_buf); single_value->field_lengthIndicator.decode_text(text_buf); single_value->field_iP4__Elements.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 ListofIP4Elements_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 @NS_Types.ListofIP4Elements."); } } void ListofIP4Elements_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: { ListofIP4Elements_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) iP4__Elements().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iP4_Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iP4__Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.ListofIP4Elements: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ListofIP4Elements_template* precondition = new ListofIP4Elements_template; precondition->set_param(*param.get_elem(0)); ListofIP4Elements_template* implied_template = new ListofIP4Elements_template; implied_template->set_param(*param.get_elem(1)); *this = ListofIP4Elements_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.ListofIP4Elements"); } is_ifpresent = param.get_ifpresent(); } void ListofIP4Elements_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.ListofIP4Elements"); single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@NS_Types.ListofIP4Elements"); single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@NS_Types.ListofIP4Elements"); single_value->field_iP4__Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.ListofIP4Elements"); 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 : "@NS_Types.ListofIP4Elements"); } boolean ListofIP4Elements_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ListofIP4Elements_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idxref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } IP6__Elements::IP6__Elements(const IP6__Elements& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.IP6_Elements."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } IP6__Elements::~IP6__Elements() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void IP6__Elements::clean_up() { if (val_ptr != NULL) { if (val_ptr->ref_count > 1) { val_ptr->ref_count--; val_ptr = NULL; } else if (val_ptr->ref_count == 1) { for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) if (val_ptr->value_elements[elem_count] != NULL) delete val_ptr->value_elements[elem_count]; free_pointers((void**)val_ptr->value_elements); delete val_ptr; val_ptr = NULL; } else TTCN_error("Internal error: Invalid reference counter in a record of/set of value."); } } IP6__Elements& IP6__Elements::operator=(null_type) { clean_up(); val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; return *this; } IP6__Elements& IP6__Elements::operator=(const IP6__Elements& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @NS_Types.IP6_Elements."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean IP6__Elements::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @NS_Types.IP6_Elements."); return val_ptr->n_elements == 0 ; } boolean IP6__Elements::operator==(const IP6__Elements& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @NS_Types.IP6_Elements."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @NS_Types.IP6_Elements."); if (val_ptr == other_value.val_ptr) return TRUE; if (val_ptr->n_elements != (other_value.val_ptr)->n_elements) return FALSE; for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){ if (val_ptr->value_elements[elem_count] != NULL){ if ((other_value.val_ptr)->value_elements[elem_count] != NULL){ if (*val_ptr->value_elements[elem_count] != *(other_value.val_ptr)->value_elements[elem_count]) return FALSE; } else return FALSE; } else { if ((other_value.val_ptr)->value_elements[elem_count] != NULL) return FALSE; } } return TRUE; } IP6__Element& IP6__Elements::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @NS_Types.IP6_Elements using a negative index: %d.", index_value); if (val_ptr == NULL) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } else if (val_ptr->ref_count > 1) { struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct; new_val_ptr->ref_count = 1; new_val_ptr->n_elements = (index_value >= val_ptr->n_elements) ? index_value + 1 : val_ptr->n_elements; new_val_ptr->value_elements = (IP6__Element**)allocate_pointers(new_val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++){ if (val_ptr->value_elements[elem_count] != NULL){ new_val_ptr->value_elements[elem_count] = new IP6__Element(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (index_value >= val_ptr->n_elements) set_size(index_value + 1); if (val_ptr->value_elements[index_value] == NULL) { val_ptr->value_elements[index_value] = new IP6__Element; } return *val_ptr->value_elements[index_value]; } IP6__Element& IP6__Elements::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @NS_Types.IP6_Elements."); return (*this)[(int)index_value]; } const IP6__Element& IP6__Elements::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @NS_Types.IP6_Elements."); if (index_value < 0) TTCN_error("Accessing an element of type @NS_Types.IP6_Elements using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @NS_Types.IP6_Elements: The index is %d, but the value has only %d elements.", index_value, val_ptr->n_elements); return (val_ptr->value_elements[index_value] == NULL) ? UNBOUND_ELEM : *val_ptr->value_elements[index_value]; } const IP6__Element& IP6__Elements::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @NS_Types.IP6_Elements."); return (*this)[(int)index_value]; } IP6__Elements IP6__Elements::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } IP6__Elements IP6__Elements::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } IP6__Elements IP6__Elements::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } IP6__Elements IP6__Elements::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @NS_Types.IP6_Elements."); if (val_ptr->n_elements == 0) return *this; int rc; if (rotate_count>=0) rc = rotate_count % val_ptr->n_elements; else rc = val_ptr->n_elements - ((-rotate_count) % val_ptr->n_elements); if (rc == 0) return *this; IP6__Elements ret_val; ret_val.set_size(val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[(i+rc)%val_ptr->n_elements] =new IP6__Element(*val_ptr->value_elements[i]); } } return ret_val; } IP6__Elements IP6__Elements::operator+(const IP6__Elements& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @NS_Types.IP6_Elements concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; IP6__Elements ret_val; ret_val.set_size(val_ptr->n_elements+other_value.val_ptr->n_elements); for (int i=0; in_elements; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i] = new IP6__Element(*val_ptr->value_elements[i]); } } for (int i=0; in_elements; i++) { if (other_value.val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i+val_ptr->n_elements] = new IP6__Element(*other_value.val_ptr->value_elements[i]); } } return ret_val; } IP6__Elements IP6__Elements::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @NS_Types.IP6_Elements."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@NS_Types.IP6_Elements","element"); IP6__Elements ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new IP6__Element(*val_ptr->value_elements[i+index]); } } return ret_val; } IP6__Elements IP6__Elements::replace(int index, int len, const IP6__Elements& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @NS_Types.IP6_Elements."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @NS_Types.IP6_Elements."); check_replace_arguments(val_ptr->n_elements, index, len, "@NS_Types.IP6_Elements","element"); IP6__Elements ret_val; ret_val.set_size(val_ptr->n_elements + repl.val_ptr->n_elements - len); for (int i = 0; i < index; i++) { if (val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i] = new IP6__Element(*val_ptr->value_elements[i]); } } for (int i = 0; i < repl.val_ptr->n_elements; i++) { if (repl.val_ptr->value_elements[i] != NULL) { ret_val.val_ptr->value_elements[i+index] = new IP6__Element(*repl.val_ptr->value_elements[i]); } } for (int i = 0; i < val_ptr->n_elements - index - len; i++) { if (val_ptr->value_elements[index+i+len] != NULL) { ret_val.val_ptr->value_elements[index+i+repl.val_ptr->n_elements] = new IP6__Element(*val_ptr->value_elements[index+i+len]); } } return ret_val; } IP6__Elements IP6__Elements::replace(int index, int len, const IP6__Elements_template& repl) const { if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value."); return replace(index, len, repl.valueof()); } void IP6__Elements::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @NS_Types.IP6_Elements."); if (val_ptr == NULL) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } else if (val_ptr->ref_count > 1) { struct recordof_setof_struct *new_val_ptr = new recordof_setof_struct; new_val_ptr->ref_count = 1; new_val_ptr->n_elements = (new_size < val_ptr->n_elements) ? new_size : val_ptr->n_elements; new_val_ptr->value_elements = (IP6__Element**)allocate_pointers(new_val_ptr->n_elements); for (int elem_count = 0; elem_count < new_val_ptr->n_elements; elem_count++) { if (val_ptr->value_elements[elem_count] != NULL){ new_val_ptr->value_elements[elem_count] = new IP6__Element(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (IP6__Element**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); #ifdef TITAN_MEMORY_DEBUG_SET_RECORD_OF if((val_ptr->n_elements/1000)!=(new_size/1000)) TTCN_warning("New size of type @NS_Types.IP6_Elements: %d",new_size); #endif val_ptr->n_elements = new_size; } else if (new_size < val_ptr->n_elements) { for (int elem_count = new_size; elem_count < val_ptr->n_elements; elem_count++) if (val_ptr->value_elements[elem_count] != NULL)delete val_ptr->value_elements[elem_count]; val_ptr->value_elements = (IP6__Element**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean IP6__Elements::is_value() const { if (val_ptr == NULL) return FALSE; for(int i = 0; i < val_ptr->n_elements; ++i) { if (val_ptr->value_elements[i] == NULL || !val_ptr->value_elements[i]->is_value()) return FALSE; } return TRUE; } int IP6__Elements::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @NS_Types.IP6_Elements."); return val_ptr->n_elements; } int IP6__Elements::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @NS_Types.IP6_Elements."); for (int my_length=val_ptr->n_elements; my_length>0; my_length--) if (val_ptr->value_elements[my_length-1] != NULL) return my_length; return 0; } void IP6__Elements::log() const { if (val_ptr == NULL) {; TTCN_Logger::log_event_unbound(); return; } switch (val_ptr->n_elements) { case 0: TTCN_Logger::log_event_str("{ }"); break; default: TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); (*this)[elem_count].log(); } TTCN_Logger::log_event_str(" }"); } } void IP6__Elements::set_implicit_omit() { if (val_ptr == NULL) return; for (int i = 0; i < val_ptr->n_elements; i++) { if (val_ptr->value_elements[i] != NULL) val_ptr->value_elements[i]->set_implicit_omit(); } } void IP6__Elements::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "record of value"); switch (param.get_operation_type()) { case Module_Param::OT_ASSIGN: if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) { *this = NULL_VALUE; return; } switch (param.get_type()) { case Module_Param::MP_Value_List: set_size(param.get_size()); for (size_t i=0; iget_type()!=Module_Param::MP_NotUsed) { (*this)[i].set_param(*curr); if (!(*this)[i].is_bound()) { delete val_ptr->value_elements[i]; val_ptr->value_elements[i] = NULL; } } } break; case Module_Param::MP_Indexed_List: for (size_t i=0; iget_id()->get_index()].set_param(*curr); if (!(*this)[curr->get_id()->get_index()].is_bound()) { delete val_ptr->value_elements[curr->get_id()->get_index()]; val_ptr->value_elements[curr->get_id()->get_index()] = NULL; } } break; default: param.type_error("record of value", "@NS_Types.IP6_Elements"); } break; case Module_Param::OT_CONCAT: switch (param.get_type()) { case Module_Param::MP_Value_List: { if (!is_bound()) *this = NULL_VALUE; int start_idx = lengthof(); for (size_t i=0; iget_type()!=Module_Param::MP_NotUsed)) { (*this)[start_idx+(int)i].set_param(*curr); } } } break; case Module_Param::MP_Indexed_List: param.error("Cannot concatenate an indexed value list"); break; default: param.type_error("record of value", "@NS_Types.IP6_Elements"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void IP6__Elements::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @NS_Types.IP6_Elements."); text_buf.push_int(val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) (*this)[elem_count].encode_text(text_buf); } void IP6__Elements::decode_text(Text_Buf& text_buf) { clean_up(); val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = text_buf.pull_int().get_val(); if (val_ptr->n_elements < 0) TTCN_error("Text decoder: Negative size was received for a value of type @NS_Types.IP6_Elements."); val_ptr->value_elements = (IP6__Element**)allocate_pointers(val_ptr->n_elements); for (int elem_count = 0; elem_count < val_ptr->n_elements; elem_count++) { val_ptr->value_elements[elem_count] = new IP6__Element; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void IP6__Elements::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 IP6__Elements::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 IP6__Elements::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean /*no_err*/, int sel_field, boolean first_call, const RAW_Force_Omit*){ int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; int decoded_length=0; int decoded_field_length=0; size_t start_of_field=0; if(first_call) { clean_up(); val_ptr=new recordof_setof_struct; val_ptr->ref_count=1; val_ptr->n_elements=0; val_ptr->value_elements=NULL; } int start_field=val_ptr->n_elements; if(p_td.raw->fieldlength || sel_field!=-1){ int a=0; if(sel_field==-1) sel_field=p_td.raw->fieldlength; start_of_field=p_buf.get_pos_bit(); for(a=0;a=0){ delete &(*this)[a+start_field]; a--; val_ptr->n_elements--; } p_buf.set_pos_bit(start_of_field); return decoded_field_length; } decoded_length+=decoded_field_length; limit-=decoded_field_length; } if(a==0) val_ptr->n_elements=0; } else { if(limit==0){ if(!first_call) return -1; val_ptr->n_elements=0; return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength; } int a=start_field; while(limit>0){ start_of_field=p_buf.get_pos_bit(); decoded_field_length=(*this)[a].RAW_decode(*p_td.oftype_descr,p_buf,limit,top_bit_ord,TRUE); if(decoded_field_length < 0){ delete &(*this)[a]; val_ptr->n_elements--; p_buf.set_pos_bit(start_of_field); if(a>start_field){ return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength; } else return -1; } decoded_length+=decoded_field_length; limit-=decoded_field_length; a++; } } return decoded_length+p_buf.increase_pos_padd(p_td.raw->padding)+prepaddlength; } int IP6__Elements::RAW_encode(const TTCN_Typedescriptor_t& p_td,RAW_enc_tree& myleaf) const{ int encoded_length=0; int encoded_num_of_records=p_td.raw->fieldlength?smaller(val_ptr->n_elements, p_td.raw->fieldlength):val_ptr->n_elements; myleaf.isleaf=FALSE; myleaf.rec_of=TRUE; myleaf.body.node.num_of_nodes=encoded_num_of_records; myleaf.body.node.nodes=init_nodes_of_enc_tree(encoded_num_of_records); for(int a=0;araw); encoded_length+=(*this)[a].RAW_encode(*p_td.oftype_descr,*myleaf.body.node.nodes[a]); } return myleaf.length=encoded_length; } void IP6__Elements_template::copy_value(const IP6__Elements& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @NS_Types.IP6_Elements with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (IP6__Element_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (other_value[elem_count].is_bound()) { single_value.value_elements[elem_count] = new IP6__Element_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new IP6__Element_template; } } set_selection(SPECIFIC_VALUE); } void IP6__Elements_template::copy_template(const IP6__Elements_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value.n_elements = other_value.single_value.n_elements; single_value.value_elements = (IP6__Element_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (UNINITIALIZED_TEMPLATE != other_value.single_value.value_elements[elem_count]->get_selection()) { single_value.value_elements[elem_count] = new IP6__Element_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new IP6__Element_template; } } case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new IP6__Elements_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 IP6__Elements_template(*other_value.implication_.precondition); implication_.implied_template = new IP6__Elements_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 @NS_Types.IP6_Elements."); break; } set_selection(other_value); } boolean IP6__Elements_template::match_function_specific(const Base_Type *value_ptr, int value_index, const Restricted_Length_Template *template_ptr, int template_index, boolean legacy) { if (value_index >= 0) return ((const IP6__Elements_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const IP6__Elements*)value_ptr)[value_index], legacy); else return ((const IP6__Elements_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } IP6__Elements_template::IP6__Elements_template() { } IP6__Elements_template::IP6__Elements_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } IP6__Elements_template::IP6__Elements_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } IP6__Elements_template::IP6__Elements_template(const IP6__Elements& other_value) { copy_value(other_value); } IP6__Elements_template::IP6__Elements_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP6__Elements&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.IP6_Elements from an unbound optional field."); } } IP6__Elements_template::IP6__Elements_template(IP6__Elements_template* p_precondition, IP6__Elements_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IP6__Elements_template::IP6__Elements_template(Dynamic_Match_Interface* p_dyn_match) : Base_Record_Of_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } IP6__Elements_template::IP6__Elements_template(const IP6__Elements_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } IP6__Elements_template::~IP6__Elements_template() { clean_up(); } void IP6__Elements_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) delete single_value.value_elements[elem_count]; free_pointers((void**)single_value.value_elements); break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } IP6__Elements_template& IP6__Elements_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IP6__Elements_template& IP6__Elements_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } IP6__Elements_template& IP6__Elements_template::operator=(const IP6__Elements& other_value) { clean_up(); copy_value(other_value); return *this; } IP6__Elements_template& IP6__Elements_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP6__Elements&)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 @NS_Types.IP6_Elements."); } return *this; } IP6__Elements_template& IP6__Elements_template::operator=(const IP6__Elements_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } IP6__Element_template& IP6__Elements_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Types.IP6_Elements using a negative index: %d.", index_value); switch (template_selection) { case SPECIFIC_VALUE: if(index_value < single_value.n_elements) break; // no break case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: case UNINITIALIZED_TEMPLATE: set_size(index_value + 1); break; default: TTCN_error("Accessing an element of a non-specific template for type @NS_Types.IP6_Elements."); break; } return *single_value.value_elements[index_value]; } IP6__Element_template& IP6__Elements_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @NS_Types.IP6_Elements."); return (*this)[(int)index_value]; } const IP6__Element_template& IP6__Elements_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @NS_Types.IP6_Elements using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @NS_Types.IP6_Elements."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @NS_Types.IP6_Elements: The index is %d, but the template has only %d elements.", index_value, single_value.n_elements); return *single_value.value_elements[index_value]; } const IP6__Element_template& IP6__Elements_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @NS_Types.IP6_Elements."); return (*this)[(int)index_value]; } void IP6__Elements_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @NS_Types.IP6_Elements."); template_sel old_selection = template_selection; if (old_selection != SPECIFIC_VALUE) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; } if (new_size > single_value.n_elements) { single_value.value_elements = (IP6__Element_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++) single_value.value_elements[elem_count] = new IP6__Element_template(ANY_VALUE); } else { for (int elem_count = single_value.n_elements; elem_count < new_size; elem_count++) single_value.value_elements[elem_count] = new IP6__Element_template; } single_value.n_elements = new_size; } else if (new_size < single_value.n_elements) { for (int elem_count = new_size; elem_count < single_value.n_elements; elem_count++) delete single_value.value_elements[elem_count]; single_value.value_elements = (IP6__Element_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int IP6__Elements_template::n_elem() const { switch (template_selection) { case SPECIFIC_VALUE: return single_value.n_elements; break; case VALUE_LIST: return value_list.n_values; break; default: TTCN_error("Performing n_elem"); } } int IP6__Elements_template::size_of(boolean is_size) const { const char* op_name = is_size ? "size" : "length"; int min_size; boolean has_any_or_none; if (is_ifpresent) TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP6_Elements which has an ifpresent attribute.", op_name); switch (template_selection) { case SPECIFIC_VALUE: { min_size = 0; has_any_or_none = FALSE; int elem_count = single_value.n_elements; if (!is_size) { while (elem_count>0 && !single_value.value_elements[elem_count-1]->is_bound()) elem_count--; } for (int i=0; iget_selection()) { case OMIT_VALUE: TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP6_Elements containing omit element.", op_name); case ANY_OR_OMIT: has_any_or_none = TRUE; break; default: min_size++; break; } } } break; case OMIT_VALUE: TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP6_Elements containing omit value.", op_name); case ANY_VALUE: case ANY_OR_OMIT: min_size = 0; has_any_or_none = TRUE; break; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP6_Elements containing an empty list.", op_name); int item_size = value_list.list_value[0].size_of(is_size); for (unsigned int i = 1; i < value_list.n_values; i++) { if (value_list.list_value[i].size_of(is_size)!=item_size) TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP6_Elements containing a value list with different sizes.", op_name); } min_size = item_size; has_any_or_none = FALSE; break; } case COMPLEMENTED_LIST: TTCN_error("Performing %sof() operation on a template of type @NS_Types.IP6_Elements containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @NS_Types.IP6_Elements.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @NS_Types.IP6_Elements"); } boolean IP6__Elements_template::match(const IP6__Elements& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; int value_length = other_value.size_of(); if (!match_length(value_length)) return FALSE; switch (template_selection) { case SPECIFIC_VALUE: return match_record_of(&other_value, value_length, this, single_value.n_elements, match_function_specific, legacy); case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching with an uninitialized/unsupported template of type @NS_Types.IP6_Elements."); } return FALSE; } boolean IP6__Elements_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) if (!single_value.value_elements[elem_count]->is_value()) return FALSE; return TRUE; } IP6__Elements IP6__Elements_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 @NS_Types.IP6_Elements."); IP6__Elements ret_val; ret_val.set_size(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) if (single_value.value_elements[elem_count]->is_bound()) { ret_val[elem_count] = single_value.value_elements[elem_count]->valueof(); } return ret_val; } IP6__Elements IP6__Elements_template::substr(int index, int returncount) const { if (!is_value()) TTCN_error("The first argument of function substr() is a template with non-specific value."); return valueof().substr(index, returncount); } IP6__Elements IP6__Elements_template::replace(int index, int len, const IP6__Elements_template& repl) const { if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value."); if (!repl.is_value()) TTCN_error("The fourth argument of function replace() is a template with non-specific value."); return valueof().replace(index, len, repl.valueof()); } IP6__Elements IP6__Elements_template::replace(int index, int len, const IP6__Elements& repl) const { if (!is_value()) TTCN_error("The first argument of function replace() is a template with non-specific value."); return valueof().replace(index, len, repl); } void IP6__Elements_template::set_type(template_sel template_type, unsigned int list_length) { clean_up(); switch (template_type) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = list_length; value_list.list_value = new IP6__Elements_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @NS_Types.IP6_Elements."); } set_selection(template_type); } IP6__Elements_template& IP6__Elements_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Internal error: Accessing a list element of a non-list template of type @NS_Types.IP6_Elements."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @NS_Types.IP6_Elements."); return value_list.list_value[list_index]; } void IP6__Elements_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: if (single_value.n_elements > 0) { TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); if (permutation_starts_at(elem_count)) TTCN_Logger::log_event_str("permutation("); single_value.value_elements[elem_count]->log(); if (permutation_ends_at(elem_count)) TTCN_Logger::log_char(')'); } TTCN_Logger::log_event_str(" }"); } else TTCN_Logger::log_event_str("{ }"); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) { if (list_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[list_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_restricted(); log_ifpresent(); } void IP6__Elements_template::log_match(const IP6__Elements& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); }else{ if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if(!single_value.value_elements[elem_count]->match(match_value[elem_count], legacy)){ TTCN_Logger::log_logmatch_info("[%d]", elem_count); single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } log_match_length(single_value.n_elements); } else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE && single_value.n_elements > 0 && get_number_of_permutations() == 0 && single_value.n_elements == match_value.size_of()) { TTCN_Logger::log_event_str("{ "); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); single_value.value_elements[elem_count]->log_match(match_value[elem_count], legacy); } TTCN_Logger::log_event_str(" }"); log_match_length(single_value.n_elements); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void IP6__Elements_template::encode_text(Text_Buf& text_buf) const { encode_text_permutation(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) single_value.value_elements[elem_count]->encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @NS_Types.IP6_Elements."); } } void IP6__Elements_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_permutation(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value.n_elements = text_buf.pull_int().get_val(); if (single_value.n_elements < 0) TTCN_error("Text decoder: Negative size was received for a template of type @NS_Types.IP6_Elements."); single_value.value_elements = (IP6__Element_template**)allocate_pointers(single_value.n_elements); for (int elem_count = 0; elem_count < single_value.n_elements; elem_count++) { single_value.value_elements[elem_count] = new IP6__Element_template; single_value.value_elements[elem_count]->decode_text(text_buf); } case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new IP6__Elements_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of type @NS_Types.IP6_Elements."); } } boolean IP6__Elements_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IP6__Elements_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_id()->get_index())].set_param(*param.get_elem(p_i)); } break; case Module_Param::MP_Value_List: { set_size(param.get_size()); int curr_idx = 0; for (size_t p_i=0; p_iget_type()) { case Module_Param::MP_NotUsed: curr_idx++; break; case Module_Param::MP_Permutation_Template: { int perm_start_idx = curr_idx; Module_Param* param_i = param.get_elem(p_i); for (size_t perm_i=0; perm_iget_size(); perm_i++) { (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i))); curr_idx++; } int perm_end_idx = curr_idx - 1; add_permutation(perm_start_idx, perm_end_idx); } break; default: (*this)[curr_idx].set_param(*param.get_elem(p_i)); curr_idx++; } } } break; case Module_Param::MP_Implication_Template: { IP6__Elements_template* precondition = new IP6__Elements_template; precondition->set_param(*param.get_elem(0)); IP6__Elements_template* implied_template = new IP6__Elements_template; implied_template->set_param(*param.get_elem(1)); *this = IP6__Elements_template(precondition, implied_template); } break; default: param.type_error("record of template", "@NS_Types.IP6_Elements"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void IP6__Elements_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; for (int i=0; icheck_restriction(t_res, t_name ? t_name : "@NS_Types.IP6_Elements"); 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 : "@NS_Types.IP6_Elements"); } boolean IP6__Elements_template::get_istemplate_kind(const char* type) const { if (!strcmp(type, "AnyElement")) { if (template_selection != SPECIFIC_VALUE) { return FALSE; } for (int i = 0; i < single_value.n_elements; i++) { if (single_value.value_elements[i]->get_selection() == ANY_VALUE) { return TRUE; } } return FALSE; } else if (!strcmp(type, "AnyElementsOrNone")) { if (template_selection != SPECIFIC_VALUE) { return FALSE; } for (int i = 0; i < single_value.n_elements; i++) { if (single_value.value_elements[i]->get_selection() == ANY_OR_OMIT) { return TRUE; } } return FALSE; } else if (!strcmp(type, "permutation")) { return number_of_permutations; } else if (!strcmp(type, "length")) { return length_restriction_type != NO_LENGTH_RESTRICTION; } else { return Base_Template::get_istemplate_kind(type); } } IP6__Element::IP6__Element() { } IP6__Element::IP6__Element(const OCTETSTRING& par_ipAddress, const OCTETSTRING& par_uDP__Port, const OCTETSTRING& par_signallingWeight, const OCTETSTRING& par_dataWeight) : field_ipAddress(par_ipAddress), field_uDP__Port(par_uDP__Port), field_signallingWeight(par_signallingWeight), field_dataWeight(par_dataWeight) { } IP6__Element::IP6__Element(const IP6__Element& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.IP6_Element."); if (other_value.ipAddress().is_bound()) field_ipAddress = other_value.ipAddress(); else field_ipAddress.clean_up(); if (other_value.uDP__Port().is_bound()) field_uDP__Port = other_value.uDP__Port(); else field_uDP__Port.clean_up(); if (other_value.signallingWeight().is_bound()) field_signallingWeight = other_value.signallingWeight(); else field_signallingWeight.clean_up(); if (other_value.dataWeight().is_bound()) field_dataWeight = other_value.dataWeight(); else field_dataWeight.clean_up(); } void IP6__Element::clean_up() { field_ipAddress.clean_up(); field_uDP__Port.clean_up(); field_signallingWeight.clean_up(); field_dataWeight.clean_up(); } const TTCN_Typedescriptor_t* IP6__Element::get_descriptor() const { return &IP6__Element_descr_; } IP6__Element& IP6__Element::operator=(const IP6__Element& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.IP6_Element."); if (other_value.ipAddress().is_bound()) field_ipAddress = other_value.ipAddress(); else field_ipAddress.clean_up(); if (other_value.uDP__Port().is_bound()) field_uDP__Port = other_value.uDP__Port(); else field_uDP__Port.clean_up(); if (other_value.signallingWeight().is_bound()) field_signallingWeight = other_value.signallingWeight(); else field_signallingWeight.clean_up(); if (other_value.dataWeight().is_bound()) field_dataWeight = other_value.dataWeight(); else field_dataWeight.clean_up(); } return *this; } boolean IP6__Element::operator==(const IP6__Element& other_value) const { return field_ipAddress==other_value.field_ipAddress && field_uDP__Port==other_value.field_uDP__Port && field_signallingWeight==other_value.field_signallingWeight && field_dataWeight==other_value.field_dataWeight; } boolean IP6__Element::is_bound() const { return (field_ipAddress.is_bound()) || (field_uDP__Port.is_bound()) || (field_signallingWeight.is_bound()) || (field_dataWeight.is_bound()); } boolean IP6__Element::is_value() const { return field_ipAddress.is_value() && field_uDP__Port.is_value() && field_signallingWeight.is_value() && field_dataWeight.is_value(); } void IP6__Element::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ ipAddress := "); field_ipAddress.log(); TTCN_Logger::log_event_str(", uDP_Port := "); field_uDP__Port.log(); TTCN_Logger::log_event_str(", signallingWeight := "); field_signallingWeight.log(); TTCN_Logger::log_event_str(", dataWeight := "); field_dataWeight.log(); TTCN_Logger::log_event_str(" }"); } void IP6__Element::set_implicit_omit() { if (ipAddress().is_bound()) ipAddress().set_implicit_omit(); if (uDP__Port().is_bound()) uDP__Port().set_implicit_omit(); if (signallingWeight().is_bound()) signallingWeight().set_implicit_omit(); if (dataWeight().is_bound()) dataWeight().set_implicit_omit(); } void IP6__Element::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) ipAddress().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) uDP__Port().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) signallingWeight().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) dataWeight().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(), "ipAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uDP_Port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uDP__Port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "signallingWeight")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { signallingWeight().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "dataWeight")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { dataWeight().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.IP6_Element: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.IP6_Element"); } } void IP6__Element::encode_text(Text_Buf& text_buf) const { field_ipAddress.encode_text(text_buf); field_uDP__Port.encode_text(text_buf); field_signallingWeight.encode_text(text_buf); field_dataWeight.encode_text(text_buf); } void IP6__Element::decode_text(Text_Buf& text_buf) { field_ipAddress.decode_text(text_buf); field_uDP__Port.decode_text(text_buf); field_signallingWeight.decode_text(text_buf); field_dataWeight.decode_text(text_buf); } void IP6__Element::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 IP6__Element::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 IP6__Element::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, General__Types::OCT16_descr_.raw->forceomit); decoded_field_length = field_ipAddress.RAW_decode(General__Types::OCT16_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, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_uDP__Port.RAW_decode(General__Types::OCT2_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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_signallingWeight.RAW_decode(General__Types::OCT1_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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_dataWeight.RAW_decode(General__Types::OCT1_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 IP6__Element::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, General__Types::OCT16_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::OCT2_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT1_descr_.raw); encoded_length += field_ipAddress.RAW_encode(General__Types::OCT16_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_uDP__Port.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_signallingWeight.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_dataWeight.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct IP6__Element_template::single_value_struct { OCTETSTRING_template field_ipAddress; OCTETSTRING_template field_uDP__Port; OCTETSTRING_template field_signallingWeight; OCTETSTRING_template field_dataWeight; }; void IP6__Element_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_ipAddress = ANY_VALUE; single_value->field_uDP__Port = ANY_VALUE; single_value->field_signallingWeight = ANY_VALUE; single_value->field_dataWeight = ANY_VALUE; } } } void IP6__Element_template::copy_value(const IP6__Element& other_value) { single_value = new single_value_struct; if (other_value.ipAddress().is_bound()) { single_value->field_ipAddress = other_value.ipAddress(); } else { single_value->field_ipAddress.clean_up(); } if (other_value.uDP__Port().is_bound()) { single_value->field_uDP__Port = other_value.uDP__Port(); } else { single_value->field_uDP__Port.clean_up(); } if (other_value.signallingWeight().is_bound()) { single_value->field_signallingWeight = other_value.signallingWeight(); } else { single_value->field_signallingWeight.clean_up(); } if (other_value.dataWeight().is_bound()) { single_value->field_dataWeight = other_value.dataWeight(); } else { single_value->field_dataWeight.clean_up(); } set_selection(SPECIFIC_VALUE); } void IP6__Element_template::copy_template(const IP6__Element_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.ipAddress().get_selection()) { single_value->field_ipAddress = other_value.ipAddress(); } else { single_value->field_ipAddress.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.uDP__Port().get_selection()) { single_value->field_uDP__Port = other_value.uDP__Port(); } else { single_value->field_uDP__Port.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.signallingWeight().get_selection()) { single_value->field_signallingWeight = other_value.signallingWeight(); } else { single_value->field_signallingWeight.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.dataWeight().get_selection()) { single_value->field_dataWeight = other_value.dataWeight(); } else { single_value->field_dataWeight.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 IP6__Element_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 IP6__Element_template(*other_value.implication_.precondition); implication_.implied_template = new IP6__Element_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 @NS_Types.IP6_Element."); break; } set_selection(other_value); } IP6__Element_template::IP6__Element_template() { } IP6__Element_template::IP6__Element_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IP6__Element_template::IP6__Element_template(const IP6__Element& other_value) { copy_value(other_value); } IP6__Element_template::IP6__Element_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP6__Element&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.IP6_Element from an unbound optional field."); } } IP6__Element_template::IP6__Element_template(IP6__Element_template* p_precondition, IP6__Element_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IP6__Element_template::IP6__Element_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; } IP6__Element_template::IP6__Element_template(const IP6__Element_template& other_value) : Base_Template() { copy_template(other_value); } IP6__Element_template::~IP6__Element_template() { clean_up(); } IP6__Element_template& IP6__Element_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IP6__Element_template& IP6__Element_template::operator=(const IP6__Element& other_value) { clean_up(); copy_value(other_value); return *this; } IP6__Element_template& IP6__Element_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP6__Element&)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 @NS_Types.IP6_Element."); } return *this; } IP6__Element_template& IP6__Element_template::operator=(const IP6__Element_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IP6__Element_template::match(const IP6__Element& 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.ipAddress().is_bound()) return FALSE; if(!single_value->field_ipAddress.match(other_value.ipAddress(), legacy))return FALSE; if(!other_value.uDP__Port().is_bound()) return FALSE; if(!single_value->field_uDP__Port.match(other_value.uDP__Port(), legacy))return FALSE; if(!other_value.signallingWeight().is_bound()) return FALSE; if(!single_value->field_signallingWeight.match(other_value.signallingWeight(), legacy))return FALSE; if(!other_value.dataWeight().is_bound()) return FALSE; if(!single_value->field_dataWeight.match(other_value.dataWeight(), 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 @NS_Types.IP6_Element."); } return FALSE; } boolean IP6__Element_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_ipAddress.is_bound() || single_value->field_uDP__Port.is_bound() || single_value->field_signallingWeight.is_bound() || single_value->field_dataWeight.is_bound(); } boolean IP6__Element_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_ipAddress.is_value() && single_value->field_uDP__Port.is_value() && single_value->field_signallingWeight.is_value() && single_value->field_dataWeight.is_value(); } void IP6__Element_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; } IP6__Element IP6__Element_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 @NS_Types.IP6_Element."); IP6__Element ret_val; if (single_value->field_ipAddress.is_bound()) { ret_val.ipAddress() = single_value->field_ipAddress.valueof(); } if (single_value->field_uDP__Port.is_bound()) { ret_val.uDP__Port() = single_value->field_uDP__Port.valueof(); } if (single_value->field_signallingWeight.is_bound()) { ret_val.signallingWeight() = single_value->field_signallingWeight.valueof(); } if (single_value->field_dataWeight.is_bound()) { ret_val.dataWeight() = single_value->field_dataWeight.valueof(); } return ret_val; } void IP6__Element_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 @NS_Types.IP6_Element."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new IP6__Element_template[list_length]; } IP6__Element_template& IP6__Element_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 @NS_Types.IP6_Element."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.IP6_Element."); return value_list.list_value[list_index]; } OCTETSTRING_template& IP6__Element_template::ipAddress() { set_specific(); return single_value->field_ipAddress; } const OCTETSTRING_template& IP6__Element_template::ipAddress() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ipAddress of a non-specific template of type @NS_Types.IP6_Element."); return single_value->field_ipAddress; } OCTETSTRING_template& IP6__Element_template::uDP__Port() { set_specific(); return single_value->field_uDP__Port; } const OCTETSTRING_template& IP6__Element_template::uDP__Port() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field uDP_Port of a non-specific template of type @NS_Types.IP6_Element."); return single_value->field_uDP__Port; } OCTETSTRING_template& IP6__Element_template::signallingWeight() { set_specific(); return single_value->field_signallingWeight; } const OCTETSTRING_template& IP6__Element_template::signallingWeight() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field signallingWeight of a non-specific template of type @NS_Types.IP6_Element."); return single_value->field_signallingWeight; } OCTETSTRING_template& IP6__Element_template::dataWeight() { set_specific(); return single_value->field_dataWeight; } const OCTETSTRING_template& IP6__Element_template::dataWeight() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field dataWeight of a non-specific template of type @NS_Types.IP6_Element."); return single_value->field_dataWeight; } int IP6__Element_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP6_Element 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 @NS_Types.IP6_Element 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 @NS_Types.IP6_Element containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP6_Element containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP6_Element containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP6_Element containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP6_Element containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP6_Element containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP6_Element containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.IP6_Element."); } return 0; } void IP6__Element_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ ipAddress := "); single_value->field_ipAddress.log(); TTCN_Logger::log_event_str(", uDP_Port := "); single_value->field_uDP__Port.log(); TTCN_Logger::log_event_str(", signallingWeight := "); single_value->field_signallingWeight.log(); TTCN_Logger::log_event_str(", dataWeight := "); single_value->field_dataWeight.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 IP6__Element_template::log_match(const IP6__Element& 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_ipAddress.match(match_value.ipAddress(), legacy)){ TTCN_Logger::log_logmatch_info(".ipAddress"); single_value->field_ipAddress.log_match(match_value.ipAddress(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_uDP__Port.match(match_value.uDP__Port(), legacy)){ TTCN_Logger::log_logmatch_info(".uDP_Port"); single_value->field_uDP__Port.log_match(match_value.uDP__Port(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_signallingWeight.match(match_value.signallingWeight(), legacy)){ TTCN_Logger::log_logmatch_info(".signallingWeight"); single_value->field_signallingWeight.log_match(match_value.signallingWeight(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_dataWeight.match(match_value.dataWeight(), legacy)){ TTCN_Logger::log_logmatch_info(".dataWeight"); single_value->field_dataWeight.log_match(match_value.dataWeight(), 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("{ ipAddress := "); single_value->field_ipAddress.log_match(match_value.ipAddress(), legacy); TTCN_Logger::log_event_str(", uDP_Port := "); single_value->field_uDP__Port.log_match(match_value.uDP__Port(), legacy); TTCN_Logger::log_event_str(", signallingWeight := "); single_value->field_signallingWeight.log_match(match_value.signallingWeight(), legacy); TTCN_Logger::log_event_str(", dataWeight := "); single_value->field_dataWeight.log_match(match_value.dataWeight(), 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 IP6__Element_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_ipAddress.encode_text(text_buf); single_value->field_uDP__Port.encode_text(text_buf); single_value->field_signallingWeight.encode_text(text_buf); single_value->field_dataWeight.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 @NS_Types.IP6_Element."); } } void IP6__Element_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_ipAddress.decode_text(text_buf); single_value->field_uDP__Port.decode_text(text_buf); single_value->field_signallingWeight.decode_text(text_buf); single_value->field_dataWeight.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 IP6__Element_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 @NS_Types.IP6_Element."); } } void IP6__Element_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: { IP6__Element_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) ipAddress().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) uDP__Port().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) signallingWeight().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) dataWeight().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(), "ipAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uDP_Port")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uDP__Port().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "signallingWeight")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { signallingWeight().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "dataWeight")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { dataWeight().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.IP6_Element: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { IP6__Element_template* precondition = new IP6__Element_template; precondition->set_param(*param.get_elem(0)); IP6__Element_template* implied_template = new IP6__Element_template; implied_template->set_param(*param.get_elem(1)); *this = IP6__Element_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.IP6_Element"); } is_ifpresent = param.get_ifpresent(); } void IP6__Element_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_ipAddress.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP6_Element"); single_value->field_uDP__Port.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP6_Element"); single_value->field_signallingWeight.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP6_Element"); single_value->field_dataWeight.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP6_Element"); 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 : "@NS_Types.IP6_Element"); } boolean IP6__Element_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IP6__Element_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) iP6__Elements().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iP6_Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iP6__Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.ListofIP6Elements: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.ListofIP6Elements"); } } void ListofIP6Elements::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_ext.encode_text(text_buf); field_lengthIndicator.encode_text(text_buf); field_iP6__Elements.encode_text(text_buf); } void ListofIP6Elements::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_ext.decode_text(text_buf); field_lengthIndicator.decode_text(text_buf); field_iP6__Elements.decode_text(text_buf); } void ListofIP6Elements::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 ListofIP6Elements::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 ListofIP6Elements::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; int selected_field = -1; if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord; else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB; else local_top_order=ORDER_LSB; int value_of_length_field2 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, ListofIP6Elements_ext_descr_.raw->forceomit); decoded_field_length = field_ext.RAW_decode(ListofIP6Elements_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_ext == bs_0) selected_field = 0; else if (field_ext == bs_1) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_2_force_omit(2, force_omit, ListofIP6Elements_lengthIndicator_descr_.raw->forceomit); decoded_field_length = field_lengthIndicator.RAW_decode(ListofIP6Elements_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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()); switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: { INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN1__2_length1_descr_); field_lengthIndicator.length1() = tmp1; value_of_length_field2 += tmp1.get_long_long_val() * 8; break; } case LIN1__2::ALT_length2: { INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN1__2_length2_descr_); field_lengthIndicator.length2() = tmp2; value_of_length_field2 += tmp2.get_long_long_val() * 8; break; } default: value_of_length_field2 = 0; } RAW_Force_Omit field_3_force_omit(3, force_omit, IP6__Elements_descr_.raw->forceomit); decoded_field_length = field_iP6__Elements.RAW_decode(IP6__Elements_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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()); value_of_length_field2 -= decoded_field_length; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ListofIP6Elements::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, ListofIP6Elements_ext_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, ListofIP6Elements_lengthIndicator_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, IP6__Elements_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_ext.RAW_encode(ListofIP6Elements_ext_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_lengthIndicator.RAW_encode(ListofIP6Elements_lengthIndicator_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_iP6__Elements.RAW_encode(IP6__Elements_descr_, *myleaf.body.node.nodes[3]); { int sel_field = 0; while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; } const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr; int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length; delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field]; myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos; } switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: if (field_ext != bs_0) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_0.RAW_encode(ListofIP6Elements_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; case LIN1__2::ALT_length2: if (field_ext != bs_1) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_1.RAW_encode(ListofIP6Elements_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; default:; } return myleaf.length = encoded_length; } struct ListofIP6Elements_template::single_value_struct { OCTETSTRING_template field_iEI; BITSTRING_template field_ext; LIN1__2_template field_lengthIndicator; IP6__Elements_template field_iP6__Elements; }; void ListofIP6Elements_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_iEI = ANY_VALUE; single_value->field_ext = ANY_VALUE; single_value->field_lengthIndicator = ANY_VALUE; single_value->field_iP6__Elements = ANY_VALUE; } } } void ListofIP6Elements_template::copy_value(const ListofIP6Elements& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.ext().is_bound()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (other_value.lengthIndicator().is_bound()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (other_value.iP6__Elements().is_bound()) { single_value->field_iP6__Elements = other_value.iP6__Elements(); } else { single_value->field_iP6__Elements.clean_up(); } set_selection(SPECIFIC_VALUE); } void ListofIP6Elements_template::copy_template(const ListofIP6Elements_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.iP6__Elements().get_selection()) { single_value->field_iP6__Elements = other_value.iP6__Elements(); } else { single_value->field_iP6__Elements.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 ListofIP6Elements_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 ListofIP6Elements_template(*other_value.implication_.precondition); implication_.implied_template = new ListofIP6Elements_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 @NS_Types.ListofIP6Elements."); break; } set_selection(other_value); } ListofIP6Elements_template::ListofIP6Elements_template() { } ListofIP6Elements_template::ListofIP6Elements_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ListofIP6Elements_template::ListofIP6Elements_template(const ListofIP6Elements& other_value) { copy_value(other_value); } ListofIP6Elements_template::ListofIP6Elements_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ListofIP6Elements&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.ListofIP6Elements from an unbound optional field."); } } ListofIP6Elements_template::ListofIP6Elements_template(ListofIP6Elements_template* p_precondition, ListofIP6Elements_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ListofIP6Elements_template::ListofIP6Elements_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; } ListofIP6Elements_template::ListofIP6Elements_template(const ListofIP6Elements_template& other_value) : Base_Template() { copy_template(other_value); } ListofIP6Elements_template::~ListofIP6Elements_template() { clean_up(); } ListofIP6Elements_template& ListofIP6Elements_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ListofIP6Elements_template& ListofIP6Elements_template::operator=(const ListofIP6Elements& other_value) { clean_up(); copy_value(other_value); return *this; } ListofIP6Elements_template& ListofIP6Elements_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ListofIP6Elements&)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 @NS_Types.ListofIP6Elements."); } return *this; } ListofIP6Elements_template& ListofIP6Elements_template::operator=(const ListofIP6Elements_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ListofIP6Elements_template::match(const ListofIP6Elements& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.ext().is_bound()) return FALSE; if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE; if(!other_value.lengthIndicator().is_bound()) return FALSE; if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE; if(!other_value.iP6__Elements().is_bound()) return FALSE; if(!single_value->field_iP6__Elements.match(other_value.iP6__Elements(), 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 @NS_Types.ListofIP6Elements."); } return FALSE; } boolean ListofIP6Elements_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_ext.is_bound() || single_value->field_lengthIndicator.is_bound() || single_value->field_iP6__Elements.is_bound(); } boolean ListofIP6Elements_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_ext.is_value() && single_value->field_lengthIndicator.is_value() && single_value->field_iP6__Elements.is_value(); } void ListofIP6Elements_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; } ListofIP6Elements ListofIP6Elements_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 @NS_Types.ListofIP6Elements."); ListofIP6Elements ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_ext.is_bound()) { ret_val.ext() = single_value->field_ext.valueof(); } if (single_value->field_lengthIndicator.is_bound()) { ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof(); } if (single_value->field_iP6__Elements.is_bound()) { ret_val.iP6__Elements() = single_value->field_iP6__Elements.valueof(); } return ret_val; } void ListofIP6Elements_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 @NS_Types.ListofIP6Elements."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ListofIP6Elements_template[list_length]; } ListofIP6Elements_template& ListofIP6Elements_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 @NS_Types.ListofIP6Elements."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.ListofIP6Elements."); return value_list.list_value[list_index]; } OCTETSTRING_template& ListofIP6Elements_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& ListofIP6Elements_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.ListofIP6Elements."); return single_value->field_iEI; } BITSTRING_template& ListofIP6Elements_template::ext() { set_specific(); return single_value->field_ext; } const BITSTRING_template& ListofIP6Elements_template::ext() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ext of a non-specific template of type @NS_Types.ListofIP6Elements."); return single_value->field_ext; } LIN1__2_template& ListofIP6Elements_template::lengthIndicator() { set_specific(); return single_value->field_lengthIndicator; } const LIN1__2_template& ListofIP6Elements_template::lengthIndicator() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthIndicator of a non-specific template of type @NS_Types.ListofIP6Elements."); return single_value->field_lengthIndicator; } IP6__Elements_template& ListofIP6Elements_template::iP6__Elements() { set_specific(); return single_value->field_iP6__Elements; } const IP6__Elements_template& ListofIP6Elements_template::iP6__Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iP6_Elements of a non-specific template of type @NS_Types.ListofIP6Elements."); return single_value->field_iP6__Elements; } int ListofIP6Elements_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP6Elements 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 @NS_Types.ListofIP6Elements 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 @NS_Types.ListofIP6Elements containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP6Elements containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP6Elements containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP6Elements containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP6Elements containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP6Elements containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ListofIP6Elements containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.ListofIP6Elements."); } return 0; } void ListofIP6Elements_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log(); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log(); TTCN_Logger::log_event_str(", iP6_Elements := "); single_value->field_iP6__Elements.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 ListofIP6Elements_template::log_match(const ListofIP6Elements& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ext.match(match_value.ext(), legacy)){ TTCN_Logger::log_logmatch_info(".ext"); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthIndicator"); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_iP6__Elements.match(match_value.iP6__Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".iP6_Elements"); single_value->field_iP6__Elements.log_match(match_value.iP6__Elements(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::log_event_str(", iP6_Elements := "); single_value->field_iP6__Elements.log_match(match_value.iP6__Elements(), 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 ListofIP6Elements_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_ext.encode_text(text_buf); single_value->field_lengthIndicator.encode_text(text_buf); single_value->field_iP6__Elements.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 @NS_Types.ListofIP6Elements."); } } void ListofIP6Elements_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_iEI.decode_text(text_buf); single_value->field_ext.decode_text(text_buf); single_value->field_lengthIndicator.decode_text(text_buf); single_value->field_iP6__Elements.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 ListofIP6Elements_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 @NS_Types.ListofIP6Elements."); } } void ListofIP6Elements_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: { ListofIP6Elements_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) iP6__Elements().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iP6_Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iP6__Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.ListofIP6Elements: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ListofIP6Elements_template* precondition = new ListofIP6Elements_template; precondition->set_param(*param.get_elem(0)); ListofIP6Elements_template* implied_template = new ListofIP6Elements_template; implied_template->set_param(*param.get_elem(1)); *this = ListofIP6Elements_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.ListofIP6Elements"); } is_ifpresent = param.get_ifpresent(); } void ListofIP6Elements_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.ListofIP6Elements"); single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@NS_Types.ListofIP6Elements"); single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@NS_Types.ListofIP6Elements"); single_value->field_iP6__Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.ListofIP6Elements"); 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 : "@NS_Types.ListofIP6Elements"); } boolean ListofIP6Elements_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ListofIP6Elements_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_ip6Address: return field_ip6Address->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void IPAddress::clean_up() { switch (union_selection) { case ALT_ip4Address: delete field_ip4Address; break; case ALT_ip6Address: delete field_ip6Address; break; default: break; } union_selection = UNBOUND_VALUE; } void IPAddress::log() const { switch (union_selection) { case ALT_ip4Address: TTCN_Logger::log_event_str("{ ip4Address := "); field_ip4Address->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_ip6Address: TTCN_Logger::log_event_str("{ ip6Address := "); field_ip6Address->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void IPAddress::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, "ip4Address")) { ip4Address().set_param(*mp_last); if (!ip4Address().is_bound()) clean_up(); return; } if (!strcmp(last_name, "ip6Address")) { ip6Address().set_param(*mp_last); if (!ip6Address().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @NS_Types.IPAddress.", last_name); } void IPAddress::set_implicit_omit() { switch (union_selection) { case ALT_ip4Address: field_ip4Address->set_implicit_omit(); break; case ALT_ip6Address: field_ip6Address->set_implicit_omit(); break; default: break; } } void IPAddress::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_ip4Address: field_ip4Address->encode_text(text_buf); break; case ALT_ip6Address: field_ip6Address->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @NS_Types.IPAddress."); } } void IPAddress::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_ip4Address: ip4Address().decode_text(text_buf); break; case ALT_ip6Address: ip6Address().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @NS_Types.IPAddress."); } } void IPAddress::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 IPAddress::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 IPAddress::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, General__Types::OCT4_descr_.raw->forceomit); decoded_length = ip4Address().RAW_decode(General__Types::OCT4_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, General__Types::OCT16_descr_.raw->forceomit); decoded_length = ip6Address().RAW_decode(General__Types::OCT16_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } default: break; } return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } else { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT4_descr_.raw->forceomit); decoded_length = ip4Address().RAW_decode(General__Types::OCT4_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_0_force_omit); if (decoded_length >= 0) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::OCT16_descr_.raw->forceomit); decoded_length = ip6Address().RAW_decode(General__Types::OCT16_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_length >= 0) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } } clean_up(); return -1; } int IPAddress::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 2; myleaf.body.node.nodes = init_nodes_of_enc_tree(2); memset(myleaf.body.node.nodes, 0, 2 * sizeof(RAW_enc_tree *)); switch (union_selection) { case ALT_ip4Address: myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, General__Types::OCT4_descr_.raw); encoded_length = field_ip4Address->RAW_encode(General__Types::OCT4_descr_, *myleaf.body.node.nodes[0]); myleaf.body.node.nodes[0]->coding_descr = &General__Types::OCT4_descr_; break; case ALT_ip6Address: myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, General__Types::OCT16_descr_.raw); encoded_length = field_ip6Address->RAW_encode(General__Types::OCT16_descr_, *myleaf.body.node.nodes[1]); myleaf.body.node.nodes[1]->coding_descr = &General__Types::OCT16_descr_; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); } return encoded_length; } void IPAddress_template::copy_value(const IPAddress& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case IPAddress::ALT_ip4Address: single_value.field_ip4Address = new OCTETSTRING_template(other_value.ip4Address()); break; case IPAddress::ALT_ip6Address: single_value.field_ip6Address = new OCTETSTRING_template(other_value.ip6Address()); break; default: TTCN_error("Initializing a template with an unbound value of type @NS_Types.IPAddress."); } set_selection(SPECIFIC_VALUE); } void IPAddress_template::copy_template(const IPAddress_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 IPAddress::ALT_ip4Address: single_value.field_ip4Address = new OCTETSTRING_template(*other_value.single_value.field_ip4Address); break; case IPAddress::ALT_ip6Address: single_value.field_ip6Address = new OCTETSTRING_template(*other_value.single_value.field_ip6Address); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @NS_Types.IPAddress."); } 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 IPAddress_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 IPAddress_template(*other_value.implication_.precondition); implication_.implied_template = new IPAddress_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 @NS_Types.IPAddress."); } set_selection(other_value); } IPAddress_template::IPAddress_template() { } IPAddress_template::IPAddress_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IPAddress_template::IPAddress_template(const IPAddress& other_value) { copy_value(other_value); } IPAddress_template::IPAddress_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IPAddress&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @NS_Types.IPAddress from an unbound optional field."); } } IPAddress_template::IPAddress_template(IPAddress_template* p_precondition, IPAddress_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IPAddress_template::IPAddress_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; } IPAddress_template::IPAddress_template(const IPAddress_template& other_value) : Base_Template(){ copy_template(other_value); } IPAddress_template::~IPAddress_template() { clean_up(); } void IPAddress_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case IPAddress::ALT_ip4Address: delete single_value.field_ip4Address; break; case IPAddress::ALT_ip6Address: delete single_value.field_ip6Address; 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; } IPAddress_template& IPAddress_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IPAddress_template& IPAddress_template::operator=(const IPAddress& other_value) { clean_up(); copy_value(other_value); return *this; } IPAddress_template& IPAddress_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IPAddress&)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 @NS_Types.IPAddress."); } return *this; } IPAddress_template& IPAddress_template::operator=(const IPAddress_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IPAddress_template::match(const IPAddress& 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: { IPAddress::union_selection_type value_selection = other_value.get_selection(); if (value_selection == IPAddress::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case IPAddress::ALT_ip4Address: return single_value.field_ip4Address->match(other_value.ip4Address(), legacy); case IPAddress::ALT_ip6Address: return single_value.field_ip6Address->match(other_value.ip6Address(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @NS_Types.IPAddress."); } } 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 @NS_Types.IPAddress."); } return FALSE; } boolean IPAddress_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case IPAddress::ALT_ip4Address: return single_value.field_ip4Address->is_value(); case IPAddress::ALT_ip6Address: return single_value.field_ip6Address->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @NS_Types.IPAddress."); } } IPAddress IPAddress_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 @NS_Types.IPAddress."); IPAddress ret_val; switch (single_value.union_selection) { case IPAddress::ALT_ip4Address: ret_val.ip4Address() = single_value.field_ip4Address->valueof(); break; case IPAddress::ALT_ip6Address: ret_val.ip6Address() = single_value.field_ip6Address->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @NS_Types.IPAddress."); } return ret_val; } IPAddress_template& IPAddress_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 @NS_Types.IPAddress."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @NS_Types.IPAddress."); return value_list.list_value[list_index]; } void IPAddress_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 @NS_Types.IPAddress."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new IPAddress_template[list_length]; } OCTETSTRING_template& IPAddress_template::ip4Address() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != IPAddress::ALT_ip4Address) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ip4Address = new OCTETSTRING_template(ANY_VALUE); else single_value.field_ip4Address = new OCTETSTRING_template; single_value.union_selection = IPAddress::ALT_ip4Address; set_selection(SPECIFIC_VALUE); } return *single_value.field_ip4Address; } const OCTETSTRING_template& IPAddress_template::ip4Address() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ip4Address in a non-specific template of union type @NS_Types.IPAddress."); if (single_value.union_selection != IPAddress::ALT_ip4Address) TTCN_error("Accessing non-selected field ip4Address in a template of union type @NS_Types.IPAddress."); return *single_value.field_ip4Address; } OCTETSTRING_template& IPAddress_template::ip6Address() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != IPAddress::ALT_ip6Address) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_ip6Address = new OCTETSTRING_template(ANY_VALUE); else single_value.field_ip6Address = new OCTETSTRING_template; single_value.union_selection = IPAddress::ALT_ip6Address; set_selection(SPECIFIC_VALUE); } return *single_value.field_ip6Address; } const OCTETSTRING_template& IPAddress_template::ip6Address() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ip6Address in a non-specific template of union type @NS_Types.IPAddress."); if (single_value.union_selection != IPAddress::ALT_ip6Address) TTCN_error("Accessing non-selected field ip6Address in a template of union type @NS_Types.IPAddress."); return *single_value.field_ip6Address; } boolean IPAddress_template::ischosen(IPAddress::union_selection_type checked_selection) const { if (checked_selection == IPAddress::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @NS_Types.IPAddress."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == IPAddress::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @NS_Types.IPAddress."); 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 @NS_Types.IPAddress 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 IPAddress_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case IPAddress::ALT_ip4Address: TTCN_Logger::log_event_str("{ ip4Address := "); single_value.field_ip4Address->log(); TTCN_Logger::log_event_str(" }"); break; case IPAddress::ALT_ip6Address: TTCN_Logger::log_event_str("{ ip6Address := "); single_value.field_ip6Address->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 IPAddress_template::log_match(const IPAddress& 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 IPAddress::ALT_ip4Address: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".ip4Address"); single_value.field_ip4Address->log_match(match_value.ip4Address(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ ip4Address := "); single_value.field_ip4Address->log_match(match_value.ip4Address(), legacy); TTCN_Logger::log_event_str(" }"); } break; case IPAddress::ALT_ip6Address: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".ip6Address"); single_value.field_ip6Address->log_match(match_value.ip6Address(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ ip6Address := "); single_value.field_ip6Address->log_match(match_value.ip6Address(), 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 IPAddress_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 IPAddress::ALT_ip4Address: single_value.field_ip4Address->encode_text(text_buf); break; case IPAddress::ALT_ip6Address: single_value.field_ip6Address->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @NS_Types.IPAddress."); } 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 @NS_Types.IPAddress."); } } void IPAddress_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = IPAddress::UNBOUND_VALUE; IPAddress::union_selection_type new_selection = (IPAddress::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case IPAddress::ALT_ip4Address: single_value.field_ip4Address = new OCTETSTRING_template; single_value.field_ip4Address->decode_text(text_buf); break; case IPAddress::ALT_ip6Address: single_value.field_ip6Address = new OCTETSTRING_template; single_value.field_ip6Address->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @NS_Types.IPAddress."); } 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 IPAddress_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 @NS_Types.IPAddress."); } } boolean IPAddress_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IPAddress_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 `@NS_Types.IPAddress'"); } if (strcmp("ip4Address", param_field) == 0) { ip4Address().set_param(param); return; } else if (strcmp("ip6Address", param_field) == 0) { ip6Address().set_param(param); return; } else param.error("Field `%s' not found in union template type `@NS_Types.IPAddress'", 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: { IPAddress_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", "@NS_Types.IPAddress"); 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, "ip4Address")) { ip4Address().set_param(*mp_last); break; } if (!strcmp(last_name, "ip6Address")) { ip6Address().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @NS_Types.IPAddress.", last_name); } break; case Module_Param::MP_Implication_Template: { IPAddress_template* precondition = new IPAddress_template; precondition->set_param(*m_p->get_elem(0)); IPAddress_template* implied_template = new IPAddress_template; implied_template->set_param(*m_p->get_elem(1)); *this = IPAddress_template(precondition, implied_template); } break; default: param.type_error("union template", "@NS_Types.IPAddress"); } is_ifpresent = param.get_ifpresent(); } void IPAddress_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 IPAddress::ALT_ip4Address: single_value.field_ip4Address->check_restriction(t_res, t_name ? t_name : "@NS_Types.IPAddress"); return; case IPAddress::ALT_ip6Address: single_value.field_ip6Address->check_restriction(t_res, t_name ? t_name : "@NS_Types.IPAddress"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @NS_Types.IPAddress."); } 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 : "@NS_Types.IPAddress"); } IP__Address__NS::IP__Address__NS() { } IP__Address__NS::IP__Address__NS(const OCTETSTRING& par_iEI, const OCTETSTRING& par_addressType, const IPAddress& par_ipAddress) : field_iEI(par_iEI), field_addressType(par_addressType), field_ipAddress(par_ipAddress) { } IP__Address__NS::IP__Address__NS(const IP__Address__NS& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.IP_Address_NS."); if (other_value.iEI().is_bound()) field_iEI = other_value.iEI(); else field_iEI.clean_up(); if (other_value.addressType().is_bound()) field_addressType = other_value.addressType(); else field_addressType.clean_up(); if (other_value.ipAddress().is_bound()) field_ipAddress = other_value.ipAddress(); else field_ipAddress.clean_up(); } void IP__Address__NS::clean_up() { field_iEI.clean_up(); field_addressType.clean_up(); field_ipAddress.clean_up(); } const TTCN_Typedescriptor_t* IP__Address__NS::get_descriptor() const { return &IP__Address__NS_descr_; } IP__Address__NS& IP__Address__NS::operator=(const IP__Address__NS& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.IP_Address_NS."); if (other_value.iEI().is_bound()) field_iEI = other_value.iEI(); else field_iEI.clean_up(); if (other_value.addressType().is_bound()) field_addressType = other_value.addressType(); else field_addressType.clean_up(); if (other_value.ipAddress().is_bound()) field_ipAddress = other_value.ipAddress(); else field_ipAddress.clean_up(); } return *this; } boolean IP__Address__NS::operator==(const IP__Address__NS& other_value) const { return field_iEI==other_value.field_iEI && field_addressType==other_value.field_addressType && field_ipAddress==other_value.field_ipAddress; } boolean IP__Address__NS::is_bound() const { return (field_iEI.is_bound()) || (field_addressType.is_bound()) || (field_ipAddress.is_bound()); } boolean IP__Address__NS::is_value() const { return field_iEI.is_value() && field_addressType.is_value() && field_ipAddress.is_value(); } void IP__Address__NS::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ iEI := "); field_iEI.log(); TTCN_Logger::log_event_str(", addressType := "); field_addressType.log(); TTCN_Logger::log_event_str(", ipAddress := "); field_ipAddress.log(); TTCN_Logger::log_event_str(" }"); } void IP__Address__NS::set_implicit_omit() { if (iEI().is_bound()) iEI().set_implicit_omit(); if (addressType().is_bound()) addressType().set_implicit_omit(); if (ipAddress().is_bound()) ipAddress().set_implicit_omit(); } void IP__Address__NS::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (30 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) addressType().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ipAddress().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "addressType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { addressType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ipAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.IP_Address_NS: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.IP_Address_NS"); } } void IP__Address__NS::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_addressType.encode_text(text_buf); field_ipAddress.encode_text(text_buf); } void IP__Address__NS::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_addressType.decode_text(text_buf); field_ipAddress.decode_text(text_buf); } void IP__Address__NS::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 IP__Address__NS::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 IP__Address__NS::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; int selected_field = -1; if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord; else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB; else local_top_order=ORDER_LSB; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_addressType.RAW_decode(General__Types::OCT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_addressType == os_0) selected_field = 0; else if (field_addressType == os_1) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_2_force_omit(2, force_omit, IP__Address__NS_ipAddress_descr_.raw->forceomit); decoded_field_length = field_ipAddress.RAW_decode(IP__Address__NS_ipAddress_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int IP__Address__NS::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 3; myleaf.body.node.nodes = init_nodes_of_enc_tree(3); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, IP__Address__NS_ipAddress_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_addressType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_ipAddress.RAW_encode(IP__Address__NS_ipAddress_descr_, *myleaf.body.node.nodes[2]); switch (field_ipAddress.get_selection()) { case IPAddress::ALT_ip4Address: if (field_addressType != os_0) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) os_0.RAW_encode(General__Types::OCT1_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; case IPAddress::ALT_ip6Address: if (field_addressType != os_1) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) os_1.RAW_encode(General__Types::OCT1_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; default:; } return myleaf.length = encoded_length; } struct IP__Address__NS_template::single_value_struct { OCTETSTRING_template field_iEI; OCTETSTRING_template field_addressType; IPAddress_template field_ipAddress; }; void IP__Address__NS_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_iEI = ANY_VALUE; single_value->field_addressType = ANY_VALUE; single_value->field_ipAddress = ANY_VALUE; } } } void IP__Address__NS_template::copy_value(const IP__Address__NS& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.addressType().is_bound()) { single_value->field_addressType = other_value.addressType(); } else { single_value->field_addressType.clean_up(); } if (other_value.ipAddress().is_bound()) { single_value->field_ipAddress = other_value.ipAddress(); } else { single_value->field_ipAddress.clean_up(); } set_selection(SPECIFIC_VALUE); } void IP__Address__NS_template::copy_template(const IP__Address__NS_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.addressType().get_selection()) { single_value->field_addressType = other_value.addressType(); } else { single_value->field_addressType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ipAddress().get_selection()) { single_value->field_ipAddress = other_value.ipAddress(); } else { single_value->field_ipAddress.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 IP__Address__NS_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 IP__Address__NS_template(*other_value.implication_.precondition); implication_.implied_template = new IP__Address__NS_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 @NS_Types.IP_Address_NS."); break; } set_selection(other_value); } IP__Address__NS_template::IP__Address__NS_template() { } IP__Address__NS_template::IP__Address__NS_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } IP__Address__NS_template::IP__Address__NS_template(const IP__Address__NS& other_value) { copy_value(other_value); } IP__Address__NS_template::IP__Address__NS_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP__Address__NS&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.IP_Address_NS from an unbound optional field."); } } IP__Address__NS_template::IP__Address__NS_template(IP__Address__NS_template* p_precondition, IP__Address__NS_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } IP__Address__NS_template::IP__Address__NS_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; } IP__Address__NS_template::IP__Address__NS_template(const IP__Address__NS_template& other_value) : Base_Template() { copy_template(other_value); } IP__Address__NS_template::~IP__Address__NS_template() { clean_up(); } IP__Address__NS_template& IP__Address__NS_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } IP__Address__NS_template& IP__Address__NS_template::operator=(const IP__Address__NS& other_value) { clean_up(); copy_value(other_value); return *this; } IP__Address__NS_template& IP__Address__NS_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const IP__Address__NS&)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 @NS_Types.IP_Address_NS."); } return *this; } IP__Address__NS_template& IP__Address__NS_template::operator=(const IP__Address__NS_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean IP__Address__NS_template::match(const IP__Address__NS& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.addressType().is_bound()) return FALSE; if(!single_value->field_addressType.match(other_value.addressType(), legacy))return FALSE; if(!other_value.ipAddress().is_bound()) return FALSE; if(!single_value->field_ipAddress.match(other_value.ipAddress(), 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 @NS_Types.IP_Address_NS."); } return FALSE; } boolean IP__Address__NS_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_addressType.is_bound() || single_value->field_ipAddress.is_bound(); } boolean IP__Address__NS_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_addressType.is_value() && single_value->field_ipAddress.is_value(); } void IP__Address__NS_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; } IP__Address__NS IP__Address__NS_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 @NS_Types.IP_Address_NS."); IP__Address__NS ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_addressType.is_bound()) { ret_val.addressType() = single_value->field_addressType.valueof(); } if (single_value->field_ipAddress.is_bound()) { ret_val.ipAddress() = single_value->field_ipAddress.valueof(); } return ret_val; } void IP__Address__NS_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 @NS_Types.IP_Address_NS."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new IP__Address__NS_template[list_length]; } IP__Address__NS_template& IP__Address__NS_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 @NS_Types.IP_Address_NS."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.IP_Address_NS."); return value_list.list_value[list_index]; } OCTETSTRING_template& IP__Address__NS_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& IP__Address__NS_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.IP_Address_NS."); return single_value->field_iEI; } OCTETSTRING_template& IP__Address__NS_template::addressType() { set_specific(); return single_value->field_addressType; } const OCTETSTRING_template& IP__Address__NS_template::addressType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field addressType of a non-specific template of type @NS_Types.IP_Address_NS."); return single_value->field_addressType; } IPAddress_template& IP__Address__NS_template::ipAddress() { set_specific(); return single_value->field_ipAddress; } const IPAddress_template& IP__Address__NS_template::ipAddress() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ipAddress of a non-specific template of type @NS_Types.IP_Address_NS."); return single_value->field_ipAddress; } int IP__Address__NS_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP_Address_NS which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 3; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.IP_Address_NS 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 @NS_Types.IP_Address_NS containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP_Address_NS containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP_Address_NS containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP_Address_NS containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP_Address_NS containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP_Address_NS containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.IP_Address_NS containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.IP_Address_NS."); } return 0; } void IP__Address__NS_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", addressType := "); single_value->field_addressType.log(); TTCN_Logger::log_event_str(", ipAddress := "); single_value->field_ipAddress.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 IP__Address__NS_template::log_match(const IP__Address__NS& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_addressType.match(match_value.addressType(), legacy)){ TTCN_Logger::log_logmatch_info(".addressType"); single_value->field_addressType.log_match(match_value.addressType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ipAddress.match(match_value.ipAddress(), legacy)){ TTCN_Logger::log_logmatch_info(".ipAddress"); single_value->field_ipAddress.log_match(match_value.ipAddress(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", addressType := "); single_value->field_addressType.log_match(match_value.addressType(), legacy); TTCN_Logger::log_event_str(", ipAddress := "); single_value->field_ipAddress.log_match(match_value.ipAddress(), 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 IP__Address__NS_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_addressType.encode_text(text_buf); single_value->field_ipAddress.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 @NS_Types.IP_Address_NS."); } } void IP__Address__NS_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_iEI.decode_text(text_buf); single_value->field_addressType.decode_text(text_buf); single_value->field_ipAddress.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 IP__Address__NS_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 @NS_Types.IP_Address_NS."); } } void IP__Address__NS_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: { IP__Address__NS_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) addressType().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ipAddress().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "addressType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { addressType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ipAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.IP_Address_NS: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { IP__Address__NS_template* precondition = new IP__Address__NS_template; precondition->set_param(*param.get_elem(0)); IP__Address__NS_template* implied_template = new IP__Address__NS_template; implied_template->set_param(*param.get_elem(1)); *this = IP__Address__NS_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.IP_Address_NS"); } is_ifpresent = param.get_ifpresent(); } void IP__Address__NS_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP_Address_NS"); single_value->field_addressType.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP_Address_NS"); single_value->field_ipAddress.check_restriction(t_res, t_name ? t_name : "@NS_Types.IP_Address_NS"); 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 : "@NS_Types.IP_Address_NS"); } boolean IP__Address__NS_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean IP__Address__NS_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) eBIT().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "eBIT")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eBIT().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_idxerror("Non existent field name in type @NS_Types.EndFlag: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.EndFlag"); } } void EndFlag::encode_text(Text_Buf& text_buf) const { field_eBIT.encode_text(text_buf); field_spare.encode_text(text_buf); } void EndFlag::decode_text(Text_Buf& text_buf) { field_eBIT.decode_text(text_buf); field_spare.decode_text(text_buf); } void EndFlag::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 EndFlag::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 EndFlag::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, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_eBIT.RAW_decode(General__Types::BIT1_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, General__Types::BIT7_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT7_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 EndFlag::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, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT7_descr_.raw); encoded_length += field_eBIT.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_spare.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct EndFlag_template::single_value_struct { BITSTRING_template field_eBIT; BITSTRING_template field_spare; }; void EndFlag_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_eBIT = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void EndFlag_template::copy_value(const EndFlag& other_value) { single_value = new single_value_struct; if (other_value.eBIT().is_bound()) { single_value->field_eBIT = other_value.eBIT(); } else { single_value->field_eBIT.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } set_selection(SPECIFIC_VALUE); } void EndFlag_template::copy_template(const EndFlag_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.eBIT().get_selection()) { single_value->field_eBIT = other_value.eBIT(); } else { single_value->field_eBIT.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.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 EndFlag_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 EndFlag_template(*other_value.implication_.precondition); implication_.implied_template = new EndFlag_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 @NS_Types.EndFlag."); break; } set_selection(other_value); } EndFlag_template::EndFlag_template() { } EndFlag_template::EndFlag_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EndFlag_template::EndFlag_template(const EndFlag& other_value) { copy_value(other_value); } EndFlag_template::EndFlag_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EndFlag&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.EndFlag from an unbound optional field."); } } EndFlag_template::EndFlag_template(EndFlag_template* p_precondition, EndFlag_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EndFlag_template::EndFlag_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; } EndFlag_template::EndFlag_template(const EndFlag_template& other_value) : Base_Template() { copy_template(other_value); } EndFlag_template::~EndFlag_template() { clean_up(); } EndFlag_template& EndFlag_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EndFlag_template& EndFlag_template::operator=(const EndFlag& other_value) { clean_up(); copy_value(other_value); return *this; } EndFlag_template& EndFlag_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EndFlag&)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 @NS_Types.EndFlag."); } return *this; } EndFlag_template& EndFlag_template::operator=(const EndFlag_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EndFlag_template::match(const EndFlag& 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.eBIT().is_bound()) return FALSE; if(!single_value->field_eBIT.match(other_value.eBIT(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), 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 @NS_Types.EndFlag."); } return FALSE; } boolean EndFlag_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_eBIT.is_bound() || single_value->field_spare.is_bound(); } boolean EndFlag_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_eBIT.is_value() && single_value->field_spare.is_value(); } void EndFlag_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; } EndFlag EndFlag_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 @NS_Types.EndFlag."); EndFlag ret_val; if (single_value->field_eBIT.is_bound()) { ret_val.eBIT() = single_value->field_eBIT.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void EndFlag_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 @NS_Types.EndFlag."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EndFlag_template[list_length]; } EndFlag_template& EndFlag_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 @NS_Types.EndFlag."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.EndFlag."); return value_list.list_value[list_index]; } BITSTRING_template& EndFlag_template::eBIT() { set_specific(); return single_value->field_eBIT; } const BITSTRING_template& EndFlag_template::eBIT() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field eBIT of a non-specific template of type @NS_Types.EndFlag."); return single_value->field_eBIT; } BITSTRING_template& EndFlag_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& EndFlag_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @NS_Types.EndFlag."); return single_value->field_spare; } int EndFlag_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.EndFlag 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 @NS_Types.EndFlag 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 @NS_Types.EndFlag containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.EndFlag containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.EndFlag containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.EndFlag containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.EndFlag containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.EndFlag containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.EndFlag containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.EndFlag."); } return 0; } void EndFlag_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ eBIT := "); single_value->field_eBIT.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.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 EndFlag_template::log_match(const EndFlag& 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_eBIT.match(match_value.eBIT(), legacy)){ TTCN_Logger::log_logmatch_info(".eBIT"); single_value->field_eBIT.log_match(match_value.eBIT(), 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); } }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("{ eBIT := "); single_value->field_eBIT.log_match(match_value.eBIT(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), 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 EndFlag_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_eBIT.encode_text(text_buf); single_value->field_spare.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 @NS_Types.EndFlag."); } } void EndFlag_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_eBIT.decode_text(text_buf); single_value->field_spare.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 EndFlag_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 @NS_Types.EndFlag."); } } void EndFlag_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: { EndFlag_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) eBIT().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "eBIT")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eBIT().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_idxerror("Non existent field name in type @NS_Types.EndFlag: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EndFlag_template* precondition = new EndFlag_template; precondition->set_param(*param.get_elem(0)); EndFlag_template* implied_template = new EndFlag_template; implied_template->set_param(*param.get_elem(1)); *this = EndFlag_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.EndFlag"); } is_ifpresent = param.get_ifpresent(); } void EndFlag_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_eBIT.check_restriction(t_res, t_name ? t_name : "@NS_Types.EndFlag"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@NS_Types.EndFlag"); 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 : "@NS_Types.EndFlag"); } boolean EndFlag_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EndFlag_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) resetBIT().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)); 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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "resetBIT")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { resetBIT().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_idxerror("Non existent field name in type @NS_Types.ResetFlag: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.ResetFlag"); } } void ResetFlag::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_resetBIT.encode_text(text_buf); field_spare.encode_text(text_buf); } void ResetFlag::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_resetBIT.decode_text(text_buf); field_spare.decode_text(text_buf); } void ResetFlag::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 ResetFlag::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 ResetFlag::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_resetBIT.RAW_decode(General__Types::BIT1_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, General__Types::BIT7_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT7_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ResetFlag::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 3; myleaf.body.node.nodes = init_nodes_of_enc_tree(3); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT7_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_resetBIT.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_spare.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[2]); return myleaf.length = encoded_length; } struct ResetFlag_template::single_value_struct { OCTETSTRING_template field_iEI; BITSTRING_template field_resetBIT; BITSTRING_template field_spare; }; void ResetFlag_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_iEI = ANY_VALUE; single_value->field_resetBIT = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void ResetFlag_template::copy_value(const ResetFlag& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.resetBIT().is_bound()) { single_value->field_resetBIT = other_value.resetBIT(); } else { single_value->field_resetBIT.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } set_selection(SPECIFIC_VALUE); } void ResetFlag_template::copy_template(const ResetFlag_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.resetBIT().get_selection()) { single_value->field_resetBIT = other_value.resetBIT(); } else { single_value->field_resetBIT.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.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 ResetFlag_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 ResetFlag_template(*other_value.implication_.precondition); implication_.implied_template = new ResetFlag_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 @NS_Types.ResetFlag."); break; } set_selection(other_value); } ResetFlag_template::ResetFlag_template() { } ResetFlag_template::ResetFlag_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ResetFlag_template::ResetFlag_template(const ResetFlag& other_value) { copy_value(other_value); } ResetFlag_template::ResetFlag_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ResetFlag&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.ResetFlag from an unbound optional field."); } } ResetFlag_template::ResetFlag_template(ResetFlag_template* p_precondition, ResetFlag_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ResetFlag_template::ResetFlag_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; } ResetFlag_template::ResetFlag_template(const ResetFlag_template& other_value) : Base_Template() { copy_template(other_value); } ResetFlag_template::~ResetFlag_template() { clean_up(); } ResetFlag_template& ResetFlag_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ResetFlag_template& ResetFlag_template::operator=(const ResetFlag& other_value) { clean_up(); copy_value(other_value); return *this; } ResetFlag_template& ResetFlag_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ResetFlag&)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 @NS_Types.ResetFlag."); } return *this; } ResetFlag_template& ResetFlag_template::operator=(const ResetFlag_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ResetFlag_template::match(const ResetFlag& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.resetBIT().is_bound()) return FALSE; if(!single_value->field_resetBIT.match(other_value.resetBIT(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), 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 @NS_Types.ResetFlag."); } return FALSE; } boolean ResetFlag_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_resetBIT.is_bound() || single_value->field_spare.is_bound(); } boolean ResetFlag_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_resetBIT.is_value() && single_value->field_spare.is_value(); } void ResetFlag_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; } ResetFlag ResetFlag_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 @NS_Types.ResetFlag."); ResetFlag ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_resetBIT.is_bound()) { ret_val.resetBIT() = single_value->field_resetBIT.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void ResetFlag_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 @NS_Types.ResetFlag."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ResetFlag_template[list_length]; } ResetFlag_template& ResetFlag_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 @NS_Types.ResetFlag."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.ResetFlag."); return value_list.list_value[list_index]; } OCTETSTRING_template& ResetFlag_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& ResetFlag_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.ResetFlag."); return single_value->field_iEI; } BITSTRING_template& ResetFlag_template::resetBIT() { set_specific(); return single_value->field_resetBIT; } const BITSTRING_template& ResetFlag_template::resetBIT() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field resetBIT of a non-specific template of type @NS_Types.ResetFlag."); return single_value->field_resetBIT; } BITSTRING_template& ResetFlag_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& ResetFlag_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @NS_Types.ResetFlag."); return single_value->field_spare; } int ResetFlag_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ResetFlag which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 3; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.ResetFlag 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 @NS_Types.ResetFlag containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ResetFlag containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ResetFlag containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ResetFlag containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ResetFlag containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ResetFlag containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.ResetFlag containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.ResetFlag."); } return 0; } void ResetFlag_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", resetBIT := "); single_value->field_resetBIT.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.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 ResetFlag_template::log_match(const ResetFlag& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_resetBIT.match(match_value.resetBIT(), legacy)){ TTCN_Logger::log_logmatch_info(".resetBIT"); single_value->field_resetBIT.log_match(match_value.resetBIT(), 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); } }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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", resetBIT := "); single_value->field_resetBIT.log_match(match_value.resetBIT(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), 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 ResetFlag_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_resetBIT.encode_text(text_buf); single_value->field_spare.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 @NS_Types.ResetFlag."); } } void ResetFlag_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_iEI.decode_text(text_buf); single_value->field_resetBIT.decode_text(text_buf); single_value->field_spare.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 ResetFlag_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 @NS_Types.ResetFlag."); } } void ResetFlag_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: { ResetFlag_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) resetBIT().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)); 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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "resetBIT")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { resetBIT().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_idxerror("Non existent field name in type @NS_Types.ResetFlag: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ResetFlag_template* precondition = new ResetFlag_template; precondition->set_param(*param.get_elem(0)); ResetFlag_template* implied_template = new ResetFlag_template; implied_template->set_param(*param.get_elem(1)); *this = ResetFlag_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.ResetFlag"); } is_ifpresent = param.get_ifpresent(); } void ResetFlag_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.ResetFlag"); single_value->field_resetBIT.check_restriction(t_res, t_name ? t_name : "@NS_Types.ResetFlag"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@NS_Types.ResetFlag"); 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 : "@NS_Types.ResetFlag"); } boolean ResetFlag_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ResetFlag_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) maxNumberOfNSVCs().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "maxNumberOfNSVCs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { maxNumberOfNSVCs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.MaxNumberOfNSVCs: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.MaxNumberOfNSVCs"); } } void MaxNumberOfNSVCs::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_maxNumberOfNSVCs.encode_text(text_buf); } void MaxNumberOfNSVCs::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_maxNumberOfNSVCs.decode_text(text_buf); } void MaxNumberOfNSVCs::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 MaxNumberOfNSVCs::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 MaxNumberOfNSVCs::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_maxNumberOfNSVCs.RAW_decode(General__Types::OCT2_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 MaxNumberOfNSVCs::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::OCT2_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_maxNumberOfNSVCs.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct MaxNumberOfNSVCs_template::single_value_struct { OCTETSTRING_template field_iEI; OCTETSTRING_template field_maxNumberOfNSVCs; }; void MaxNumberOfNSVCs_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_iEI = ANY_VALUE; single_value->field_maxNumberOfNSVCs = ANY_VALUE; } } } void MaxNumberOfNSVCs_template::copy_value(const MaxNumberOfNSVCs& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.maxNumberOfNSVCs().is_bound()) { single_value->field_maxNumberOfNSVCs = other_value.maxNumberOfNSVCs(); } else { single_value->field_maxNumberOfNSVCs.clean_up(); } set_selection(SPECIFIC_VALUE); } void MaxNumberOfNSVCs_template::copy_template(const MaxNumberOfNSVCs_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.maxNumberOfNSVCs().get_selection()) { single_value->field_maxNumberOfNSVCs = other_value.maxNumberOfNSVCs(); } else { single_value->field_maxNumberOfNSVCs.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 MaxNumberOfNSVCs_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 MaxNumberOfNSVCs_template(*other_value.implication_.precondition); implication_.implied_template = new MaxNumberOfNSVCs_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 @NS_Types.MaxNumberOfNSVCs."); break; } set_selection(other_value); } MaxNumberOfNSVCs_template::MaxNumberOfNSVCs_template() { } MaxNumberOfNSVCs_template::MaxNumberOfNSVCs_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MaxNumberOfNSVCs_template::MaxNumberOfNSVCs_template(const MaxNumberOfNSVCs& other_value) { copy_value(other_value); } MaxNumberOfNSVCs_template::MaxNumberOfNSVCs_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MaxNumberOfNSVCs&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.MaxNumberOfNSVCs from an unbound optional field."); } } MaxNumberOfNSVCs_template::MaxNumberOfNSVCs_template(MaxNumberOfNSVCs_template* p_precondition, MaxNumberOfNSVCs_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MaxNumberOfNSVCs_template::MaxNumberOfNSVCs_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; } MaxNumberOfNSVCs_template::MaxNumberOfNSVCs_template(const MaxNumberOfNSVCs_template& other_value) : Base_Template() { copy_template(other_value); } MaxNumberOfNSVCs_template::~MaxNumberOfNSVCs_template() { clean_up(); } MaxNumberOfNSVCs_template& MaxNumberOfNSVCs_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MaxNumberOfNSVCs_template& MaxNumberOfNSVCs_template::operator=(const MaxNumberOfNSVCs& other_value) { clean_up(); copy_value(other_value); return *this; } MaxNumberOfNSVCs_template& MaxNumberOfNSVCs_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MaxNumberOfNSVCs&)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 @NS_Types.MaxNumberOfNSVCs."); } return *this; } MaxNumberOfNSVCs_template& MaxNumberOfNSVCs_template::operator=(const MaxNumberOfNSVCs_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MaxNumberOfNSVCs_template::match(const MaxNumberOfNSVCs& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.maxNumberOfNSVCs().is_bound()) return FALSE; if(!single_value->field_maxNumberOfNSVCs.match(other_value.maxNumberOfNSVCs(), 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 @NS_Types.MaxNumberOfNSVCs."); } return FALSE; } boolean MaxNumberOfNSVCs_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_maxNumberOfNSVCs.is_bound(); } boolean MaxNumberOfNSVCs_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_maxNumberOfNSVCs.is_value(); } void MaxNumberOfNSVCs_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; } MaxNumberOfNSVCs MaxNumberOfNSVCs_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 @NS_Types.MaxNumberOfNSVCs."); MaxNumberOfNSVCs ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_maxNumberOfNSVCs.is_bound()) { ret_val.maxNumberOfNSVCs() = single_value->field_maxNumberOfNSVCs.valueof(); } return ret_val; } void MaxNumberOfNSVCs_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 @NS_Types.MaxNumberOfNSVCs."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MaxNumberOfNSVCs_template[list_length]; } MaxNumberOfNSVCs_template& MaxNumberOfNSVCs_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 @NS_Types.MaxNumberOfNSVCs."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.MaxNumberOfNSVCs."); return value_list.list_value[list_index]; } OCTETSTRING_template& MaxNumberOfNSVCs_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& MaxNumberOfNSVCs_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.MaxNumberOfNSVCs."); return single_value->field_iEI; } OCTETSTRING_template& MaxNumberOfNSVCs_template::maxNumberOfNSVCs() { set_specific(); return single_value->field_maxNumberOfNSVCs; } const OCTETSTRING_template& MaxNumberOfNSVCs_template::maxNumberOfNSVCs() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field maxNumberOfNSVCs of a non-specific template of type @NS_Types.MaxNumberOfNSVCs."); return single_value->field_maxNumberOfNSVCs; } int MaxNumberOfNSVCs_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.MaxNumberOfNSVCs 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 @NS_Types.MaxNumberOfNSVCs 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 @NS_Types.MaxNumberOfNSVCs containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.MaxNumberOfNSVCs containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.MaxNumberOfNSVCs containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.MaxNumberOfNSVCs containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.MaxNumberOfNSVCs containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.MaxNumberOfNSVCs containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.MaxNumberOfNSVCs containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.MaxNumberOfNSVCs."); } return 0; } void MaxNumberOfNSVCs_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", maxNumberOfNSVCs := "); single_value->field_maxNumberOfNSVCs.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 MaxNumberOfNSVCs_template::log_match(const MaxNumberOfNSVCs& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_maxNumberOfNSVCs.match(match_value.maxNumberOfNSVCs(), legacy)){ TTCN_Logger::log_logmatch_info(".maxNumberOfNSVCs"); single_value->field_maxNumberOfNSVCs.log_match(match_value.maxNumberOfNSVCs(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", maxNumberOfNSVCs := "); single_value->field_maxNumberOfNSVCs.log_match(match_value.maxNumberOfNSVCs(), 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 MaxNumberOfNSVCs_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_maxNumberOfNSVCs.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 @NS_Types.MaxNumberOfNSVCs."); } } void MaxNumberOfNSVCs_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_iEI.decode_text(text_buf); single_value->field_maxNumberOfNSVCs.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 MaxNumberOfNSVCs_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 @NS_Types.MaxNumberOfNSVCs."); } } void MaxNumberOfNSVCs_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: { MaxNumberOfNSVCs_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) maxNumberOfNSVCs().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "maxNumberOfNSVCs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { maxNumberOfNSVCs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.MaxNumberOfNSVCs: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MaxNumberOfNSVCs_template* precondition = new MaxNumberOfNSVCs_template; precondition->set_param(*param.get_elem(0)); MaxNumberOfNSVCs_template* implied_template = new MaxNumberOfNSVCs_template; implied_template->set_param(*param.get_elem(1)); *this = MaxNumberOfNSVCs_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.MaxNumberOfNSVCs"); } is_ifpresent = param.get_ifpresent(); } void MaxNumberOfNSVCs_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.MaxNumberOfNSVCs"); single_value->field_maxNumberOfNSVCs.check_restriction(t_res, t_name ? t_name : "@NS_Types.MaxNumberOfNSVCs"); 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 : "@NS_Types.MaxNumberOfNSVCs"); } boolean MaxNumberOfNSVCs_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MaxNumberOfNSVCs_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) numberOfIP__Endpoints().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "numberOfIP_Endpoints")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { numberOfIP__Endpoints().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.NumberOfIP_Endpoints: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.NumberOfIP_Endpoints"); } } void NumberOfIP__Endpoints::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_numberOfIP__Endpoints.encode_text(text_buf); } void NumberOfIP__Endpoints::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_numberOfIP__Endpoints.decode_text(text_buf); } void NumberOfIP__Endpoints::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 NumberOfIP__Endpoints::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 NumberOfIP__Endpoints::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_numberOfIP__Endpoints.RAW_decode(General__Types::OCT2_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 NumberOfIP__Endpoints::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::OCT2_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_numberOfIP__Endpoints.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct NumberOfIP__Endpoints_template::single_value_struct { OCTETSTRING_template field_iEI; OCTETSTRING_template field_numberOfIP__Endpoints; }; void NumberOfIP__Endpoints_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_iEI = ANY_VALUE; single_value->field_numberOfIP__Endpoints = ANY_VALUE; } } } void NumberOfIP__Endpoints_template::copy_value(const NumberOfIP__Endpoints& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.numberOfIP__Endpoints().is_bound()) { single_value->field_numberOfIP__Endpoints = other_value.numberOfIP__Endpoints(); } else { single_value->field_numberOfIP__Endpoints.clean_up(); } set_selection(SPECIFIC_VALUE); } void NumberOfIP__Endpoints_template::copy_template(const NumberOfIP__Endpoints_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.numberOfIP__Endpoints().get_selection()) { single_value->field_numberOfIP__Endpoints = other_value.numberOfIP__Endpoints(); } else { single_value->field_numberOfIP__Endpoints.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 NumberOfIP__Endpoints_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 NumberOfIP__Endpoints_template(*other_value.implication_.precondition); implication_.implied_template = new NumberOfIP__Endpoints_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 @NS_Types.NumberOfIP_Endpoints."); break; } set_selection(other_value); } NumberOfIP__Endpoints_template::NumberOfIP__Endpoints_template() { } NumberOfIP__Endpoints_template::NumberOfIP__Endpoints_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } NumberOfIP__Endpoints_template::NumberOfIP__Endpoints_template(const NumberOfIP__Endpoints& other_value) { copy_value(other_value); } NumberOfIP__Endpoints_template::NumberOfIP__Endpoints_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NumberOfIP__Endpoints&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.NumberOfIP_Endpoints from an unbound optional field."); } } NumberOfIP__Endpoints_template::NumberOfIP__Endpoints_template(NumberOfIP__Endpoints_template* p_precondition, NumberOfIP__Endpoints_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } NumberOfIP__Endpoints_template::NumberOfIP__Endpoints_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; } NumberOfIP__Endpoints_template::NumberOfIP__Endpoints_template(const NumberOfIP__Endpoints_template& other_value) : Base_Template() { copy_template(other_value); } NumberOfIP__Endpoints_template::~NumberOfIP__Endpoints_template() { clean_up(); } NumberOfIP__Endpoints_template& NumberOfIP__Endpoints_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } NumberOfIP__Endpoints_template& NumberOfIP__Endpoints_template::operator=(const NumberOfIP__Endpoints& other_value) { clean_up(); copy_value(other_value); return *this; } NumberOfIP__Endpoints_template& NumberOfIP__Endpoints_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NumberOfIP__Endpoints&)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 @NS_Types.NumberOfIP_Endpoints."); } return *this; } NumberOfIP__Endpoints_template& NumberOfIP__Endpoints_template::operator=(const NumberOfIP__Endpoints_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean NumberOfIP__Endpoints_template::match(const NumberOfIP__Endpoints& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.numberOfIP__Endpoints().is_bound()) return FALSE; if(!single_value->field_numberOfIP__Endpoints.match(other_value.numberOfIP__Endpoints(), 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 @NS_Types.NumberOfIP_Endpoints."); } return FALSE; } boolean NumberOfIP__Endpoints_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_numberOfIP__Endpoints.is_bound(); } boolean NumberOfIP__Endpoints_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_numberOfIP__Endpoints.is_value(); } void NumberOfIP__Endpoints_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; } NumberOfIP__Endpoints NumberOfIP__Endpoints_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 @NS_Types.NumberOfIP_Endpoints."); NumberOfIP__Endpoints ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_numberOfIP__Endpoints.is_bound()) { ret_val.numberOfIP__Endpoints() = single_value->field_numberOfIP__Endpoints.valueof(); } return ret_val; } void NumberOfIP__Endpoints_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 @NS_Types.NumberOfIP_Endpoints."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new NumberOfIP__Endpoints_template[list_length]; } NumberOfIP__Endpoints_template& NumberOfIP__Endpoints_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 @NS_Types.NumberOfIP_Endpoints."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.NumberOfIP_Endpoints."); return value_list.list_value[list_index]; } OCTETSTRING_template& NumberOfIP__Endpoints_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& NumberOfIP__Endpoints_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.NumberOfIP_Endpoints."); return single_value->field_iEI; } OCTETSTRING_template& NumberOfIP__Endpoints_template::numberOfIP__Endpoints() { set_specific(); return single_value->field_numberOfIP__Endpoints; } const OCTETSTRING_template& NumberOfIP__Endpoints_template::numberOfIP__Endpoints() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field numberOfIP_Endpoints of a non-specific template of type @NS_Types.NumberOfIP_Endpoints."); return single_value->field_numberOfIP__Endpoints; } int NumberOfIP__Endpoints_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NumberOfIP_Endpoints 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 @NS_Types.NumberOfIP_Endpoints 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 @NS_Types.NumberOfIP_Endpoints containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NumberOfIP_Endpoints containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NumberOfIP_Endpoints containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NumberOfIP_Endpoints containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NumberOfIP_Endpoints containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NumberOfIP_Endpoints containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NumberOfIP_Endpoints containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.NumberOfIP_Endpoints."); } return 0; } void NumberOfIP__Endpoints_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", numberOfIP_Endpoints := "); single_value->field_numberOfIP__Endpoints.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 NumberOfIP__Endpoints_template::log_match(const NumberOfIP__Endpoints& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_numberOfIP__Endpoints.match(match_value.numberOfIP__Endpoints(), legacy)){ TTCN_Logger::log_logmatch_info(".numberOfIP_Endpoints"); single_value->field_numberOfIP__Endpoints.log_match(match_value.numberOfIP__Endpoints(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", numberOfIP_Endpoints := "); single_value->field_numberOfIP__Endpoints.log_match(match_value.numberOfIP__Endpoints(), 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 NumberOfIP__Endpoints_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_numberOfIP__Endpoints.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 @NS_Types.NumberOfIP_Endpoints."); } } void NumberOfIP__Endpoints_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_iEI.decode_text(text_buf); single_value->field_numberOfIP__Endpoints.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 NumberOfIP__Endpoints_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 @NS_Types.NumberOfIP_Endpoints."); } } void NumberOfIP__Endpoints_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: { NumberOfIP__Endpoints_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) numberOfIP__Endpoints().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "numberOfIP_Endpoints")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { numberOfIP__Endpoints().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.NumberOfIP_Endpoints: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { NumberOfIP__Endpoints_template* precondition = new NumberOfIP__Endpoints_template; precondition->set_param(*param.get_elem(0)); NumberOfIP__Endpoints_template* implied_template = new NumberOfIP__Endpoints_template; implied_template->set_param(*param.get_elem(1)); *this = NumberOfIP__Endpoints_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.NumberOfIP_Endpoints"); } is_ifpresent = param.get_ifpresent(); } void NumberOfIP__Endpoints_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.NumberOfIP_Endpoints"); single_value->field_numberOfIP__Endpoints.check_restriction(t_res, t_name ? t_name : "@NS_Types.NumberOfIP_Endpoints"); 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 : "@NS_Types.NumberOfIP_Endpoints"); } boolean NumberOfIP__Endpoints_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean NumberOfIP__Endpoints_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nSEI().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.NSEI_NS: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.NSEI_NS"); } } void NSEI__NS::encode_text(Text_Buf& text_buf) const { field_iEI.encode_text(text_buf); field_ext.encode_text(text_buf); field_lengthIndicator.encode_text(text_buf); field_nSEI.encode_text(text_buf); } void NSEI__NS::decode_text(Text_Buf& text_buf) { field_iEI.decode_text(text_buf); field_ext.decode_text(text_buf); field_lengthIndicator.decode_text(text_buf); field_nSEI.decode_text(text_buf); } void NSEI__NS::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 NSEI__NS::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 NSEI__NS::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; int selected_field = -1; if(p_td.raw->top_bit_order==TOP_BIT_INHERITED)local_top_order=top_bit_ord; else if(p_td.raw->top_bit_order==TOP_BIT_RIGHT)local_top_order=ORDER_MSB; else local_top_order=ORDER_LSB; int value_of_length_field2 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_iEI.RAW_decode(General__Types::OCT1_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, NSEI__NS_ext_descr_.raw->forceomit); decoded_field_length = field_ext.RAW_decode(NSEI__NS_ext_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_ext == bs_0) selected_field = 0; else if (field_ext == bs_1) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_2_force_omit(2, force_omit, NSEI__NS_lengthIndicator_descr_.raw->forceomit); decoded_field_length = field_lengthIndicator.RAW_decode(NSEI__NS_lengthIndicator_descr_, p_buf, limit, local_top_order, no_err, selected_field, 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()); switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: { INTEGER tmp1 = field_lengthIndicator.length1().convert_to_Integer(LIN1__2_length1_descr_); field_lengthIndicator.length1() = tmp1; value_of_length_field2 += tmp1.get_long_long_val() * 8; break; } case LIN1__2::ALT_length2: { INTEGER tmp2 = field_lengthIndicator.length2().convert_to_Integer(LIN1__2_length2_descr_); field_lengthIndicator.length2() = tmp2; value_of_length_field2 += tmp2.get_long_long_val() * 8; break; } default: value_of_length_field2 = 0; } RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_nSEI.RAW_decode(General__Types::OCT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), 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()); value_of_length_field2 -= decoded_field_length; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int NSEI__NS::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NSEI__NS_ext_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NSEI__NS_lengthIndicator_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::OCT2_descr_.raw); encoded_length += field_iEI.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_ext.RAW_encode(NSEI__NS_ext_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_lengthIndicator.RAW_encode(NSEI__NS_lengthIndicator_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_nSEI.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[3]); { int sel_field = 0; while (myleaf.body.node.nodes[2]->body.node.nodes[sel_field] == NULL) { sel_field++; } const TTCN_Typedescriptor_t* tmpTypeDesc = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr; int tmp_length = myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length; delete myleaf.body.node.nodes[2]->body.node.nodes[sel_field]; myleaf.body.node.nodes[2]->body.node.nodes[sel_field] = new RAW_enc_tree(TRUE, myleaf.body.node.nodes[2], &(myleaf.body.node.nodes[2]->curr_pos), sel_field, tmpTypeDesc->raw); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->length = tmp_length; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calc = CALC_LENGTH; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->coding_descr = tmpTypeDesc; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[2]->body.node.nodes[sel_field]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos; } switch (field_lengthIndicator.get_selection()) { case LIN1__2::ALT_length1: if (field_ext != bs_0) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_0.RAW_encode(NSEI__NS_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; case LIN1__2::ALT_length2: if (field_ext != bs_1) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 1 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_1.RAW_encode(NSEI__NS_ext_descr_,*temp_leaf); else TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); free_tree_pos(pr_pos.pos); } break; default:; } return myleaf.length = encoded_length; } struct NSEI__NS_template::single_value_struct { OCTETSTRING_template field_iEI; BITSTRING_template field_ext; LIN1__2_template field_lengthIndicator; OCTETSTRING_template field_nSEI; }; void NSEI__NS_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_iEI = ANY_VALUE; single_value->field_ext = ANY_VALUE; single_value->field_lengthIndicator = ANY_VALUE; single_value->field_nSEI = ANY_VALUE; } } } void NSEI__NS_template::copy_value(const NSEI__NS& other_value) { single_value = new single_value_struct; if (other_value.iEI().is_bound()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (other_value.ext().is_bound()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (other_value.lengthIndicator().is_bound()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (other_value.nSEI().is_bound()) { single_value->field_nSEI = other_value.nSEI(); } else { single_value->field_nSEI.clean_up(); } set_selection(SPECIFIC_VALUE); } void NSEI__NS_template::copy_template(const NSEI__NS_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.iEI().get_selection()) { single_value->field_iEI = other_value.iEI(); } else { single_value->field_iEI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ext().get_selection()) { single_value->field_ext = other_value.ext(); } else { single_value->field_ext.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthIndicator().get_selection()) { single_value->field_lengthIndicator = other_value.lengthIndicator(); } else { single_value->field_lengthIndicator.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI().get_selection()) { single_value->field_nSEI = other_value.nSEI(); } else { single_value->field_nSEI.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 NSEI__NS_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 NSEI__NS_template(*other_value.implication_.precondition); implication_.implied_template = new NSEI__NS_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 @NS_Types.NSEI_NS."); break; } set_selection(other_value); } NSEI__NS_template::NSEI__NS_template() { } NSEI__NS_template::NSEI__NS_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } NSEI__NS_template::NSEI__NS_template(const NSEI__NS& other_value) { copy_value(other_value); } NSEI__NS_template::NSEI__NS_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NSEI__NS&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.NSEI_NS from an unbound optional field."); } } NSEI__NS_template::NSEI__NS_template(NSEI__NS_template* p_precondition, NSEI__NS_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } NSEI__NS_template::NSEI__NS_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; } NSEI__NS_template::NSEI__NS_template(const NSEI__NS_template& other_value) : Base_Template() { copy_template(other_value); } NSEI__NS_template::~NSEI__NS_template() { clean_up(); } NSEI__NS_template& NSEI__NS_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } NSEI__NS_template& NSEI__NS_template::operator=(const NSEI__NS& other_value) { clean_up(); copy_value(other_value); return *this; } NSEI__NS_template& NSEI__NS_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NSEI__NS&)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 @NS_Types.NSEI_NS."); } return *this; } NSEI__NS_template& NSEI__NS_template::operator=(const NSEI__NS_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean NSEI__NS_template::match(const NSEI__NS& 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.iEI().is_bound()) return FALSE; if(!single_value->field_iEI.match(other_value.iEI(), legacy))return FALSE; if(!other_value.ext().is_bound()) return FALSE; if(!single_value->field_ext.match(other_value.ext(), legacy))return FALSE; if(!other_value.lengthIndicator().is_bound()) return FALSE; if(!single_value->field_lengthIndicator.match(other_value.lengthIndicator(), legacy))return FALSE; if(!other_value.nSEI().is_bound()) return FALSE; if(!single_value->field_nSEI.match(other_value.nSEI(), 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 @NS_Types.NSEI_NS."); } return FALSE; } boolean NSEI__NS_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_iEI.is_bound() || single_value->field_ext.is_bound() || single_value->field_lengthIndicator.is_bound() || single_value->field_nSEI.is_bound(); } boolean NSEI__NS_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_iEI.is_value() && single_value->field_ext.is_value() && single_value->field_lengthIndicator.is_value() && single_value->field_nSEI.is_value(); } void NSEI__NS_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; } NSEI__NS NSEI__NS_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 @NS_Types.NSEI_NS."); NSEI__NS ret_val; if (single_value->field_iEI.is_bound()) { ret_val.iEI() = single_value->field_iEI.valueof(); } if (single_value->field_ext.is_bound()) { ret_val.ext() = single_value->field_ext.valueof(); } if (single_value->field_lengthIndicator.is_bound()) { ret_val.lengthIndicator() = single_value->field_lengthIndicator.valueof(); } if (single_value->field_nSEI.is_bound()) { ret_val.nSEI() = single_value->field_nSEI.valueof(); } return ret_val; } void NSEI__NS_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 @NS_Types.NSEI_NS."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new NSEI__NS_template[list_length]; } NSEI__NS_template& NSEI__NS_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 @NS_Types.NSEI_NS."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.NSEI_NS."); return value_list.list_value[list_index]; } OCTETSTRING_template& NSEI__NS_template::iEI() { set_specific(); return single_value->field_iEI; } const OCTETSTRING_template& NSEI__NS_template::iEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iEI of a non-specific template of type @NS_Types.NSEI_NS."); return single_value->field_iEI; } BITSTRING_template& NSEI__NS_template::ext() { set_specific(); return single_value->field_ext; } const BITSTRING_template& NSEI__NS_template::ext() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ext of a non-specific template of type @NS_Types.NSEI_NS."); return single_value->field_ext; } LIN1__2_template& NSEI__NS_template::lengthIndicator() { set_specific(); return single_value->field_lengthIndicator; } const LIN1__2_template& NSEI__NS_template::lengthIndicator() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthIndicator of a non-specific template of type @NS_Types.NSEI_NS."); return single_value->field_lengthIndicator; } OCTETSTRING_template& NSEI__NS_template::nSEI() { set_specific(); return single_value->field_nSEI; } const OCTETSTRING_template& NSEI__NS_template::nSEI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI of a non-specific template of type @NS_Types.NSEI_NS."); return single_value->field_nSEI; } int NSEI__NS_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NSEI_NS 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 @NS_Types.NSEI_NS 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 @NS_Types.NSEI_NS containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NSEI_NS containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NSEI_NS containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NSEI_NS containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NSEI_NS containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NSEI_NS containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NSEI_NS containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.NSEI_NS."); } return 0; } void NSEI__NS_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ iEI := "); single_value->field_iEI.log(); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log(); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log(); TTCN_Logger::log_event_str(", nSEI := "); single_value->field_nSEI.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 NSEI__NS_template::log_match(const NSEI__NS& 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_iEI.match(match_value.iEI(), legacy)){ TTCN_Logger::log_logmatch_info(".iEI"); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ext.match(match_value.ext(), legacy)){ TTCN_Logger::log_logmatch_info(".ext"); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthIndicator.match(match_value.lengthIndicator(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthIndicator"); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI.match(match_value.nSEI(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI"); single_value->field_nSEI.log_match(match_value.nSEI(), 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("{ iEI := "); single_value->field_iEI.log_match(match_value.iEI(), legacy); TTCN_Logger::log_event_str(", ext := "); single_value->field_ext.log_match(match_value.ext(), legacy); TTCN_Logger::log_event_str(", lengthIndicator := "); single_value->field_lengthIndicator.log_match(match_value.lengthIndicator(), legacy); TTCN_Logger::log_event_str(", nSEI := "); single_value->field_nSEI.log_match(match_value.nSEI(), 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 NSEI__NS_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_iEI.encode_text(text_buf); single_value->field_ext.encode_text(text_buf); single_value->field_lengthIndicator.encode_text(text_buf); single_value->field_nSEI.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 @NS_Types.NSEI_NS."); } } void NSEI__NS_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_iEI.decode_text(text_buf); single_value->field_ext.decode_text(text_buf); single_value->field_lengthIndicator.decode_text(text_buf); single_value->field_nSEI.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 NSEI__NS_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 @NS_Types.NSEI_NS."); } } void NSEI__NS_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: { NSEI__NS_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) iEI().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ext().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lengthIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nSEI().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(), "iEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.NSEI_NS: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { NSEI__NS_template* precondition = new NSEI__NS_template; precondition->set_param(*param.get_elem(0)); NSEI__NS_template* implied_template = new NSEI__NS_template; implied_template->set_param(*param.get_elem(1)); *this = NSEI__NS_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.NSEI_NS"); } is_ifpresent = param.get_ifpresent(); } void NSEI__NS_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_iEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.NSEI_NS"); single_value->field_ext.check_restriction(t_res, t_name ? t_name : "@NS_Types.NSEI_NS"); single_value->field_lengthIndicator.check_restriction(t_res, t_name ? t_name : "@NS_Types.NSEI_NS"); single_value->field_nSEI.check_restriction(t_res, t_name ? t_name : "@NS_Types.NSEI_NS"); 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 : "@NS_Types.NSEI_NS"); } boolean NSEI__NS_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean NSEI__NS_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) rBit().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cBit().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)); 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(), "rBit")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rBit().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cBit")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cBit().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_idxerror("Non existent field name in type @NS_Types.NS_SDU_ControlBits: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.NS_SDU_ControlBits"); } } void NS__SDU__ControlBits::encode_text(Text_Buf& text_buf) const { field_rBit.encode_text(text_buf); field_cBit.encode_text(text_buf); field_spare.encode_text(text_buf); } void NS__SDU__ControlBits::decode_text(Text_Buf& text_buf) { field_rBit.decode_text(text_buf); field_cBit.decode_text(text_buf); field_spare.decode_text(text_buf); } void NS__SDU__ControlBits::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 NS__SDU__ControlBits::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 NS__SDU__ControlBits::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, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_rBit.RAW_decode(General__Types::BIT1_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, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_cBit.RAW_decode(General__Types::BIT1_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, General__Types::BIT6_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT6_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int NS__SDU__ControlBits::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 3; myleaf.body.node.nodes = init_nodes_of_enc_tree(3); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT6_descr_.raw); encoded_length += field_rBit.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_cBit.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_spare.RAW_encode(General__Types::BIT6_descr_, *myleaf.body.node.nodes[2]); return myleaf.length = encoded_length; } struct NS__SDU__ControlBits_template::single_value_struct { BITSTRING_template field_rBit; BITSTRING_template field_cBit; BITSTRING_template field_spare; }; void NS__SDU__ControlBits_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_rBit = ANY_VALUE; single_value->field_cBit = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void NS__SDU__ControlBits_template::copy_value(const NS__SDU__ControlBits& other_value) { single_value = new single_value_struct; if (other_value.rBit().is_bound()) { single_value->field_rBit = other_value.rBit(); } else { single_value->field_rBit.clean_up(); } if (other_value.cBit().is_bound()) { single_value->field_cBit = other_value.cBit(); } else { single_value->field_cBit.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } set_selection(SPECIFIC_VALUE); } void NS__SDU__ControlBits_template::copy_template(const NS__SDU__ControlBits_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.rBit().get_selection()) { single_value->field_rBit = other_value.rBit(); } else { single_value->field_rBit.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cBit().get_selection()) { single_value->field_cBit = other_value.cBit(); } else { single_value->field_cBit.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.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 NS__SDU__ControlBits_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 NS__SDU__ControlBits_template(*other_value.implication_.precondition); implication_.implied_template = new NS__SDU__ControlBits_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 @NS_Types.NS_SDU_ControlBits."); break; } set_selection(other_value); } NS__SDU__ControlBits_template::NS__SDU__ControlBits_template() { } NS__SDU__ControlBits_template::NS__SDU__ControlBits_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } NS__SDU__ControlBits_template::NS__SDU__ControlBits_template(const NS__SDU__ControlBits& other_value) { copy_value(other_value); } NS__SDU__ControlBits_template::NS__SDU__ControlBits_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NS__SDU__ControlBits&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.NS_SDU_ControlBits from an unbound optional field."); } } NS__SDU__ControlBits_template::NS__SDU__ControlBits_template(NS__SDU__ControlBits_template* p_precondition, NS__SDU__ControlBits_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } NS__SDU__ControlBits_template::NS__SDU__ControlBits_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; } NS__SDU__ControlBits_template::NS__SDU__ControlBits_template(const NS__SDU__ControlBits_template& other_value) : Base_Template() { copy_template(other_value); } NS__SDU__ControlBits_template::~NS__SDU__ControlBits_template() { clean_up(); } NS__SDU__ControlBits_template& NS__SDU__ControlBits_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } NS__SDU__ControlBits_template& NS__SDU__ControlBits_template::operator=(const NS__SDU__ControlBits& other_value) { clean_up(); copy_value(other_value); return *this; } NS__SDU__ControlBits_template& NS__SDU__ControlBits_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NS__SDU__ControlBits&)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 @NS_Types.NS_SDU_ControlBits."); } return *this; } NS__SDU__ControlBits_template& NS__SDU__ControlBits_template::operator=(const NS__SDU__ControlBits_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean NS__SDU__ControlBits_template::match(const NS__SDU__ControlBits& 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.rBit().is_bound()) return FALSE; if(!single_value->field_rBit.match(other_value.rBit(), legacy))return FALSE; if(!other_value.cBit().is_bound()) return FALSE; if(!single_value->field_cBit.match(other_value.cBit(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), 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 @NS_Types.NS_SDU_ControlBits."); } return FALSE; } boolean NS__SDU__ControlBits_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_rBit.is_bound() || single_value->field_cBit.is_bound() || single_value->field_spare.is_bound(); } boolean NS__SDU__ControlBits_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_rBit.is_value() && single_value->field_cBit.is_value() && single_value->field_spare.is_value(); } void NS__SDU__ControlBits_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; } NS__SDU__ControlBits NS__SDU__ControlBits_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 @NS_Types.NS_SDU_ControlBits."); NS__SDU__ControlBits ret_val; if (single_value->field_rBit.is_bound()) { ret_val.rBit() = single_value->field_rBit.valueof(); } if (single_value->field_cBit.is_bound()) { ret_val.cBit() = single_value->field_cBit.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void NS__SDU__ControlBits_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 @NS_Types.NS_SDU_ControlBits."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new NS__SDU__ControlBits_template[list_length]; } NS__SDU__ControlBits_template& NS__SDU__ControlBits_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 @NS_Types.NS_SDU_ControlBits."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.NS_SDU_ControlBits."); return value_list.list_value[list_index]; } BITSTRING_template& NS__SDU__ControlBits_template::rBit() { set_specific(); return single_value->field_rBit; } const BITSTRING_template& NS__SDU__ControlBits_template::rBit() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rBit of a non-specific template of type @NS_Types.NS_SDU_ControlBits."); return single_value->field_rBit; } BITSTRING_template& NS__SDU__ControlBits_template::cBit() { set_specific(); return single_value->field_cBit; } const BITSTRING_template& NS__SDU__ControlBits_template::cBit() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cBit of a non-specific template of type @NS_Types.NS_SDU_ControlBits."); return single_value->field_cBit; } BITSTRING_template& NS__SDU__ControlBits_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& NS__SDU__ControlBits_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @NS_Types.NS_SDU_ControlBits."); return single_value->field_spare; } int NS__SDU__ControlBits_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_SDU_ControlBits which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 3; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.NS_SDU_ControlBits 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 @NS_Types.NS_SDU_ControlBits containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_SDU_ControlBits containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_SDU_ControlBits containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_SDU_ControlBits containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_SDU_ControlBits containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_SDU_ControlBits containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.NS_SDU_ControlBits containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.NS_SDU_ControlBits."); } return 0; } void NS__SDU__ControlBits_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ rBit := "); single_value->field_rBit.log(); TTCN_Logger::log_event_str(", cBit := "); single_value->field_cBit.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.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 NS__SDU__ControlBits_template::log_match(const NS__SDU__ControlBits& 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_rBit.match(match_value.rBit(), legacy)){ TTCN_Logger::log_logmatch_info(".rBit"); single_value->field_rBit.log_match(match_value.rBit(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cBit.match(match_value.cBit(), legacy)){ TTCN_Logger::log_logmatch_info(".cBit"); single_value->field_cBit.log_match(match_value.cBit(), 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); } }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("{ rBit := "); single_value->field_rBit.log_match(match_value.rBit(), legacy); TTCN_Logger::log_event_str(", cBit := "); single_value->field_cBit.log_match(match_value.cBit(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), 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 NS__SDU__ControlBits_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_rBit.encode_text(text_buf); single_value->field_cBit.encode_text(text_buf); single_value->field_spare.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 @NS_Types.NS_SDU_ControlBits."); } } void NS__SDU__ControlBits_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_rBit.decode_text(text_buf); single_value->field_cBit.decode_text(text_buf); single_value->field_spare.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 NS__SDU__ControlBits_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 @NS_Types.NS_SDU_ControlBits."); } } void NS__SDU__ControlBits_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: { NS__SDU__ControlBits_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) rBit().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cBit().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)); 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(), "rBit")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rBit().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cBit")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cBit().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_idxerror("Non existent field name in type @NS_Types.NS_SDU_ControlBits: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { NS__SDU__ControlBits_template* precondition = new NS__SDU__ControlBits_template; precondition->set_param(*param.get_elem(0)); NS__SDU__ControlBits_template* implied_template = new NS__SDU__ControlBits_template; implied_template->set_param(*param.get_elem(1)); *this = NS__SDU__ControlBits_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.NS_SDU_ControlBits"); } is_ifpresent = param.get_ifpresent(); } void NS__SDU__ControlBits_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_rBit.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_SDU_ControlBits"); single_value->field_cBit.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_SDU_ControlBits"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@NS_Types.NS_SDU_ControlBits"); 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 : "@NS_Types.NS_SDU_ControlBits"); } boolean NS__SDU__ControlBits_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean NS__SDU__ControlBits_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) nsPduType().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Alive: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Alive"); } } void PDU__NS__Alive::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); } void PDU__NS__Alive::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); } void PDU__NS__Alive::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 PDU__NS__Alive::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 PDU__NS__Alive::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__NS__Alive::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 1; myleaf.body.node.nodes = init_nodes_of_enc_tree(1); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); return myleaf.length = encoded_length; } struct PDU__NS__Alive_template::single_value_struct { OCTETSTRING_template field_nsPduType; }; void PDU__NS__Alive_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_nsPduType = ANY_VALUE; } } } void PDU__NS__Alive_template::copy_value(const PDU__NS__Alive& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Alive_template::copy_template(const PDU__NS__Alive_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.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 PDU__NS__Alive_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 PDU__NS__Alive_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__Alive_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 @NS_Types.PDU_NS_Alive."); break; } set_selection(other_value); } PDU__NS__Alive_template::PDU__NS__Alive_template() { } PDU__NS__Alive_template::PDU__NS__Alive_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Alive_template::PDU__NS__Alive_template(const PDU__NS__Alive& other_value) { copy_value(other_value); } PDU__NS__Alive_template::PDU__NS__Alive_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Alive&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Alive from an unbound optional field."); } } PDU__NS__Alive_template::PDU__NS__Alive_template(PDU__NS__Alive_template* p_precondition, PDU__NS__Alive_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Alive_template::PDU__NS__Alive_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; } PDU__NS__Alive_template::PDU__NS__Alive_template(const PDU__NS__Alive_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Alive_template::~PDU__NS__Alive_template() { clean_up(); } PDU__NS__Alive_template& PDU__NS__Alive_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Alive_template& PDU__NS__Alive_template::operator=(const PDU__NS__Alive& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Alive_template& PDU__NS__Alive_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Alive&)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 @NS_Types.PDU_NS_Alive."); } return *this; } PDU__NS__Alive_template& PDU__NS__Alive_template::operator=(const PDU__NS__Alive_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Alive_template::match(const PDU__NS__Alive& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), 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 @NS_Types.PDU_NS_Alive."); } return FALSE; } boolean PDU__NS__Alive_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound(); } boolean PDU__NS__Alive_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value(); } void PDU__NS__Alive_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; } PDU__NS__Alive PDU__NS__Alive_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 @NS_Types.PDU_NS_Alive."); PDU__NS__Alive ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } return ret_val; } void PDU__NS__Alive_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 @NS_Types.PDU_NS_Alive."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Alive_template[list_length]; } PDU__NS__Alive_template& PDU__NS__Alive_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 @NS_Types.PDU_NS_Alive."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Alive."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Alive_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Alive_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Alive."); return single_value->field_nsPduType; } int PDU__NS__Alive_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 1; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive 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 @NS_Types.PDU_NS_Alive containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Alive."); } return 0; } void PDU__NS__Alive_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.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 PDU__NS__Alive_template::log_match(const PDU__NS__Alive& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), 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("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), 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 PDU__NS__Alive_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.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 @NS_Types.PDU_NS_Alive."); } } void PDU__NS__Alive_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_nsPduType.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 PDU__NS__Alive_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 @NS_Types.PDU_NS_Alive."); } } void PDU__NS__Alive_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: { PDU__NS__Alive_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) nsPduType().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Alive: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Alive_template* precondition = new PDU__NS__Alive_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Alive_template* implied_template = new PDU__NS__Alive_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Alive_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Alive"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__Alive_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Alive"); 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 : "@NS_Types.PDU_NS_Alive"); } boolean PDU__NS__Alive_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__Alive_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) nsPduType().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Alive_Ack: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Alive_Ack"); } } void PDU__NS__Alive__Ack::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); } void PDU__NS__Alive__Ack::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); } void PDU__NS__Alive__Ack::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 PDU__NS__Alive__Ack::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 PDU__NS__Alive__Ack::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__NS__Alive__Ack::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 1; myleaf.body.node.nodes = init_nodes_of_enc_tree(1); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); return myleaf.length = encoded_length; } struct PDU__NS__Alive__Ack_template::single_value_struct { OCTETSTRING_template field_nsPduType; }; void PDU__NS__Alive__Ack_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_nsPduType = ANY_VALUE; } } } void PDU__NS__Alive__Ack_template::copy_value(const PDU__NS__Alive__Ack& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Alive__Ack_template::copy_template(const PDU__NS__Alive__Ack_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.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 PDU__NS__Alive__Ack_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 PDU__NS__Alive__Ack_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__Alive__Ack_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 @NS_Types.PDU_NS_Alive_Ack."); break; } set_selection(other_value); } PDU__NS__Alive__Ack_template::PDU__NS__Alive__Ack_template() { } PDU__NS__Alive__Ack_template::PDU__NS__Alive__Ack_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Alive__Ack_template::PDU__NS__Alive__Ack_template(const PDU__NS__Alive__Ack& other_value) { copy_value(other_value); } PDU__NS__Alive__Ack_template::PDU__NS__Alive__Ack_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Alive__Ack&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Alive_Ack from an unbound optional field."); } } PDU__NS__Alive__Ack_template::PDU__NS__Alive__Ack_template(PDU__NS__Alive__Ack_template* p_precondition, PDU__NS__Alive__Ack_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Alive__Ack_template::PDU__NS__Alive__Ack_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; } PDU__NS__Alive__Ack_template::PDU__NS__Alive__Ack_template(const PDU__NS__Alive__Ack_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Alive__Ack_template::~PDU__NS__Alive__Ack_template() { clean_up(); } PDU__NS__Alive__Ack_template& PDU__NS__Alive__Ack_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Alive__Ack_template& PDU__NS__Alive__Ack_template::operator=(const PDU__NS__Alive__Ack& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Alive__Ack_template& PDU__NS__Alive__Ack_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Alive__Ack&)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 @NS_Types.PDU_NS_Alive_Ack."); } return *this; } PDU__NS__Alive__Ack_template& PDU__NS__Alive__Ack_template::operator=(const PDU__NS__Alive__Ack_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Alive__Ack_template::match(const PDU__NS__Alive__Ack& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), 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 @NS_Types.PDU_NS_Alive_Ack."); } return FALSE; } boolean PDU__NS__Alive__Ack_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound(); } boolean PDU__NS__Alive__Ack_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value(); } void PDU__NS__Alive__Ack_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; } PDU__NS__Alive__Ack PDU__NS__Alive__Ack_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 @NS_Types.PDU_NS_Alive_Ack."); PDU__NS__Alive__Ack ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } return ret_val; } void PDU__NS__Alive__Ack_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 @NS_Types.PDU_NS_Alive_Ack."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Alive__Ack_template[list_length]; } PDU__NS__Alive__Ack_template& PDU__NS__Alive__Ack_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 @NS_Types.PDU_NS_Alive_Ack."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Alive_Ack."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Alive__Ack_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Alive__Ack_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Alive_Ack."); return single_value->field_nsPduType; } int PDU__NS__Alive__Ack_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive_Ack which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 1; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive_Ack 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 @NS_Types.PDU_NS_Alive_Ack containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive_Ack containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive_Ack containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive_Ack containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive_Ack containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive_Ack containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Alive_Ack containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Alive_Ack."); } return 0; } void PDU__NS__Alive__Ack_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.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 PDU__NS__Alive__Ack_template::log_match(const PDU__NS__Alive__Ack& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), 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("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), 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 PDU__NS__Alive__Ack_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.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 @NS_Types.PDU_NS_Alive_Ack."); } } void PDU__NS__Alive__Ack_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_nsPduType.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 PDU__NS__Alive__Ack_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 @NS_Types.PDU_NS_Alive_Ack."); } } void PDU__NS__Alive__Ack_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: { PDU__NS__Alive__Ack_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) nsPduType().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Alive_Ack: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Alive__Ack_template* precondition = new PDU__NS__Alive__Ack_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Alive__Ack_template* implied_template = new PDU__NS__Alive__Ack_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Alive__Ack_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Alive_Ack"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__Alive__Ack_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Alive_Ack"); 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 : "@NS_Types.PDU_NS_Alive_Ack"); } boolean PDU__NS__Alive__Ack_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__Alive__Ack_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Block: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Block"); } } void PDU__NS__Block::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_causeNS.encode_text(text_buf); field_nS__VCI.encode_text(text_buf); } void PDU__NS__Block::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_causeNS.decode_text(text_buf); field_nS__VCI.decode_text(text_buf); } void PDU__NS__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 PDU__NS__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 PDU__NS__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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, CauseNS_descr_.raw->forceomit); decoded_field_length = field_causeNS.RAW_decode(CauseNS_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, NS__VCI_descr_.raw->forceomit); decoded_field_length = field_nS__VCI.RAW_decode(NS__VCI_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__NS__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 = 3; myleaf.body.node.nodes = init_nodes_of_enc_tree(3); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CauseNS_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NS__VCI_descr_.raw); encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_causeNS.RAW_encode(CauseNS_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_nS__VCI.RAW_encode(NS__VCI_descr_, *myleaf.body.node.nodes[2]); return myleaf.length = encoded_length; } struct PDU__NS__Block_template::single_value_struct { OCTETSTRING_template field_nsPduType; CauseNS_template field_causeNS; NS__VCI_template field_nS__VCI; }; void PDU__NS__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_nsPduType = ANY_VALUE; single_value->field_causeNS = ANY_VALUE; single_value->field_nS__VCI = ANY_VALUE; } } } void PDU__NS__Block_template::copy_value(const PDU__NS__Block& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.causeNS().is_bound()) { single_value->field_causeNS = other_value.causeNS(); } else { single_value->field_causeNS.clean_up(); } if (other_value.nS__VCI().is_bound()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Block_template::copy_template(const PDU__NS__Block_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.causeNS().get_selection()) { single_value->field_causeNS = other_value.causeNS(); } else { single_value->field_causeNS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nS__VCI().get_selection()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.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 PDU__NS__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 PDU__NS__Block_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__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 @NS_Types.PDU_NS_Block."); break; } set_selection(other_value); } PDU__NS__Block_template::PDU__NS__Block_template() { } PDU__NS__Block_template::PDU__NS__Block_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Block_template::PDU__NS__Block_template(const PDU__NS__Block& other_value) { copy_value(other_value); } PDU__NS__Block_template::PDU__NS__Block_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Block&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Block from an unbound optional field."); } } PDU__NS__Block_template::PDU__NS__Block_template(PDU__NS__Block_template* p_precondition, PDU__NS__Block_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Block_template::PDU__NS__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; } PDU__NS__Block_template::PDU__NS__Block_template(const PDU__NS__Block_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Block_template::~PDU__NS__Block_template() { clean_up(); } PDU__NS__Block_template& PDU__NS__Block_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Block_template& PDU__NS__Block_template::operator=(const PDU__NS__Block& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Block_template& PDU__NS__Block_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__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 @NS_Types.PDU_NS_Block."); } return *this; } PDU__NS__Block_template& PDU__NS__Block_template::operator=(const PDU__NS__Block_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Block_template::match(const PDU__NS__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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.causeNS().is_bound()) return FALSE; if(!single_value->field_causeNS.match(other_value.causeNS(), legacy))return FALSE; if(!other_value.nS__VCI().is_bound()) return FALSE; if(!single_value->field_nS__VCI.match(other_value.nS__VCI(), 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 @NS_Types.PDU_NS_Block."); } return FALSE; } boolean PDU__NS__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_nsPduType.is_bound() || single_value->field_causeNS.is_bound() || single_value->field_nS__VCI.is_bound(); } boolean PDU__NS__Block_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_causeNS.is_value() && single_value->field_nS__VCI.is_value(); } void PDU__NS__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; } PDU__NS__Block PDU__NS__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 @NS_Types.PDU_NS_Block."); PDU__NS__Block ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_causeNS.is_bound()) { ret_val.causeNS() = single_value->field_causeNS.valueof(); } if (single_value->field_nS__VCI.is_bound()) { ret_val.nS__VCI() = single_value->field_nS__VCI.valueof(); } return ret_val; } void PDU__NS__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 @NS_Types.PDU_NS_Block."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Block_template[list_length]; } PDU__NS__Block_template& PDU__NS__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 @NS_Types.PDU_NS_Block."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Block."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Block_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Block_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Block."); return single_value->field_nsPduType; } CauseNS_template& PDU__NS__Block_template::causeNS() { set_specific(); return single_value->field_causeNS; } const CauseNS_template& PDU__NS__Block_template::causeNS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field causeNS of a non-specific template of type @NS_Types.PDU_NS_Block."); return single_value->field_causeNS; } NS__VCI_template& PDU__NS__Block_template::nS__VCI() { set_specific(); return single_value->field_nS__VCI; } const NS__VCI_template& PDU__NS__Block_template::nS__VCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nS_VCI of a non-specific template of type @NS_Types.PDU_NS_Block."); return single_value->field_nS__VCI; } int PDU__NS__Block_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 3; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_NS_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 @NS_Types.PDU_NS_Block containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Block."); } return 0; } void PDU__NS__Block_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", causeNS := "); single_value->field_causeNS.log(); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.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 PDU__NS__Block_template::log_match(const PDU__NS__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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_causeNS.match(match_value.causeNS(), legacy)){ TTCN_Logger::log_logmatch_info(".causeNS"); single_value->field_causeNS.log_match(match_value.causeNS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nS__VCI.match(match_value.nS__VCI(), legacy)){ TTCN_Logger::log_logmatch_info(".nS_VCI"); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), 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("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", causeNS := "); single_value->field_causeNS.log_match(match_value.causeNS(), legacy); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), 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 PDU__NS__Block_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_causeNS.encode_text(text_buf); single_value->field_nS__VCI.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 @NS_Types.PDU_NS_Block."); } } void PDU__NS__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_nsPduType.decode_text(text_buf); single_value->field_causeNS.decode_text(text_buf); single_value->field_nS__VCI.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 PDU__NS__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 @NS_Types.PDU_NS_Block."); } } void PDU__NS__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: { PDU__NS__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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Block: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Block_template* precondition = new PDU__NS__Block_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Block_template* implied_template = new PDU__NS__Block_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Block_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Block"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Block"); single_value->field_causeNS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Block"); single_value->field_nS__VCI.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_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 : "@NS_Types.PDU_NS_Block"); } boolean PDU__NS__Block_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Block_Ack: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Block_Ack"); } } void PDU__NS__Block__Ack::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nS__VCI.encode_text(text_buf); } void PDU__NS__Block__Ack::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nS__VCI.decode_text(text_buf); } void PDU__NS__Block__Ack::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 PDU__NS__Block__Ack::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 PDU__NS__Block__Ack::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NS__VCI_descr_.raw->forceomit); decoded_field_length = field_nS__VCI.RAW_decode(NS__VCI_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 PDU__NS__Block__Ack::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NS__VCI_descr_.raw); encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nS__VCI.RAW_encode(NS__VCI_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct PDU__NS__Block__Ack_template::single_value_struct { OCTETSTRING_template field_nsPduType; NS__VCI_template field_nS__VCI; }; void PDU__NS__Block__Ack_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_nsPduType = ANY_VALUE; single_value->field_nS__VCI = ANY_VALUE; } } } void PDU__NS__Block__Ack_template::copy_value(const PDU__NS__Block__Ack& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nS__VCI().is_bound()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Block__Ack_template::copy_template(const PDU__NS__Block__Ack_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nS__VCI().get_selection()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.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 PDU__NS__Block__Ack_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 PDU__NS__Block__Ack_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__Block__Ack_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 @NS_Types.PDU_NS_Block_Ack."); break; } set_selection(other_value); } PDU__NS__Block__Ack_template::PDU__NS__Block__Ack_template() { } PDU__NS__Block__Ack_template::PDU__NS__Block__Ack_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Block__Ack_template::PDU__NS__Block__Ack_template(const PDU__NS__Block__Ack& other_value) { copy_value(other_value); } PDU__NS__Block__Ack_template::PDU__NS__Block__Ack_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Block__Ack&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Block_Ack from an unbound optional field."); } } PDU__NS__Block__Ack_template::PDU__NS__Block__Ack_template(PDU__NS__Block__Ack_template* p_precondition, PDU__NS__Block__Ack_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Block__Ack_template::PDU__NS__Block__Ack_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; } PDU__NS__Block__Ack_template::PDU__NS__Block__Ack_template(const PDU__NS__Block__Ack_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Block__Ack_template::~PDU__NS__Block__Ack_template() { clean_up(); } PDU__NS__Block__Ack_template& PDU__NS__Block__Ack_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Block__Ack_template& PDU__NS__Block__Ack_template::operator=(const PDU__NS__Block__Ack& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Block__Ack_template& PDU__NS__Block__Ack_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Block__Ack&)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 @NS_Types.PDU_NS_Block_Ack."); } return *this; } PDU__NS__Block__Ack_template& PDU__NS__Block__Ack_template::operator=(const PDU__NS__Block__Ack_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Block__Ack_template::match(const PDU__NS__Block__Ack& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nS__VCI().is_bound()) return FALSE; if(!single_value->field_nS__VCI.match(other_value.nS__VCI(), 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 @NS_Types.PDU_NS_Block_Ack."); } return FALSE; } boolean PDU__NS__Block__Ack_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nS__VCI.is_bound(); } boolean PDU__NS__Block__Ack_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nS__VCI.is_value(); } void PDU__NS__Block__Ack_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; } PDU__NS__Block__Ack PDU__NS__Block__Ack_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 @NS_Types.PDU_NS_Block_Ack."); PDU__NS__Block__Ack ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nS__VCI.is_bound()) { ret_val.nS__VCI() = single_value->field_nS__VCI.valueof(); } return ret_val; } void PDU__NS__Block__Ack_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 @NS_Types.PDU_NS_Block_Ack."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Block__Ack_template[list_length]; } PDU__NS__Block__Ack_template& PDU__NS__Block__Ack_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 @NS_Types.PDU_NS_Block_Ack."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Block_Ack."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Block__Ack_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Block__Ack_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Block_Ack."); return single_value->field_nsPduType; } NS__VCI_template& PDU__NS__Block__Ack_template::nS__VCI() { set_specific(); return single_value->field_nS__VCI; } const NS__VCI_template& PDU__NS__Block__Ack_template::nS__VCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nS_VCI of a non-specific template of type @NS_Types.PDU_NS_Block_Ack."); return single_value->field_nS__VCI; } int PDU__NS__Block__Ack_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block_Ack 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 @NS_Types.PDU_NS_Block_Ack 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 @NS_Types.PDU_NS_Block_Ack containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block_Ack containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block_Ack containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block_Ack containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block_Ack containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block_Ack containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Block_Ack containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Block_Ack."); } return 0; } void PDU__NS__Block__Ack_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.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 PDU__NS__Block__Ack_template::log_match(const PDU__NS__Block__Ack& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nS__VCI.match(match_value.nS__VCI(), legacy)){ TTCN_Logger::log_logmatch_info(".nS_VCI"); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), 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("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), 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 PDU__NS__Block__Ack_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nS__VCI.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 @NS_Types.PDU_NS_Block_Ack."); } } void PDU__NS__Block__Ack_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_nsPduType.decode_text(text_buf); single_value->field_nS__VCI.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 PDU__NS__Block__Ack_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 @NS_Types.PDU_NS_Block_Ack."); } } void PDU__NS__Block__Ack_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: { PDU__NS__Block__Ack_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Block_Ack: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Block__Ack_template* precondition = new PDU__NS__Block__Ack_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Block__Ack_template* implied_template = new PDU__NS__Block__Ack_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Block__Ack_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Block_Ack"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__Block__Ack_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Block_Ack"); single_value->field_nS__VCI.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Block_Ack"); 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 : "@NS_Types.PDU_NS_Block_Ack"); } boolean PDU__NS__Block__Ack_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__Block__Ack_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Reset: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Reset"); } } void PDU__NS__Reset::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_causeNS.encode_text(text_buf); field_nS__VCI.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); } void PDU__NS__Reset::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_causeNS.decode_text(text_buf); field_nS__VCI.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); } void PDU__NS__Reset::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 PDU__NS__Reset::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 PDU__NS__Reset::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, CauseNS_descr_.raw->forceomit); decoded_field_length = field_causeNS.RAW_decode(CauseNS_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, NS__VCI_descr_.raw->forceomit); decoded_field_length = field_nS__VCI.RAW_decode(NS__VCI_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_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 PDU__NS__Reset::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CauseNS_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NS__VCI_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, NSEI__NS_descr_.raw); encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_causeNS.RAW_encode(CauseNS_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_nS__VCI.RAW_encode(NS__VCI_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct PDU__NS__Reset_template::single_value_struct { OCTETSTRING_template field_nsPduType; CauseNS_template field_causeNS; NS__VCI_template field_nS__VCI; NSEI__NS_template field_nSEI__NS; }; void PDU__NS__Reset_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_nsPduType = ANY_VALUE; single_value->field_causeNS = ANY_VALUE; single_value->field_nS__VCI = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; } } } void PDU__NS__Reset_template::copy_value(const PDU__NS__Reset& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.causeNS().is_bound()) { single_value->field_causeNS = other_value.causeNS(); } else { single_value->field_causeNS.clean_up(); } if (other_value.nS__VCI().is_bound()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Reset_template::copy_template(const PDU__NS__Reset_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.causeNS().get_selection()) { single_value->field_causeNS = other_value.causeNS(); } else { single_value->field_causeNS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nS__VCI().get_selection()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.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 PDU__NS__Reset_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 PDU__NS__Reset_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__Reset_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 @NS_Types.PDU_NS_Reset."); break; } set_selection(other_value); } PDU__NS__Reset_template::PDU__NS__Reset_template() { } PDU__NS__Reset_template::PDU__NS__Reset_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Reset_template::PDU__NS__Reset_template(const PDU__NS__Reset& other_value) { copy_value(other_value); } PDU__NS__Reset_template::PDU__NS__Reset_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Reset&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Reset from an unbound optional field."); } } PDU__NS__Reset_template::PDU__NS__Reset_template(PDU__NS__Reset_template* p_precondition, PDU__NS__Reset_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Reset_template::PDU__NS__Reset_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; } PDU__NS__Reset_template::PDU__NS__Reset_template(const PDU__NS__Reset_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Reset_template::~PDU__NS__Reset_template() { clean_up(); } PDU__NS__Reset_template& PDU__NS__Reset_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Reset_template& PDU__NS__Reset_template::operator=(const PDU__NS__Reset& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Reset_template& PDU__NS__Reset_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Reset&)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 @NS_Types.PDU_NS_Reset."); } return *this; } PDU__NS__Reset_template& PDU__NS__Reset_template::operator=(const PDU__NS__Reset_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Reset_template::match(const PDU__NS__Reset& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.causeNS().is_bound()) return FALSE; if(!single_value->field_causeNS.match(other_value.causeNS(), legacy))return FALSE; if(!other_value.nS__VCI().is_bound()) return FALSE; if(!single_value->field_nS__VCI.match(other_value.nS__VCI(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), 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 @NS_Types.PDU_NS_Reset."); } return FALSE; } boolean PDU__NS__Reset_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_causeNS.is_bound() || single_value->field_nS__VCI.is_bound() || single_value->field_nSEI__NS.is_bound(); } boolean PDU__NS__Reset_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_causeNS.is_value() && single_value->field_nS__VCI.is_value() && single_value->field_nSEI__NS.is_value(); } void PDU__NS__Reset_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; } PDU__NS__Reset PDU__NS__Reset_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 @NS_Types.PDU_NS_Reset."); PDU__NS__Reset ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_causeNS.is_bound()) { ret_val.causeNS() = single_value->field_causeNS.valueof(); } if (single_value->field_nS__VCI.is_bound()) { ret_val.nS__VCI() = single_value->field_nS__VCI.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } return ret_val; } void PDU__NS__Reset_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 @NS_Types.PDU_NS_Reset."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Reset_template[list_length]; } PDU__NS__Reset_template& PDU__NS__Reset_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 @NS_Types.PDU_NS_Reset."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Reset."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Reset_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Reset_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Reset."); return single_value->field_nsPduType; } CauseNS_template& PDU__NS__Reset_template::causeNS() { set_specific(); return single_value->field_causeNS; } const CauseNS_template& PDU__NS__Reset_template::causeNS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field causeNS of a non-specific template of type @NS_Types.PDU_NS_Reset."); return single_value->field_causeNS; } NS__VCI_template& PDU__NS__Reset_template::nS__VCI() { set_specific(); return single_value->field_nS__VCI; } const NS__VCI_template& PDU__NS__Reset_template::nS__VCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nS_VCI of a non-specific template of type @NS_Types.PDU_NS_Reset."); return single_value->field_nS__VCI; } NSEI__NS_template& PDU__NS__Reset_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__NS__Reset_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_NS_Reset."); return single_value->field_nSEI__NS; } int PDU__NS__Reset_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset 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 @NS_Types.PDU_NS_Reset 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 @NS_Types.PDU_NS_Reset containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Reset."); } return 0; } void PDU__NS__Reset_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", causeNS := "); single_value->field_causeNS.log(); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.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 PDU__NS__Reset_template::log_match(const PDU__NS__Reset& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_causeNS.match(match_value.causeNS(), legacy)){ TTCN_Logger::log_logmatch_info(".causeNS"); single_value->field_causeNS.log_match(match_value.causeNS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nS__VCI.match(match_value.nS__VCI(), legacy)){ TTCN_Logger::log_logmatch_info(".nS_VCI"); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), 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("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", causeNS := "); single_value->field_causeNS.log_match(match_value.causeNS(), legacy); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), 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 PDU__NS__Reset_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_causeNS.encode_text(text_buf); single_value->field_nS__VCI.encode_text(text_buf); single_value->field_nSEI__NS.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 @NS_Types.PDU_NS_Reset."); } } void PDU__NS__Reset_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_nsPduType.decode_text(text_buf); single_value->field_causeNS.decode_text(text_buf); single_value->field_nS__VCI.decode_text(text_buf); single_value->field_nSEI__NS.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 PDU__NS__Reset_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 @NS_Types.PDU_NS_Reset."); } } void PDU__NS__Reset_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: { PDU__NS__Reset_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Reset: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Reset_template* precondition = new PDU__NS__Reset_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Reset_template* implied_template = new PDU__NS__Reset_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Reset_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Reset"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__Reset_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Reset"); single_value->field_causeNS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Reset"); single_value->field_nS__VCI.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Reset"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Reset"); 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 : "@NS_Types.PDU_NS_Reset"); } boolean PDU__NS__Reset_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__Reset_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Reset_Ack: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Reset_Ack"); } } void PDU__NS__Reset__Ack::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nS__VCI.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); } void PDU__NS__Reset__Ack::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nS__VCI.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); } void PDU__NS__Reset__Ack::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 PDU__NS__Reset__Ack::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 PDU__NS__Reset__Ack::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NS__VCI_descr_.raw->forceomit); decoded_field_length = field_nS__VCI.RAW_decode(NS__VCI_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__NS__Reset__Ack::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 3; myleaf.body.node.nodes = init_nodes_of_enc_tree(3); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NS__VCI_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NSEI__NS_descr_.raw); encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nS__VCI.RAW_encode(NS__VCI_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[2]); return myleaf.length = encoded_length; } struct PDU__NS__Reset__Ack_template::single_value_struct { OCTETSTRING_template field_nsPduType; NS__VCI_template field_nS__VCI; NSEI__NS_template field_nSEI__NS; }; void PDU__NS__Reset__Ack_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_nsPduType = ANY_VALUE; single_value->field_nS__VCI = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; } } } void PDU__NS__Reset__Ack_template::copy_value(const PDU__NS__Reset__Ack& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nS__VCI().is_bound()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Reset__Ack_template::copy_template(const PDU__NS__Reset__Ack_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nS__VCI().get_selection()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.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 PDU__NS__Reset__Ack_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 PDU__NS__Reset__Ack_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__Reset__Ack_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 @NS_Types.PDU_NS_Reset_Ack."); break; } set_selection(other_value); } PDU__NS__Reset__Ack_template::PDU__NS__Reset__Ack_template() { } PDU__NS__Reset__Ack_template::PDU__NS__Reset__Ack_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Reset__Ack_template::PDU__NS__Reset__Ack_template(const PDU__NS__Reset__Ack& other_value) { copy_value(other_value); } PDU__NS__Reset__Ack_template::PDU__NS__Reset__Ack_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Reset__Ack&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Reset_Ack from an unbound optional field."); } } PDU__NS__Reset__Ack_template::PDU__NS__Reset__Ack_template(PDU__NS__Reset__Ack_template* p_precondition, PDU__NS__Reset__Ack_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Reset__Ack_template::PDU__NS__Reset__Ack_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; } PDU__NS__Reset__Ack_template::PDU__NS__Reset__Ack_template(const PDU__NS__Reset__Ack_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Reset__Ack_template::~PDU__NS__Reset__Ack_template() { clean_up(); } PDU__NS__Reset__Ack_template& PDU__NS__Reset__Ack_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Reset__Ack_template& PDU__NS__Reset__Ack_template::operator=(const PDU__NS__Reset__Ack& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Reset__Ack_template& PDU__NS__Reset__Ack_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Reset__Ack&)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 @NS_Types.PDU_NS_Reset_Ack."); } return *this; } PDU__NS__Reset__Ack_template& PDU__NS__Reset__Ack_template::operator=(const PDU__NS__Reset__Ack_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Reset__Ack_template::match(const PDU__NS__Reset__Ack& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nS__VCI().is_bound()) return FALSE; if(!single_value->field_nS__VCI.match(other_value.nS__VCI(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), 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 @NS_Types.PDU_NS_Reset_Ack."); } return FALSE; } boolean PDU__NS__Reset__Ack_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nS__VCI.is_bound() || single_value->field_nSEI__NS.is_bound(); } boolean PDU__NS__Reset__Ack_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nS__VCI.is_value() && single_value->field_nSEI__NS.is_value(); } void PDU__NS__Reset__Ack_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; } PDU__NS__Reset__Ack PDU__NS__Reset__Ack_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 @NS_Types.PDU_NS_Reset_Ack."); PDU__NS__Reset__Ack ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nS__VCI.is_bound()) { ret_val.nS__VCI() = single_value->field_nS__VCI.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } return ret_val; } void PDU__NS__Reset__Ack_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 @NS_Types.PDU_NS_Reset_Ack."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Reset__Ack_template[list_length]; } PDU__NS__Reset__Ack_template& PDU__NS__Reset__Ack_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 @NS_Types.PDU_NS_Reset_Ack."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Reset_Ack."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Reset__Ack_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Reset__Ack_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Reset_Ack."); return single_value->field_nsPduType; } NS__VCI_template& PDU__NS__Reset__Ack_template::nS__VCI() { set_specific(); return single_value->field_nS__VCI; } const NS__VCI_template& PDU__NS__Reset__Ack_template::nS__VCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nS_VCI of a non-specific template of type @NS_Types.PDU_NS_Reset_Ack."); return single_value->field_nS__VCI; } NSEI__NS_template& PDU__NS__Reset__Ack_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__NS__Reset__Ack_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_NS_Reset_Ack."); return single_value->field_nSEI__NS; } int PDU__NS__Reset__Ack_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset_Ack which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 3; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset_Ack 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 @NS_Types.PDU_NS_Reset_Ack containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset_Ack containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset_Ack containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset_Ack containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset_Ack containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset_Ack containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Reset_Ack containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Reset_Ack."); } return 0; } void PDU__NS__Reset__Ack_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.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 PDU__NS__Reset__Ack_template::log_match(const PDU__NS__Reset__Ack& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nS__VCI.match(match_value.nS__VCI(), legacy)){ TTCN_Logger::log_logmatch_info(".nS_VCI"); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), 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("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), 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 PDU__NS__Reset__Ack_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nS__VCI.encode_text(text_buf); single_value->field_nSEI__NS.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 @NS_Types.PDU_NS_Reset_Ack."); } } void PDU__NS__Reset__Ack_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_nsPduType.decode_text(text_buf); single_value->field_nS__VCI.decode_text(text_buf); single_value->field_nSEI__NS.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 PDU__NS__Reset__Ack_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 @NS_Types.PDU_NS_Reset_Ack."); } } void PDU__NS__Reset__Ack_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: { PDU__NS__Reset__Ack_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Reset_Ack: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Reset__Ack_template* precondition = new PDU__NS__Reset__Ack_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Reset__Ack_template* implied_template = new PDU__NS__Reset__Ack_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Reset__Ack_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Reset_Ack"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__Reset__Ack_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Reset_Ack"); single_value->field_nS__VCI.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Reset_Ack"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Reset_Ack"); 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 : "@NS_Types.PDU_NS_Reset_Ack"); } boolean PDU__NS__Reset__Ack_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__Reset__Ack_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx& par_nS__VCI, const OPTIONAL< NS__PDU >& par_nS__PDU, const OPTIONAL< BVCI__NS >& par_bVCI__NS, const OPTIONAL< ListofIP4Elements >& par_listofIP4Elements, const OPTIONAL< ListofIP6Elements >& par_listofIP6Elements) : field_nsPduType(par_nsPduType), field_causeNS(par_causeNS), field_nS__VCI(par_nS__VCI), field_nS__PDU(par_nS__PDU), field_bVCI__NS(par_bVCI__NS), field_listofIP4Elements(par_listofIP4Elements), field_listofIP6Elements(par_listofIP6Elements) { } PDU__NS__Status::PDU__NS__Status(const PDU__NS__Status& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.PDU_NS_Status."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.causeNS().is_bound()) field_causeNS = other_value.causeNS(); else field_causeNS.clean_up(); if (other_value.nS__VCI().is_bound()) field_nS__VCI = other_value.nS__VCI(); else field_nS__VCI.clean_up(); if (other_value.nS__PDU().is_bound()) field_nS__PDU = other_value.nS__PDU(); else field_nS__PDU.clean_up(); if (other_value.bVCI__NS().is_bound()) field_bVCI__NS = other_value.bVCI__NS(); else field_bVCI__NS.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } void PDU__NS__Status::clean_up() { field_nsPduType.clean_up(); field_causeNS.clean_up(); field_nS__VCI.clean_up(); field_nS__PDU.clean_up(); field_bVCI__NS.clean_up(); field_listofIP4Elements.clean_up(); field_listofIP6Elements.clean_up(); } const TTCN_Typedescriptor_t* PDU__NS__Status::get_descriptor() const { return &PDU__NS__Status_descr_; } PDU__NS__Status& PDU__NS__Status::operator=(const PDU__NS__Status& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.PDU_NS_Status."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.causeNS().is_bound()) field_causeNS = other_value.causeNS(); else field_causeNS.clean_up(); if (other_value.nS__VCI().is_bound()) field_nS__VCI = other_value.nS__VCI(); else field_nS__VCI.clean_up(); if (other_value.nS__PDU().is_bound()) field_nS__PDU = other_value.nS__PDU(); else field_nS__PDU.clean_up(); if (other_value.bVCI__NS().is_bound()) field_bVCI__NS = other_value.bVCI__NS(); else field_bVCI__NS.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } return *this; } boolean PDU__NS__Status::operator==(const PDU__NS__Status& other_value) const { return field_nsPduType==other_value.field_nsPduType && field_causeNS==other_value.field_causeNS && field_nS__VCI==other_value.field_nS__VCI && field_nS__PDU==other_value.field_nS__PDU && field_bVCI__NS==other_value.field_bVCI__NS && field_listofIP4Elements==other_value.field_listofIP4Elements && field_listofIP6Elements==other_value.field_listofIP6Elements; } boolean PDU__NS__Status::is_bound() const { return (field_nsPduType.is_bound()) || (field_causeNS.is_bound()) || (OPTIONAL_OMIT == field_nS__VCI.get_selection() || field_nS__VCI.is_bound()) || (OPTIONAL_OMIT == field_nS__PDU.get_selection() || field_nS__PDU.is_bound()) || (OPTIONAL_OMIT == field_bVCI__NS.get_selection() || field_bVCI__NS.is_bound()) || (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_bound()) || (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_bound()); } boolean PDU__NS__Status::is_value() const { return field_nsPduType.is_value() && field_causeNS.is_value() && (OPTIONAL_OMIT == field_nS__VCI.get_selection() || field_nS__VCI.is_value()) && (OPTIONAL_OMIT == field_nS__PDU.get_selection() || field_nS__PDU.is_value()) && (OPTIONAL_OMIT == field_bVCI__NS.get_selection() || field_bVCI__NS.is_value()) && (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_value()) && (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_value()); } int PDU__NS__Status::size_of() const { int ret_val = 2; if (field_nS__VCI.ispresent()) ret_val++; if (field_nS__PDU.ispresent()) ret_val++; if (field_bVCI__NS.ispresent()) ret_val++; if (field_listofIP4Elements.ispresent()) ret_val++; if (field_listofIP6Elements.ispresent()) ret_val++; return ret_val; } void PDU__NS__Status::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nsPduType := "); field_nsPduType.log(); TTCN_Logger::log_event_str(", causeNS := "); field_causeNS.log(); TTCN_Logger::log_event_str(", nS_VCI := "); field_nS__VCI.log(); TTCN_Logger::log_event_str(", nS_PDU := "); field_nS__PDU.log(); TTCN_Logger::log_event_str(", bVCI_NS := "); field_bVCI__NS.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" }"); } void PDU__NS__Status::set_implicit_omit() { if (nsPduType().is_bound()) nsPduType().set_implicit_omit(); if (causeNS().is_bound()) causeNS().set_implicit_omit(); if (!nS__VCI().is_bound()) nS__VCI() = OMIT_VALUE; else nS__VCI().set_implicit_omit(); if (!nS__PDU().is_bound()) nS__PDU() = OMIT_VALUE; else nS__PDU().set_implicit_omit(); if (!bVCI__NS().is_bound()) bVCI__NS() = OMIT_VALUE; else bVCI__NS().set_implicit_omit(); if (!listofIP4Elements().is_bound()) listofIP4Elements() = OMIT_VALUE; else listofIP4Elements().set_implicit_omit(); if (!listofIP6Elements().is_bound()) listofIP6Elements() = OMIT_VALUE; else listofIP6Elements().set_implicit_omit(); } void PDU__NS__Status::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 (70 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nS__PDU().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) bVCI__NS().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(6)); 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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_PDU")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__PDU().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bVCI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bVCI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Status: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Status"); } } void PDU__NS__Status::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_causeNS.encode_text(text_buf); field_nS__VCI.encode_text(text_buf); field_nS__PDU.encode_text(text_buf); field_bVCI__NS.encode_text(text_buf); field_listofIP4Elements.encode_text(text_buf); field_listofIP6Elements.encode_text(text_buf); } void PDU__NS__Status::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_causeNS.decode_text(text_buf); field_nS__VCI.decode_text(text_buf); field_nS__PDU.decode_text(text_buf); field_bVCI__NS.decode_text(text_buf); field_listofIP4Elements.decode_text(text_buf); field_listofIP6Elements.decode_text(text_buf); } void PDU__NS__Status::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 PDU__NS__Status::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 PDU__NS__Status::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, CauseNS_descr_.raw->forceomit); decoded_field_length = field_causeNS.RAW_decode(CauseNS_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(2)) { field_nS__VCI = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, NS__VCI_descr_.raw->forceomit); decoded_field_length = field_nS__VCI().RAW_decode(NS__VCI_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_nS__VCI = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_nS__VCI.ispresent() || field_nS__VCI().iEI() != os_0){ field_nS__VCI=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_nS__VCI=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(3)) { field_nS__PDU = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, NS__PDU_descr_.raw->forceomit); decoded_field_length = field_nS__PDU().RAW_decode(NS__PDU_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_nS__PDU = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_nS__PDU.ispresent() || field_nS__PDU().iEI() != os_1){ field_nS__PDU=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_nS__PDU=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_bVCI__NS = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, BVCI__NS_descr_.raw->forceomit); decoded_field_length = field_bVCI__NS().RAW_decode(BVCI__NS_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_bVCI__NS = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_bVCI__NS.ispresent() || field_bVCI__NS().iEI() != os_2){ field_bVCI__NS=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_bVCI__NS=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(5)) { field_listofIP4Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_5_force_omit(5, force_omit, ListofIP4Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP4Elements().RAW_decode(ListofIP4Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 1) { field_listofIP4Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_3){ field_listofIP4Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP4Elements=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(6)) { field_listofIP6Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_6_force_omit(6, force_omit, ListofIP6Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP6Elements().RAW_decode(ListofIP6Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 1) { field_listofIP6Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4){ field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__NS__Status::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 = 7; myleaf.body.node.nodes = init_nodes_of_enc_tree(7); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CauseNS_descr_.raw); if (field_nS__VCI.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NS__VCI_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; if (field_nS__PDU.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, NS__PDU_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; if (field_bVCI__NS.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, BVCI__NS_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; if (field_listofIP4Elements.ispresent()) { myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, ListofIP4Elements_descr_.raw); } else myleaf.body.node.nodes[5] = NULL; if (field_listofIP6Elements.ispresent()) { myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, ListofIP6Elements_descr_.raw); } else myleaf.body.node.nodes[6] = NULL; encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_causeNS.RAW_encode(CauseNS_descr_, *myleaf.body.node.nodes[1]); if (field_nS__VCI.ispresent()) { encoded_length += field_nS__VCI().RAW_encode(NS__VCI_descr_, *myleaf.body.node.nodes[2]); } if (field_nS__PDU.ispresent()) { encoded_length += field_nS__PDU().RAW_encode(NS__PDU_descr_, *myleaf.body.node.nodes[3]); } if (field_bVCI__NS.ispresent()) { encoded_length += field_bVCI__NS().RAW_encode(BVCI__NS_descr_, *myleaf.body.node.nodes[4]); } if (field_listofIP4Elements.ispresent()) { encoded_length += field_listofIP4Elements().RAW_encode(ListofIP4Elements_descr_, *myleaf.body.node.nodes[5]); } if (field_listofIP6Elements.ispresent()) { encoded_length += field_listofIP6Elements().RAW_encode(ListofIP6Elements_descr_, *myleaf.body.node.nodes[6]); } if (field_nS__VCI.ispresent() && (!field_nS__VCI.ispresent() || field_nS__VCI().iEI() != os_0)) { 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){ os_0.RAW_encode(General__Types::OCT1_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); } } if (field_nS__PDU.ispresent() && (!field_nS__PDU.ispresent() || field_nS__PDU().iEI() != os_1)) { 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){ os_1.RAW_encode(General__Types::OCT1_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); } } if (field_bVCI__NS.ispresent() && (!field_bVCI__NS.ispresent() || field_bVCI__NS().iEI() != os_2)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={4,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){ os_2.RAW_encode(General__Types::OCT1_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); } } if (field_listofIP4Elements.ispresent() && (!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_3)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={5,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){ os_3.RAW_encode(General__Types::OCT1_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); } } if (field_listofIP6Elements.ispresent() && (!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={6,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){ os_4.RAW_encode(General__Types::OCT1_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); } } return myleaf.length = encoded_length; } struct PDU__NS__Status_template::single_value_struct { OCTETSTRING_template field_nsPduType; CauseNS_template field_causeNS; NS__VCI_template field_nS__VCI; NS__PDU_template field_nS__PDU; BVCI__NS_template field_bVCI__NS; ListofIP4Elements_template field_listofIP4Elements; ListofIP6Elements_template field_listofIP6Elements; }; void PDU__NS__Status_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_nsPduType = ANY_VALUE; single_value->field_causeNS = ANY_VALUE; single_value->field_nS__VCI = ANY_OR_OMIT; single_value->field_nS__PDU = ANY_OR_OMIT; single_value->field_bVCI__NS = ANY_OR_OMIT; single_value->field_listofIP4Elements = ANY_OR_OMIT; single_value->field_listofIP6Elements = ANY_OR_OMIT; } } } void PDU__NS__Status_template::copy_value(const PDU__NS__Status& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.causeNS().is_bound()) { single_value->field_causeNS = other_value.causeNS(); } else { single_value->field_causeNS.clean_up(); } if (other_value.nS__VCI().is_bound()) { if (other_value.nS__VCI().ispresent()) single_value->field_nS__VCI = other_value.nS__VCI()(); else single_value->field_nS__VCI = OMIT_VALUE; } else { single_value->field_nS__VCI.clean_up(); } if (other_value.nS__PDU().is_bound()) { if (other_value.nS__PDU().ispresent()) single_value->field_nS__PDU = other_value.nS__PDU()(); else single_value->field_nS__PDU = OMIT_VALUE; } else { single_value->field_nS__PDU.clean_up(); } if (other_value.bVCI__NS().is_bound()) { if (other_value.bVCI__NS().ispresent()) single_value->field_bVCI__NS = other_value.bVCI__NS()(); else single_value->field_bVCI__NS = OMIT_VALUE; } else { single_value->field_bVCI__NS.clean_up(); } if (other_value.listofIP4Elements().is_bound()) { if (other_value.listofIP4Elements().ispresent()) single_value->field_listofIP4Elements = other_value.listofIP4Elements()(); else single_value->field_listofIP4Elements = OMIT_VALUE; } else { single_value->field_listofIP4Elements.clean_up(); } if (other_value.listofIP6Elements().is_bound()) { if (other_value.listofIP6Elements().ispresent()) single_value->field_listofIP6Elements = other_value.listofIP6Elements()(); else single_value->field_listofIP6Elements = OMIT_VALUE; } else { single_value->field_listofIP6Elements.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Status_template::copy_template(const PDU__NS__Status_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.causeNS().get_selection()) { single_value->field_causeNS = other_value.causeNS(); } else { single_value->field_causeNS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nS__VCI().get_selection()) { single_value->field_nS__VCI = other_value.nS__VCI(); } else { single_value->field_nS__VCI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nS__PDU().get_selection()) { single_value->field_nS__PDU = other_value.nS__PDU(); } else { single_value->field_nS__PDU.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.bVCI__NS().get_selection()) { single_value->field_bVCI__NS = other_value.bVCI__NS(); } else { single_value->field_bVCI__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP4Elements().get_selection()) { single_value->field_listofIP4Elements = other_value.listofIP4Elements(); } else { single_value->field_listofIP4Elements.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP6Elements().get_selection()) { single_value->field_listofIP6Elements = other_value.listofIP6Elements(); } else { single_value->field_listofIP6Elements.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 PDU__NS__Status_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 PDU__NS__Status_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__Status_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 @NS_Types.PDU_NS_Status."); break; } set_selection(other_value); } PDU__NS__Status_template::PDU__NS__Status_template() { } PDU__NS__Status_template::PDU__NS__Status_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Status_template::PDU__NS__Status_template(const PDU__NS__Status& other_value) { copy_value(other_value); } PDU__NS__Status_template::PDU__NS__Status_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Status&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Status from an unbound optional field."); } } PDU__NS__Status_template::PDU__NS__Status_template(PDU__NS__Status_template* p_precondition, PDU__NS__Status_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Status_template::PDU__NS__Status_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; } PDU__NS__Status_template::PDU__NS__Status_template(const PDU__NS__Status_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Status_template::~PDU__NS__Status_template() { clean_up(); } PDU__NS__Status_template& PDU__NS__Status_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Status_template& PDU__NS__Status_template::operator=(const PDU__NS__Status& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Status_template& PDU__NS__Status_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Status&)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 @NS_Types.PDU_NS_Status."); } return *this; } PDU__NS__Status_template& PDU__NS__Status_template::operator=(const PDU__NS__Status_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Status_template::match(const PDU__NS__Status& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.causeNS().is_bound()) return FALSE; if(!single_value->field_causeNS.match(other_value.causeNS(), legacy))return FALSE; if(!other_value.nS__VCI().is_bound()) return FALSE; if((other_value.nS__VCI().ispresent() ? !single_value->field_nS__VCI.match((const NS__VCI&)other_value.nS__VCI(), legacy) : !single_value->field_nS__VCI.match_omit(legacy)))return FALSE; if(!other_value.nS__PDU().is_bound()) return FALSE; if((other_value.nS__PDU().ispresent() ? !single_value->field_nS__PDU.match((const NS__PDU&)other_value.nS__PDU(), legacy) : !single_value->field_nS__PDU.match_omit(legacy)))return FALSE; if(!other_value.bVCI__NS().is_bound()) return FALSE; if((other_value.bVCI__NS().ispresent() ? !single_value->field_bVCI__NS.match((const BVCI__NS&)other_value.bVCI__NS(), legacy) : !single_value->field_bVCI__NS.match_omit(legacy)))return FALSE; if(!other_value.listofIP4Elements().is_bound()) return FALSE; if((other_value.listofIP4Elements().ispresent() ? !single_value->field_listofIP4Elements.match((const ListofIP4Elements&)other_value.listofIP4Elements(), legacy) : !single_value->field_listofIP4Elements.match_omit(legacy)))return FALSE; if(!other_value.listofIP6Elements().is_bound()) return FALSE; if((other_value.listofIP6Elements().ispresent() ? !single_value->field_listofIP6Elements.match((const ListofIP6Elements&)other_value.listofIP6Elements(), legacy) : !single_value->field_listofIP6Elements.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @NS_Types.PDU_NS_Status."); } return FALSE; } boolean PDU__NS__Status_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_causeNS.is_bound() || (single_value->field_nS__VCI.is_omit() || single_value->field_nS__VCI.is_bound()) || (single_value->field_nS__PDU.is_omit() || single_value->field_nS__PDU.is_bound()) || (single_value->field_bVCI__NS.is_omit() || single_value->field_bVCI__NS.is_bound()) || (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_bound()) || (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_bound()); } boolean PDU__NS__Status_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_causeNS.is_value() && (single_value->field_nS__VCI.is_omit() || single_value->field_nS__VCI.is_value()) && (single_value->field_nS__PDU.is_omit() || single_value->field_nS__PDU.is_value()) && (single_value->field_bVCI__NS.is_omit() || single_value->field_bVCI__NS.is_value()) && (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_value()) && (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_value()); } void PDU__NS__Status_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; } PDU__NS__Status PDU__NS__Status_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 @NS_Types.PDU_NS_Status."); PDU__NS__Status ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_causeNS.is_bound()) { ret_val.causeNS() = single_value->field_causeNS.valueof(); } if (single_value->field_nS__VCI.is_omit()) ret_val.nS__VCI() = OMIT_VALUE; else if (single_value->field_nS__VCI.is_bound()) { ret_val.nS__VCI() = single_value->field_nS__VCI.valueof(); } if (single_value->field_nS__PDU.is_omit()) ret_val.nS__PDU() = OMIT_VALUE; else if (single_value->field_nS__PDU.is_bound()) { ret_val.nS__PDU() = single_value->field_nS__PDU.valueof(); } if (single_value->field_bVCI__NS.is_omit()) ret_val.bVCI__NS() = OMIT_VALUE; else if (single_value->field_bVCI__NS.is_bound()) { ret_val.bVCI__NS() = single_value->field_bVCI__NS.valueof(); } if (single_value->field_listofIP4Elements.is_omit()) ret_val.listofIP4Elements() = OMIT_VALUE; else if (single_value->field_listofIP4Elements.is_bound()) { ret_val.listofIP4Elements() = single_value->field_listofIP4Elements.valueof(); } if (single_value->field_listofIP6Elements.is_omit()) ret_val.listofIP6Elements() = OMIT_VALUE; else if (single_value->field_listofIP6Elements.is_bound()) { ret_val.listofIP6Elements() = single_value->field_listofIP6Elements.valueof(); } return ret_val; } void PDU__NS__Status_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 @NS_Types.PDU_NS_Status."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Status_template[list_length]; } PDU__NS__Status_template& PDU__NS__Status_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 @NS_Types.PDU_NS_Status."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Status."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Status_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Status_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Status."); return single_value->field_nsPduType; } CauseNS_template& PDU__NS__Status_template::causeNS() { set_specific(); return single_value->field_causeNS; } const CauseNS_template& PDU__NS__Status_template::causeNS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field causeNS of a non-specific template of type @NS_Types.PDU_NS_Status."); return single_value->field_causeNS; } NS__VCI_template& PDU__NS__Status_template::nS__VCI() { set_specific(); return single_value->field_nS__VCI; } const NS__VCI_template& PDU__NS__Status_template::nS__VCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nS_VCI of a non-specific template of type @NS_Types.PDU_NS_Status."); return single_value->field_nS__VCI; } NS__PDU_template& PDU__NS__Status_template::nS__PDU() { set_specific(); return single_value->field_nS__PDU; } const NS__PDU_template& PDU__NS__Status_template::nS__PDU() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nS_PDU of a non-specific template of type @NS_Types.PDU_NS_Status."); return single_value->field_nS__PDU; } BVCI__NS_template& PDU__NS__Status_template::bVCI__NS() { set_specific(); return single_value->field_bVCI__NS; } const BVCI__NS_template& PDU__NS__Status_template::bVCI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bVCI_NS of a non-specific template of type @NS_Types.PDU_NS_Status."); return single_value->field_bVCI__NS; } ListofIP4Elements_template& PDU__NS__Status_template::listofIP4Elements() { set_specific(); return single_value->field_listofIP4Elements; } const ListofIP4Elements_template& PDU__NS__Status_template::listofIP4Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP4Elements of a non-specific template of type @NS_Types.PDU_NS_Status."); return single_value->field_listofIP4Elements; } ListofIP6Elements_template& PDU__NS__Status_template::listofIP6Elements() { set_specific(); return single_value->field_listofIP6Elements; } const ListofIP6Elements_template& PDU__NS__Status_template::listofIP6Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP6Elements of a non-specific template of type @NS_Types.PDU_NS_Status."); return single_value->field_listofIP6Elements; } int PDU__NS__Status_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Status which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_nS__VCI.is_present()) ret_val++; if (single_value->field_nS__PDU.is_present()) ret_val++; if (single_value->field_bVCI__NS.is_present()) ret_val++; if (single_value->field_listofIP4Elements.is_present()) ret_val++; if (single_value->field_listofIP6Elements.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Status 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 @NS_Types.PDU_NS_Status containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Status containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Status containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Status containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Status containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Status containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Status containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Status."); } return 0; } void PDU__NS__Status_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", causeNS := "); single_value->field_causeNS.log(); TTCN_Logger::log_event_str(", nS_VCI := "); single_value->field_nS__VCI.log(); TTCN_Logger::log_event_str(", nS_PDU := "); single_value->field_nS__PDU.log(); TTCN_Logger::log_event_str(", bVCI_NS := "); single_value->field_bVCI__NS.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); single_value->field_listofIP6Elements.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 PDU__NS__Status_template::log_match(const PDU__NS__Status& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_causeNS.match(match_value.causeNS(), legacy)){ TTCN_Logger::log_logmatch_info(".causeNS"); single_value->field_causeNS.log_match(match_value.causeNS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.nS__VCI().ispresent()){ if(!single_value->field_nS__VCI.match(match_value.nS__VCI(), legacy)){ TTCN_Logger::log_logmatch_info(".nS_VCI"); single_value->field_nS__VCI.log_match(match_value.nS__VCI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_nS__VCI.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".nS_VCI := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_nS__VCI.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.nS__PDU().ispresent()){ if(!single_value->field_nS__PDU.match(match_value.nS__PDU(), legacy)){ TTCN_Logger::log_logmatch_info(".nS_PDU"); single_value->field_nS__PDU.log_match(match_value.nS__PDU(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_nS__PDU.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".nS_PDU := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_nS__PDU.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.bVCI__NS().ispresent()){ if(!single_value->field_bVCI__NS.match(match_value.bVCI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".bVCI_NS"); single_value->field_bVCI__NS.log_match(match_value.bVCI__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_bVCI__NS.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".bVCI_NS := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_bVCI__NS.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.listofIP4Elements().ispresent()){ if(!single_value->field_listofIP4Elements.match(match_value.listofIP4Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements"); single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP4Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.listofIP6Elements().ispresent()){ if(!single_value->field_listofIP6Elements.match(match_value.listofIP6Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements"); single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP6Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", causeNS := "); single_value->field_causeNS.log_match(match_value.causeNS(), legacy); TTCN_Logger::log_event_str(", nS_VCI := "); if (match_value.nS__VCI().ispresent()) { single_value->field_nS__VCI.log_match(match_value.nS__VCI(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_nS__VCI.log(); if (single_value->field_nS__VCI.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", nS_PDU := "); if (match_value.nS__PDU().ispresent()) { single_value->field_nS__PDU.log_match(match_value.nS__PDU(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_nS__PDU.log(); if (single_value->field_nS__PDU.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", bVCI_NS := "); if (match_value.bVCI__NS().ispresent()) { single_value->field_bVCI__NS.log_match(match_value.bVCI__NS(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_bVCI__NS.log(); if (single_value->field_bVCI__NS.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", listofIP4Elements := "); if (match_value.listofIP4Elements().ispresent()) { single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP4Elements.log(); if (single_value->field_listofIP4Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", listofIP6Elements := "); if (match_value.listofIP6Elements().ispresent()) { single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP6Elements.log(); if (single_value->field_listofIP6Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void PDU__NS__Status_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_causeNS.encode_text(text_buf); single_value->field_nS__VCI.encode_text(text_buf); single_value->field_nS__PDU.encode_text(text_buf); single_value->field_bVCI__NS.encode_text(text_buf); single_value->field_listofIP4Elements.encode_text(text_buf); single_value->field_listofIP6Elements.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 @NS_Types.PDU_NS_Status."); } } void PDU__NS__Status_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_nsPduType.decode_text(text_buf); single_value->field_causeNS.decode_text(text_buf); single_value->field_nS__VCI.decode_text(text_buf); single_value->field_nS__PDU.decode_text(text_buf); single_value->field_bVCI__NS.decode_text(text_buf); single_value->field_listofIP4Elements.decode_text(text_buf); single_value->field_listofIP6Elements.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 PDU__NS__Status_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 @NS_Types.PDU_NS_Status."); } } void PDU__NS__Status_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: { PDU__NS__Status_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nS__VCI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nS__PDU().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) bVCI__NS().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(6)); 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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_VCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__VCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_PDU")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__PDU().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bVCI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bVCI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Status: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Status_template* precondition = new PDU__NS__Status_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Status_template* implied_template = new PDU__NS__Status_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Status_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Status"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__Status_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Status"); single_value->field_causeNS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Status"); single_value->field_nS__VCI.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Status"); single_value->field_nS__PDU.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Status"); single_value->field_bVCI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Status"); single_value->field_listofIP4Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Status"); single_value->field_listofIP6Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Status"); 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 : "@NS_Types.PDU_NS_Status"); } boolean PDU__NS__Status_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__Status_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) nsPduType().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Unblock: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Unblock"); } } void PDU__NS__Unblock::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); } void PDU__NS__Unblock::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); } void PDU__NS__Unblock::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 PDU__NS__Unblock::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 PDU__NS__Unblock::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__NS__Unblock::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 1; myleaf.body.node.nodes = init_nodes_of_enc_tree(1); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); return myleaf.length = encoded_length; } struct PDU__NS__Unblock_template::single_value_struct { OCTETSTRING_template field_nsPduType; }; void PDU__NS__Unblock_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_nsPduType = ANY_VALUE; } } } void PDU__NS__Unblock_template::copy_value(const PDU__NS__Unblock& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Unblock_template::copy_template(const PDU__NS__Unblock_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.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 PDU__NS__Unblock_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 PDU__NS__Unblock_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__Unblock_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 @NS_Types.PDU_NS_Unblock."); break; } set_selection(other_value); } PDU__NS__Unblock_template::PDU__NS__Unblock_template() { } PDU__NS__Unblock_template::PDU__NS__Unblock_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Unblock_template::PDU__NS__Unblock_template(const PDU__NS__Unblock& other_value) { copy_value(other_value); } PDU__NS__Unblock_template::PDU__NS__Unblock_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Unblock&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Unblock from an unbound optional field."); } } PDU__NS__Unblock_template::PDU__NS__Unblock_template(PDU__NS__Unblock_template* p_precondition, PDU__NS__Unblock_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Unblock_template::PDU__NS__Unblock_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; } PDU__NS__Unblock_template::PDU__NS__Unblock_template(const PDU__NS__Unblock_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Unblock_template::~PDU__NS__Unblock_template() { clean_up(); } PDU__NS__Unblock_template& PDU__NS__Unblock_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Unblock_template& PDU__NS__Unblock_template::operator=(const PDU__NS__Unblock& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Unblock_template& PDU__NS__Unblock_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Unblock&)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 @NS_Types.PDU_NS_Unblock."); } return *this; } PDU__NS__Unblock_template& PDU__NS__Unblock_template::operator=(const PDU__NS__Unblock_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Unblock_template::match(const PDU__NS__Unblock& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), 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 @NS_Types.PDU_NS_Unblock."); } return FALSE; } boolean PDU__NS__Unblock_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound(); } boolean PDU__NS__Unblock_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value(); } void PDU__NS__Unblock_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; } PDU__NS__Unblock PDU__NS__Unblock_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 @NS_Types.PDU_NS_Unblock."); PDU__NS__Unblock ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } return ret_val; } void PDU__NS__Unblock_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 @NS_Types.PDU_NS_Unblock."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Unblock_template[list_length]; } PDU__NS__Unblock_template& PDU__NS__Unblock_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 @NS_Types.PDU_NS_Unblock."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Unblock."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Unblock_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Unblock_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Unblock."); return single_value->field_nsPduType; } int PDU__NS__Unblock_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 1; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock 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 @NS_Types.PDU_NS_Unblock containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Unblock."); } return 0; } void PDU__NS__Unblock_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.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 PDU__NS__Unblock_template::log_match(const PDU__NS__Unblock& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), 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("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), 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 PDU__NS__Unblock_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.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 @NS_Types.PDU_NS_Unblock."); } } void PDU__NS__Unblock_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_nsPduType.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 PDU__NS__Unblock_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 @NS_Types.PDU_NS_Unblock."); } } void PDU__NS__Unblock_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: { PDU__NS__Unblock_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) nsPduType().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Unblock: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Unblock_template* precondition = new PDU__NS__Unblock_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Unblock_template* implied_template = new PDU__NS__Unblock_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Unblock_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Unblock"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__Unblock_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Unblock"); 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 : "@NS_Types.PDU_NS_Unblock"); } boolean PDU__NS__Unblock_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__Unblock_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) nsPduType().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Unblock_Ack: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Unblock_Ack"); } } void PDU__NS__Unblock__Ack::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); } void PDU__NS__Unblock__Ack::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); } void PDU__NS__Unblock__Ack::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 PDU__NS__Unblock__Ack::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 PDU__NS__Unblock__Ack::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__NS__Unblock__Ack::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 1; myleaf.body.node.nodes = init_nodes_of_enc_tree(1); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); return myleaf.length = encoded_length; } struct PDU__NS__Unblock__Ack_template::single_value_struct { OCTETSTRING_template field_nsPduType; }; void PDU__NS__Unblock__Ack_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_nsPduType = ANY_VALUE; } } } void PDU__NS__Unblock__Ack_template::copy_value(const PDU__NS__Unblock__Ack& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Unblock__Ack_template::copy_template(const PDU__NS__Unblock__Ack_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.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 PDU__NS__Unblock__Ack_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 PDU__NS__Unblock__Ack_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__Unblock__Ack_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 @NS_Types.PDU_NS_Unblock_Ack."); break; } set_selection(other_value); } PDU__NS__Unblock__Ack_template::PDU__NS__Unblock__Ack_template() { } PDU__NS__Unblock__Ack_template::PDU__NS__Unblock__Ack_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Unblock__Ack_template::PDU__NS__Unblock__Ack_template(const PDU__NS__Unblock__Ack& other_value) { copy_value(other_value); } PDU__NS__Unblock__Ack_template::PDU__NS__Unblock__Ack_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Unblock__Ack&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Unblock_Ack from an unbound optional field."); } } PDU__NS__Unblock__Ack_template::PDU__NS__Unblock__Ack_template(PDU__NS__Unblock__Ack_template* p_precondition, PDU__NS__Unblock__Ack_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Unblock__Ack_template::PDU__NS__Unblock__Ack_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; } PDU__NS__Unblock__Ack_template::PDU__NS__Unblock__Ack_template(const PDU__NS__Unblock__Ack_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Unblock__Ack_template::~PDU__NS__Unblock__Ack_template() { clean_up(); } PDU__NS__Unblock__Ack_template& PDU__NS__Unblock__Ack_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Unblock__Ack_template& PDU__NS__Unblock__Ack_template::operator=(const PDU__NS__Unblock__Ack& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Unblock__Ack_template& PDU__NS__Unblock__Ack_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Unblock__Ack&)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 @NS_Types.PDU_NS_Unblock_Ack."); } return *this; } PDU__NS__Unblock__Ack_template& PDU__NS__Unblock__Ack_template::operator=(const PDU__NS__Unblock__Ack_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Unblock__Ack_template::match(const PDU__NS__Unblock__Ack& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), 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 @NS_Types.PDU_NS_Unblock_Ack."); } return FALSE; } boolean PDU__NS__Unblock__Ack_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound(); } boolean PDU__NS__Unblock__Ack_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value(); } void PDU__NS__Unblock__Ack_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; } PDU__NS__Unblock__Ack PDU__NS__Unblock__Ack_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 @NS_Types.PDU_NS_Unblock_Ack."); PDU__NS__Unblock__Ack ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } return ret_val; } void PDU__NS__Unblock__Ack_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 @NS_Types.PDU_NS_Unblock_Ack."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Unblock__Ack_template[list_length]; } PDU__NS__Unblock__Ack_template& PDU__NS__Unblock__Ack_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 @NS_Types.PDU_NS_Unblock_Ack."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Unblock_Ack."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Unblock__Ack_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Unblock__Ack_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Unblock_Ack."); return single_value->field_nsPduType; } int PDU__NS__Unblock__Ack_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock_Ack which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 1; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock_Ack 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 @NS_Types.PDU_NS_Unblock_Ack containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock_Ack containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock_Ack containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock_Ack containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock_Ack containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock_Ack containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unblock_Ack containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Unblock_Ack."); } return 0; } void PDU__NS__Unblock__Ack_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.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 PDU__NS__Unblock__Ack_template::log_match(const PDU__NS__Unblock__Ack& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), 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("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), 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 PDU__NS__Unblock__Ack_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.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 @NS_Types.PDU_NS_Unblock_Ack."); } } void PDU__NS__Unblock__Ack_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_nsPduType.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 PDU__NS__Unblock__Ack_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 @NS_Types.PDU_NS_Unblock_Ack."); } } void PDU__NS__Unblock__Ack_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: { PDU__NS__Unblock__Ack_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) nsPduType().set_param(*param.get_elem(0)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Unblock_Ack: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Unblock__Ack_template* precondition = new PDU__NS__Unblock__Ack_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Unblock__Ack_template* implied_template = new PDU__NS__Unblock__Ack_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Unblock__Ack_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Unblock_Ack"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__Unblock__Ack_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Unblock_Ack"); 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 : "@NS_Types.PDU_NS_Unblock_Ack"); } boolean PDU__NS__Unblock__Ack_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__Unblock__Ack_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nS__SDU__ControlBits().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) bVCI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nS__SDU().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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_SDU_ControlBits")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__SDU__ControlBits().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bVCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bVCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_SDU")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__SDU().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Unitdata: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_NS_Unitdata"); } } void PDU__NS__Unitdata::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nS__SDU__ControlBits.encode_text(text_buf); field_bVCI.encode_text(text_buf); field_nS__SDU.encode_text(text_buf); } void PDU__NS__Unitdata::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nS__SDU__ControlBits.decode_text(text_buf); field_bVCI.decode_text(text_buf); field_nS__SDU.decode_text(text_buf); } void PDU__NS__Unitdata::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 PDU__NS__Unitdata::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 PDU__NS__Unitdata::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NS__SDU__ControlBits_descr_.raw->forceomit); decoded_field_length = field_nS__SDU__ControlBits.RAW_decode(NS__SDU__ControlBits_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, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_bVCI.RAW_decode(General__Types::OCT2_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, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_nS__SDU.RAW_decode(OCTETSTRING_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 PDU__NS__Unitdata::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, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NS__SDU__ControlBits_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT2_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, OCTETSTRING_descr_.raw); encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nS__SDU__ControlBits.RAW_encode(NS__SDU__ControlBits_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_bVCI.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_nS__SDU.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct PDU__NS__Unitdata_template::single_value_struct { OCTETSTRING_template field_nsPduType; NS__SDU__ControlBits_template field_nS__SDU__ControlBits; OCTETSTRING_template field_bVCI; OCTETSTRING_template field_nS__SDU; }; void PDU__NS__Unitdata_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_nsPduType = ANY_VALUE; single_value->field_nS__SDU__ControlBits = ANY_VALUE; single_value->field_bVCI = ANY_VALUE; single_value->field_nS__SDU = ANY_VALUE; } } } void PDU__NS__Unitdata_template::copy_value(const PDU__NS__Unitdata& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nS__SDU__ControlBits().is_bound()) { single_value->field_nS__SDU__ControlBits = other_value.nS__SDU__ControlBits(); } else { single_value->field_nS__SDU__ControlBits.clean_up(); } if (other_value.bVCI().is_bound()) { single_value->field_bVCI = other_value.bVCI(); } else { single_value->field_bVCI.clean_up(); } if (other_value.nS__SDU().is_bound()) { single_value->field_nS__SDU = other_value.nS__SDU(); } else { single_value->field_nS__SDU.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__NS__Unitdata_template::copy_template(const PDU__NS__Unitdata_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nS__SDU__ControlBits().get_selection()) { single_value->field_nS__SDU__ControlBits = other_value.nS__SDU__ControlBits(); } else { single_value->field_nS__SDU__ControlBits.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.bVCI().get_selection()) { single_value->field_bVCI = other_value.bVCI(); } else { single_value->field_bVCI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nS__SDU().get_selection()) { single_value->field_nS__SDU = other_value.nS__SDU(); } else { single_value->field_nS__SDU.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 PDU__NS__Unitdata_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 PDU__NS__Unitdata_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS__Unitdata_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 @NS_Types.PDU_NS_Unitdata."); break; } set_selection(other_value); } PDU__NS__Unitdata_template::PDU__NS__Unitdata_template() { } PDU__NS__Unitdata_template::PDU__NS__Unitdata_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS__Unitdata_template::PDU__NS__Unitdata_template(const PDU__NS__Unitdata& other_value) { copy_value(other_value); } PDU__NS__Unitdata_template::PDU__NS__Unitdata_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Unitdata&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_NS_Unitdata from an unbound optional field."); } } PDU__NS__Unitdata_template::PDU__NS__Unitdata_template(PDU__NS__Unitdata_template* p_precondition, PDU__NS__Unitdata_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS__Unitdata_template::PDU__NS__Unitdata_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; } PDU__NS__Unitdata_template::PDU__NS__Unitdata_template(const PDU__NS__Unitdata_template& other_value) : Base_Template() { copy_template(other_value); } PDU__NS__Unitdata_template::~PDU__NS__Unitdata_template() { clean_up(); } PDU__NS__Unitdata_template& PDU__NS__Unitdata_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS__Unitdata_template& PDU__NS__Unitdata_template::operator=(const PDU__NS__Unitdata& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS__Unitdata_template& PDU__NS__Unitdata_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS__Unitdata&)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 @NS_Types.PDU_NS_Unitdata."); } return *this; } PDU__NS__Unitdata_template& PDU__NS__Unitdata_template::operator=(const PDU__NS__Unitdata_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS__Unitdata_template::match(const PDU__NS__Unitdata& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nS__SDU__ControlBits().is_bound()) return FALSE; if(!single_value->field_nS__SDU__ControlBits.match(other_value.nS__SDU__ControlBits(), legacy))return FALSE; if(!other_value.bVCI().is_bound()) return FALSE; if(!single_value->field_bVCI.match(other_value.bVCI(), legacy))return FALSE; if(!other_value.nS__SDU().is_bound()) return FALSE; if(!single_value->field_nS__SDU.match(other_value.nS__SDU(), 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 @NS_Types.PDU_NS_Unitdata."); } return FALSE; } boolean PDU__NS__Unitdata_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nS__SDU__ControlBits.is_bound() || single_value->field_bVCI.is_bound() || single_value->field_nS__SDU.is_bound(); } boolean PDU__NS__Unitdata_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nS__SDU__ControlBits.is_value() && single_value->field_bVCI.is_value() && single_value->field_nS__SDU.is_value(); } void PDU__NS__Unitdata_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; } PDU__NS__Unitdata PDU__NS__Unitdata_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 @NS_Types.PDU_NS_Unitdata."); PDU__NS__Unitdata ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nS__SDU__ControlBits.is_bound()) { ret_val.nS__SDU__ControlBits() = single_value->field_nS__SDU__ControlBits.valueof(); } if (single_value->field_bVCI.is_bound()) { ret_val.bVCI() = single_value->field_bVCI.valueof(); } if (single_value->field_nS__SDU.is_bound()) { ret_val.nS__SDU() = single_value->field_nS__SDU.valueof(); } return ret_val; } void PDU__NS__Unitdata_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 @NS_Types.PDU_NS_Unitdata."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS__Unitdata_template[list_length]; } PDU__NS__Unitdata_template& PDU__NS__Unitdata_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 @NS_Types.PDU_NS_Unitdata."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_NS_Unitdata."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__NS__Unitdata_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__NS__Unitdata_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_NS_Unitdata."); return single_value->field_nsPduType; } NS__SDU__ControlBits_template& PDU__NS__Unitdata_template::nS__SDU__ControlBits() { set_specific(); return single_value->field_nS__SDU__ControlBits; } const NS__SDU__ControlBits_template& PDU__NS__Unitdata_template::nS__SDU__ControlBits() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nS_SDU_ControlBits of a non-specific template of type @NS_Types.PDU_NS_Unitdata."); return single_value->field_nS__SDU__ControlBits; } OCTETSTRING_template& PDU__NS__Unitdata_template::bVCI() { set_specific(); return single_value->field_bVCI; } const OCTETSTRING_template& PDU__NS__Unitdata_template::bVCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bVCI of a non-specific template of type @NS_Types.PDU_NS_Unitdata."); return single_value->field_bVCI; } OCTETSTRING_template& PDU__NS__Unitdata_template::nS__SDU() { set_specific(); return single_value->field_nS__SDU; } const OCTETSTRING_template& PDU__NS__Unitdata_template::nS__SDU() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nS_SDU of a non-specific template of type @NS_Types.PDU_NS_Unitdata."); return single_value->field_nS__SDU; } int PDU__NS__Unitdata_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unitdata 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 @NS_Types.PDU_NS_Unitdata 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 @NS_Types.PDU_NS_Unitdata containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unitdata containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unitdata containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unitdata containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unitdata containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unitdata containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_NS_Unitdata containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_NS_Unitdata."); } return 0; } void PDU__NS__Unitdata_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nS_SDU_ControlBits := "); single_value->field_nS__SDU__ControlBits.log(); TTCN_Logger::log_event_str(", bVCI := "); single_value->field_bVCI.log(); TTCN_Logger::log_event_str(", nS_SDU := "); single_value->field_nS__SDU.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 PDU__NS__Unitdata_template::log_match(const PDU__NS__Unitdata& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nS__SDU__ControlBits.match(match_value.nS__SDU__ControlBits(), legacy)){ TTCN_Logger::log_logmatch_info(".nS_SDU_ControlBits"); single_value->field_nS__SDU__ControlBits.log_match(match_value.nS__SDU__ControlBits(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_bVCI.match(match_value.bVCI(), legacy)){ TTCN_Logger::log_logmatch_info(".bVCI"); single_value->field_bVCI.log_match(match_value.bVCI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nS__SDU.match(match_value.nS__SDU(), legacy)){ TTCN_Logger::log_logmatch_info(".nS_SDU"); single_value->field_nS__SDU.log_match(match_value.nS__SDU(), 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("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nS_SDU_ControlBits := "); single_value->field_nS__SDU__ControlBits.log_match(match_value.nS__SDU__ControlBits(), legacy); TTCN_Logger::log_event_str(", bVCI := "); single_value->field_bVCI.log_match(match_value.bVCI(), legacy); TTCN_Logger::log_event_str(", nS_SDU := "); single_value->field_nS__SDU.log_match(match_value.nS__SDU(), 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 PDU__NS__Unitdata_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nS__SDU__ControlBits.encode_text(text_buf); single_value->field_bVCI.encode_text(text_buf); single_value->field_nS__SDU.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 @NS_Types.PDU_NS_Unitdata."); } } void PDU__NS__Unitdata_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_nsPduType.decode_text(text_buf); single_value->field_nS__SDU__ControlBits.decode_text(text_buf); single_value->field_bVCI.decode_text(text_buf); single_value->field_nS__SDU.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 PDU__NS__Unitdata_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 @NS_Types.PDU_NS_Unitdata."); } } void PDU__NS__Unitdata_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: { PDU__NS__Unitdata_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nS__SDU__ControlBits().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) bVCI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) nS__SDU().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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_SDU_ControlBits")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__SDU__ControlBits().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bVCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bVCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nS_SDU")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nS__SDU().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_NS_Unitdata: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__NS__Unitdata_template* precondition = new PDU__NS__Unitdata_template; precondition->set_param(*param.get_elem(0)); PDU__NS__Unitdata_template* implied_template = new PDU__NS__Unitdata_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__NS__Unitdata_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_NS_Unitdata"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS__Unitdata_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Unitdata"); single_value->field_nS__SDU__ControlBits.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Unitdata"); single_value->field_bVCI.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Unitdata"); single_value->field_nS__SDU.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS_Unitdata"); 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 : "@NS_Types.PDU_NS_Unitdata"); } boolean PDU__NS__Unitdata_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS__Unitdata_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx& par_causeNS, const OPTIONAL< IP__Address__NS >& par_iP__Address__NS, const OPTIONAL< ListofIP4Elements >& par_listofIP4Elements, const OPTIONAL< ListofIP6Elements >& par_listofIP6Elements) : field_nsPduType(par_nsPduType), field_nSEI__NS(par_nSEI__NS), field_transactionID(par_transactionID), field_causeNS(par_causeNS), field_iP__Address__NS(par_iP__Address__NS), field_listofIP4Elements(par_listofIP4Elements), field_listofIP6Elements(par_listofIP6Elements) { } PDU__SNS__Ack::PDU__SNS__Ack(const PDU__SNS__Ack& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.PDU_SNS_Ack."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.transactionID().is_bound()) field_transactionID = other_value.transactionID(); else field_transactionID.clean_up(); if (other_value.causeNS().is_bound()) field_causeNS = other_value.causeNS(); else field_causeNS.clean_up(); if (other_value.iP__Address__NS().is_bound()) field_iP__Address__NS = other_value.iP__Address__NS(); else field_iP__Address__NS.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } void PDU__SNS__Ack::clean_up() { field_nsPduType.clean_up(); field_nSEI__NS.clean_up(); field_transactionID.clean_up(); field_causeNS.clean_up(); field_iP__Address__NS.clean_up(); field_listofIP4Elements.clean_up(); field_listofIP6Elements.clean_up(); } const TTCN_Typedescriptor_t* PDU__SNS__Ack::get_descriptor() const { return &PDU__SNS__Ack_descr_; } PDU__SNS__Ack& PDU__SNS__Ack::operator=(const PDU__SNS__Ack& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.PDU_SNS_Ack."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.transactionID().is_bound()) field_transactionID = other_value.transactionID(); else field_transactionID.clean_up(); if (other_value.causeNS().is_bound()) field_causeNS = other_value.causeNS(); else field_causeNS.clean_up(); if (other_value.iP__Address__NS().is_bound()) field_iP__Address__NS = other_value.iP__Address__NS(); else field_iP__Address__NS.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } return *this; } boolean PDU__SNS__Ack::operator==(const PDU__SNS__Ack& other_value) const { return field_nsPduType==other_value.field_nsPduType && field_nSEI__NS==other_value.field_nSEI__NS && field_transactionID==other_value.field_transactionID && field_causeNS==other_value.field_causeNS && field_iP__Address__NS==other_value.field_iP__Address__NS && field_listofIP4Elements==other_value.field_listofIP4Elements && field_listofIP6Elements==other_value.field_listofIP6Elements; } boolean PDU__SNS__Ack::is_bound() const { return (field_nsPduType.is_bound()) || (field_nSEI__NS.is_bound()) || (field_transactionID.is_bound()) || (OPTIONAL_OMIT == field_causeNS.get_selection() || field_causeNS.is_bound()) || (OPTIONAL_OMIT == field_iP__Address__NS.get_selection() || field_iP__Address__NS.is_bound()) || (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_bound()) || (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_bound()); } boolean PDU__SNS__Ack::is_value() const { return field_nsPduType.is_value() && field_nSEI__NS.is_value() && field_transactionID.is_value() && (OPTIONAL_OMIT == field_causeNS.get_selection() || field_causeNS.is_value()) && (OPTIONAL_OMIT == field_iP__Address__NS.get_selection() || field_iP__Address__NS.is_value()) && (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_value()) && (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_value()); } int PDU__SNS__Ack::size_of() const { int ret_val = 3; if (field_causeNS.ispresent()) ret_val++; if (field_iP__Address__NS.ispresent()) ret_val++; if (field_listofIP4Elements.ispresent()) ret_val++; if (field_listofIP6Elements.ispresent()) ret_val++; return ret_val; } void PDU__SNS__Ack::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nsPduType := "); field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); field_nSEI__NS.log(); TTCN_Logger::log_event_str(", transactionID := "); field_transactionID.log(); TTCN_Logger::log_event_str(", causeNS := "); field_causeNS.log(); TTCN_Logger::log_event_str(", iP_Address_NS := "); field_iP__Address__NS.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" }"); } void PDU__SNS__Ack::set_implicit_omit() { if (nsPduType().is_bound()) nsPduType().set_implicit_omit(); if (nSEI__NS().is_bound()) nSEI__NS().set_implicit_omit(); if (transactionID().is_bound()) transactionID().set_implicit_omit(); if (!causeNS().is_bound()) causeNS() = OMIT_VALUE; else causeNS().set_implicit_omit(); if (!iP__Address__NS().is_bound()) iP__Address__NS() = OMIT_VALUE; else iP__Address__NS().set_implicit_omit(); if (!listofIP4Elements().is_bound()) listofIP4Elements() = OMIT_VALUE; else listofIP4Elements().set_implicit_omit(); if (!listofIP6Elements().is_bound()) listofIP6Elements() = OMIT_VALUE; else listofIP6Elements().set_implicit_omit(); } void PDU__SNS__Ack::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 (70 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transactionID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) iP__Address__NS().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(6)); 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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transactionID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transactionID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iP_Address_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iP__Address__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Ack: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_SNS_Ack"); } } void PDU__SNS__Ack::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); field_transactionID.encode_text(text_buf); field_causeNS.encode_text(text_buf); field_iP__Address__NS.encode_text(text_buf); field_listofIP4Elements.encode_text(text_buf); field_listofIP6Elements.encode_text(text_buf); } void PDU__SNS__Ack::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); field_transactionID.decode_text(text_buf); field_causeNS.decode_text(text_buf); field_iP__Address__NS.decode_text(text_buf); field_listofIP4Elements.decode_text(text_buf); field_listofIP6Elements.decode_text(text_buf); } void PDU__SNS__Ack::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 PDU__SNS__Ack::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 PDU__SNS__Ack::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_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, PDU__SNS__Ack_transactionID_descr_.raw->forceomit); decoded_field_length = field_transactionID.RAW_decode(PDU__SNS__Ack_transactionID_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(3)) { field_causeNS = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, CauseNS_descr_.raw->forceomit); decoded_field_length = field_causeNS().RAW_decode(CauseNS_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_causeNS = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_causeNS.ispresent() || field_causeNS().iEI() != os_5){ field_causeNS=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_causeNS=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_iP__Address__NS = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, IP__Address__NS_descr_.raw->forceomit); decoded_field_length = field_iP__Address__NS().RAW_decode(IP__Address__NS_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_iP__Address__NS = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_iP__Address__NS.ispresent() || field_iP__Address__NS().iEI() != os_6){ field_iP__Address__NS=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_iP__Address__NS=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(5)) { field_listofIP4Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_5_force_omit(5, force_omit, ListofIP4Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP4Elements().RAW_decode(ListofIP4Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 1) { field_listofIP4Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_3){ field_listofIP4Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP4Elements=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(6)) { field_listofIP6Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_6_force_omit(6, force_omit, ListofIP6Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP6Elements().RAW_decode(ListofIP6Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 1) { field_listofIP6Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4){ field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__SNS__Ack::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 = 7; myleaf.body.node.nodes = init_nodes_of_enc_tree(7); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NSEI__NS_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PDU__SNS__Ack_transactionID_descr_.raw); if (field_causeNS.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, CauseNS_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; if (field_iP__Address__NS.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, IP__Address__NS_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; if (field_listofIP4Elements.ispresent()) { myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, ListofIP4Elements_descr_.raw); } else myleaf.body.node.nodes[5] = NULL; if (field_listofIP6Elements.ispresent()) { myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, ListofIP6Elements_descr_.raw); } else myleaf.body.node.nodes[6] = NULL; encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_transactionID.RAW_encode(PDU__SNS__Ack_transactionID_descr_, *myleaf.body.node.nodes[2]); if (field_causeNS.ispresent()) { encoded_length += field_causeNS().RAW_encode(CauseNS_descr_, *myleaf.body.node.nodes[3]); } if (field_iP__Address__NS.ispresent()) { encoded_length += field_iP__Address__NS().RAW_encode(IP__Address__NS_descr_, *myleaf.body.node.nodes[4]); } if (field_listofIP4Elements.ispresent()) { encoded_length += field_listofIP4Elements().RAW_encode(ListofIP4Elements_descr_, *myleaf.body.node.nodes[5]); } if (field_listofIP6Elements.ispresent()) { encoded_length += field_listofIP6Elements().RAW_encode(ListofIP6Elements_descr_, *myleaf.body.node.nodes[6]); } if (field_causeNS.ispresent() && (!field_causeNS.ispresent() || field_causeNS().iEI() != os_5)) { 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){ os_5.RAW_encode(General__Types::OCT1_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); } } if (field_iP__Address__NS.ispresent() && (!field_iP__Address__NS.ispresent() || field_iP__Address__NS().iEI() != os_6)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={4,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){ os_6.RAW_encode(General__Types::OCT1_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); } } if (field_listofIP4Elements.ispresent() && (!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_3)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={5,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){ os_3.RAW_encode(General__Types::OCT1_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); } } if (field_listofIP6Elements.ispresent() && (!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={6,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){ os_4.RAW_encode(General__Types::OCT1_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); } } return myleaf.length = encoded_length; } struct PDU__SNS__Ack_template::single_value_struct { OCTETSTRING_template field_nsPduType; NSEI__NS_template field_nSEI__NS; INTEGER_template field_transactionID; CauseNS_template field_causeNS; IP__Address__NS_template field_iP__Address__NS; ListofIP4Elements_template field_listofIP4Elements; ListofIP6Elements_template field_listofIP6Elements; }; void PDU__SNS__Ack_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_nsPduType = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; single_value->field_transactionID = ANY_VALUE; single_value->field_causeNS = ANY_OR_OMIT; single_value->field_iP__Address__NS = ANY_OR_OMIT; single_value->field_listofIP4Elements = ANY_OR_OMIT; single_value->field_listofIP6Elements = ANY_OR_OMIT; } } } void PDU__SNS__Ack_template::copy_value(const PDU__SNS__Ack& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (other_value.transactionID().is_bound()) { single_value->field_transactionID = other_value.transactionID(); } else { single_value->field_transactionID.clean_up(); } if (other_value.causeNS().is_bound()) { if (other_value.causeNS().ispresent()) single_value->field_causeNS = other_value.causeNS()(); else single_value->field_causeNS = OMIT_VALUE; } else { single_value->field_causeNS.clean_up(); } if (other_value.iP__Address__NS().is_bound()) { if (other_value.iP__Address__NS().ispresent()) single_value->field_iP__Address__NS = other_value.iP__Address__NS()(); else single_value->field_iP__Address__NS = OMIT_VALUE; } else { single_value->field_iP__Address__NS.clean_up(); } if (other_value.listofIP4Elements().is_bound()) { if (other_value.listofIP4Elements().ispresent()) single_value->field_listofIP4Elements = other_value.listofIP4Elements()(); else single_value->field_listofIP4Elements = OMIT_VALUE; } else { single_value->field_listofIP4Elements.clean_up(); } if (other_value.listofIP6Elements().is_bound()) { if (other_value.listofIP6Elements().ispresent()) single_value->field_listofIP6Elements = other_value.listofIP6Elements()(); else single_value->field_listofIP6Elements = OMIT_VALUE; } else { single_value->field_listofIP6Elements.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__SNS__Ack_template::copy_template(const PDU__SNS__Ack_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.transactionID().get_selection()) { single_value->field_transactionID = other_value.transactionID(); } else { single_value->field_transactionID.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.causeNS().get_selection()) { single_value->field_causeNS = other_value.causeNS(); } else { single_value->field_causeNS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.iP__Address__NS().get_selection()) { single_value->field_iP__Address__NS = other_value.iP__Address__NS(); } else { single_value->field_iP__Address__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP4Elements().get_selection()) { single_value->field_listofIP4Elements = other_value.listofIP4Elements(); } else { single_value->field_listofIP4Elements.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP6Elements().get_selection()) { single_value->field_listofIP6Elements = other_value.listofIP6Elements(); } else { single_value->field_listofIP6Elements.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 PDU__SNS__Ack_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 PDU__SNS__Ack_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__SNS__Ack_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 @NS_Types.PDU_SNS_Ack."); break; } set_selection(other_value); } PDU__SNS__Ack_template::PDU__SNS__Ack_template() { } PDU__SNS__Ack_template::PDU__SNS__Ack_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__SNS__Ack_template::PDU__SNS__Ack_template(const PDU__SNS__Ack& other_value) { copy_value(other_value); } PDU__SNS__Ack_template::PDU__SNS__Ack_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Ack&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_SNS_Ack from an unbound optional field."); } } PDU__SNS__Ack_template::PDU__SNS__Ack_template(PDU__SNS__Ack_template* p_precondition, PDU__SNS__Ack_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__SNS__Ack_template::PDU__SNS__Ack_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; } PDU__SNS__Ack_template::PDU__SNS__Ack_template(const PDU__SNS__Ack_template& other_value) : Base_Template() { copy_template(other_value); } PDU__SNS__Ack_template::~PDU__SNS__Ack_template() { clean_up(); } PDU__SNS__Ack_template& PDU__SNS__Ack_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__SNS__Ack_template& PDU__SNS__Ack_template::operator=(const PDU__SNS__Ack& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__SNS__Ack_template& PDU__SNS__Ack_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Ack&)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 @NS_Types.PDU_SNS_Ack."); } return *this; } PDU__SNS__Ack_template& PDU__SNS__Ack_template::operator=(const PDU__SNS__Ack_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__SNS__Ack_template::match(const PDU__SNS__Ack& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), legacy))return FALSE; if(!other_value.transactionID().is_bound()) return FALSE; if(!single_value->field_transactionID.match(other_value.transactionID(), legacy))return FALSE; if(!other_value.causeNS().is_bound()) return FALSE; if((other_value.causeNS().ispresent() ? !single_value->field_causeNS.match((const CauseNS&)other_value.causeNS(), legacy) : !single_value->field_causeNS.match_omit(legacy)))return FALSE; if(!other_value.iP__Address__NS().is_bound()) return FALSE; if((other_value.iP__Address__NS().ispresent() ? !single_value->field_iP__Address__NS.match((const IP__Address__NS&)other_value.iP__Address__NS(), legacy) : !single_value->field_iP__Address__NS.match_omit(legacy)))return FALSE; if(!other_value.listofIP4Elements().is_bound()) return FALSE; if((other_value.listofIP4Elements().ispresent() ? !single_value->field_listofIP4Elements.match((const ListofIP4Elements&)other_value.listofIP4Elements(), legacy) : !single_value->field_listofIP4Elements.match_omit(legacy)))return FALSE; if(!other_value.listofIP6Elements().is_bound()) return FALSE; if((other_value.listofIP6Elements().ispresent() ? !single_value->field_listofIP6Elements.match((const ListofIP6Elements&)other_value.listofIP6Elements(), legacy) : !single_value->field_listofIP6Elements.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Ack."); } return FALSE; } boolean PDU__SNS__Ack_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nSEI__NS.is_bound() || single_value->field_transactionID.is_bound() || (single_value->field_causeNS.is_omit() || single_value->field_causeNS.is_bound()) || (single_value->field_iP__Address__NS.is_omit() || single_value->field_iP__Address__NS.is_bound()) || (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_bound()) || (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_bound()); } boolean PDU__SNS__Ack_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nSEI__NS.is_value() && single_value->field_transactionID.is_value() && (single_value->field_causeNS.is_omit() || single_value->field_causeNS.is_value()) && (single_value->field_iP__Address__NS.is_omit() || single_value->field_iP__Address__NS.is_value()) && (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_value()) && (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_value()); } void PDU__SNS__Ack_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; } PDU__SNS__Ack PDU__SNS__Ack_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 @NS_Types.PDU_SNS_Ack."); PDU__SNS__Ack ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } if (single_value->field_transactionID.is_bound()) { ret_val.transactionID() = single_value->field_transactionID.valueof(); } if (single_value->field_causeNS.is_omit()) ret_val.causeNS() = OMIT_VALUE; else if (single_value->field_causeNS.is_bound()) { ret_val.causeNS() = single_value->field_causeNS.valueof(); } if (single_value->field_iP__Address__NS.is_omit()) ret_val.iP__Address__NS() = OMIT_VALUE; else if (single_value->field_iP__Address__NS.is_bound()) { ret_val.iP__Address__NS() = single_value->field_iP__Address__NS.valueof(); } if (single_value->field_listofIP4Elements.is_omit()) ret_val.listofIP4Elements() = OMIT_VALUE; else if (single_value->field_listofIP4Elements.is_bound()) { ret_val.listofIP4Elements() = single_value->field_listofIP4Elements.valueof(); } if (single_value->field_listofIP6Elements.is_omit()) ret_val.listofIP6Elements() = OMIT_VALUE; else if (single_value->field_listofIP6Elements.is_bound()) { ret_val.listofIP6Elements() = single_value->field_listofIP6Elements.valueof(); } return ret_val; } void PDU__SNS__Ack_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 @NS_Types.PDU_SNS_Ack."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__SNS__Ack_template[list_length]; } PDU__SNS__Ack_template& PDU__SNS__Ack_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 @NS_Types.PDU_SNS_Ack."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_SNS_Ack."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__SNS__Ack_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__SNS__Ack_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_SNS_Ack."); return single_value->field_nsPduType; } NSEI__NS_template& PDU__SNS__Ack_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__SNS__Ack_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_SNS_Ack."); return single_value->field_nSEI__NS; } INTEGER_template& PDU__SNS__Ack_template::transactionID() { set_specific(); return single_value->field_transactionID; } const INTEGER_template& PDU__SNS__Ack_template::transactionID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field transactionID of a non-specific template of type @NS_Types.PDU_SNS_Ack."); return single_value->field_transactionID; } CauseNS_template& PDU__SNS__Ack_template::causeNS() { set_specific(); return single_value->field_causeNS; } const CauseNS_template& PDU__SNS__Ack_template::causeNS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field causeNS of a non-specific template of type @NS_Types.PDU_SNS_Ack."); return single_value->field_causeNS; } IP__Address__NS_template& PDU__SNS__Ack_template::iP__Address__NS() { set_specific(); return single_value->field_iP__Address__NS; } const IP__Address__NS_template& PDU__SNS__Ack_template::iP__Address__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iP_Address_NS of a non-specific template of type @NS_Types.PDU_SNS_Ack."); return single_value->field_iP__Address__NS; } ListofIP4Elements_template& PDU__SNS__Ack_template::listofIP4Elements() { set_specific(); return single_value->field_listofIP4Elements; } const ListofIP4Elements_template& PDU__SNS__Ack_template::listofIP4Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP4Elements of a non-specific template of type @NS_Types.PDU_SNS_Ack."); return single_value->field_listofIP4Elements; } ListofIP6Elements_template& PDU__SNS__Ack_template::listofIP6Elements() { set_specific(); return single_value->field_listofIP6Elements; } const ListofIP6Elements_template& PDU__SNS__Ack_template::listofIP6Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP6Elements of a non-specific template of type @NS_Types.PDU_SNS_Ack."); return single_value->field_listofIP6Elements; } int PDU__SNS__Ack_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Ack which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_causeNS.is_present()) ret_val++; if (single_value->field_iP__Address__NS.is_present()) ret_val++; if (single_value->field_listofIP4Elements.is_present()) ret_val++; if (single_value->field_listofIP6Elements.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Ack 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 @NS_Types.PDU_SNS_Ack containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Ack containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Ack containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Ack containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Ack containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Ack containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Ack containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Ack."); } return 0; } void PDU__SNS__Ack_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log(); TTCN_Logger::log_event_str(", transactionID := "); single_value->field_transactionID.log(); TTCN_Logger::log_event_str(", causeNS := "); single_value->field_causeNS.log(); TTCN_Logger::log_event_str(", iP_Address_NS := "); single_value->field_iP__Address__NS.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); single_value->field_listofIP6Elements.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 PDU__SNS__Ack_template::log_match(const PDU__SNS__Ack& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_transactionID.match(match_value.transactionID(), legacy)){ TTCN_Logger::log_logmatch_info(".transactionID"); single_value->field_transactionID.log_match(match_value.transactionID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.causeNS().ispresent()){ if(!single_value->field_causeNS.match(match_value.causeNS(), legacy)){ TTCN_Logger::log_logmatch_info(".causeNS"); single_value->field_causeNS.log_match(match_value.causeNS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_causeNS.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".causeNS := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_causeNS.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.iP__Address__NS().ispresent()){ if(!single_value->field_iP__Address__NS.match(match_value.iP__Address__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".iP_Address_NS"); single_value->field_iP__Address__NS.log_match(match_value.iP__Address__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_iP__Address__NS.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".iP_Address_NS := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_iP__Address__NS.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.listofIP4Elements().ispresent()){ if(!single_value->field_listofIP4Elements.match(match_value.listofIP4Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements"); single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP4Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.listofIP6Elements().ispresent()){ if(!single_value->field_listofIP6Elements.match(match_value.listofIP6Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements"); single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP6Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::log_event_str(", transactionID := "); single_value->field_transactionID.log_match(match_value.transactionID(), legacy); TTCN_Logger::log_event_str(", causeNS := "); if (match_value.causeNS().ispresent()) { single_value->field_causeNS.log_match(match_value.causeNS(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_causeNS.log(); if (single_value->field_causeNS.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", iP_Address_NS := "); if (match_value.iP__Address__NS().ispresent()) { single_value->field_iP__Address__NS.log_match(match_value.iP__Address__NS(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_iP__Address__NS.log(); if (single_value->field_iP__Address__NS.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", listofIP4Elements := "); if (match_value.listofIP4Elements().ispresent()) { single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP4Elements.log(); if (single_value->field_listofIP4Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", listofIP6Elements := "); if (match_value.listofIP6Elements().ispresent()) { single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP6Elements.log(); if (single_value->field_listofIP6Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void PDU__SNS__Ack_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nSEI__NS.encode_text(text_buf); single_value->field_transactionID.encode_text(text_buf); single_value->field_causeNS.encode_text(text_buf); single_value->field_iP__Address__NS.encode_text(text_buf); single_value->field_listofIP4Elements.encode_text(text_buf); single_value->field_listofIP6Elements.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 @NS_Types.PDU_SNS_Ack."); } } void PDU__SNS__Ack_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_nsPduType.decode_text(text_buf); single_value->field_nSEI__NS.decode_text(text_buf); single_value->field_transactionID.decode_text(text_buf); single_value->field_causeNS.decode_text(text_buf); single_value->field_iP__Address__NS.decode_text(text_buf); single_value->field_listofIP4Elements.decode_text(text_buf); single_value->field_listofIP6Elements.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 PDU__SNS__Ack_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 @NS_Types.PDU_SNS_Ack."); } } void PDU__SNS__Ack_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: { PDU__SNS__Ack_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transactionID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) iP__Address__NS().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(6)); 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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transactionID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transactionID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iP_Address_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iP__Address__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Ack: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__SNS__Ack_template* precondition = new PDU__SNS__Ack_template; precondition->set_param(*param.get_elem(0)); PDU__SNS__Ack_template* implied_template = new PDU__SNS__Ack_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__SNS__Ack_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_SNS_Ack"); } is_ifpresent = param.get_ifpresent(); } void PDU__SNS__Ack_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Ack"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Ack"); single_value->field_transactionID.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Ack"); single_value->field_causeNS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Ack"); single_value->field_iP__Address__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Ack"); single_value->field_listofIP4Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Ack"); single_value->field_listofIP6Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Ack"); 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 : "@NS_Types.PDU_SNS_Ack"); } boolean PDU__SNS__Ack_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__SNS__Ack_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx& par_listofIP4Elements, const OPTIONAL< ListofIP6Elements >& par_listofIP6Elements) : field_nsPduType(par_nsPduType), field_nSEI__NS(par_nSEI__NS), field_transactionID(par_transactionID), field_listofIP4Elements(par_listofIP4Elements), field_listofIP6Elements(par_listofIP6Elements) { } PDU__SNS__Add::PDU__SNS__Add(const PDU__SNS__Add& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.PDU_SNS_Add."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.transactionID().is_bound()) field_transactionID = other_value.transactionID(); else field_transactionID.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } void PDU__SNS__Add::clean_up() { field_nsPduType.clean_up(); field_nSEI__NS.clean_up(); field_transactionID.clean_up(); field_listofIP4Elements.clean_up(); field_listofIP6Elements.clean_up(); } const TTCN_Typedescriptor_t* PDU__SNS__Add::get_descriptor() const { return &PDU__SNS__Add_descr_; } PDU__SNS__Add& PDU__SNS__Add::operator=(const PDU__SNS__Add& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.PDU_SNS_Add."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.transactionID().is_bound()) field_transactionID = other_value.transactionID(); else field_transactionID.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } return *this; } boolean PDU__SNS__Add::operator==(const PDU__SNS__Add& other_value) const { return field_nsPduType==other_value.field_nsPduType && field_nSEI__NS==other_value.field_nSEI__NS && field_transactionID==other_value.field_transactionID && field_listofIP4Elements==other_value.field_listofIP4Elements && field_listofIP6Elements==other_value.field_listofIP6Elements; } boolean PDU__SNS__Add::is_bound() const { return (field_nsPduType.is_bound()) || (field_nSEI__NS.is_bound()) || (field_transactionID.is_bound()) || (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_bound()) || (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_bound()); } boolean PDU__SNS__Add::is_value() const { return field_nsPduType.is_value() && field_nSEI__NS.is_value() && field_transactionID.is_value() && (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_value()) && (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_value()); } int PDU__SNS__Add::size_of() const { int ret_val = 3; if (field_listofIP4Elements.ispresent()) ret_val++; if (field_listofIP6Elements.ispresent()) ret_val++; return ret_val; } void PDU__SNS__Add::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nsPduType := "); field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); field_nSEI__NS.log(); TTCN_Logger::log_event_str(", transactionID := "); field_transactionID.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" }"); } void PDU__SNS__Add::set_implicit_omit() { if (nsPduType().is_bound()) nsPduType().set_implicit_omit(); if (nSEI__NS().is_bound()) nSEI__NS().set_implicit_omit(); if (transactionID().is_bound()) transactionID().set_implicit_omit(); if (!listofIP4Elements().is_bound()) listofIP4Elements() = OMIT_VALUE; else listofIP4Elements().set_implicit_omit(); if (!listofIP6Elements().is_bound()) listofIP6Elements() = OMIT_VALUE; else listofIP6Elements().set_implicit_omit(); } void PDU__SNS__Add::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 (50 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transactionID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(4)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transactionID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transactionID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Add: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_SNS_Add"); } } void PDU__SNS__Add::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); field_transactionID.encode_text(text_buf); field_listofIP4Elements.encode_text(text_buf); field_listofIP6Elements.encode_text(text_buf); } void PDU__SNS__Add::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); field_transactionID.decode_text(text_buf); field_listofIP4Elements.decode_text(text_buf); field_listofIP6Elements.decode_text(text_buf); } void PDU__SNS__Add::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 PDU__SNS__Add::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 PDU__SNS__Add::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_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, PDU__SNS__Add_transactionID_descr_.raw->forceomit); decoded_field_length = field_transactionID.RAW_decode(PDU__SNS__Add_transactionID_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(3)) { field_listofIP4Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, ListofIP4Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP4Elements().RAW_decode(ListofIP4Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_listofIP4Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_3){ field_listofIP4Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP4Elements=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_listofIP6Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, ListofIP6Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP6Elements().RAW_decode(ListofIP6Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_listofIP6Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4){ field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__SNS__Add::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 = 5; myleaf.body.node.nodes = init_nodes_of_enc_tree(5); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NSEI__NS_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PDU__SNS__Add_transactionID_descr_.raw); if (field_listofIP4Elements.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, ListofIP4Elements_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; if (field_listofIP6Elements.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, ListofIP6Elements_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_transactionID.RAW_encode(PDU__SNS__Add_transactionID_descr_, *myleaf.body.node.nodes[2]); if (field_listofIP4Elements.ispresent()) { encoded_length += field_listofIP4Elements().RAW_encode(ListofIP4Elements_descr_, *myleaf.body.node.nodes[3]); } if (field_listofIP6Elements.ispresent()) { encoded_length += field_listofIP6Elements().RAW_encode(ListofIP6Elements_descr_, *myleaf.body.node.nodes[4]); } if (field_listofIP4Elements.ispresent() && (!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_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){ os_3.RAW_encode(General__Types::OCT1_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); } } if (field_listofIP6Elements.ispresent() && (!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={4,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){ os_4.RAW_encode(General__Types::OCT1_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); } } return myleaf.length = encoded_length; } struct PDU__SNS__Add_template::single_value_struct { OCTETSTRING_template field_nsPduType; NSEI__NS_template field_nSEI__NS; INTEGER_template field_transactionID; ListofIP4Elements_template field_listofIP4Elements; ListofIP6Elements_template field_listofIP6Elements; }; void PDU__SNS__Add_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_nsPduType = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; single_value->field_transactionID = ANY_VALUE; single_value->field_listofIP4Elements = ANY_OR_OMIT; single_value->field_listofIP6Elements = ANY_OR_OMIT; } } } void PDU__SNS__Add_template::copy_value(const PDU__SNS__Add& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (other_value.transactionID().is_bound()) { single_value->field_transactionID = other_value.transactionID(); } else { single_value->field_transactionID.clean_up(); } if (other_value.listofIP4Elements().is_bound()) { if (other_value.listofIP4Elements().ispresent()) single_value->field_listofIP4Elements = other_value.listofIP4Elements()(); else single_value->field_listofIP4Elements = OMIT_VALUE; } else { single_value->field_listofIP4Elements.clean_up(); } if (other_value.listofIP6Elements().is_bound()) { if (other_value.listofIP6Elements().ispresent()) single_value->field_listofIP6Elements = other_value.listofIP6Elements()(); else single_value->field_listofIP6Elements = OMIT_VALUE; } else { single_value->field_listofIP6Elements.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__SNS__Add_template::copy_template(const PDU__SNS__Add_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.transactionID().get_selection()) { single_value->field_transactionID = other_value.transactionID(); } else { single_value->field_transactionID.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP4Elements().get_selection()) { single_value->field_listofIP4Elements = other_value.listofIP4Elements(); } else { single_value->field_listofIP4Elements.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP6Elements().get_selection()) { single_value->field_listofIP6Elements = other_value.listofIP6Elements(); } else { single_value->field_listofIP6Elements.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 PDU__SNS__Add_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 PDU__SNS__Add_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__SNS__Add_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 @NS_Types.PDU_SNS_Add."); break; } set_selection(other_value); } PDU__SNS__Add_template::PDU__SNS__Add_template() { } PDU__SNS__Add_template::PDU__SNS__Add_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__SNS__Add_template::PDU__SNS__Add_template(const PDU__SNS__Add& other_value) { copy_value(other_value); } PDU__SNS__Add_template::PDU__SNS__Add_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Add&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_SNS_Add from an unbound optional field."); } } PDU__SNS__Add_template::PDU__SNS__Add_template(PDU__SNS__Add_template* p_precondition, PDU__SNS__Add_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__SNS__Add_template::PDU__SNS__Add_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; } PDU__SNS__Add_template::PDU__SNS__Add_template(const PDU__SNS__Add_template& other_value) : Base_Template() { copy_template(other_value); } PDU__SNS__Add_template::~PDU__SNS__Add_template() { clean_up(); } PDU__SNS__Add_template& PDU__SNS__Add_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__SNS__Add_template& PDU__SNS__Add_template::operator=(const PDU__SNS__Add& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__SNS__Add_template& PDU__SNS__Add_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Add&)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 @NS_Types.PDU_SNS_Add."); } return *this; } PDU__SNS__Add_template& PDU__SNS__Add_template::operator=(const PDU__SNS__Add_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__SNS__Add_template::match(const PDU__SNS__Add& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), legacy))return FALSE; if(!other_value.transactionID().is_bound()) return FALSE; if(!single_value->field_transactionID.match(other_value.transactionID(), legacy))return FALSE; if(!other_value.listofIP4Elements().is_bound()) return FALSE; if((other_value.listofIP4Elements().ispresent() ? !single_value->field_listofIP4Elements.match((const ListofIP4Elements&)other_value.listofIP4Elements(), legacy) : !single_value->field_listofIP4Elements.match_omit(legacy)))return FALSE; if(!other_value.listofIP6Elements().is_bound()) return FALSE; if((other_value.listofIP6Elements().ispresent() ? !single_value->field_listofIP6Elements.match((const ListofIP6Elements&)other_value.listofIP6Elements(), legacy) : !single_value->field_listofIP6Elements.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Add."); } return FALSE; } boolean PDU__SNS__Add_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nSEI__NS.is_bound() || single_value->field_transactionID.is_bound() || (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_bound()) || (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_bound()); } boolean PDU__SNS__Add_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nSEI__NS.is_value() && single_value->field_transactionID.is_value() && (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_value()) && (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_value()); } void PDU__SNS__Add_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; } PDU__SNS__Add PDU__SNS__Add_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 @NS_Types.PDU_SNS_Add."); PDU__SNS__Add ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } if (single_value->field_transactionID.is_bound()) { ret_val.transactionID() = single_value->field_transactionID.valueof(); } if (single_value->field_listofIP4Elements.is_omit()) ret_val.listofIP4Elements() = OMIT_VALUE; else if (single_value->field_listofIP4Elements.is_bound()) { ret_val.listofIP4Elements() = single_value->field_listofIP4Elements.valueof(); } if (single_value->field_listofIP6Elements.is_omit()) ret_val.listofIP6Elements() = OMIT_VALUE; else if (single_value->field_listofIP6Elements.is_bound()) { ret_val.listofIP6Elements() = single_value->field_listofIP6Elements.valueof(); } return ret_val; } void PDU__SNS__Add_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 @NS_Types.PDU_SNS_Add."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__SNS__Add_template[list_length]; } PDU__SNS__Add_template& PDU__SNS__Add_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 @NS_Types.PDU_SNS_Add."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_SNS_Add."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__SNS__Add_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__SNS__Add_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_SNS_Add."); return single_value->field_nsPduType; } NSEI__NS_template& PDU__SNS__Add_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__SNS__Add_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_SNS_Add."); return single_value->field_nSEI__NS; } INTEGER_template& PDU__SNS__Add_template::transactionID() { set_specific(); return single_value->field_transactionID; } const INTEGER_template& PDU__SNS__Add_template::transactionID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field transactionID of a non-specific template of type @NS_Types.PDU_SNS_Add."); return single_value->field_transactionID; } ListofIP4Elements_template& PDU__SNS__Add_template::listofIP4Elements() { set_specific(); return single_value->field_listofIP4Elements; } const ListofIP4Elements_template& PDU__SNS__Add_template::listofIP4Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP4Elements of a non-specific template of type @NS_Types.PDU_SNS_Add."); return single_value->field_listofIP4Elements; } ListofIP6Elements_template& PDU__SNS__Add_template::listofIP6Elements() { set_specific(); return single_value->field_listofIP6Elements; } const ListofIP6Elements_template& PDU__SNS__Add_template::listofIP6Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP6Elements of a non-specific template of type @NS_Types.PDU_SNS_Add."); return single_value->field_listofIP6Elements; } int PDU__SNS__Add_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Add which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_listofIP4Elements.is_present()) ret_val++; if (single_value->field_listofIP6Elements.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Add 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 @NS_Types.PDU_SNS_Add containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Add containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Add containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Add containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Add containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Add containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Add containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Add."); } return 0; } void PDU__SNS__Add_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log(); TTCN_Logger::log_event_str(", transactionID := "); single_value->field_transactionID.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); single_value->field_listofIP6Elements.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 PDU__SNS__Add_template::log_match(const PDU__SNS__Add& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_transactionID.match(match_value.transactionID(), legacy)){ TTCN_Logger::log_logmatch_info(".transactionID"); single_value->field_transactionID.log_match(match_value.transactionID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.listofIP4Elements().ispresent()){ if(!single_value->field_listofIP4Elements.match(match_value.listofIP4Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements"); single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP4Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.listofIP6Elements().ispresent()){ if(!single_value->field_listofIP6Elements.match(match_value.listofIP6Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements"); single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP6Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::log_event_str(", transactionID := "); single_value->field_transactionID.log_match(match_value.transactionID(), legacy); TTCN_Logger::log_event_str(", listofIP4Elements := "); if (match_value.listofIP4Elements().ispresent()) { single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP4Elements.log(); if (single_value->field_listofIP4Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", listofIP6Elements := "); if (match_value.listofIP6Elements().ispresent()) { single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP6Elements.log(); if (single_value->field_listofIP6Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void PDU__SNS__Add_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nSEI__NS.encode_text(text_buf); single_value->field_transactionID.encode_text(text_buf); single_value->field_listofIP4Elements.encode_text(text_buf); single_value->field_listofIP6Elements.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 @NS_Types.PDU_SNS_Add."); } } void PDU__SNS__Add_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_nsPduType.decode_text(text_buf); single_value->field_nSEI__NS.decode_text(text_buf); single_value->field_transactionID.decode_text(text_buf); single_value->field_listofIP4Elements.decode_text(text_buf); single_value->field_listofIP6Elements.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 PDU__SNS__Add_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 @NS_Types.PDU_SNS_Add."); } } void PDU__SNS__Add_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: { PDU__SNS__Add_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transactionID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(4)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transactionID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transactionID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Add: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__SNS__Add_template* precondition = new PDU__SNS__Add_template; precondition->set_param(*param.get_elem(0)); PDU__SNS__Add_template* implied_template = new PDU__SNS__Add_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__SNS__Add_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_SNS_Add"); } is_ifpresent = param.get_ifpresent(); } void PDU__SNS__Add_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Add"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Add"); single_value->field_transactionID.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Add"); single_value->field_listofIP4Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Add"); single_value->field_listofIP6Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Add"); 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 : "@NS_Types.PDU_SNS_Add"); } boolean PDU__SNS__Add_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__SNS__Add_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx& par_listofIP4Elements, const OPTIONAL< ListofIP6Elements >& par_listofIP6Elements) : field_nsPduType(par_nsPduType), field_nSEI__NS(par_nSEI__NS), field_transactionID(par_transactionID), field_listofIP4Elements(par_listofIP4Elements), field_listofIP6Elements(par_listofIP6Elements) { } PDU__SNS__ChangeWeight::PDU__SNS__ChangeWeight(const PDU__SNS__ChangeWeight& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.PDU_SNS_ChangeWeight."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.transactionID().is_bound()) field_transactionID = other_value.transactionID(); else field_transactionID.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } void PDU__SNS__ChangeWeight::clean_up() { field_nsPduType.clean_up(); field_nSEI__NS.clean_up(); field_transactionID.clean_up(); field_listofIP4Elements.clean_up(); field_listofIP6Elements.clean_up(); } const TTCN_Typedescriptor_t* PDU__SNS__ChangeWeight::get_descriptor() const { return &PDU__SNS__ChangeWeight_descr_; } PDU__SNS__ChangeWeight& PDU__SNS__ChangeWeight::operator=(const PDU__SNS__ChangeWeight& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.PDU_SNS_ChangeWeight."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.transactionID().is_bound()) field_transactionID = other_value.transactionID(); else field_transactionID.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } return *this; } boolean PDU__SNS__ChangeWeight::operator==(const PDU__SNS__ChangeWeight& other_value) const { return field_nsPduType==other_value.field_nsPduType && field_nSEI__NS==other_value.field_nSEI__NS && field_transactionID==other_value.field_transactionID && field_listofIP4Elements==other_value.field_listofIP4Elements && field_listofIP6Elements==other_value.field_listofIP6Elements; } boolean PDU__SNS__ChangeWeight::is_bound() const { return (field_nsPduType.is_bound()) || (field_nSEI__NS.is_bound()) || (field_transactionID.is_bound()) || (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_bound()) || (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_bound()); } boolean PDU__SNS__ChangeWeight::is_value() const { return field_nsPduType.is_value() && field_nSEI__NS.is_value() && field_transactionID.is_value() && (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_value()) && (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_value()); } int PDU__SNS__ChangeWeight::size_of() const { int ret_val = 3; if (field_listofIP4Elements.ispresent()) ret_val++; if (field_listofIP6Elements.ispresent()) ret_val++; return ret_val; } void PDU__SNS__ChangeWeight::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nsPduType := "); field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); field_nSEI__NS.log(); TTCN_Logger::log_event_str(", transactionID := "); field_transactionID.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" }"); } void PDU__SNS__ChangeWeight::set_implicit_omit() { if (nsPduType().is_bound()) nsPduType().set_implicit_omit(); if (nSEI__NS().is_bound()) nSEI__NS().set_implicit_omit(); if (transactionID().is_bound()) transactionID().set_implicit_omit(); if (!listofIP4Elements().is_bound()) listofIP4Elements() = OMIT_VALUE; else listofIP4Elements().set_implicit_omit(); if (!listofIP6Elements().is_bound()) listofIP6Elements() = OMIT_VALUE; else listofIP6Elements().set_implicit_omit(); } void PDU__SNS__ChangeWeight::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 (50 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transactionID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(4)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transactionID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transactionID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_ChangeWeight: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_SNS_ChangeWeight"); } } void PDU__SNS__ChangeWeight::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); field_transactionID.encode_text(text_buf); field_listofIP4Elements.encode_text(text_buf); field_listofIP6Elements.encode_text(text_buf); } void PDU__SNS__ChangeWeight::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); field_transactionID.decode_text(text_buf); field_listofIP4Elements.decode_text(text_buf); field_listofIP6Elements.decode_text(text_buf); } void PDU__SNS__ChangeWeight::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 PDU__SNS__ChangeWeight::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 PDU__SNS__ChangeWeight::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_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, PDU__SNS__ChangeWeight_transactionID_descr_.raw->forceomit); decoded_field_length = field_transactionID.RAW_decode(PDU__SNS__ChangeWeight_transactionID_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(3)) { field_listofIP4Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, ListofIP4Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP4Elements().RAW_decode(ListofIP4Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_listofIP4Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_3){ field_listofIP4Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP4Elements=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_listofIP6Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, ListofIP6Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP6Elements().RAW_decode(ListofIP6Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_listofIP6Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4){ field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__SNS__ChangeWeight::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 = 5; myleaf.body.node.nodes = init_nodes_of_enc_tree(5); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NSEI__NS_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PDU__SNS__ChangeWeight_transactionID_descr_.raw); if (field_listofIP4Elements.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, ListofIP4Elements_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; if (field_listofIP6Elements.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, ListofIP6Elements_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_transactionID.RAW_encode(PDU__SNS__ChangeWeight_transactionID_descr_, *myleaf.body.node.nodes[2]); if (field_listofIP4Elements.ispresent()) { encoded_length += field_listofIP4Elements().RAW_encode(ListofIP4Elements_descr_, *myleaf.body.node.nodes[3]); } if (field_listofIP6Elements.ispresent()) { encoded_length += field_listofIP6Elements().RAW_encode(ListofIP6Elements_descr_, *myleaf.body.node.nodes[4]); } if (field_listofIP4Elements.ispresent() && (!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_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){ os_3.RAW_encode(General__Types::OCT1_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); } } if (field_listofIP6Elements.ispresent() && (!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={4,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){ os_4.RAW_encode(General__Types::OCT1_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); } } return myleaf.length = encoded_length; } struct PDU__SNS__ChangeWeight_template::single_value_struct { OCTETSTRING_template field_nsPduType; NSEI__NS_template field_nSEI__NS; INTEGER_template field_transactionID; ListofIP4Elements_template field_listofIP4Elements; ListofIP6Elements_template field_listofIP6Elements; }; void PDU__SNS__ChangeWeight_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_nsPduType = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; single_value->field_transactionID = ANY_VALUE; single_value->field_listofIP4Elements = ANY_OR_OMIT; single_value->field_listofIP6Elements = ANY_OR_OMIT; } } } void PDU__SNS__ChangeWeight_template::copy_value(const PDU__SNS__ChangeWeight& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (other_value.transactionID().is_bound()) { single_value->field_transactionID = other_value.transactionID(); } else { single_value->field_transactionID.clean_up(); } if (other_value.listofIP4Elements().is_bound()) { if (other_value.listofIP4Elements().ispresent()) single_value->field_listofIP4Elements = other_value.listofIP4Elements()(); else single_value->field_listofIP4Elements = OMIT_VALUE; } else { single_value->field_listofIP4Elements.clean_up(); } if (other_value.listofIP6Elements().is_bound()) { if (other_value.listofIP6Elements().ispresent()) single_value->field_listofIP6Elements = other_value.listofIP6Elements()(); else single_value->field_listofIP6Elements = OMIT_VALUE; } else { single_value->field_listofIP6Elements.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__SNS__ChangeWeight_template::copy_template(const PDU__SNS__ChangeWeight_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.transactionID().get_selection()) { single_value->field_transactionID = other_value.transactionID(); } else { single_value->field_transactionID.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP4Elements().get_selection()) { single_value->field_listofIP4Elements = other_value.listofIP4Elements(); } else { single_value->field_listofIP4Elements.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP6Elements().get_selection()) { single_value->field_listofIP6Elements = other_value.listofIP6Elements(); } else { single_value->field_listofIP6Elements.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 PDU__SNS__ChangeWeight_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 PDU__SNS__ChangeWeight_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__SNS__ChangeWeight_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 @NS_Types.PDU_SNS_ChangeWeight."); break; } set_selection(other_value); } PDU__SNS__ChangeWeight_template::PDU__SNS__ChangeWeight_template() { } PDU__SNS__ChangeWeight_template::PDU__SNS__ChangeWeight_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__SNS__ChangeWeight_template::PDU__SNS__ChangeWeight_template(const PDU__SNS__ChangeWeight& other_value) { copy_value(other_value); } PDU__SNS__ChangeWeight_template::PDU__SNS__ChangeWeight_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__ChangeWeight&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_SNS_ChangeWeight from an unbound optional field."); } } PDU__SNS__ChangeWeight_template::PDU__SNS__ChangeWeight_template(PDU__SNS__ChangeWeight_template* p_precondition, PDU__SNS__ChangeWeight_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__SNS__ChangeWeight_template::PDU__SNS__ChangeWeight_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; } PDU__SNS__ChangeWeight_template::PDU__SNS__ChangeWeight_template(const PDU__SNS__ChangeWeight_template& other_value) : Base_Template() { copy_template(other_value); } PDU__SNS__ChangeWeight_template::~PDU__SNS__ChangeWeight_template() { clean_up(); } PDU__SNS__ChangeWeight_template& PDU__SNS__ChangeWeight_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__SNS__ChangeWeight_template& PDU__SNS__ChangeWeight_template::operator=(const PDU__SNS__ChangeWeight& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__SNS__ChangeWeight_template& PDU__SNS__ChangeWeight_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__ChangeWeight&)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 @NS_Types.PDU_SNS_ChangeWeight."); } return *this; } PDU__SNS__ChangeWeight_template& PDU__SNS__ChangeWeight_template::operator=(const PDU__SNS__ChangeWeight_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__SNS__ChangeWeight_template::match(const PDU__SNS__ChangeWeight& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), legacy))return FALSE; if(!other_value.transactionID().is_bound()) return FALSE; if(!single_value->field_transactionID.match(other_value.transactionID(), legacy))return FALSE; if(!other_value.listofIP4Elements().is_bound()) return FALSE; if((other_value.listofIP4Elements().ispresent() ? !single_value->field_listofIP4Elements.match((const ListofIP4Elements&)other_value.listofIP4Elements(), legacy) : !single_value->field_listofIP4Elements.match_omit(legacy)))return FALSE; if(!other_value.listofIP6Elements().is_bound()) return FALSE; if((other_value.listofIP6Elements().ispresent() ? !single_value->field_listofIP6Elements.match((const ListofIP6Elements&)other_value.listofIP6Elements(), legacy) : !single_value->field_listofIP6Elements.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @NS_Types.PDU_SNS_ChangeWeight."); } return FALSE; } boolean PDU__SNS__ChangeWeight_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nSEI__NS.is_bound() || single_value->field_transactionID.is_bound() || (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_bound()) || (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_bound()); } boolean PDU__SNS__ChangeWeight_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nSEI__NS.is_value() && single_value->field_transactionID.is_value() && (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_value()) && (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_value()); } void PDU__SNS__ChangeWeight_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; } PDU__SNS__ChangeWeight PDU__SNS__ChangeWeight_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 @NS_Types.PDU_SNS_ChangeWeight."); PDU__SNS__ChangeWeight ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } if (single_value->field_transactionID.is_bound()) { ret_val.transactionID() = single_value->field_transactionID.valueof(); } if (single_value->field_listofIP4Elements.is_omit()) ret_val.listofIP4Elements() = OMIT_VALUE; else if (single_value->field_listofIP4Elements.is_bound()) { ret_val.listofIP4Elements() = single_value->field_listofIP4Elements.valueof(); } if (single_value->field_listofIP6Elements.is_omit()) ret_val.listofIP6Elements() = OMIT_VALUE; else if (single_value->field_listofIP6Elements.is_bound()) { ret_val.listofIP6Elements() = single_value->field_listofIP6Elements.valueof(); } return ret_val; } void PDU__SNS__ChangeWeight_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 @NS_Types.PDU_SNS_ChangeWeight."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__SNS__ChangeWeight_template[list_length]; } PDU__SNS__ChangeWeight_template& PDU__SNS__ChangeWeight_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 @NS_Types.PDU_SNS_ChangeWeight."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_SNS_ChangeWeight."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__SNS__ChangeWeight_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__SNS__ChangeWeight_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_SNS_ChangeWeight."); return single_value->field_nsPduType; } NSEI__NS_template& PDU__SNS__ChangeWeight_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__SNS__ChangeWeight_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_SNS_ChangeWeight."); return single_value->field_nSEI__NS; } INTEGER_template& PDU__SNS__ChangeWeight_template::transactionID() { set_specific(); return single_value->field_transactionID; } const INTEGER_template& PDU__SNS__ChangeWeight_template::transactionID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field transactionID of a non-specific template of type @NS_Types.PDU_SNS_ChangeWeight."); return single_value->field_transactionID; } ListofIP4Elements_template& PDU__SNS__ChangeWeight_template::listofIP4Elements() { set_specific(); return single_value->field_listofIP4Elements; } const ListofIP4Elements_template& PDU__SNS__ChangeWeight_template::listofIP4Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP4Elements of a non-specific template of type @NS_Types.PDU_SNS_ChangeWeight."); return single_value->field_listofIP4Elements; } ListofIP6Elements_template& PDU__SNS__ChangeWeight_template::listofIP6Elements() { set_specific(); return single_value->field_listofIP6Elements; } const ListofIP6Elements_template& PDU__SNS__ChangeWeight_template::listofIP6Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP6Elements of a non-specific template of type @NS_Types.PDU_SNS_ChangeWeight."); return single_value->field_listofIP6Elements; } int PDU__SNS__ChangeWeight_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_ChangeWeight which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_listofIP4Elements.is_present()) ret_val++; if (single_value->field_listofIP6Elements.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_ChangeWeight 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 @NS_Types.PDU_SNS_ChangeWeight containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_ChangeWeight containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_ChangeWeight containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_ChangeWeight containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_ChangeWeight containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_ChangeWeight containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_ChangeWeight containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_SNS_ChangeWeight."); } return 0; } void PDU__SNS__ChangeWeight_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log(); TTCN_Logger::log_event_str(", transactionID := "); single_value->field_transactionID.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); single_value->field_listofIP6Elements.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 PDU__SNS__ChangeWeight_template::log_match(const PDU__SNS__ChangeWeight& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_transactionID.match(match_value.transactionID(), legacy)){ TTCN_Logger::log_logmatch_info(".transactionID"); single_value->field_transactionID.log_match(match_value.transactionID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.listofIP4Elements().ispresent()){ if(!single_value->field_listofIP4Elements.match(match_value.listofIP4Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements"); single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP4Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.listofIP6Elements().ispresent()){ if(!single_value->field_listofIP6Elements.match(match_value.listofIP6Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements"); single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP6Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::log_event_str(", transactionID := "); single_value->field_transactionID.log_match(match_value.transactionID(), legacy); TTCN_Logger::log_event_str(", listofIP4Elements := "); if (match_value.listofIP4Elements().ispresent()) { single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP4Elements.log(); if (single_value->field_listofIP4Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", listofIP6Elements := "); if (match_value.listofIP6Elements().ispresent()) { single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP6Elements.log(); if (single_value->field_listofIP6Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void PDU__SNS__ChangeWeight_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nSEI__NS.encode_text(text_buf); single_value->field_transactionID.encode_text(text_buf); single_value->field_listofIP4Elements.encode_text(text_buf); single_value->field_listofIP6Elements.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 @NS_Types.PDU_SNS_ChangeWeight."); } } void PDU__SNS__ChangeWeight_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_nsPduType.decode_text(text_buf); single_value->field_nSEI__NS.decode_text(text_buf); single_value->field_transactionID.decode_text(text_buf); single_value->field_listofIP4Elements.decode_text(text_buf); single_value->field_listofIP6Elements.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 PDU__SNS__ChangeWeight_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 @NS_Types.PDU_SNS_ChangeWeight."); } } void PDU__SNS__ChangeWeight_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: { PDU__SNS__ChangeWeight_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transactionID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(4)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transactionID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transactionID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_ChangeWeight: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__SNS__ChangeWeight_template* precondition = new PDU__SNS__ChangeWeight_template; precondition->set_param(*param.get_elem(0)); PDU__SNS__ChangeWeight_template* implied_template = new PDU__SNS__ChangeWeight_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__SNS__ChangeWeight_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_SNS_ChangeWeight"); } is_ifpresent = param.get_ifpresent(); } void PDU__SNS__ChangeWeight_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_ChangeWeight"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_ChangeWeight"); single_value->field_transactionID.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_ChangeWeight"); single_value->field_listofIP4Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_ChangeWeight"); single_value->field_listofIP6Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_ChangeWeight"); 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 : "@NS_Types.PDU_SNS_ChangeWeight"); } boolean PDU__SNS__ChangeWeight_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__SNS__ChangeWeight_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx& par_listofIP4Elements, const OPTIONAL< ListofIP6Elements >& par_listofIP6Elements) : field_nsPduType(par_nsPduType), field_endFlag(par_endFlag), field_nSEI__NS(par_nSEI__NS), field_listofIP4Elements(par_listofIP4Elements), field_listofIP6Elements(par_listofIP6Elements) { } PDU__SNS__Config::PDU__SNS__Config(const PDU__SNS__Config& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.PDU_SNS_Config."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.endFlag().is_bound()) field_endFlag = other_value.endFlag(); else field_endFlag.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } void PDU__SNS__Config::clean_up() { field_nsPduType.clean_up(); field_endFlag.clean_up(); field_nSEI__NS.clean_up(); field_listofIP4Elements.clean_up(); field_listofIP6Elements.clean_up(); } const TTCN_Typedescriptor_t* PDU__SNS__Config::get_descriptor() const { return &PDU__SNS__Config_descr_; } PDU__SNS__Config& PDU__SNS__Config::operator=(const PDU__SNS__Config& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.PDU_SNS_Config."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.endFlag().is_bound()) field_endFlag = other_value.endFlag(); else field_endFlag.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } return *this; } boolean PDU__SNS__Config::operator==(const PDU__SNS__Config& other_value) const { return field_nsPduType==other_value.field_nsPduType && field_endFlag==other_value.field_endFlag && field_nSEI__NS==other_value.field_nSEI__NS && field_listofIP4Elements==other_value.field_listofIP4Elements && field_listofIP6Elements==other_value.field_listofIP6Elements; } boolean PDU__SNS__Config::is_bound() const { return (field_nsPduType.is_bound()) || (field_endFlag.is_bound()) || (field_nSEI__NS.is_bound()) || (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_bound()) || (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_bound()); } boolean PDU__SNS__Config::is_value() const { return field_nsPduType.is_value() && field_endFlag.is_value() && field_nSEI__NS.is_value() && (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_value()) && (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_value()); } int PDU__SNS__Config::size_of() const { int ret_val = 3; if (field_listofIP4Elements.ispresent()) ret_val++; if (field_listofIP6Elements.ispresent()) ret_val++; return ret_val; } void PDU__SNS__Config::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nsPduType := "); field_nsPduType.log(); TTCN_Logger::log_event_str(", endFlag := "); field_endFlag.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); field_nSEI__NS.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" }"); } void PDU__SNS__Config::set_implicit_omit() { if (nsPduType().is_bound()) nsPduType().set_implicit_omit(); if (endFlag().is_bound()) endFlag().set_implicit_omit(); if (nSEI__NS().is_bound()) nSEI__NS().set_implicit_omit(); if (!listofIP4Elements().is_bound()) listofIP4Elements() = OMIT_VALUE; else listofIP4Elements().set_implicit_omit(); if (!listofIP6Elements().is_bound()) listofIP6Elements() = OMIT_VALUE; else listofIP6Elements().set_implicit_omit(); } void PDU__SNS__Config::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (50 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) endFlag().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(4)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "endFlag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { endFlag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Config: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_SNS_Config"); } } void PDU__SNS__Config::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_endFlag.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); field_listofIP4Elements.encode_text(text_buf); field_listofIP6Elements.encode_text(text_buf); } void PDU__SNS__Config::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_endFlag.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); field_listofIP4Elements.decode_text(text_buf); field_listofIP6Elements.decode_text(text_buf); } void PDU__SNS__Config::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PDU__SNS__Config::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PDU__SNS__Config::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit* force_omit) { (void)no_err; int prepaddlength=p_buf.increase_pos_padd(p_td.raw->prepadding); limit-=prepaddlength; size_t last_decoded_pos = p_buf.get_pos_bit(); int decoded_length = 0; int decoded_field_length = 0; raw_order_t local_top_order; 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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, EndFlag_descr_.raw->forceomit); decoded_field_length = field_endFlag.RAW_decode(EndFlag_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(3)) { field_listofIP4Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, ListofIP4Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP4Elements().RAW_decode(ListofIP4Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_listofIP4Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_3){ field_listofIP4Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP4Elements=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_listofIP6Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, ListofIP6Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP6Elements().RAW_decode(ListofIP6Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_listofIP6Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4){ field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__SNS__Config::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 5; myleaf.body.node.nodes = init_nodes_of_enc_tree(5); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EndFlag_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NSEI__NS_descr_.raw); if (field_listofIP4Elements.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, ListofIP4Elements_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; if (field_listofIP6Elements.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, ListofIP6Elements_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_endFlag.RAW_encode(EndFlag_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[2]); if (field_listofIP4Elements.ispresent()) { encoded_length += field_listofIP4Elements().RAW_encode(ListofIP4Elements_descr_, *myleaf.body.node.nodes[3]); } if (field_listofIP6Elements.ispresent()) { encoded_length += field_listofIP6Elements().RAW_encode(ListofIP6Elements_descr_, *myleaf.body.node.nodes[4]); } if (field_listofIP4Elements.ispresent() && (!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_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){ os_3.RAW_encode(General__Types::OCT1_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); } } if (field_listofIP6Elements.ispresent() && (!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={4,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){ os_4.RAW_encode(General__Types::OCT1_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); } } return myleaf.length = encoded_length; } struct PDU__SNS__Config_template::single_value_struct { OCTETSTRING_template field_nsPduType; EndFlag_template field_endFlag; NSEI__NS_template field_nSEI__NS; ListofIP4Elements_template field_listofIP4Elements; ListofIP6Elements_template field_listofIP6Elements; }; void PDU__SNS__Config_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_nsPduType = ANY_VALUE; single_value->field_endFlag = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; single_value->field_listofIP4Elements = ANY_OR_OMIT; single_value->field_listofIP6Elements = ANY_OR_OMIT; } } } void PDU__SNS__Config_template::copy_value(const PDU__SNS__Config& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.endFlag().is_bound()) { single_value->field_endFlag = other_value.endFlag(); } else { single_value->field_endFlag.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (other_value.listofIP4Elements().is_bound()) { if (other_value.listofIP4Elements().ispresent()) single_value->field_listofIP4Elements = other_value.listofIP4Elements()(); else single_value->field_listofIP4Elements = OMIT_VALUE; } else { single_value->field_listofIP4Elements.clean_up(); } if (other_value.listofIP6Elements().is_bound()) { if (other_value.listofIP6Elements().ispresent()) single_value->field_listofIP6Elements = other_value.listofIP6Elements()(); else single_value->field_listofIP6Elements = OMIT_VALUE; } else { single_value->field_listofIP6Elements.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__SNS__Config_template::copy_template(const PDU__SNS__Config_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.endFlag().get_selection()) { single_value->field_endFlag = other_value.endFlag(); } else { single_value->field_endFlag.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP4Elements().get_selection()) { single_value->field_listofIP4Elements = other_value.listofIP4Elements(); } else { single_value->field_listofIP4Elements.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP6Elements().get_selection()) { single_value->field_listofIP6Elements = other_value.listofIP6Elements(); } else { single_value->field_listofIP6Elements.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 PDU__SNS__Config_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new PDU__SNS__Config_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__SNS__Config_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Config."); break; } set_selection(other_value); } PDU__SNS__Config_template::PDU__SNS__Config_template() { } PDU__SNS__Config_template::PDU__SNS__Config_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__SNS__Config_template::PDU__SNS__Config_template(const PDU__SNS__Config& other_value) { copy_value(other_value); } PDU__SNS__Config_template::PDU__SNS__Config_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Config&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_SNS_Config from an unbound optional field."); } } PDU__SNS__Config_template::PDU__SNS__Config_template(PDU__SNS__Config_template* p_precondition, PDU__SNS__Config_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__SNS__Config_template::PDU__SNS__Config_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } PDU__SNS__Config_template::PDU__SNS__Config_template(const PDU__SNS__Config_template& other_value) : Base_Template() { copy_template(other_value); } PDU__SNS__Config_template::~PDU__SNS__Config_template() { clean_up(); } PDU__SNS__Config_template& PDU__SNS__Config_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__SNS__Config_template& PDU__SNS__Config_template::operator=(const PDU__SNS__Config& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__SNS__Config_template& PDU__SNS__Config_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Config&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @NS_Types.PDU_SNS_Config."); } return *this; } PDU__SNS__Config_template& PDU__SNS__Config_template::operator=(const PDU__SNS__Config_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__SNS__Config_template::match(const PDU__SNS__Config& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.endFlag().is_bound()) return FALSE; if(!single_value->field_endFlag.match(other_value.endFlag(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), legacy))return FALSE; if(!other_value.listofIP4Elements().is_bound()) return FALSE; if((other_value.listofIP4Elements().ispresent() ? !single_value->field_listofIP4Elements.match((const ListofIP4Elements&)other_value.listofIP4Elements(), legacy) : !single_value->field_listofIP4Elements.match_omit(legacy)))return FALSE; if(!other_value.listofIP6Elements().is_bound()) return FALSE; if((other_value.listofIP6Elements().ispresent() ? !single_value->field_listofIP6Elements.match((const ListofIP6Elements&)other_value.listofIP6Elements(), legacy) : !single_value->field_listofIP6Elements.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Config."); } return FALSE; } boolean PDU__SNS__Config_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_endFlag.is_bound() || single_value->field_nSEI__NS.is_bound() || (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_bound()) || (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_bound()); } boolean PDU__SNS__Config_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_endFlag.is_value() && single_value->field_nSEI__NS.is_value() && (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_value()) && (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_value()); } void PDU__SNS__Config_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: delete single_value; break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PDU__SNS__Config PDU__SNS__Config_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @NS_Types.PDU_SNS_Config."); PDU__SNS__Config ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_endFlag.is_bound()) { ret_val.endFlag() = single_value->field_endFlag.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } if (single_value->field_listofIP4Elements.is_omit()) ret_val.listofIP4Elements() = OMIT_VALUE; else if (single_value->field_listofIP4Elements.is_bound()) { ret_val.listofIP4Elements() = single_value->field_listofIP4Elements.valueof(); } if (single_value->field_listofIP6Elements.is_omit()) ret_val.listofIP6Elements() = OMIT_VALUE; else if (single_value->field_listofIP6Elements.is_bound()) { ret_val.listofIP6Elements() = single_value->field_listofIP6Elements.valueof(); } return ret_val; } void PDU__SNS__Config_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @NS_Types.PDU_SNS_Config."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__SNS__Config_template[list_length]; } PDU__SNS__Config_template& PDU__SNS__Config_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @NS_Types.PDU_SNS_Config."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_SNS_Config."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__SNS__Config_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__SNS__Config_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_SNS_Config."); return single_value->field_nsPduType; } EndFlag_template& PDU__SNS__Config_template::endFlag() { set_specific(); return single_value->field_endFlag; } const EndFlag_template& PDU__SNS__Config_template::endFlag() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field endFlag of a non-specific template of type @NS_Types.PDU_SNS_Config."); return single_value->field_endFlag; } NSEI__NS_template& PDU__SNS__Config_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__SNS__Config_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_SNS_Config."); return single_value->field_nSEI__NS; } ListofIP4Elements_template& PDU__SNS__Config_template::listofIP4Elements() { set_specific(); return single_value->field_listofIP4Elements; } const ListofIP4Elements_template& PDU__SNS__Config_template::listofIP4Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP4Elements of a non-specific template of type @NS_Types.PDU_SNS_Config."); return single_value->field_listofIP4Elements; } ListofIP6Elements_template& PDU__SNS__Config_template::listofIP6Elements() { set_specific(); return single_value->field_listofIP6Elements; } const ListofIP6Elements_template& PDU__SNS__Config_template::listofIP6Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP6Elements of a non-specific template of type @NS_Types.PDU_SNS_Config."); return single_value->field_listofIP6Elements; } int PDU__SNS__Config_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_listofIP4Elements.is_present()) ret_val++; if (single_value->field_listofIP6Elements.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Config."); } return 0; } void PDU__SNS__Config_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", endFlag := "); single_value->field_endFlag.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); single_value->field_listofIP6Elements.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 PDU__SNS__Config_template::log_match(const PDU__SNS__Config& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if(!single_value->field_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_endFlag.match(match_value.endFlag(), legacy)){ TTCN_Logger::log_logmatch_info(".endFlag"); single_value->field_endFlag.log_match(match_value.endFlag(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.listofIP4Elements().ispresent()){ if(!single_value->field_listofIP4Elements.match(match_value.listofIP4Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements"); single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP4Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.listofIP6Elements().ispresent()){ if(!single_value->field_listofIP6Elements.match(match_value.listofIP6Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements"); single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP6Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", endFlag := "); single_value->field_endFlag.log_match(match_value.endFlag(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::log_event_str(", listofIP4Elements := "); if (match_value.listofIP4Elements().ispresent()) { single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP4Elements.log(); if (single_value->field_listofIP4Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", listofIP6Elements := "); if (match_value.listofIP6Elements().ispresent()) { single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP6Elements.log(); if (single_value->field_listofIP6Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void PDU__SNS__Config_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_endFlag.encode_text(text_buf); single_value->field_nSEI__NS.encode_text(text_buf); single_value->field_listofIP4Elements.encode_text(text_buf); single_value->field_listofIP6Elements.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 @NS_Types.PDU_SNS_Config."); } } void PDU__SNS__Config_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_nsPduType.decode_text(text_buf); single_value->field_endFlag.decode_text(text_buf); single_value->field_nSEI__NS.decode_text(text_buf); single_value->field_listofIP4Elements.decode_text(text_buf); single_value->field_listofIP6Elements.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 PDU__SNS__Config_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @NS_Types.PDU_SNS_Config."); } } void PDU__SNS__Config_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); switch (param.get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PDU__SNS__Config_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) endFlag().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(4)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "endFlag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { endFlag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Config: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__SNS__Config_template* precondition = new PDU__SNS__Config_template; precondition->set_param(*param.get_elem(0)); PDU__SNS__Config_template* implied_template = new PDU__SNS__Config_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__SNS__Config_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_SNS_Config"); } is_ifpresent = param.get_ifpresent(); } void PDU__SNS__Config_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Config"); single_value->field_endFlag.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Config"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Config"); single_value->field_listofIP4Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Config"); single_value->field_listofIP6Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Config"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@NS_Types.PDU_SNS_Config"); } boolean PDU__SNS__Config_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__SNS__Config_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx& par_causeNS) : field_nsPduType(par_nsPduType), field_nSEI__NS(par_nSEI__NS), field_causeNS(par_causeNS) { } PDU__SNS__Config__Ack::PDU__SNS__Config__Ack(const PDU__SNS__Config__Ack& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.PDU_SNS_Config_Ack."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.causeNS().is_bound()) field_causeNS = other_value.causeNS(); else field_causeNS.clean_up(); } void PDU__SNS__Config__Ack::clean_up() { field_nsPduType.clean_up(); field_nSEI__NS.clean_up(); field_causeNS.clean_up(); } const TTCN_Typedescriptor_t* PDU__SNS__Config__Ack::get_descriptor() const { return &PDU__SNS__Config__Ack_descr_; } PDU__SNS__Config__Ack& PDU__SNS__Config__Ack::operator=(const PDU__SNS__Config__Ack& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.PDU_SNS_Config_Ack."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.causeNS().is_bound()) field_causeNS = other_value.causeNS(); else field_causeNS.clean_up(); } return *this; } boolean PDU__SNS__Config__Ack::operator==(const PDU__SNS__Config__Ack& other_value) const { return field_nsPduType==other_value.field_nsPduType && field_nSEI__NS==other_value.field_nSEI__NS && field_causeNS==other_value.field_causeNS; } boolean PDU__SNS__Config__Ack::is_bound() const { return (field_nsPduType.is_bound()) || (field_nSEI__NS.is_bound()) || (OPTIONAL_OMIT == field_causeNS.get_selection() || field_causeNS.is_bound()); } boolean PDU__SNS__Config__Ack::is_value() const { return field_nsPduType.is_value() && field_nSEI__NS.is_value() && (OPTIONAL_OMIT == field_causeNS.get_selection() || field_causeNS.is_value()); } int PDU__SNS__Config__Ack::size_of() const { int ret_val = 2; if (field_causeNS.ispresent()) ret_val++; return ret_val; } void PDU__SNS__Config__Ack::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nsPduType := "); field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); field_nSEI__NS.log(); TTCN_Logger::log_event_str(", causeNS := "); field_causeNS.log(); TTCN_Logger::log_event_str(" }"); } void PDU__SNS__Config__Ack::set_implicit_omit() { if (nsPduType().is_bound()) nsPduType().set_implicit_omit(); if (nSEI__NS().is_bound()) nSEI__NS().set_implicit_omit(); if (!causeNS().is_bound()) causeNS() = OMIT_VALUE; else causeNS().set_implicit_omit(); } void PDU__SNS__Config__Ack::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (30 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Config_Ack: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_SNS_Config_Ack"); } } void PDU__SNS__Config__Ack::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); field_causeNS.encode_text(text_buf); } void PDU__SNS__Config__Ack::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); field_causeNS.decode_text(text_buf); } void PDU__SNS__Config__Ack::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 PDU__SNS__Config__Ack::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 PDU__SNS__Config__Ack::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(2)) { field_causeNS = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, CauseNS_descr_.raw->forceomit); decoded_field_length = field_causeNS().RAW_decode(CauseNS_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_causeNS = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_causeNS.ispresent() || field_causeNS().iEI() != os_5){ field_causeNS=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_causeNS=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__SNS__Config__Ack::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 3; myleaf.body.node.nodes = init_nodes_of_enc_tree(3); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NSEI__NS_descr_.raw); if (field_causeNS.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, CauseNS_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[1]); if (field_causeNS.ispresent()) { encoded_length += field_causeNS().RAW_encode(CauseNS_descr_, *myleaf.body.node.nodes[2]); } if (field_causeNS.ispresent() && (!field_causeNS.ispresent() || field_causeNS().iEI() != os_5)) { 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){ os_5.RAW_encode(General__Types::OCT1_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); } } return myleaf.length = encoded_length; } struct PDU__SNS__Config__Ack_template::single_value_struct { OCTETSTRING_template field_nsPduType; NSEI__NS_template field_nSEI__NS; CauseNS_template field_causeNS; }; void PDU__SNS__Config__Ack_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_nsPduType = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; single_value->field_causeNS = ANY_OR_OMIT; } } } void PDU__SNS__Config__Ack_template::copy_value(const PDU__SNS__Config__Ack& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (other_value.causeNS().is_bound()) { if (other_value.causeNS().ispresent()) single_value->field_causeNS = other_value.causeNS()(); else single_value->field_causeNS = OMIT_VALUE; } else { single_value->field_causeNS.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__SNS__Config__Ack_template::copy_template(const PDU__SNS__Config__Ack_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.causeNS().get_selection()) { single_value->field_causeNS = other_value.causeNS(); } else { single_value->field_causeNS.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 PDU__SNS__Config__Ack_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 PDU__SNS__Config__Ack_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__SNS__Config__Ack_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 @NS_Types.PDU_SNS_Config_Ack."); break; } set_selection(other_value); } PDU__SNS__Config__Ack_template::PDU__SNS__Config__Ack_template() { } PDU__SNS__Config__Ack_template::PDU__SNS__Config__Ack_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__SNS__Config__Ack_template::PDU__SNS__Config__Ack_template(const PDU__SNS__Config__Ack& other_value) { copy_value(other_value); } PDU__SNS__Config__Ack_template::PDU__SNS__Config__Ack_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Config__Ack&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_SNS_Config_Ack from an unbound optional field."); } } PDU__SNS__Config__Ack_template::PDU__SNS__Config__Ack_template(PDU__SNS__Config__Ack_template* p_precondition, PDU__SNS__Config__Ack_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__SNS__Config__Ack_template::PDU__SNS__Config__Ack_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; } PDU__SNS__Config__Ack_template::PDU__SNS__Config__Ack_template(const PDU__SNS__Config__Ack_template& other_value) : Base_Template() { copy_template(other_value); } PDU__SNS__Config__Ack_template::~PDU__SNS__Config__Ack_template() { clean_up(); } PDU__SNS__Config__Ack_template& PDU__SNS__Config__Ack_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__SNS__Config__Ack_template& PDU__SNS__Config__Ack_template::operator=(const PDU__SNS__Config__Ack& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__SNS__Config__Ack_template& PDU__SNS__Config__Ack_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Config__Ack&)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 @NS_Types.PDU_SNS_Config_Ack."); } return *this; } PDU__SNS__Config__Ack_template& PDU__SNS__Config__Ack_template::operator=(const PDU__SNS__Config__Ack_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__SNS__Config__Ack_template::match(const PDU__SNS__Config__Ack& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), legacy))return FALSE; if(!other_value.causeNS().is_bound()) return FALSE; if((other_value.causeNS().ispresent() ? !single_value->field_causeNS.match((const CauseNS&)other_value.causeNS(), legacy) : !single_value->field_causeNS.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Config_Ack."); } return FALSE; } boolean PDU__SNS__Config__Ack_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nSEI__NS.is_bound() || (single_value->field_causeNS.is_omit() || single_value->field_causeNS.is_bound()); } boolean PDU__SNS__Config__Ack_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nSEI__NS.is_value() && (single_value->field_causeNS.is_omit() || single_value->field_causeNS.is_value()); } void PDU__SNS__Config__Ack_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; } PDU__SNS__Config__Ack PDU__SNS__Config__Ack_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 @NS_Types.PDU_SNS_Config_Ack."); PDU__SNS__Config__Ack ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } if (single_value->field_causeNS.is_omit()) ret_val.causeNS() = OMIT_VALUE; else if (single_value->field_causeNS.is_bound()) { ret_val.causeNS() = single_value->field_causeNS.valueof(); } return ret_val; } void PDU__SNS__Config__Ack_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 @NS_Types.PDU_SNS_Config_Ack."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__SNS__Config__Ack_template[list_length]; } PDU__SNS__Config__Ack_template& PDU__SNS__Config__Ack_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 @NS_Types.PDU_SNS_Config_Ack."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_SNS_Config_Ack."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__SNS__Config__Ack_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__SNS__Config__Ack_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_SNS_Config_Ack."); return single_value->field_nsPduType; } NSEI__NS_template& PDU__SNS__Config__Ack_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__SNS__Config__Ack_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_SNS_Config_Ack."); return single_value->field_nSEI__NS; } CauseNS_template& PDU__SNS__Config__Ack_template::causeNS() { set_specific(); return single_value->field_causeNS; } const CauseNS_template& PDU__SNS__Config__Ack_template::causeNS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field causeNS of a non-specific template of type @NS_Types.PDU_SNS_Config_Ack."); return single_value->field_causeNS; } int PDU__SNS__Config__Ack_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config_Ack which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_causeNS.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config_Ack 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 @NS_Types.PDU_SNS_Config_Ack containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config_Ack containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config_Ack containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config_Ack containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config_Ack containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config_Ack containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Config_Ack containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Config_Ack."); } return 0; } void PDU__SNS__Config__Ack_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log(); TTCN_Logger::log_event_str(", causeNS := "); single_value->field_causeNS.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 PDU__SNS__Config__Ack_template::log_match(const PDU__SNS__Config__Ack& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.causeNS().ispresent()){ if(!single_value->field_causeNS.match(match_value.causeNS(), legacy)){ TTCN_Logger::log_logmatch_info(".causeNS"); single_value->field_causeNS.log_match(match_value.causeNS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_causeNS.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".causeNS := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_causeNS.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::log_event_str(", causeNS := "); if (match_value.causeNS().ispresent()) { single_value->field_causeNS.log_match(match_value.causeNS(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_causeNS.log(); if (single_value->field_causeNS.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void PDU__SNS__Config__Ack_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nSEI__NS.encode_text(text_buf); single_value->field_causeNS.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 @NS_Types.PDU_SNS_Config_Ack."); } } void PDU__SNS__Config__Ack_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_nsPduType.decode_text(text_buf); single_value->field_nSEI__NS.decode_text(text_buf); single_value->field_causeNS.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 PDU__SNS__Config__Ack_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 @NS_Types.PDU_SNS_Config_Ack."); } } void PDU__SNS__Config__Ack_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: { PDU__SNS__Config__Ack_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Config_Ack: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__SNS__Config__Ack_template* precondition = new PDU__SNS__Config__Ack_template; precondition->set_param(*param.get_elem(0)); PDU__SNS__Config__Ack_template* implied_template = new PDU__SNS__Config__Ack_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__SNS__Config__Ack_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_SNS_Config_Ack"); } is_ifpresent = param.get_ifpresent(); } void PDU__SNS__Config__Ack_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Config_Ack"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Config_Ack"); single_value->field_causeNS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Config_Ack"); 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 : "@NS_Types.PDU_SNS_Config_Ack"); } boolean PDU__SNS__Config__Ack_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__SNS__Config__Ack_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx& par_iP__Address__NS, const OPTIONAL< ListofIP4Elements >& par_listofIP4Elements, const OPTIONAL< ListofIP6Elements >& par_listofIP6Elements) : field_nsPduType(par_nsPduType), field_nSEI__NS(par_nSEI__NS), field_transactionID(par_transactionID), field_iP__Address__NS(par_iP__Address__NS), field_listofIP4Elements(par_listofIP4Elements), field_listofIP6Elements(par_listofIP6Elements) { } PDU__SNS__Delete::PDU__SNS__Delete(const PDU__SNS__Delete& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.PDU_SNS_Delete."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.transactionID().is_bound()) field_transactionID = other_value.transactionID(); else field_transactionID.clean_up(); if (other_value.iP__Address__NS().is_bound()) field_iP__Address__NS = other_value.iP__Address__NS(); else field_iP__Address__NS.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } void PDU__SNS__Delete::clean_up() { field_nsPduType.clean_up(); field_nSEI__NS.clean_up(); field_transactionID.clean_up(); field_iP__Address__NS.clean_up(); field_listofIP4Elements.clean_up(); field_listofIP6Elements.clean_up(); } const TTCN_Typedescriptor_t* PDU__SNS__Delete::get_descriptor() const { return &PDU__SNS__Delete_descr_; } PDU__SNS__Delete& PDU__SNS__Delete::operator=(const PDU__SNS__Delete& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.PDU_SNS_Delete."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.transactionID().is_bound()) field_transactionID = other_value.transactionID(); else field_transactionID.clean_up(); if (other_value.iP__Address__NS().is_bound()) field_iP__Address__NS = other_value.iP__Address__NS(); else field_iP__Address__NS.clean_up(); if (other_value.listofIP4Elements().is_bound()) field_listofIP4Elements = other_value.listofIP4Elements(); else field_listofIP4Elements.clean_up(); if (other_value.listofIP6Elements().is_bound()) field_listofIP6Elements = other_value.listofIP6Elements(); else field_listofIP6Elements.clean_up(); } return *this; } boolean PDU__SNS__Delete::operator==(const PDU__SNS__Delete& other_value) const { return field_nsPduType==other_value.field_nsPduType && field_nSEI__NS==other_value.field_nSEI__NS && field_transactionID==other_value.field_transactionID && field_iP__Address__NS==other_value.field_iP__Address__NS && field_listofIP4Elements==other_value.field_listofIP4Elements && field_listofIP6Elements==other_value.field_listofIP6Elements; } boolean PDU__SNS__Delete::is_bound() const { return (field_nsPduType.is_bound()) || (field_nSEI__NS.is_bound()) || (field_transactionID.is_bound()) || (OPTIONAL_OMIT == field_iP__Address__NS.get_selection() || field_iP__Address__NS.is_bound()) || (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_bound()) || (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_bound()); } boolean PDU__SNS__Delete::is_value() const { return field_nsPduType.is_value() && field_nSEI__NS.is_value() && field_transactionID.is_value() && (OPTIONAL_OMIT == field_iP__Address__NS.get_selection() || field_iP__Address__NS.is_value()) && (OPTIONAL_OMIT == field_listofIP4Elements.get_selection() || field_listofIP4Elements.is_value()) && (OPTIONAL_OMIT == field_listofIP6Elements.get_selection() || field_listofIP6Elements.is_value()); } int PDU__SNS__Delete::size_of() const { int ret_val = 3; if (field_iP__Address__NS.ispresent()) ret_val++; if (field_listofIP4Elements.ispresent()) ret_val++; if (field_listofIP6Elements.ispresent()) ret_val++; return ret_val; } void PDU__SNS__Delete::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nsPduType := "); field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); field_nSEI__NS.log(); TTCN_Logger::log_event_str(", transactionID := "); field_transactionID.log(); TTCN_Logger::log_event_str(", iP_Address_NS := "); field_iP__Address__NS.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" }"); } void PDU__SNS__Delete::set_implicit_omit() { if (nsPduType().is_bound()) nsPduType().set_implicit_omit(); if (nSEI__NS().is_bound()) nSEI__NS().set_implicit_omit(); if (transactionID().is_bound()) transactionID().set_implicit_omit(); if (!iP__Address__NS().is_bound()) iP__Address__NS() = OMIT_VALUE; else iP__Address__NS().set_implicit_omit(); if (!listofIP4Elements().is_bound()) listofIP4Elements() = OMIT_VALUE; else listofIP4Elements().set_implicit_omit(); if (!listofIP6Elements().is_bound()) listofIP6Elements() = OMIT_VALUE; else listofIP6Elements().set_implicit_omit(); } void PDU__SNS__Delete::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 (60 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transactionID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) iP__Address__NS().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(5)); 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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transactionID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transactionID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iP_Address_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iP__Address__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Delete: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_SNS_Delete"); } } void PDU__SNS__Delete::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); field_transactionID.encode_text(text_buf); field_iP__Address__NS.encode_text(text_buf); field_listofIP4Elements.encode_text(text_buf); field_listofIP6Elements.encode_text(text_buf); } void PDU__SNS__Delete::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); field_transactionID.decode_text(text_buf); field_iP__Address__NS.decode_text(text_buf); field_listofIP4Elements.decode_text(text_buf); field_listofIP6Elements.decode_text(text_buf); } void PDU__SNS__Delete::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 PDU__SNS__Delete::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 PDU__SNS__Delete::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_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, PDU__SNS__Delete_transactionID_descr_.raw->forceomit); decoded_field_length = field_transactionID.RAW_decode(PDU__SNS__Delete_transactionID_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(3)) { field_iP__Address__NS = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, IP__Address__NS_descr_.raw->forceomit); decoded_field_length = field_iP__Address__NS().RAW_decode(IP__Address__NS_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_iP__Address__NS = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_iP__Address__NS.ispresent() || field_iP__Address__NS().iEI() != os_6){ field_iP__Address__NS=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_iP__Address__NS=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_listofIP4Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, ListofIP4Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP4Elements().RAW_decode(ListofIP4Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_listofIP4Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_3){ field_listofIP4Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP4Elements=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(5)) { field_listofIP6Elements = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_5_force_omit(5, force_omit, ListofIP6Elements_descr_.raw->forceomit); decoded_field_length = field_listofIP6Elements().RAW_decode(ListofIP6Elements_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 1) { field_listofIP6Elements = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4){ field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_listofIP6Elements=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__SNS__Delete::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 = 6; myleaf.body.node.nodes = init_nodes_of_enc_tree(6); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NSEI__NS_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PDU__SNS__Delete_transactionID_descr_.raw); if (field_iP__Address__NS.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, IP__Address__NS_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; if (field_listofIP4Elements.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, ListofIP4Elements_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; if (field_listofIP6Elements.ispresent()) { myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, ListofIP6Elements_descr_.raw); } else myleaf.body.node.nodes[5] = NULL; encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_transactionID.RAW_encode(PDU__SNS__Delete_transactionID_descr_, *myleaf.body.node.nodes[2]); if (field_iP__Address__NS.ispresent()) { encoded_length += field_iP__Address__NS().RAW_encode(IP__Address__NS_descr_, *myleaf.body.node.nodes[3]); } if (field_listofIP4Elements.ispresent()) { encoded_length += field_listofIP4Elements().RAW_encode(ListofIP4Elements_descr_, *myleaf.body.node.nodes[4]); } if (field_listofIP6Elements.ispresent()) { encoded_length += field_listofIP6Elements().RAW_encode(ListofIP6Elements_descr_, *myleaf.body.node.nodes[5]); } if (field_iP__Address__NS.ispresent() && (!field_iP__Address__NS.ispresent() || field_iP__Address__NS().iEI() != os_6)) { 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){ os_6.RAW_encode(General__Types::OCT1_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); } } if (field_listofIP4Elements.ispresent() && (!field_listofIP4Elements.ispresent() || field_listofIP4Elements().iEI() != os_3)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={4,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){ os_3.RAW_encode(General__Types::OCT1_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); } } if (field_listofIP6Elements.ispresent() && (!field_listofIP6Elements.ispresent() || field_listofIP6Elements().iEI() != os_4)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={5,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){ os_4.RAW_encode(General__Types::OCT1_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); } } return myleaf.length = encoded_length; } struct PDU__SNS__Delete_template::single_value_struct { OCTETSTRING_template field_nsPduType; NSEI__NS_template field_nSEI__NS; INTEGER_template field_transactionID; IP__Address__NS_template field_iP__Address__NS; ListofIP4Elements_template field_listofIP4Elements; ListofIP6Elements_template field_listofIP6Elements; }; void PDU__SNS__Delete_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_nsPduType = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; single_value->field_transactionID = ANY_VALUE; single_value->field_iP__Address__NS = ANY_OR_OMIT; single_value->field_listofIP4Elements = ANY_OR_OMIT; single_value->field_listofIP6Elements = ANY_OR_OMIT; } } } void PDU__SNS__Delete_template::copy_value(const PDU__SNS__Delete& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (other_value.transactionID().is_bound()) { single_value->field_transactionID = other_value.transactionID(); } else { single_value->field_transactionID.clean_up(); } if (other_value.iP__Address__NS().is_bound()) { if (other_value.iP__Address__NS().ispresent()) single_value->field_iP__Address__NS = other_value.iP__Address__NS()(); else single_value->field_iP__Address__NS = OMIT_VALUE; } else { single_value->field_iP__Address__NS.clean_up(); } if (other_value.listofIP4Elements().is_bound()) { if (other_value.listofIP4Elements().ispresent()) single_value->field_listofIP4Elements = other_value.listofIP4Elements()(); else single_value->field_listofIP4Elements = OMIT_VALUE; } else { single_value->field_listofIP4Elements.clean_up(); } if (other_value.listofIP6Elements().is_bound()) { if (other_value.listofIP6Elements().ispresent()) single_value->field_listofIP6Elements = other_value.listofIP6Elements()(); else single_value->field_listofIP6Elements = OMIT_VALUE; } else { single_value->field_listofIP6Elements.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__SNS__Delete_template::copy_template(const PDU__SNS__Delete_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.transactionID().get_selection()) { single_value->field_transactionID = other_value.transactionID(); } else { single_value->field_transactionID.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.iP__Address__NS().get_selection()) { single_value->field_iP__Address__NS = other_value.iP__Address__NS(); } else { single_value->field_iP__Address__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP4Elements().get_selection()) { single_value->field_listofIP4Elements = other_value.listofIP4Elements(); } else { single_value->field_listofIP4Elements.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listofIP6Elements().get_selection()) { single_value->field_listofIP6Elements = other_value.listofIP6Elements(); } else { single_value->field_listofIP6Elements.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 PDU__SNS__Delete_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 PDU__SNS__Delete_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__SNS__Delete_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 @NS_Types.PDU_SNS_Delete."); break; } set_selection(other_value); } PDU__SNS__Delete_template::PDU__SNS__Delete_template() { } PDU__SNS__Delete_template::PDU__SNS__Delete_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__SNS__Delete_template::PDU__SNS__Delete_template(const PDU__SNS__Delete& other_value) { copy_value(other_value); } PDU__SNS__Delete_template::PDU__SNS__Delete_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Delete&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_SNS_Delete from an unbound optional field."); } } PDU__SNS__Delete_template::PDU__SNS__Delete_template(PDU__SNS__Delete_template* p_precondition, PDU__SNS__Delete_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__SNS__Delete_template::PDU__SNS__Delete_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; } PDU__SNS__Delete_template::PDU__SNS__Delete_template(const PDU__SNS__Delete_template& other_value) : Base_Template() { copy_template(other_value); } PDU__SNS__Delete_template::~PDU__SNS__Delete_template() { clean_up(); } PDU__SNS__Delete_template& PDU__SNS__Delete_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__SNS__Delete_template& PDU__SNS__Delete_template::operator=(const PDU__SNS__Delete& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__SNS__Delete_template& PDU__SNS__Delete_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Delete&)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 @NS_Types.PDU_SNS_Delete."); } return *this; } PDU__SNS__Delete_template& PDU__SNS__Delete_template::operator=(const PDU__SNS__Delete_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__SNS__Delete_template::match(const PDU__SNS__Delete& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), legacy))return FALSE; if(!other_value.transactionID().is_bound()) return FALSE; if(!single_value->field_transactionID.match(other_value.transactionID(), legacy))return FALSE; if(!other_value.iP__Address__NS().is_bound()) return FALSE; if((other_value.iP__Address__NS().ispresent() ? !single_value->field_iP__Address__NS.match((const IP__Address__NS&)other_value.iP__Address__NS(), legacy) : !single_value->field_iP__Address__NS.match_omit(legacy)))return FALSE; if(!other_value.listofIP4Elements().is_bound()) return FALSE; if((other_value.listofIP4Elements().ispresent() ? !single_value->field_listofIP4Elements.match((const ListofIP4Elements&)other_value.listofIP4Elements(), legacy) : !single_value->field_listofIP4Elements.match_omit(legacy)))return FALSE; if(!other_value.listofIP6Elements().is_bound()) return FALSE; if((other_value.listofIP6Elements().ispresent() ? !single_value->field_listofIP6Elements.match((const ListofIP6Elements&)other_value.listofIP6Elements(), legacy) : !single_value->field_listofIP6Elements.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Delete."); } return FALSE; } boolean PDU__SNS__Delete_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nSEI__NS.is_bound() || single_value->field_transactionID.is_bound() || (single_value->field_iP__Address__NS.is_omit() || single_value->field_iP__Address__NS.is_bound()) || (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_bound()) || (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_bound()); } boolean PDU__SNS__Delete_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nSEI__NS.is_value() && single_value->field_transactionID.is_value() && (single_value->field_iP__Address__NS.is_omit() || single_value->field_iP__Address__NS.is_value()) && (single_value->field_listofIP4Elements.is_omit() || single_value->field_listofIP4Elements.is_value()) && (single_value->field_listofIP6Elements.is_omit() || single_value->field_listofIP6Elements.is_value()); } void PDU__SNS__Delete_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; } PDU__SNS__Delete PDU__SNS__Delete_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 @NS_Types.PDU_SNS_Delete."); PDU__SNS__Delete ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } if (single_value->field_transactionID.is_bound()) { ret_val.transactionID() = single_value->field_transactionID.valueof(); } if (single_value->field_iP__Address__NS.is_omit()) ret_val.iP__Address__NS() = OMIT_VALUE; else if (single_value->field_iP__Address__NS.is_bound()) { ret_val.iP__Address__NS() = single_value->field_iP__Address__NS.valueof(); } if (single_value->field_listofIP4Elements.is_omit()) ret_val.listofIP4Elements() = OMIT_VALUE; else if (single_value->field_listofIP4Elements.is_bound()) { ret_val.listofIP4Elements() = single_value->field_listofIP4Elements.valueof(); } if (single_value->field_listofIP6Elements.is_omit()) ret_val.listofIP6Elements() = OMIT_VALUE; else if (single_value->field_listofIP6Elements.is_bound()) { ret_val.listofIP6Elements() = single_value->field_listofIP6Elements.valueof(); } return ret_val; } void PDU__SNS__Delete_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 @NS_Types.PDU_SNS_Delete."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__SNS__Delete_template[list_length]; } PDU__SNS__Delete_template& PDU__SNS__Delete_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 @NS_Types.PDU_SNS_Delete."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_SNS_Delete."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__SNS__Delete_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__SNS__Delete_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_SNS_Delete."); return single_value->field_nsPduType; } NSEI__NS_template& PDU__SNS__Delete_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__SNS__Delete_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_SNS_Delete."); return single_value->field_nSEI__NS; } INTEGER_template& PDU__SNS__Delete_template::transactionID() { set_specific(); return single_value->field_transactionID; } const INTEGER_template& PDU__SNS__Delete_template::transactionID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field transactionID of a non-specific template of type @NS_Types.PDU_SNS_Delete."); return single_value->field_transactionID; } IP__Address__NS_template& PDU__SNS__Delete_template::iP__Address__NS() { set_specific(); return single_value->field_iP__Address__NS; } const IP__Address__NS_template& PDU__SNS__Delete_template::iP__Address__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iP_Address_NS of a non-specific template of type @NS_Types.PDU_SNS_Delete."); return single_value->field_iP__Address__NS; } ListofIP4Elements_template& PDU__SNS__Delete_template::listofIP4Elements() { set_specific(); return single_value->field_listofIP4Elements; } const ListofIP4Elements_template& PDU__SNS__Delete_template::listofIP4Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP4Elements of a non-specific template of type @NS_Types.PDU_SNS_Delete."); return single_value->field_listofIP4Elements; } ListofIP6Elements_template& PDU__SNS__Delete_template::listofIP6Elements() { set_specific(); return single_value->field_listofIP6Elements; } const ListofIP6Elements_template& PDU__SNS__Delete_template::listofIP6Elements() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listofIP6Elements of a non-specific template of type @NS_Types.PDU_SNS_Delete."); return single_value->field_listofIP6Elements; } int PDU__SNS__Delete_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Delete which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_iP__Address__NS.is_present()) ret_val++; if (single_value->field_listofIP4Elements.is_present()) ret_val++; if (single_value->field_listofIP6Elements.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Delete 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 @NS_Types.PDU_SNS_Delete containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Delete containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Delete containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Delete containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Delete containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Delete containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Delete containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Delete."); } return 0; } void PDU__SNS__Delete_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log(); TTCN_Logger::log_event_str(", transactionID := "); single_value->field_transactionID.log(); TTCN_Logger::log_event_str(", iP_Address_NS := "); single_value->field_iP__Address__NS.log(); TTCN_Logger::log_event_str(", listofIP4Elements := "); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(", listofIP6Elements := "); single_value->field_listofIP6Elements.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 PDU__SNS__Delete_template::log_match(const PDU__SNS__Delete& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_transactionID.match(match_value.transactionID(), legacy)){ TTCN_Logger::log_logmatch_info(".transactionID"); single_value->field_transactionID.log_match(match_value.transactionID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.iP__Address__NS().ispresent()){ if(!single_value->field_iP__Address__NS.match(match_value.iP__Address__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".iP_Address_NS"); single_value->field_iP__Address__NS.log_match(match_value.iP__Address__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_iP__Address__NS.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".iP_Address_NS := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_iP__Address__NS.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.listofIP4Elements().ispresent()){ if(!single_value->field_listofIP4Elements.match(match_value.listofIP4Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements"); single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP4Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP4Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP4Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.listofIP6Elements().ispresent()){ if(!single_value->field_listofIP6Elements.match(match_value.listofIP6Elements(), legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements"); single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_listofIP6Elements.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".listofIP6Elements := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_listofIP6Elements.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::log_event_str(", transactionID := "); single_value->field_transactionID.log_match(match_value.transactionID(), legacy); TTCN_Logger::log_event_str(", iP_Address_NS := "); if (match_value.iP__Address__NS().ispresent()) { single_value->field_iP__Address__NS.log_match(match_value.iP__Address__NS(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_iP__Address__NS.log(); if (single_value->field_iP__Address__NS.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", listofIP4Elements := "); if (match_value.listofIP4Elements().ispresent()) { single_value->field_listofIP4Elements.log_match(match_value.listofIP4Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP4Elements.log(); if (single_value->field_listofIP4Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", listofIP6Elements := "); if (match_value.listofIP6Elements().ispresent()) { single_value->field_listofIP6Elements.log_match(match_value.listofIP6Elements(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_listofIP6Elements.log(); if (single_value->field_listofIP6Elements.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void PDU__SNS__Delete_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nSEI__NS.encode_text(text_buf); single_value->field_transactionID.encode_text(text_buf); single_value->field_iP__Address__NS.encode_text(text_buf); single_value->field_listofIP4Elements.encode_text(text_buf); single_value->field_listofIP6Elements.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 @NS_Types.PDU_SNS_Delete."); } } void PDU__SNS__Delete_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_nsPduType.decode_text(text_buf); single_value->field_nSEI__NS.decode_text(text_buf); single_value->field_transactionID.decode_text(text_buf); single_value->field_iP__Address__NS.decode_text(text_buf); single_value->field_listofIP4Elements.decode_text(text_buf); single_value->field_listofIP6Elements.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 PDU__SNS__Delete_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 @NS_Types.PDU_SNS_Delete."); } } void PDU__SNS__Delete_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: { PDU__SNS__Delete_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) transactionID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) iP__Address__NS().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) listofIP4Elements().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) listofIP6Elements().set_param(*param.get_elem(5)); 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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "transactionID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { transactionID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iP_Address_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iP__Address__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP4Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP4Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listofIP6Elements")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listofIP6Elements().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Delete: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__SNS__Delete_template* precondition = new PDU__SNS__Delete_template; precondition->set_param(*param.get_elem(0)); PDU__SNS__Delete_template* implied_template = new PDU__SNS__Delete_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__SNS__Delete_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_SNS_Delete"); } is_ifpresent = param.get_ifpresent(); } void PDU__SNS__Delete_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Delete"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Delete"); single_value->field_transactionID.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Delete"); single_value->field_iP__Address__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Delete"); single_value->field_listofIP4Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Delete"); single_value->field_listofIP6Elements.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Delete"); 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 : "@NS_Types.PDU_SNS_Delete"); } boolean PDU__SNS__Delete_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__SNS__Delete_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx& par_numberOfIP4__Endpoints, const OPTIONAL< NumberOfIP__Endpoints >& par_numberOfIP6__Endpoints) : field_nsPduType(par_nsPduType), field_nSEI__NS(par_nSEI__NS), field_resetFlag(par_resetFlag), field_maxNumberOfNSVCs(par_maxNumberOfNSVCs), field_numberOfIP4__Endpoints(par_numberOfIP4__Endpoints), field_numberOfIP6__Endpoints(par_numberOfIP6__Endpoints) { } PDU__SNS__Size::PDU__SNS__Size(const PDU__SNS__Size& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.PDU_SNS_Size."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.resetFlag().is_bound()) field_resetFlag = other_value.resetFlag(); else field_resetFlag.clean_up(); if (other_value.maxNumberOfNSVCs().is_bound()) field_maxNumberOfNSVCs = other_value.maxNumberOfNSVCs(); else field_maxNumberOfNSVCs.clean_up(); if (other_value.numberOfIP4__Endpoints().is_bound()) field_numberOfIP4__Endpoints = other_value.numberOfIP4__Endpoints(); else field_numberOfIP4__Endpoints.clean_up(); if (other_value.numberOfIP6__Endpoints().is_bound()) field_numberOfIP6__Endpoints = other_value.numberOfIP6__Endpoints(); else field_numberOfIP6__Endpoints.clean_up(); } void PDU__SNS__Size::clean_up() { field_nsPduType.clean_up(); field_nSEI__NS.clean_up(); field_resetFlag.clean_up(); field_maxNumberOfNSVCs.clean_up(); field_numberOfIP4__Endpoints.clean_up(); field_numberOfIP6__Endpoints.clean_up(); } const TTCN_Typedescriptor_t* PDU__SNS__Size::get_descriptor() const { return &PDU__SNS__Size_descr_; } PDU__SNS__Size& PDU__SNS__Size::operator=(const PDU__SNS__Size& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.PDU_SNS_Size."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.resetFlag().is_bound()) field_resetFlag = other_value.resetFlag(); else field_resetFlag.clean_up(); if (other_value.maxNumberOfNSVCs().is_bound()) field_maxNumberOfNSVCs = other_value.maxNumberOfNSVCs(); else field_maxNumberOfNSVCs.clean_up(); if (other_value.numberOfIP4__Endpoints().is_bound()) field_numberOfIP4__Endpoints = other_value.numberOfIP4__Endpoints(); else field_numberOfIP4__Endpoints.clean_up(); if (other_value.numberOfIP6__Endpoints().is_bound()) field_numberOfIP6__Endpoints = other_value.numberOfIP6__Endpoints(); else field_numberOfIP6__Endpoints.clean_up(); } return *this; } boolean PDU__SNS__Size::operator==(const PDU__SNS__Size& other_value) const { return field_nsPduType==other_value.field_nsPduType && field_nSEI__NS==other_value.field_nSEI__NS && field_resetFlag==other_value.field_resetFlag && field_maxNumberOfNSVCs==other_value.field_maxNumberOfNSVCs && field_numberOfIP4__Endpoints==other_value.field_numberOfIP4__Endpoints && field_numberOfIP6__Endpoints==other_value.field_numberOfIP6__Endpoints; } boolean PDU__SNS__Size::is_bound() const { return (field_nsPduType.is_bound()) || (field_nSEI__NS.is_bound()) || (field_resetFlag.is_bound()) || (field_maxNumberOfNSVCs.is_bound()) || (OPTIONAL_OMIT == field_numberOfIP4__Endpoints.get_selection() || field_numberOfIP4__Endpoints.is_bound()) || (OPTIONAL_OMIT == field_numberOfIP6__Endpoints.get_selection() || field_numberOfIP6__Endpoints.is_bound()); } boolean PDU__SNS__Size::is_value() const { return field_nsPduType.is_value() && field_nSEI__NS.is_value() && field_resetFlag.is_value() && field_maxNumberOfNSVCs.is_value() && (OPTIONAL_OMIT == field_numberOfIP4__Endpoints.get_selection() || field_numberOfIP4__Endpoints.is_value()) && (OPTIONAL_OMIT == field_numberOfIP6__Endpoints.get_selection() || field_numberOfIP6__Endpoints.is_value()); } int PDU__SNS__Size::size_of() const { int ret_val = 4; if (field_numberOfIP4__Endpoints.ispresent()) ret_val++; if (field_numberOfIP6__Endpoints.ispresent()) ret_val++; return ret_val; } void PDU__SNS__Size::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nsPduType := "); field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); field_nSEI__NS.log(); TTCN_Logger::log_event_str(", resetFlag := "); field_resetFlag.log(); TTCN_Logger::log_event_str(", maxNumberOfNSVCs := "); field_maxNumberOfNSVCs.log(); TTCN_Logger::log_event_str(", numberOfIP4_Endpoints := "); field_numberOfIP4__Endpoints.log(); TTCN_Logger::log_event_str(", numberOfIP6_Endpoints := "); field_numberOfIP6__Endpoints.log(); TTCN_Logger::log_event_str(" }"); } void PDU__SNS__Size::set_implicit_omit() { if (nsPduType().is_bound()) nsPduType().set_implicit_omit(); if (nSEI__NS().is_bound()) nSEI__NS().set_implicit_omit(); if (resetFlag().is_bound()) resetFlag().set_implicit_omit(); if (maxNumberOfNSVCs().is_bound()) maxNumberOfNSVCs().set_implicit_omit(); if (!numberOfIP4__Endpoints().is_bound()) numberOfIP4__Endpoints() = OMIT_VALUE; else numberOfIP4__Endpoints().set_implicit_omit(); if (!numberOfIP6__Endpoints().is_bound()) numberOfIP6__Endpoints() = OMIT_VALUE; else numberOfIP6__Endpoints().set_implicit_omit(); } void PDU__SNS__Size::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 (60 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) resetFlag().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) maxNumberOfNSVCs().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) numberOfIP4__Endpoints().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) numberOfIP6__Endpoints().set_param(*param.get_elem(5)); 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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "resetFlag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { resetFlag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "maxNumberOfNSVCs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { maxNumberOfNSVCs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "numberOfIP4_Endpoints")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { numberOfIP4__Endpoints().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "numberOfIP6_Endpoints")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { numberOfIP6__Endpoints().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Size: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_SNS_Size"); } } void PDU__SNS__Size::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); field_resetFlag.encode_text(text_buf); field_maxNumberOfNSVCs.encode_text(text_buf); field_numberOfIP4__Endpoints.encode_text(text_buf); field_numberOfIP6__Endpoints.encode_text(text_buf); } void PDU__SNS__Size::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); field_resetFlag.decode_text(text_buf); field_maxNumberOfNSVCs.decode_text(text_buf); field_numberOfIP4__Endpoints.decode_text(text_buf); field_numberOfIP6__Endpoints.decode_text(text_buf); } void PDU__SNS__Size::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 PDU__SNS__Size::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 PDU__SNS__Size::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_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, ResetFlag_descr_.raw->forceomit); decoded_field_length = field_resetFlag.RAW_decode(ResetFlag_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, MaxNumberOfNSVCs_descr_.raw->forceomit); decoded_field_length = field_maxNumberOfNSVCs.RAW_decode(MaxNumberOfNSVCs_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_numberOfIP4__Endpoints = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, NumberOfIP__Endpoints_descr_.raw->forceomit); decoded_field_length = field_numberOfIP4__Endpoints().RAW_decode(NumberOfIP__Endpoints_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_numberOfIP4__Endpoints = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_numberOfIP4__Endpoints.ispresent() || field_numberOfIP4__Endpoints().iEI() != os_7){ field_numberOfIP4__Endpoints=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_numberOfIP4__Endpoints=OMIT_VALUE; if (limit > 0){ if (force_omit != NULL && (*force_omit)(5)) { field_numberOfIP6__Endpoints = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_5_force_omit(5, force_omit, NumberOfIP__Endpoints_descr_.raw->forceomit); decoded_field_length = field_numberOfIP6__Endpoints().RAW_decode(NumberOfIP__Endpoints_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 1) { field_numberOfIP6__Endpoints = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_numberOfIP6__Endpoints.ispresent() || field_numberOfIP6__Endpoints().iEI() != os_8){ field_numberOfIP6__Endpoints=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_numberOfIP6__Endpoints=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__SNS__Size::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 = 6; myleaf.body.node.nodes = init_nodes_of_enc_tree(6); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NSEI__NS_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, ResetFlag_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, MaxNumberOfNSVCs_descr_.raw); if (field_numberOfIP4__Endpoints.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, NumberOfIP__Endpoints_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; if (field_numberOfIP6__Endpoints.ispresent()) { myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, NumberOfIP__Endpoints_descr_.raw); } else myleaf.body.node.nodes[5] = NULL; encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_resetFlag.RAW_encode(ResetFlag_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_maxNumberOfNSVCs.RAW_encode(MaxNumberOfNSVCs_descr_, *myleaf.body.node.nodes[3]); if (field_numberOfIP4__Endpoints.ispresent()) { encoded_length += field_numberOfIP4__Endpoints().RAW_encode(NumberOfIP__Endpoints_descr_, *myleaf.body.node.nodes[4]); } if (field_numberOfIP6__Endpoints.ispresent()) { encoded_length += field_numberOfIP6__Endpoints().RAW_encode(NumberOfIP__Endpoints_descr_, *myleaf.body.node.nodes[5]); } if (field_numberOfIP4__Endpoints.ispresent() && (!field_numberOfIP4__Endpoints.ispresent() || field_numberOfIP4__Endpoints().iEI() != os_7)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={4,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){ os_7.RAW_encode(General__Types::OCT1_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); } } if (field_numberOfIP6__Endpoints.ispresent() && (!field_numberOfIP6__Endpoints.ispresent() || field_numberOfIP6__Endpoints().iEI() != os_8)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={5,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){ os_8.RAW_encode(General__Types::OCT1_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); } } return myleaf.length = encoded_length; } struct PDU__SNS__Size_template::single_value_struct { OCTETSTRING_template field_nsPduType; NSEI__NS_template field_nSEI__NS; ResetFlag_template field_resetFlag; MaxNumberOfNSVCs_template field_maxNumberOfNSVCs; NumberOfIP__Endpoints_template field_numberOfIP4__Endpoints; NumberOfIP__Endpoints_template field_numberOfIP6__Endpoints; }; void PDU__SNS__Size_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_nsPduType = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; single_value->field_resetFlag = ANY_VALUE; single_value->field_maxNumberOfNSVCs = ANY_VALUE; single_value->field_numberOfIP4__Endpoints = ANY_OR_OMIT; single_value->field_numberOfIP6__Endpoints = ANY_OR_OMIT; } } } void PDU__SNS__Size_template::copy_value(const PDU__SNS__Size& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (other_value.resetFlag().is_bound()) { single_value->field_resetFlag = other_value.resetFlag(); } else { single_value->field_resetFlag.clean_up(); } if (other_value.maxNumberOfNSVCs().is_bound()) { single_value->field_maxNumberOfNSVCs = other_value.maxNumberOfNSVCs(); } else { single_value->field_maxNumberOfNSVCs.clean_up(); } if (other_value.numberOfIP4__Endpoints().is_bound()) { if (other_value.numberOfIP4__Endpoints().ispresent()) single_value->field_numberOfIP4__Endpoints = other_value.numberOfIP4__Endpoints()(); else single_value->field_numberOfIP4__Endpoints = OMIT_VALUE; } else { single_value->field_numberOfIP4__Endpoints.clean_up(); } if (other_value.numberOfIP6__Endpoints().is_bound()) { if (other_value.numberOfIP6__Endpoints().ispresent()) single_value->field_numberOfIP6__Endpoints = other_value.numberOfIP6__Endpoints()(); else single_value->field_numberOfIP6__Endpoints = OMIT_VALUE; } else { single_value->field_numberOfIP6__Endpoints.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__SNS__Size_template::copy_template(const PDU__SNS__Size_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.resetFlag().get_selection()) { single_value->field_resetFlag = other_value.resetFlag(); } else { single_value->field_resetFlag.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.maxNumberOfNSVCs().get_selection()) { single_value->field_maxNumberOfNSVCs = other_value.maxNumberOfNSVCs(); } else { single_value->field_maxNumberOfNSVCs.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.numberOfIP4__Endpoints().get_selection()) { single_value->field_numberOfIP4__Endpoints = other_value.numberOfIP4__Endpoints(); } else { single_value->field_numberOfIP4__Endpoints.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.numberOfIP6__Endpoints().get_selection()) { single_value->field_numberOfIP6__Endpoints = other_value.numberOfIP6__Endpoints(); } else { single_value->field_numberOfIP6__Endpoints.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 PDU__SNS__Size_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 PDU__SNS__Size_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__SNS__Size_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 @NS_Types.PDU_SNS_Size."); break; } set_selection(other_value); } PDU__SNS__Size_template::PDU__SNS__Size_template() { } PDU__SNS__Size_template::PDU__SNS__Size_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__SNS__Size_template::PDU__SNS__Size_template(const PDU__SNS__Size& other_value) { copy_value(other_value); } PDU__SNS__Size_template::PDU__SNS__Size_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Size&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_SNS_Size from an unbound optional field."); } } PDU__SNS__Size_template::PDU__SNS__Size_template(PDU__SNS__Size_template* p_precondition, PDU__SNS__Size_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__SNS__Size_template::PDU__SNS__Size_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; } PDU__SNS__Size_template::PDU__SNS__Size_template(const PDU__SNS__Size_template& other_value) : Base_Template() { copy_template(other_value); } PDU__SNS__Size_template::~PDU__SNS__Size_template() { clean_up(); } PDU__SNS__Size_template& PDU__SNS__Size_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__SNS__Size_template& PDU__SNS__Size_template::operator=(const PDU__SNS__Size& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__SNS__Size_template& PDU__SNS__Size_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Size&)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 @NS_Types.PDU_SNS_Size."); } return *this; } PDU__SNS__Size_template& PDU__SNS__Size_template::operator=(const PDU__SNS__Size_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__SNS__Size_template::match(const PDU__SNS__Size& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), legacy))return FALSE; if(!other_value.resetFlag().is_bound()) return FALSE; if(!single_value->field_resetFlag.match(other_value.resetFlag(), legacy))return FALSE; if(!other_value.maxNumberOfNSVCs().is_bound()) return FALSE; if(!single_value->field_maxNumberOfNSVCs.match(other_value.maxNumberOfNSVCs(), legacy))return FALSE; if(!other_value.numberOfIP4__Endpoints().is_bound()) return FALSE; if((other_value.numberOfIP4__Endpoints().ispresent() ? !single_value->field_numberOfIP4__Endpoints.match((const NumberOfIP__Endpoints&)other_value.numberOfIP4__Endpoints(), legacy) : !single_value->field_numberOfIP4__Endpoints.match_omit(legacy)))return FALSE; if(!other_value.numberOfIP6__Endpoints().is_bound()) return FALSE; if((other_value.numberOfIP6__Endpoints().ispresent() ? !single_value->field_numberOfIP6__Endpoints.match((const NumberOfIP__Endpoints&)other_value.numberOfIP6__Endpoints(), legacy) : !single_value->field_numberOfIP6__Endpoints.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Size."); } return FALSE; } boolean PDU__SNS__Size_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nSEI__NS.is_bound() || single_value->field_resetFlag.is_bound() || single_value->field_maxNumberOfNSVCs.is_bound() || (single_value->field_numberOfIP4__Endpoints.is_omit() || single_value->field_numberOfIP4__Endpoints.is_bound()) || (single_value->field_numberOfIP6__Endpoints.is_omit() || single_value->field_numberOfIP6__Endpoints.is_bound()); } boolean PDU__SNS__Size_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nSEI__NS.is_value() && single_value->field_resetFlag.is_value() && single_value->field_maxNumberOfNSVCs.is_value() && (single_value->field_numberOfIP4__Endpoints.is_omit() || single_value->field_numberOfIP4__Endpoints.is_value()) && (single_value->field_numberOfIP6__Endpoints.is_omit() || single_value->field_numberOfIP6__Endpoints.is_value()); } void PDU__SNS__Size_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; } PDU__SNS__Size PDU__SNS__Size_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 @NS_Types.PDU_SNS_Size."); PDU__SNS__Size ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } if (single_value->field_resetFlag.is_bound()) { ret_val.resetFlag() = single_value->field_resetFlag.valueof(); } if (single_value->field_maxNumberOfNSVCs.is_bound()) { ret_val.maxNumberOfNSVCs() = single_value->field_maxNumberOfNSVCs.valueof(); } if (single_value->field_numberOfIP4__Endpoints.is_omit()) ret_val.numberOfIP4__Endpoints() = OMIT_VALUE; else if (single_value->field_numberOfIP4__Endpoints.is_bound()) { ret_val.numberOfIP4__Endpoints() = single_value->field_numberOfIP4__Endpoints.valueof(); } if (single_value->field_numberOfIP6__Endpoints.is_omit()) ret_val.numberOfIP6__Endpoints() = OMIT_VALUE; else if (single_value->field_numberOfIP6__Endpoints.is_bound()) { ret_val.numberOfIP6__Endpoints() = single_value->field_numberOfIP6__Endpoints.valueof(); } return ret_val; } void PDU__SNS__Size_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 @NS_Types.PDU_SNS_Size."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__SNS__Size_template[list_length]; } PDU__SNS__Size_template& PDU__SNS__Size_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 @NS_Types.PDU_SNS_Size."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_SNS_Size."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__SNS__Size_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__SNS__Size_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_SNS_Size."); return single_value->field_nsPduType; } NSEI__NS_template& PDU__SNS__Size_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__SNS__Size_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_SNS_Size."); return single_value->field_nSEI__NS; } ResetFlag_template& PDU__SNS__Size_template::resetFlag() { set_specific(); return single_value->field_resetFlag; } const ResetFlag_template& PDU__SNS__Size_template::resetFlag() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field resetFlag of a non-specific template of type @NS_Types.PDU_SNS_Size."); return single_value->field_resetFlag; } MaxNumberOfNSVCs_template& PDU__SNS__Size_template::maxNumberOfNSVCs() { set_specific(); return single_value->field_maxNumberOfNSVCs; } const MaxNumberOfNSVCs_template& PDU__SNS__Size_template::maxNumberOfNSVCs() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field maxNumberOfNSVCs of a non-specific template of type @NS_Types.PDU_SNS_Size."); return single_value->field_maxNumberOfNSVCs; } NumberOfIP__Endpoints_template& PDU__SNS__Size_template::numberOfIP4__Endpoints() { set_specific(); return single_value->field_numberOfIP4__Endpoints; } const NumberOfIP__Endpoints_template& PDU__SNS__Size_template::numberOfIP4__Endpoints() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field numberOfIP4_Endpoints of a non-specific template of type @NS_Types.PDU_SNS_Size."); return single_value->field_numberOfIP4__Endpoints; } NumberOfIP__Endpoints_template& PDU__SNS__Size_template::numberOfIP6__Endpoints() { set_specific(); return single_value->field_numberOfIP6__Endpoints; } const NumberOfIP__Endpoints_template& PDU__SNS__Size_template::numberOfIP6__Endpoints() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field numberOfIP6_Endpoints of a non-specific template of type @NS_Types.PDU_SNS_Size."); return single_value->field_numberOfIP6__Endpoints; } int PDU__SNS__Size_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_numberOfIP4__Endpoints.is_present()) ret_val++; if (single_value->field_numberOfIP6__Endpoints.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size 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 @NS_Types.PDU_SNS_Size containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Size."); } return 0; } void PDU__SNS__Size_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log(); TTCN_Logger::log_event_str(", resetFlag := "); single_value->field_resetFlag.log(); TTCN_Logger::log_event_str(", maxNumberOfNSVCs := "); single_value->field_maxNumberOfNSVCs.log(); TTCN_Logger::log_event_str(", numberOfIP4_Endpoints := "); single_value->field_numberOfIP4__Endpoints.log(); TTCN_Logger::log_event_str(", numberOfIP6_Endpoints := "); single_value->field_numberOfIP6__Endpoints.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 PDU__SNS__Size_template::log_match(const PDU__SNS__Size& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_resetFlag.match(match_value.resetFlag(), legacy)){ TTCN_Logger::log_logmatch_info(".resetFlag"); single_value->field_resetFlag.log_match(match_value.resetFlag(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_maxNumberOfNSVCs.match(match_value.maxNumberOfNSVCs(), legacy)){ TTCN_Logger::log_logmatch_info(".maxNumberOfNSVCs"); single_value->field_maxNumberOfNSVCs.log_match(match_value.maxNumberOfNSVCs(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.numberOfIP4__Endpoints().ispresent()){ if(!single_value->field_numberOfIP4__Endpoints.match(match_value.numberOfIP4__Endpoints(), legacy)){ TTCN_Logger::log_logmatch_info(".numberOfIP4_Endpoints"); single_value->field_numberOfIP4__Endpoints.log_match(match_value.numberOfIP4__Endpoints(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_numberOfIP4__Endpoints.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".numberOfIP4_Endpoints := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_numberOfIP4__Endpoints.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.numberOfIP6__Endpoints().ispresent()){ if(!single_value->field_numberOfIP6__Endpoints.match(match_value.numberOfIP6__Endpoints(), legacy)){ TTCN_Logger::log_logmatch_info(".numberOfIP6_Endpoints"); single_value->field_numberOfIP6__Endpoints.log_match(match_value.numberOfIP6__Endpoints(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_numberOfIP6__Endpoints.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".numberOfIP6_Endpoints := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_numberOfIP6__Endpoints.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::log_event_str(", resetFlag := "); single_value->field_resetFlag.log_match(match_value.resetFlag(), legacy); TTCN_Logger::log_event_str(", maxNumberOfNSVCs := "); single_value->field_maxNumberOfNSVCs.log_match(match_value.maxNumberOfNSVCs(), legacy); TTCN_Logger::log_event_str(", numberOfIP4_Endpoints := "); if (match_value.numberOfIP4__Endpoints().ispresent()) { single_value->field_numberOfIP4__Endpoints.log_match(match_value.numberOfIP4__Endpoints(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_numberOfIP4__Endpoints.log(); if (single_value->field_numberOfIP4__Endpoints.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", numberOfIP6_Endpoints := "); if (match_value.numberOfIP6__Endpoints().ispresent()) { single_value->field_numberOfIP6__Endpoints.log_match(match_value.numberOfIP6__Endpoints(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_numberOfIP6__Endpoints.log(); if (single_value->field_numberOfIP6__Endpoints.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void PDU__SNS__Size_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nSEI__NS.encode_text(text_buf); single_value->field_resetFlag.encode_text(text_buf); single_value->field_maxNumberOfNSVCs.encode_text(text_buf); single_value->field_numberOfIP4__Endpoints.encode_text(text_buf); single_value->field_numberOfIP6__Endpoints.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 @NS_Types.PDU_SNS_Size."); } } void PDU__SNS__Size_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_nsPduType.decode_text(text_buf); single_value->field_nSEI__NS.decode_text(text_buf); single_value->field_resetFlag.decode_text(text_buf); single_value->field_maxNumberOfNSVCs.decode_text(text_buf); single_value->field_numberOfIP4__Endpoints.decode_text(text_buf); single_value->field_numberOfIP6__Endpoints.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 PDU__SNS__Size_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 @NS_Types.PDU_SNS_Size."); } } void PDU__SNS__Size_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: { PDU__SNS__Size_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) resetFlag().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) maxNumberOfNSVCs().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) numberOfIP4__Endpoints().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) numberOfIP6__Endpoints().set_param(*param.get_elem(5)); 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(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "resetFlag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { resetFlag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "maxNumberOfNSVCs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { maxNumberOfNSVCs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "numberOfIP4_Endpoints")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { numberOfIP4__Endpoints().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "numberOfIP6_Endpoints")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { numberOfIP6__Endpoints().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Size: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__SNS__Size_template* precondition = new PDU__SNS__Size_template; precondition->set_param(*param.get_elem(0)); PDU__SNS__Size_template* implied_template = new PDU__SNS__Size_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__SNS__Size_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_SNS_Size"); } is_ifpresent = param.get_ifpresent(); } void PDU__SNS__Size_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Size"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Size"); single_value->field_resetFlag.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Size"); single_value->field_maxNumberOfNSVCs.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Size"); single_value->field_numberOfIP4__Endpoints.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Size"); single_value->field_numberOfIP6__Endpoints.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Size"); 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 : "@NS_Types.PDU_SNS_Size"); } boolean PDU__SNS__Size_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__SNS__Size_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx& par_causeNS) : field_nsPduType(par_nsPduType), field_nSEI__NS(par_nSEI__NS), field_causeNS(par_causeNS) { } PDU__SNS__Size__Ack::PDU__SNS__Size__Ack(const PDU__SNS__Size__Ack& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @NS_Types.PDU_SNS_Size_Ack."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.causeNS().is_bound()) field_causeNS = other_value.causeNS(); else field_causeNS.clean_up(); } void PDU__SNS__Size__Ack::clean_up() { field_nsPduType.clean_up(); field_nSEI__NS.clean_up(); field_causeNS.clean_up(); } const TTCN_Typedescriptor_t* PDU__SNS__Size__Ack::get_descriptor() const { return &PDU__SNS__Size__Ack_descr_; } PDU__SNS__Size__Ack& PDU__SNS__Size__Ack::operator=(const PDU__SNS__Size__Ack& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @NS_Types.PDU_SNS_Size_Ack."); if (other_value.nsPduType().is_bound()) field_nsPduType = other_value.nsPduType(); else field_nsPduType.clean_up(); if (other_value.nSEI__NS().is_bound()) field_nSEI__NS = other_value.nSEI__NS(); else field_nSEI__NS.clean_up(); if (other_value.causeNS().is_bound()) field_causeNS = other_value.causeNS(); else field_causeNS.clean_up(); } return *this; } boolean PDU__SNS__Size__Ack::operator==(const PDU__SNS__Size__Ack& other_value) const { return field_nsPduType==other_value.field_nsPduType && field_nSEI__NS==other_value.field_nSEI__NS && field_causeNS==other_value.field_causeNS; } boolean PDU__SNS__Size__Ack::is_bound() const { return (field_nsPduType.is_bound()) || (field_nSEI__NS.is_bound()) || (OPTIONAL_OMIT == field_causeNS.get_selection() || field_causeNS.is_bound()); } boolean PDU__SNS__Size__Ack::is_value() const { return field_nsPduType.is_value() && field_nSEI__NS.is_value() && (OPTIONAL_OMIT == field_causeNS.get_selection() || field_causeNS.is_value()); } int PDU__SNS__Size__Ack::size_of() const { int ret_val = 2; if (field_causeNS.ispresent()) ret_val++; return ret_val; } void PDU__SNS__Size__Ack::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nsPduType := "); field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); field_nSEI__NS.log(); TTCN_Logger::log_event_str(", causeNS := "); field_causeNS.log(); TTCN_Logger::log_event_str(" }"); } void PDU__SNS__Size__Ack::set_implicit_omit() { if (nsPduType().is_bound()) nsPduType().set_implicit_omit(); if (nSEI__NS().is_bound()) nSEI__NS().set_implicit_omit(); if (!causeNS().is_bound()) causeNS() = OMIT_VALUE; else causeNS().set_implicit_omit(); } void PDU__SNS__Size__Ack::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (30 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Size_Ack: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@NS_Types.PDU_SNS_Size_Ack"); } } void PDU__SNS__Size__Ack::encode_text(Text_Buf& text_buf) const { field_nsPduType.encode_text(text_buf); field_nSEI__NS.encode_text(text_buf); field_causeNS.encode_text(text_buf); } void PDU__SNS__Size__Ack::decode_text(Text_Buf& text_buf) { field_nsPduType.decode_text(text_buf); field_nSEI__NS.decode_text(text_buf); field_causeNS.decode_text(text_buf); } void PDU__SNS__Size__Ack::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 PDU__SNS__Size__Ack::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 PDU__SNS__Size__Ack::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, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nsPduType.RAW_decode(General__Types::OCT1_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, NSEI__NS_descr_.raw->forceomit); decoded_field_length = field_nSEI__NS.RAW_decode(NSEI__NS_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(2)) { field_causeNS = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, CauseNS_descr_.raw->forceomit); decoded_field_length = field_causeNS().RAW_decode(CauseNS_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_causeNS = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { if(!field_causeNS.ispresent() || field_causeNS().iEI() != os_5){ field_causeNS=OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } } else field_causeNS=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PDU__SNS__Size__Ack::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 3; myleaf.body.node.nodes = init_nodes_of_enc_tree(3); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NSEI__NS_descr_.raw); if (field_causeNS.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, CauseNS_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; encoded_length += field_nsPduType.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nSEI__NS.RAW_encode(NSEI__NS_descr_, *myleaf.body.node.nodes[1]); if (field_causeNS.ispresent()) { encoded_length += field_causeNS().RAW_encode(CauseNS_descr_, *myleaf.body.node.nodes[2]); } if (field_causeNS.ispresent() && (!field_causeNS.ispresent() || field_causeNS().iEI() != os_5)) { 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){ os_5.RAW_encode(General__Types::OCT1_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); } } return myleaf.length = encoded_length; } struct PDU__SNS__Size__Ack_template::single_value_struct { OCTETSTRING_template field_nsPduType; NSEI__NS_template field_nSEI__NS; CauseNS_template field_causeNS; }; void PDU__SNS__Size__Ack_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_nsPduType = ANY_VALUE; single_value->field_nSEI__NS = ANY_VALUE; single_value->field_causeNS = ANY_OR_OMIT; } } } void PDU__SNS__Size__Ack_template::copy_value(const PDU__SNS__Size__Ack& other_value) { single_value = new single_value_struct; if (other_value.nsPduType().is_bound()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (other_value.nSEI__NS().is_bound()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (other_value.causeNS().is_bound()) { if (other_value.causeNS().ispresent()) single_value->field_causeNS = other_value.causeNS()(); else single_value->field_causeNS = OMIT_VALUE; } else { single_value->field_causeNS.clean_up(); } set_selection(SPECIFIC_VALUE); } void PDU__SNS__Size__Ack_template::copy_template(const PDU__SNS__Size__Ack_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nsPduType().get_selection()) { single_value->field_nsPduType = other_value.nsPduType(); } else { single_value->field_nsPduType.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nSEI__NS().get_selection()) { single_value->field_nSEI__NS = other_value.nSEI__NS(); } else { single_value->field_nSEI__NS.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.causeNS().get_selection()) { single_value->field_causeNS = other_value.causeNS(); } else { single_value->field_causeNS.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 PDU__SNS__Size__Ack_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 PDU__SNS__Size__Ack_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__SNS__Size__Ack_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 @NS_Types.PDU_SNS_Size_Ack."); break; } set_selection(other_value); } PDU__SNS__Size__Ack_template::PDU__SNS__Size__Ack_template() { } PDU__SNS__Size__Ack_template::PDU__SNS__Size__Ack_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__SNS__Size__Ack_template::PDU__SNS__Size__Ack_template(const PDU__SNS__Size__Ack& other_value) { copy_value(other_value); } PDU__SNS__Size__Ack_template::PDU__SNS__Size__Ack_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Size__Ack&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @NS_Types.PDU_SNS_Size_Ack from an unbound optional field."); } } PDU__SNS__Size__Ack_template::PDU__SNS__Size__Ack_template(PDU__SNS__Size__Ack_template* p_precondition, PDU__SNS__Size__Ack_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__SNS__Size__Ack_template::PDU__SNS__Size__Ack_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; } PDU__SNS__Size__Ack_template::PDU__SNS__Size__Ack_template(const PDU__SNS__Size__Ack_template& other_value) : Base_Template() { copy_template(other_value); } PDU__SNS__Size__Ack_template::~PDU__SNS__Size__Ack_template() { clean_up(); } PDU__SNS__Size__Ack_template& PDU__SNS__Size__Ack_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__SNS__Size__Ack_template& PDU__SNS__Size__Ack_template::operator=(const PDU__SNS__Size__Ack& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__SNS__Size__Ack_template& PDU__SNS__Size__Ack_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__SNS__Size__Ack&)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 @NS_Types.PDU_SNS_Size_Ack."); } return *this; } PDU__SNS__Size__Ack_template& PDU__SNS__Size__Ack_template::operator=(const PDU__SNS__Size__Ack_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__SNS__Size__Ack_template::match(const PDU__SNS__Size__Ack& 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.nsPduType().is_bound()) return FALSE; if(!single_value->field_nsPduType.match(other_value.nsPduType(), legacy))return FALSE; if(!other_value.nSEI__NS().is_bound()) return FALSE; if(!single_value->field_nSEI__NS.match(other_value.nSEI__NS(), legacy))return FALSE; if(!other_value.causeNS().is_bound()) return FALSE; if((other_value.causeNS().ispresent() ? !single_value->field_causeNS.match((const CauseNS&)other_value.causeNS(), legacy) : !single_value->field_causeNS.match_omit(legacy)))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Size_Ack."); } return FALSE; } boolean PDU__SNS__Size__Ack_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nsPduType.is_bound() || single_value->field_nSEI__NS.is_bound() || (single_value->field_causeNS.is_omit() || single_value->field_causeNS.is_bound()); } boolean PDU__SNS__Size__Ack_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nsPduType.is_value() && single_value->field_nSEI__NS.is_value() && (single_value->field_causeNS.is_omit() || single_value->field_causeNS.is_value()); } void PDU__SNS__Size__Ack_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; } PDU__SNS__Size__Ack PDU__SNS__Size__Ack_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 @NS_Types.PDU_SNS_Size_Ack."); PDU__SNS__Size__Ack ret_val; if (single_value->field_nsPduType.is_bound()) { ret_val.nsPduType() = single_value->field_nsPduType.valueof(); } if (single_value->field_nSEI__NS.is_bound()) { ret_val.nSEI__NS() = single_value->field_nSEI__NS.valueof(); } if (single_value->field_causeNS.is_omit()) ret_val.causeNS() = OMIT_VALUE; else if (single_value->field_causeNS.is_bound()) { ret_val.causeNS() = single_value->field_causeNS.valueof(); } return ret_val; } void PDU__SNS__Size__Ack_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 @NS_Types.PDU_SNS_Size_Ack."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__SNS__Size__Ack_template[list_length]; } PDU__SNS__Size__Ack_template& PDU__SNS__Size__Ack_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 @NS_Types.PDU_SNS_Size_Ack."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @NS_Types.PDU_SNS_Size_Ack."); return value_list.list_value[list_index]; } OCTETSTRING_template& PDU__SNS__Size__Ack_template::nsPduType() { set_specific(); return single_value->field_nsPduType; } const OCTETSTRING_template& PDU__SNS__Size__Ack_template::nsPduType() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsPduType of a non-specific template of type @NS_Types.PDU_SNS_Size_Ack."); return single_value->field_nsPduType; } NSEI__NS_template& PDU__SNS__Size__Ack_template::nSEI__NS() { set_specific(); return single_value->field_nSEI__NS; } const NSEI__NS_template& PDU__SNS__Size__Ack_template::nSEI__NS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nSEI_NS of a non-specific template of type @NS_Types.PDU_SNS_Size_Ack."); return single_value->field_nSEI__NS; } CauseNS_template& PDU__SNS__Size__Ack_template::causeNS() { set_specific(); return single_value->field_causeNS; } const CauseNS_template& PDU__SNS__Size__Ack_template::causeNS() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field causeNS of a non-specific template of type @NS_Types.PDU_SNS_Size_Ack."); return single_value->field_causeNS; } int PDU__SNS__Size__Ack_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size_Ack which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_causeNS.is_present()) ret_val++; return ret_val; } case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size_Ack 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 @NS_Types.PDU_SNS_Size_Ack containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size_Ack containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size_Ack containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size_Ack containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size_Ack containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size_Ack containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @NS_Types.PDU_SNS_Size_Ack containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @NS_Types.PDU_SNS_Size_Ack."); } return 0; } void PDU__SNS__Size__Ack_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log(); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log(); TTCN_Logger::log_event_str(", causeNS := "); single_value->field_causeNS.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 PDU__SNS__Size__Ack_template::log_match(const PDU__SNS__Size__Ack& 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_nsPduType.match(match_value.nsPduType(), legacy)){ TTCN_Logger::log_logmatch_info(".nsPduType"); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nSEI__NS.match(match_value.nSEI__NS(), legacy)){ TTCN_Logger::log_logmatch_info(".nSEI_NS"); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.causeNS().ispresent()){ if(!single_value->field_causeNS.match(match_value.causeNS(), legacy)){ TTCN_Logger::log_logmatch_info(".causeNS"); single_value->field_causeNS.log_match(match_value.causeNS(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_causeNS.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".causeNS := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_causeNS.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ nsPduType := "); single_value->field_nsPduType.log_match(match_value.nsPduType(), legacy); TTCN_Logger::log_event_str(", nSEI_NS := "); single_value->field_nSEI__NS.log_match(match_value.nSEI__NS(), legacy); TTCN_Logger::log_event_str(", causeNS := "); if (match_value.causeNS().ispresent()) { single_value->field_causeNS.log_match(match_value.causeNS(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_causeNS.log(); if (single_value->field_causeNS.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(" }"); } else { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value, legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } } void PDU__SNS__Size__Ack_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nsPduType.encode_text(text_buf); single_value->field_nSEI__NS.encode_text(text_buf); single_value->field_causeNS.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 @NS_Types.PDU_SNS_Size_Ack."); } } void PDU__SNS__Size__Ack_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_nsPduType.decode_text(text_buf); single_value->field_nSEI__NS.decode_text(text_buf); single_value->field_causeNS.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 PDU__SNS__Size__Ack_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 @NS_Types.PDU_SNS_Size_Ack."); } } void PDU__SNS__Size__Ack_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: { PDU__SNS__Size__Ack_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) nsPduType().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nSEI__NS().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) causeNS().set_param(*param.get_elem(2)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "nsPduType")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsPduType().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nSEI_NS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nSEI__NS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "causeNS")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { causeNS().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @NS_Types.PDU_SNS_Size_Ack: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PDU__SNS__Size__Ack_template* precondition = new PDU__SNS__Size__Ack_template; precondition->set_param(*param.get_elem(0)); PDU__SNS__Size__Ack_template* implied_template = new PDU__SNS__Size__Ack_template; implied_template->set_param(*param.get_elem(1)); *this = PDU__SNS__Size__Ack_template(precondition, implied_template); } break; default: param.type_error("record template", "@NS_Types.PDU_SNS_Size_Ack"); } is_ifpresent = param.get_ifpresent(); } void PDU__SNS__Size__Ack_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_nsPduType.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Size_Ack"); single_value->field_nSEI__NS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Size_Ack"); single_value->field_causeNS.check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_SNS_Size_Ack"); 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 : "@NS_Types.PDU_SNS_Size_Ack"); } boolean PDU__SNS__Size__Ack_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__SNS__Size__Ack_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_pDU__NS__Alive__Ack: return field_pDU__NS__Alive__Ack->is_value(); case ALT_pDU__NS__Block: return field_pDU__NS__Block->is_value(); case ALT_pDU__NS__Block__Ack: return field_pDU__NS__Block__Ack->is_value(); case ALT_pDU__NS__Reset: return field_pDU__NS__Reset->is_value(); case ALT_pDU__NS__Reset__Ack: return field_pDU__NS__Reset__Ack->is_value(); case ALT_pDU__NS__Status: return field_pDU__NS__Status->is_value(); case ALT_pDU__NS__Unblock: return field_pDU__NS__Unblock->is_value(); case ALT_pDU__NS__Unblock__Ack: return field_pDU__NS__Unblock__Ack->is_value(); case ALT_pDU__NS__Unitdata: return field_pDU__NS__Unitdata->is_value(); case ALT_pDU__SNS__Ack: return field_pDU__SNS__Ack->is_value(); case ALT_pDU__SNS__Add: return field_pDU__SNS__Add->is_value(); case ALT_pDU__SNS__ChangeWeight: return field_pDU__SNS__ChangeWeight->is_value(); case ALT_pDU__SNS__Config: return field_pDU__SNS__Config->is_value(); case ALT_pDU__SNS__Config__Ack: return field_pDU__SNS__Config__Ack->is_value(); case ALT_pDU__SNS__Delete: return field_pDU__SNS__Delete->is_value(); case ALT_pDU__SNS__Size: return field_pDU__SNS__Size->is_value(); case ALT_pDU__SNS__Size__Ack: return field_pDU__SNS__Size__Ack->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void PDU__NS::clean_up() { switch (union_selection) { case ALT_pDU__NS__Alive: delete field_pDU__NS__Alive; break; case ALT_pDU__NS__Alive__Ack: delete field_pDU__NS__Alive__Ack; break; case ALT_pDU__NS__Block: delete field_pDU__NS__Block; break; case ALT_pDU__NS__Block__Ack: delete field_pDU__NS__Block__Ack; break; case ALT_pDU__NS__Reset: delete field_pDU__NS__Reset; break; case ALT_pDU__NS__Reset__Ack: delete field_pDU__NS__Reset__Ack; break; case ALT_pDU__NS__Status: delete field_pDU__NS__Status; break; case ALT_pDU__NS__Unblock: delete field_pDU__NS__Unblock; break; case ALT_pDU__NS__Unblock__Ack: delete field_pDU__NS__Unblock__Ack; break; case ALT_pDU__NS__Unitdata: delete field_pDU__NS__Unitdata; break; case ALT_pDU__SNS__Ack: delete field_pDU__SNS__Ack; break; case ALT_pDU__SNS__Add: delete field_pDU__SNS__Add; break; case ALT_pDU__SNS__ChangeWeight: delete field_pDU__SNS__ChangeWeight; break; case ALT_pDU__SNS__Config: delete field_pDU__SNS__Config; break; case ALT_pDU__SNS__Config__Ack: delete field_pDU__SNS__Config__Ack; break; case ALT_pDU__SNS__Delete: delete field_pDU__SNS__Delete; break; case ALT_pDU__SNS__Size: delete field_pDU__SNS__Size; break; case ALT_pDU__SNS__Size__Ack: delete field_pDU__SNS__Size__Ack; break; default: break; } union_selection = UNBOUND_VALUE; } void PDU__NS::log() const { switch (union_selection) { case ALT_pDU__NS__Alive: TTCN_Logger::log_event_str("{ pDU_NS_Alive := "); field_pDU__NS__Alive->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__NS__Alive__Ack: TTCN_Logger::log_event_str("{ pDU_NS_Alive_Ack := "); field_pDU__NS__Alive__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__NS__Block: TTCN_Logger::log_event_str("{ pDU_NS_Block := "); field_pDU__NS__Block->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__NS__Block__Ack: TTCN_Logger::log_event_str("{ pDU_NS_Block_Ack := "); field_pDU__NS__Block__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__NS__Reset: TTCN_Logger::log_event_str("{ pDU_NS_Reset := "); field_pDU__NS__Reset->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__NS__Reset__Ack: TTCN_Logger::log_event_str("{ pDU_NS_Reset_Ack := "); field_pDU__NS__Reset__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__NS__Status: TTCN_Logger::log_event_str("{ pDU_NS_Status := "); field_pDU__NS__Status->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__NS__Unblock: TTCN_Logger::log_event_str("{ pDU_NS_Unblock := "); field_pDU__NS__Unblock->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__NS__Unblock__Ack: TTCN_Logger::log_event_str("{ pDU_NS_Unblock_Ack := "); field_pDU__NS__Unblock__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__NS__Unitdata: TTCN_Logger::log_event_str("{ pDU_NS_Unitdata := "); field_pDU__NS__Unitdata->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__SNS__Ack: TTCN_Logger::log_event_str("{ pDU_SNS_Ack := "); field_pDU__SNS__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__SNS__Add: TTCN_Logger::log_event_str("{ pDU_SNS_Add := "); field_pDU__SNS__Add->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__SNS__ChangeWeight: TTCN_Logger::log_event_str("{ pDU_SNS_ChangeWeight := "); field_pDU__SNS__ChangeWeight->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__SNS__Config: TTCN_Logger::log_event_str("{ pDU_SNS_Config := "); field_pDU__SNS__Config->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__SNS__Config__Ack: TTCN_Logger::log_event_str("{ pDU_SNS_Config_Ack := "); field_pDU__SNS__Config__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__SNS__Delete: TTCN_Logger::log_event_str("{ pDU_SNS_Delete := "); field_pDU__SNS__Delete->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__SNS__Size: TTCN_Logger::log_event_str("{ pDU_SNS_Size := "); field_pDU__SNS__Size->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_pDU__SNS__Size__Ack: TTCN_Logger::log_event_str("{ pDU_SNS_Size_Ack := "); field_pDU__SNS__Size__Ack->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void PDU__NS::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, "pDU_NS_Alive")) { pDU__NS__Alive().set_param(*mp_last); if (!pDU__NS__Alive().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_NS_Alive_Ack")) { pDU__NS__Alive__Ack().set_param(*mp_last); if (!pDU__NS__Alive__Ack().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_NS_Block")) { pDU__NS__Block().set_param(*mp_last); if (!pDU__NS__Block().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_NS_Block_Ack")) { pDU__NS__Block__Ack().set_param(*mp_last); if (!pDU__NS__Block__Ack().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_NS_Reset")) { pDU__NS__Reset().set_param(*mp_last); if (!pDU__NS__Reset().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_NS_Reset_Ack")) { pDU__NS__Reset__Ack().set_param(*mp_last); if (!pDU__NS__Reset__Ack().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_NS_Status")) { pDU__NS__Status().set_param(*mp_last); if (!pDU__NS__Status().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_NS_Unblock")) { pDU__NS__Unblock().set_param(*mp_last); if (!pDU__NS__Unblock().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_NS_Unblock_Ack")) { pDU__NS__Unblock__Ack().set_param(*mp_last); if (!pDU__NS__Unblock__Ack().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_NS_Unitdata")) { pDU__NS__Unitdata().set_param(*mp_last); if (!pDU__NS__Unitdata().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_SNS_Ack")) { pDU__SNS__Ack().set_param(*mp_last); if (!pDU__SNS__Ack().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_SNS_Add")) { pDU__SNS__Add().set_param(*mp_last); if (!pDU__SNS__Add().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_SNS_ChangeWeight")) { pDU__SNS__ChangeWeight().set_param(*mp_last); if (!pDU__SNS__ChangeWeight().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_SNS_Config")) { pDU__SNS__Config().set_param(*mp_last); if (!pDU__SNS__Config().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_SNS_Config_Ack")) { pDU__SNS__Config__Ack().set_param(*mp_last); if (!pDU__SNS__Config__Ack().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_SNS_Delete")) { pDU__SNS__Delete().set_param(*mp_last); if (!pDU__SNS__Delete().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_SNS_Size")) { pDU__SNS__Size().set_param(*mp_last); if (!pDU__SNS__Size().is_bound()) clean_up(); return; } if (!strcmp(last_name, "pDU_SNS_Size_Ack")) { pDU__SNS__Size__Ack().set_param(*mp_last); if (!pDU__SNS__Size__Ack().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @NS_Types.PDU_NS.", last_name); } void PDU__NS::set_implicit_omit() { switch (union_selection) { case ALT_pDU__NS__Alive: field_pDU__NS__Alive->set_implicit_omit(); break; case ALT_pDU__NS__Alive__Ack: field_pDU__NS__Alive__Ack->set_implicit_omit(); break; case ALT_pDU__NS__Block: field_pDU__NS__Block->set_implicit_omit(); break; case ALT_pDU__NS__Block__Ack: field_pDU__NS__Block__Ack->set_implicit_omit(); break; case ALT_pDU__NS__Reset: field_pDU__NS__Reset->set_implicit_omit(); break; case ALT_pDU__NS__Reset__Ack: field_pDU__NS__Reset__Ack->set_implicit_omit(); break; case ALT_pDU__NS__Status: field_pDU__NS__Status->set_implicit_omit(); break; case ALT_pDU__NS__Unblock: field_pDU__NS__Unblock->set_implicit_omit(); break; case ALT_pDU__NS__Unblock__Ack: field_pDU__NS__Unblock__Ack->set_implicit_omit(); break; case ALT_pDU__NS__Unitdata: field_pDU__NS__Unitdata->set_implicit_omit(); break; case ALT_pDU__SNS__Ack: field_pDU__SNS__Ack->set_implicit_omit(); break; case ALT_pDU__SNS__Add: field_pDU__SNS__Add->set_implicit_omit(); break; case ALT_pDU__SNS__ChangeWeight: field_pDU__SNS__ChangeWeight->set_implicit_omit(); break; case ALT_pDU__SNS__Config: field_pDU__SNS__Config->set_implicit_omit(); break; case ALT_pDU__SNS__Config__Ack: field_pDU__SNS__Config__Ack->set_implicit_omit(); break; case ALT_pDU__SNS__Delete: field_pDU__SNS__Delete->set_implicit_omit(); break; case ALT_pDU__SNS__Size: field_pDU__SNS__Size->set_implicit_omit(); break; case ALT_pDU__SNS__Size__Ack: field_pDU__SNS__Size__Ack->set_implicit_omit(); break; default: break; } } void PDU__NS::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_pDU__NS__Alive: field_pDU__NS__Alive->encode_text(text_buf); break; case ALT_pDU__NS__Alive__Ack: field_pDU__NS__Alive__Ack->encode_text(text_buf); break; case ALT_pDU__NS__Block: field_pDU__NS__Block->encode_text(text_buf); break; case ALT_pDU__NS__Block__Ack: field_pDU__NS__Block__Ack->encode_text(text_buf); break; case ALT_pDU__NS__Reset: field_pDU__NS__Reset->encode_text(text_buf); break; case ALT_pDU__NS__Reset__Ack: field_pDU__NS__Reset__Ack->encode_text(text_buf); break; case ALT_pDU__NS__Status: field_pDU__NS__Status->encode_text(text_buf); break; case ALT_pDU__NS__Unblock: field_pDU__NS__Unblock->encode_text(text_buf); break; case ALT_pDU__NS__Unblock__Ack: field_pDU__NS__Unblock__Ack->encode_text(text_buf); break; case ALT_pDU__NS__Unitdata: field_pDU__NS__Unitdata->encode_text(text_buf); break; case ALT_pDU__SNS__Ack: field_pDU__SNS__Ack->encode_text(text_buf); break; case ALT_pDU__SNS__Add: field_pDU__SNS__Add->encode_text(text_buf); break; case ALT_pDU__SNS__ChangeWeight: field_pDU__SNS__ChangeWeight->encode_text(text_buf); break; case ALT_pDU__SNS__Config: field_pDU__SNS__Config->encode_text(text_buf); break; case ALT_pDU__SNS__Config__Ack: field_pDU__SNS__Config__Ack->encode_text(text_buf); break; case ALT_pDU__SNS__Delete: field_pDU__SNS__Delete->encode_text(text_buf); break; case ALT_pDU__SNS__Size: field_pDU__SNS__Size->encode_text(text_buf); break; case ALT_pDU__SNS__Size__Ack: field_pDU__SNS__Size__Ack->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @NS_Types.PDU_NS."); } } void PDU__NS::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_pDU__NS__Alive: pDU__NS__Alive().decode_text(text_buf); break; case ALT_pDU__NS__Alive__Ack: pDU__NS__Alive__Ack().decode_text(text_buf); break; case ALT_pDU__NS__Block: pDU__NS__Block().decode_text(text_buf); break; case ALT_pDU__NS__Block__Ack: pDU__NS__Block__Ack().decode_text(text_buf); break; case ALT_pDU__NS__Reset: pDU__NS__Reset().decode_text(text_buf); break; case ALT_pDU__NS__Reset__Ack: pDU__NS__Reset__Ack().decode_text(text_buf); break; case ALT_pDU__NS__Status: pDU__NS__Status().decode_text(text_buf); break; case ALT_pDU__NS__Unblock: pDU__NS__Unblock().decode_text(text_buf); break; case ALT_pDU__NS__Unblock__Ack: pDU__NS__Unblock__Ack().decode_text(text_buf); break; case ALT_pDU__NS__Unitdata: pDU__NS__Unitdata().decode_text(text_buf); break; case ALT_pDU__SNS__Ack: pDU__SNS__Ack().decode_text(text_buf); break; case ALT_pDU__SNS__Add: pDU__SNS__Add().decode_text(text_buf); break; case ALT_pDU__SNS__ChangeWeight: pDU__SNS__ChangeWeight().decode_text(text_buf); break; case ALT_pDU__SNS__Config: pDU__SNS__Config().decode_text(text_buf); break; case ALT_pDU__SNS__Config__Ack: pDU__SNS__Config__Ack().decode_text(text_buf); break; case ALT_pDU__SNS__Delete: pDU__SNS__Delete().decode_text(text_buf); break; case ALT_pDU__SNS__Size: pDU__SNS__Size().decode_text(text_buf); break; case ALT_pDU__SNS__Size__Ack: pDU__SNS__Size__Ack().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @NS_Types.PDU_NS."); } } void PDU__NS::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 PDU__NS::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 PDU__NS::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, PDU__NS__Alive_descr_.raw->forceomit); decoded_length = pDU__NS__Alive().RAW_decode(PDU__NS__Alive_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, PDU__NS__Alive__Ack_descr_.raw->forceomit); decoded_length = pDU__NS__Alive__Ack().RAW_decode(PDU__NS__Alive__Ack_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, PDU__NS__Block_descr_.raw->forceomit); decoded_length = pDU__NS__Block().RAW_decode(PDU__NS__Block_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, PDU__NS__Block__Ack_descr_.raw->forceomit); decoded_length = pDU__NS__Block__Ack().RAW_decode(PDU__NS__Block__Ack_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 4: { RAW_Force_Omit field_force_omit(4, force_omit, PDU__NS__Reset_descr_.raw->forceomit); decoded_length = pDU__NS__Reset().RAW_decode(PDU__NS__Reset_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 5: { RAW_Force_Omit field_force_omit(5, force_omit, PDU__NS__Reset__Ack_descr_.raw->forceomit); decoded_length = pDU__NS__Reset__Ack().RAW_decode(PDU__NS__Reset__Ack_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 6: { RAW_Force_Omit field_force_omit(6, force_omit, PDU__NS__Status_descr_.raw->forceomit); decoded_length = pDU__NS__Status().RAW_decode(PDU__NS__Status_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 7: { RAW_Force_Omit field_force_omit(7, force_omit, PDU__NS__Unblock_descr_.raw->forceomit); decoded_length = pDU__NS__Unblock().RAW_decode(PDU__NS__Unblock_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 8: { RAW_Force_Omit field_force_omit(8, force_omit, PDU__NS__Unblock__Ack_descr_.raw->forceomit); decoded_length = pDU__NS__Unblock__Ack().RAW_decode(PDU__NS__Unblock__Ack_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 9: { RAW_Force_Omit field_force_omit(9, force_omit, PDU__NS__Unitdata_descr_.raw->forceomit); decoded_length = pDU__NS__Unitdata().RAW_decode(PDU__NS__Unitdata_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 10: { RAW_Force_Omit field_force_omit(10, force_omit, PDU__SNS__Ack_descr_.raw->forceomit); decoded_length = pDU__SNS__Ack().RAW_decode(PDU__SNS__Ack_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 11: { RAW_Force_Omit field_force_omit(11, force_omit, PDU__SNS__Add_descr_.raw->forceomit); decoded_length = pDU__SNS__Add().RAW_decode(PDU__SNS__Add_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 12: { RAW_Force_Omit field_force_omit(12, force_omit, PDU__SNS__ChangeWeight_descr_.raw->forceomit); decoded_length = pDU__SNS__ChangeWeight().RAW_decode(PDU__SNS__ChangeWeight_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 13: { RAW_Force_Omit field_force_omit(13, force_omit, PDU__SNS__Config_descr_.raw->forceomit); decoded_length = pDU__SNS__Config().RAW_decode(PDU__SNS__Config_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 14: { RAW_Force_Omit field_force_omit(14, force_omit, PDU__SNS__Config__Ack_descr_.raw->forceomit); decoded_length = pDU__SNS__Config__Ack().RAW_decode(PDU__SNS__Config__Ack_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 15: { RAW_Force_Omit field_force_omit(15, force_omit, PDU__SNS__Delete_descr_.raw->forceomit); decoded_length = pDU__SNS__Delete().RAW_decode(PDU__SNS__Delete_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 16: { RAW_Force_Omit field_force_omit(16, force_omit, PDU__SNS__Size_descr_.raw->forceomit); decoded_length = pDU__SNS__Size().RAW_decode(PDU__SNS__Size_descr_, p_buf, limit, top_bit_ord, no_err, -1, TRUE, &field_force_omit); break; } case 17: { RAW_Force_Omit field_force_omit(17, force_omit, PDU__SNS__Size__Ack_descr_.raw->forceomit); decoded_length = pDU__SNS__Size__Ack().RAW_decode(PDU__SNS__Size__Ack_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; OCTETSTRING 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(General__Types::OCT1_descr_, p_buf, limit, top_bit_ord, TRUE); if (decoded_0_length > 0) { if (temporal_0 == os_9) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(0, force_omit, PDU__NS__Alive_descr_.raw->forceomit); decoded_length = pDU__NS__Alive().RAW_decode(PDU__NS__Alive_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Alive).nsPduType() == os_9) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_6) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(1, force_omit, PDU__NS__Alive__Ack_descr_.raw->forceomit); decoded_length = pDU__NS__Alive__Ack().RAW_decode(PDU__NS__Alive__Ack_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Alive__Ack).nsPduType() == os_6) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_10) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(2, force_omit, PDU__NS__Block_descr_.raw->forceomit); decoded_length = pDU__NS__Block().RAW_decode(PDU__NS__Block_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Block).nsPduType() == os_10) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_3) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(3, force_omit, PDU__NS__Block__Ack_descr_.raw->forceomit); decoded_length = pDU__NS__Block__Ack().RAW_decode(PDU__NS__Block__Ack_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Block__Ack).nsPduType() == os_3) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_1) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(4, force_omit, PDU__NS__Reset_descr_.raw->forceomit); decoded_length = pDU__NS__Reset().RAW_decode(PDU__NS__Reset_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Reset).nsPduType() == os_1) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_2) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(5, force_omit, PDU__NS__Reset__Ack_descr_.raw->forceomit); decoded_length = pDU__NS__Reset__Ack().RAW_decode(PDU__NS__Reset__Ack_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Reset__Ack).nsPduType() == os_2) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_7) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(6, force_omit, PDU__NS__Status_descr_.raw->forceomit); decoded_length = pDU__NS__Status().RAW_decode(PDU__NS__Status_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Status).nsPduType() == os_7) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_4) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(7, force_omit, PDU__NS__Unblock_descr_.raw->forceomit); decoded_length = pDU__NS__Unblock().RAW_decode(PDU__NS__Unblock_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Unblock).nsPduType() == os_4) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_11) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(8, force_omit, PDU__NS__Unblock__Ack_descr_.raw->forceomit); decoded_length = pDU__NS__Unblock__Ack().RAW_decode(PDU__NS__Unblock__Ack_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Unblock__Ack).nsPduType() == os_11) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_5) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(9, force_omit, PDU__NS__Unitdata_descr_.raw->forceomit); decoded_length = pDU__NS__Unitdata().RAW_decode(PDU__NS__Unitdata_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__NS__Unitdata).nsPduType() == os_5) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_12) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(10, force_omit, PDU__SNS__Ack_descr_.raw->forceomit); decoded_length = pDU__SNS__Ack().RAW_decode(PDU__SNS__Ack_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__SNS__Ack).nsPduType() == os_12) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_13) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(11, force_omit, PDU__SNS__Add_descr_.raw->forceomit); decoded_length = pDU__SNS__Add().RAW_decode(PDU__SNS__Add_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__SNS__Add).nsPduType() == os_13) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_14) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(12, force_omit, PDU__SNS__ChangeWeight_descr_.raw->forceomit); decoded_length = pDU__SNS__ChangeWeight().RAW_decode(PDU__SNS__ChangeWeight_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__SNS__ChangeWeight).nsPduType() == os_14) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_15) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(13, force_omit, PDU__SNS__Config_descr_.raw->forceomit); decoded_length = pDU__SNS__Config().RAW_decode(PDU__SNS__Config_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__SNS__Config).nsPduType() == os_15) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_16) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(14, force_omit, PDU__SNS__Config__Ack_descr_.raw->forceomit); decoded_length = pDU__SNS__Config__Ack().RAW_decode(PDU__SNS__Config__Ack_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__SNS__Config__Ack).nsPduType() == os_16) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_17) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(15, force_omit, PDU__SNS__Delete_descr_.raw->forceomit); decoded_length = pDU__SNS__Delete().RAW_decode(PDU__SNS__Delete_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__SNS__Delete).nsPduType() == os_17) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_18) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(16, force_omit, PDU__SNS__Size_descr_.raw->forceomit); decoded_length = pDU__SNS__Size().RAW_decode(PDU__SNS__Size_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__SNS__Size).nsPduType() == os_18) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } already_failed = FALSE; if (!already_failed) { if (decoded_0_length > 0) { if (temporal_0 == os_19) { p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_force_omit(17, force_omit, PDU__SNS__Size__Ack_descr_.raw->forceomit); decoded_length = pDU__SNS__Size__Ack().RAW_decode(PDU__SNS__Size__Ack_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_force_omit); if (decoded_length > 0) { if ((*field_pDU__SNS__Size__Ack).nsPduType() == os_19) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; }else already_failed = TRUE; } } } } } clean_up(); return -1; } int PDU__NS::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 18; myleaf.body.node.nodes = init_nodes_of_enc_tree(18); memset(myleaf.body.node.nodes, 0, 18 * sizeof(RAW_enc_tree *)); switch (union_selection) { case ALT_pDU__NS__Alive: myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, PDU__NS__Alive_descr_.raw); encoded_length = field_pDU__NS__Alive->RAW_encode(PDU__NS__Alive_descr_, *myleaf.body.node.nodes[0]); myleaf.body.node.nodes[0]->coding_descr = &PDU__NS__Alive_descr_; if ((*field_pDU__NS__Alive).nsPduType() != os_9) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={0,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){ os_9.RAW_encode(General__Types::OCT1_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_pDU__NS__Alive__Ack: myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, PDU__NS__Alive__Ack_descr_.raw); encoded_length = field_pDU__NS__Alive__Ack->RAW_encode(PDU__NS__Alive__Ack_descr_, *myleaf.body.node.nodes[1]); myleaf.body.node.nodes[1]->coding_descr = &PDU__NS__Alive__Ack_descr_; if ((*field_pDU__NS__Alive__Ack).nsPduType() != os_6) { 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){ os_6.RAW_encode(General__Types::OCT1_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_pDU__NS__Block: myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, PDU__NS__Block_descr_.raw); encoded_length = field_pDU__NS__Block->RAW_encode(PDU__NS__Block_descr_, *myleaf.body.node.nodes[2]); myleaf.body.node.nodes[2]->coding_descr = &PDU__NS__Block_descr_; if ((*field_pDU__NS__Block).nsPduType() != os_10) { 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){ os_10.RAW_encode(General__Types::OCT1_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_pDU__NS__Block__Ack: myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 3, PDU__NS__Block__Ack_descr_.raw); encoded_length = field_pDU__NS__Block__Ack->RAW_encode(PDU__NS__Block__Ack_descr_, *myleaf.body.node.nodes[3]); myleaf.body.node.nodes[3]->coding_descr = &PDU__NS__Block__Ack_descr_; if ((*field_pDU__NS__Block__Ack).nsPduType() != os_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){ os_3.RAW_encode(General__Types::OCT1_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_pDU__NS__Reset: myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 4, PDU__NS__Reset_descr_.raw); encoded_length = field_pDU__NS__Reset->RAW_encode(PDU__NS__Reset_descr_, *myleaf.body.node.nodes[4]); myleaf.body.node.nodes[4]->coding_descr = &PDU__NS__Reset_descr_; if ((*field_pDU__NS__Reset).nsPduType() != os_1) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={4,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){ os_1.RAW_encode(General__Types::OCT1_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_pDU__NS__Reset__Ack: myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 5, PDU__NS__Reset__Ack_descr_.raw); encoded_length = field_pDU__NS__Reset__Ack->RAW_encode(PDU__NS__Reset__Ack_descr_, *myleaf.body.node.nodes[5]); myleaf.body.node.nodes[5]->coding_descr = &PDU__NS__Reset__Ack_descr_; if ((*field_pDU__NS__Reset__Ack).nsPduType() != os_2) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={5,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){ os_2.RAW_encode(General__Types::OCT1_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_pDU__NS__Status: myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 6, PDU__NS__Status_descr_.raw); encoded_length = field_pDU__NS__Status->RAW_encode(PDU__NS__Status_descr_, *myleaf.body.node.nodes[6]); myleaf.body.node.nodes[6]->coding_descr = &PDU__NS__Status_descr_; if ((*field_pDU__NS__Status).nsPduType() != os_7) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={6,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){ os_7.RAW_encode(General__Types::OCT1_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_pDU__NS__Unblock: myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 7, PDU__NS__Unblock_descr_.raw); encoded_length = field_pDU__NS__Unblock->RAW_encode(PDU__NS__Unblock_descr_, *myleaf.body.node.nodes[7]); myleaf.body.node.nodes[7]->coding_descr = &PDU__NS__Unblock_descr_; if ((*field_pDU__NS__Unblock).nsPduType() != os_4) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={7,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){ os_4.RAW_encode(General__Types::OCT1_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_pDU__NS__Unblock__Ack: myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 8, PDU__NS__Unblock__Ack_descr_.raw); encoded_length = field_pDU__NS__Unblock__Ack->RAW_encode(PDU__NS__Unblock__Ack_descr_, *myleaf.body.node.nodes[8]); myleaf.body.node.nodes[8]->coding_descr = &PDU__NS__Unblock__Ack_descr_; if ((*field_pDU__NS__Unblock__Ack).nsPduType() != os_11) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={8,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){ os_11.RAW_encode(General__Types::OCT1_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_pDU__NS__Unitdata: myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 9, PDU__NS__Unitdata_descr_.raw); encoded_length = field_pDU__NS__Unitdata->RAW_encode(PDU__NS__Unitdata_descr_, *myleaf.body.node.nodes[9]); myleaf.body.node.nodes[9]->coding_descr = &PDU__NS__Unitdata_descr_; if ((*field_pDU__NS__Unitdata).nsPduType() != os_5) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={9,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){ os_5.RAW_encode(General__Types::OCT1_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_pDU__SNS__Ack: myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 10, PDU__SNS__Ack_descr_.raw); encoded_length = field_pDU__SNS__Ack->RAW_encode(PDU__SNS__Ack_descr_, *myleaf.body.node.nodes[10]); myleaf.body.node.nodes[10]->coding_descr = &PDU__SNS__Ack_descr_; if ((*field_pDU__SNS__Ack).nsPduType() != os_12) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={10,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){ os_12.RAW_encode(General__Types::OCT1_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_pDU__SNS__Add: myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 11, PDU__SNS__Add_descr_.raw); encoded_length = field_pDU__SNS__Add->RAW_encode(PDU__SNS__Add_descr_, *myleaf.body.node.nodes[11]); myleaf.body.node.nodes[11]->coding_descr = &PDU__SNS__Add_descr_; if ((*field_pDU__SNS__Add).nsPduType() != os_13) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={11,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){ os_13.RAW_encode(General__Types::OCT1_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_pDU__SNS__ChangeWeight: myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 12, PDU__SNS__ChangeWeight_descr_.raw); encoded_length = field_pDU__SNS__ChangeWeight->RAW_encode(PDU__SNS__ChangeWeight_descr_, *myleaf.body.node.nodes[12]); myleaf.body.node.nodes[12]->coding_descr = &PDU__SNS__ChangeWeight_descr_; if ((*field_pDU__SNS__ChangeWeight).nsPduType() != os_14) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={12,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){ os_14.RAW_encode(General__Types::OCT1_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_pDU__SNS__Config: myleaf.body.node.nodes[13] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 13, PDU__SNS__Config_descr_.raw); encoded_length = field_pDU__SNS__Config->RAW_encode(PDU__SNS__Config_descr_, *myleaf.body.node.nodes[13]); myleaf.body.node.nodes[13]->coding_descr = &PDU__SNS__Config_descr_; if ((*field_pDU__SNS__Config).nsPduType() != os_15) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={13,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){ os_15.RAW_encode(General__Types::OCT1_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_pDU__SNS__Config__Ack: myleaf.body.node.nodes[14] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 14, PDU__SNS__Config__Ack_descr_.raw); encoded_length = field_pDU__SNS__Config__Ack->RAW_encode(PDU__SNS__Config__Ack_descr_, *myleaf.body.node.nodes[14]); myleaf.body.node.nodes[14]->coding_descr = &PDU__SNS__Config__Ack_descr_; if ((*field_pDU__SNS__Config__Ack).nsPduType() != os_16) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={14,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){ os_16.RAW_encode(General__Types::OCT1_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_pDU__SNS__Delete: myleaf.body.node.nodes[15] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 15, PDU__SNS__Delete_descr_.raw); encoded_length = field_pDU__SNS__Delete->RAW_encode(PDU__SNS__Delete_descr_, *myleaf.body.node.nodes[15]); myleaf.body.node.nodes[15]->coding_descr = &PDU__SNS__Delete_descr_; if ((*field_pDU__SNS__Delete).nsPduType() != os_17) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={15,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){ os_17.RAW_encode(General__Types::OCT1_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_pDU__SNS__Size: myleaf.body.node.nodes[16] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 16, PDU__SNS__Size_descr_.raw); encoded_length = field_pDU__SNS__Size->RAW_encode(PDU__SNS__Size_descr_, *myleaf.body.node.nodes[16]); myleaf.body.node.nodes[16]->coding_descr = &PDU__SNS__Size_descr_; if ((*field_pDU__SNS__Size).nsPduType() != os_18) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={16,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){ os_18.RAW_encode(General__Types::OCT1_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_pDU__SNS__Size__Ack: myleaf.body.node.nodes[17] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 17, PDU__SNS__Size__Ack_descr_.raw); encoded_length = field_pDU__SNS__Size__Ack->RAW_encode(PDU__SNS__Size__Ack_descr_, *myleaf.body.node.nodes[17]); myleaf.body.node.nodes[17]->coding_descr = &PDU__SNS__Size__Ack_descr_; if ((*field_pDU__SNS__Size__Ack).nsPduType() != os_19) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={17,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){ os_19.RAW_encode(General__Types::OCT1_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 PDU__NS_template::copy_value(const PDU__NS& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case PDU__NS::ALT_pDU__NS__Alive: single_value.field_pDU__NS__Alive = new PDU__NS__Alive_template(other_value.pDU__NS__Alive()); break; case PDU__NS::ALT_pDU__NS__Alive__Ack: single_value.field_pDU__NS__Alive__Ack = new PDU__NS__Alive__Ack_template(other_value.pDU__NS__Alive__Ack()); break; case PDU__NS::ALT_pDU__NS__Block: single_value.field_pDU__NS__Block = new PDU__NS__Block_template(other_value.pDU__NS__Block()); break; case PDU__NS::ALT_pDU__NS__Block__Ack: single_value.field_pDU__NS__Block__Ack = new PDU__NS__Block__Ack_template(other_value.pDU__NS__Block__Ack()); break; case PDU__NS::ALT_pDU__NS__Reset: single_value.field_pDU__NS__Reset = new PDU__NS__Reset_template(other_value.pDU__NS__Reset()); break; case PDU__NS::ALT_pDU__NS__Reset__Ack: single_value.field_pDU__NS__Reset__Ack = new PDU__NS__Reset__Ack_template(other_value.pDU__NS__Reset__Ack()); break; case PDU__NS::ALT_pDU__NS__Status: single_value.field_pDU__NS__Status = new PDU__NS__Status_template(other_value.pDU__NS__Status()); break; case PDU__NS::ALT_pDU__NS__Unblock: single_value.field_pDU__NS__Unblock = new PDU__NS__Unblock_template(other_value.pDU__NS__Unblock()); break; case PDU__NS::ALT_pDU__NS__Unblock__Ack: single_value.field_pDU__NS__Unblock__Ack = new PDU__NS__Unblock__Ack_template(other_value.pDU__NS__Unblock__Ack()); break; case PDU__NS::ALT_pDU__NS__Unitdata: single_value.field_pDU__NS__Unitdata = new PDU__NS__Unitdata_template(other_value.pDU__NS__Unitdata()); break; case PDU__NS::ALT_pDU__SNS__Ack: single_value.field_pDU__SNS__Ack = new PDU__SNS__Ack_template(other_value.pDU__SNS__Ack()); break; case PDU__NS::ALT_pDU__SNS__Add: single_value.field_pDU__SNS__Add = new PDU__SNS__Add_template(other_value.pDU__SNS__Add()); break; case PDU__NS::ALT_pDU__SNS__ChangeWeight: single_value.field_pDU__SNS__ChangeWeight = new PDU__SNS__ChangeWeight_template(other_value.pDU__SNS__ChangeWeight()); break; case PDU__NS::ALT_pDU__SNS__Config: single_value.field_pDU__SNS__Config = new PDU__SNS__Config_template(other_value.pDU__SNS__Config()); break; case PDU__NS::ALT_pDU__SNS__Config__Ack: single_value.field_pDU__SNS__Config__Ack = new PDU__SNS__Config__Ack_template(other_value.pDU__SNS__Config__Ack()); break; case PDU__NS::ALT_pDU__SNS__Delete: single_value.field_pDU__SNS__Delete = new PDU__SNS__Delete_template(other_value.pDU__SNS__Delete()); break; case PDU__NS::ALT_pDU__SNS__Size: single_value.field_pDU__SNS__Size = new PDU__SNS__Size_template(other_value.pDU__SNS__Size()); break; case PDU__NS::ALT_pDU__SNS__Size__Ack: single_value.field_pDU__SNS__Size__Ack = new PDU__SNS__Size__Ack_template(other_value.pDU__SNS__Size__Ack()); break; default: TTCN_error("Initializing a template with an unbound value of type @NS_Types.PDU_NS."); } set_selection(SPECIFIC_VALUE); } void PDU__NS_template::copy_template(const PDU__NS_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 PDU__NS::ALT_pDU__NS__Alive: single_value.field_pDU__NS__Alive = new PDU__NS__Alive_template(*other_value.single_value.field_pDU__NS__Alive); break; case PDU__NS::ALT_pDU__NS__Alive__Ack: single_value.field_pDU__NS__Alive__Ack = new PDU__NS__Alive__Ack_template(*other_value.single_value.field_pDU__NS__Alive__Ack); break; case PDU__NS::ALT_pDU__NS__Block: single_value.field_pDU__NS__Block = new PDU__NS__Block_template(*other_value.single_value.field_pDU__NS__Block); break; case PDU__NS::ALT_pDU__NS__Block__Ack: single_value.field_pDU__NS__Block__Ack = new PDU__NS__Block__Ack_template(*other_value.single_value.field_pDU__NS__Block__Ack); break; case PDU__NS::ALT_pDU__NS__Reset: single_value.field_pDU__NS__Reset = new PDU__NS__Reset_template(*other_value.single_value.field_pDU__NS__Reset); break; case PDU__NS::ALT_pDU__NS__Reset__Ack: single_value.field_pDU__NS__Reset__Ack = new PDU__NS__Reset__Ack_template(*other_value.single_value.field_pDU__NS__Reset__Ack); break; case PDU__NS::ALT_pDU__NS__Status: single_value.field_pDU__NS__Status = new PDU__NS__Status_template(*other_value.single_value.field_pDU__NS__Status); break; case PDU__NS::ALT_pDU__NS__Unblock: single_value.field_pDU__NS__Unblock = new PDU__NS__Unblock_template(*other_value.single_value.field_pDU__NS__Unblock); break; case PDU__NS::ALT_pDU__NS__Unblock__Ack: single_value.field_pDU__NS__Unblock__Ack = new PDU__NS__Unblock__Ack_template(*other_value.single_value.field_pDU__NS__Unblock__Ack); break; case PDU__NS::ALT_pDU__NS__Unitdata: single_value.field_pDU__NS__Unitdata = new PDU__NS__Unitdata_template(*other_value.single_value.field_pDU__NS__Unitdata); break; case PDU__NS::ALT_pDU__SNS__Ack: single_value.field_pDU__SNS__Ack = new PDU__SNS__Ack_template(*other_value.single_value.field_pDU__SNS__Ack); break; case PDU__NS::ALT_pDU__SNS__Add: single_value.field_pDU__SNS__Add = new PDU__SNS__Add_template(*other_value.single_value.field_pDU__SNS__Add); break; case PDU__NS::ALT_pDU__SNS__ChangeWeight: single_value.field_pDU__SNS__ChangeWeight = new PDU__SNS__ChangeWeight_template(*other_value.single_value.field_pDU__SNS__ChangeWeight); break; case PDU__NS::ALT_pDU__SNS__Config: single_value.field_pDU__SNS__Config = new PDU__SNS__Config_template(*other_value.single_value.field_pDU__SNS__Config); break; case PDU__NS::ALT_pDU__SNS__Config__Ack: single_value.field_pDU__SNS__Config__Ack = new PDU__SNS__Config__Ack_template(*other_value.single_value.field_pDU__SNS__Config__Ack); break; case PDU__NS::ALT_pDU__SNS__Delete: single_value.field_pDU__SNS__Delete = new PDU__SNS__Delete_template(*other_value.single_value.field_pDU__SNS__Delete); break; case PDU__NS::ALT_pDU__SNS__Size: single_value.field_pDU__SNS__Size = new PDU__SNS__Size_template(*other_value.single_value.field_pDU__SNS__Size); break; case PDU__NS::ALT_pDU__SNS__Size__Ack: single_value.field_pDU__SNS__Size__Ack = new PDU__SNS__Size__Ack_template(*other_value.single_value.field_pDU__SNS__Size__Ack); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @NS_Types.PDU_NS."); } 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 PDU__NS_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 PDU__NS_template(*other_value.implication_.precondition); implication_.implied_template = new PDU__NS_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 @NS_Types.PDU_NS."); } set_selection(other_value); } PDU__NS_template::PDU__NS_template() { } PDU__NS_template::PDU__NS_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PDU__NS_template::PDU__NS_template(const PDU__NS& other_value) { copy_value(other_value); } PDU__NS_template::PDU__NS_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @NS_Types.PDU_NS from an unbound optional field."); } } PDU__NS_template::PDU__NS_template(PDU__NS_template* p_precondition, PDU__NS_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PDU__NS_template::PDU__NS_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; } PDU__NS_template::PDU__NS_template(const PDU__NS_template& other_value) : Base_Template(){ copy_template(other_value); } PDU__NS_template::~PDU__NS_template() { clean_up(); } void PDU__NS_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case PDU__NS::ALT_pDU__NS__Alive: delete single_value.field_pDU__NS__Alive; break; case PDU__NS::ALT_pDU__NS__Alive__Ack: delete single_value.field_pDU__NS__Alive__Ack; break; case PDU__NS::ALT_pDU__NS__Block: delete single_value.field_pDU__NS__Block; break; case PDU__NS::ALT_pDU__NS__Block__Ack: delete single_value.field_pDU__NS__Block__Ack; break; case PDU__NS::ALT_pDU__NS__Reset: delete single_value.field_pDU__NS__Reset; break; case PDU__NS::ALT_pDU__NS__Reset__Ack: delete single_value.field_pDU__NS__Reset__Ack; break; case PDU__NS::ALT_pDU__NS__Status: delete single_value.field_pDU__NS__Status; break; case PDU__NS::ALT_pDU__NS__Unblock: delete single_value.field_pDU__NS__Unblock; break; case PDU__NS::ALT_pDU__NS__Unblock__Ack: delete single_value.field_pDU__NS__Unblock__Ack; break; case PDU__NS::ALT_pDU__NS__Unitdata: delete single_value.field_pDU__NS__Unitdata; break; case PDU__NS::ALT_pDU__SNS__Ack: delete single_value.field_pDU__SNS__Ack; break; case PDU__NS::ALT_pDU__SNS__Add: delete single_value.field_pDU__SNS__Add; break; case PDU__NS::ALT_pDU__SNS__ChangeWeight: delete single_value.field_pDU__SNS__ChangeWeight; break; case PDU__NS::ALT_pDU__SNS__Config: delete single_value.field_pDU__SNS__Config; break; case PDU__NS::ALT_pDU__SNS__Config__Ack: delete single_value.field_pDU__SNS__Config__Ack; break; case PDU__NS::ALT_pDU__SNS__Delete: delete single_value.field_pDU__SNS__Delete; break; case PDU__NS::ALT_pDU__SNS__Size: delete single_value.field_pDU__SNS__Size; break; case PDU__NS::ALT_pDU__SNS__Size__Ack: delete single_value.field_pDU__SNS__Size__Ack; 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; } PDU__NS_template& PDU__NS_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PDU__NS_template& PDU__NS_template::operator=(const PDU__NS& other_value) { clean_up(); copy_value(other_value); return *this; } PDU__NS_template& PDU__NS_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PDU__NS&)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 @NS_Types.PDU_NS."); } return *this; } PDU__NS_template& PDU__NS_template::operator=(const PDU__NS_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PDU__NS_template::match(const PDU__NS& 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: { PDU__NS::union_selection_type value_selection = other_value.get_selection(); if (value_selection == PDU__NS::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case PDU__NS::ALT_pDU__NS__Alive: return single_value.field_pDU__NS__Alive->match(other_value.pDU__NS__Alive(), legacy); case PDU__NS::ALT_pDU__NS__Alive__Ack: return single_value.field_pDU__NS__Alive__Ack->match(other_value.pDU__NS__Alive__Ack(), legacy); case PDU__NS::ALT_pDU__NS__Block: return single_value.field_pDU__NS__Block->match(other_value.pDU__NS__Block(), legacy); case PDU__NS::ALT_pDU__NS__Block__Ack: return single_value.field_pDU__NS__Block__Ack->match(other_value.pDU__NS__Block__Ack(), legacy); case PDU__NS::ALT_pDU__NS__Reset: return single_value.field_pDU__NS__Reset->match(other_value.pDU__NS__Reset(), legacy); case PDU__NS::ALT_pDU__NS__Reset__Ack: return single_value.field_pDU__NS__Reset__Ack->match(other_value.pDU__NS__Reset__Ack(), legacy); case PDU__NS::ALT_pDU__NS__Status: return single_value.field_pDU__NS__Status->match(other_value.pDU__NS__Status(), legacy); case PDU__NS::ALT_pDU__NS__Unblock: return single_value.field_pDU__NS__Unblock->match(other_value.pDU__NS__Unblock(), legacy); case PDU__NS::ALT_pDU__NS__Unblock__Ack: return single_value.field_pDU__NS__Unblock__Ack->match(other_value.pDU__NS__Unblock__Ack(), legacy); case PDU__NS::ALT_pDU__NS__Unitdata: return single_value.field_pDU__NS__Unitdata->match(other_value.pDU__NS__Unitdata(), legacy); case PDU__NS::ALT_pDU__SNS__Ack: return single_value.field_pDU__SNS__Ack->match(other_value.pDU__SNS__Ack(), legacy); case PDU__NS::ALT_pDU__SNS__Add: return single_value.field_pDU__SNS__Add->match(other_value.pDU__SNS__Add(), legacy); case PDU__NS::ALT_pDU__SNS__ChangeWeight: return single_value.field_pDU__SNS__ChangeWeight->match(other_value.pDU__SNS__ChangeWeight(), legacy); case PDU__NS::ALT_pDU__SNS__Config: return single_value.field_pDU__SNS__Config->match(other_value.pDU__SNS__Config(), legacy); case PDU__NS::ALT_pDU__SNS__Config__Ack: return single_value.field_pDU__SNS__Config__Ack->match(other_value.pDU__SNS__Config__Ack(), legacy); case PDU__NS::ALT_pDU__SNS__Delete: return single_value.field_pDU__SNS__Delete->match(other_value.pDU__SNS__Delete(), legacy); case PDU__NS::ALT_pDU__SNS__Size: return single_value.field_pDU__SNS__Size->match(other_value.pDU__SNS__Size(), legacy); case PDU__NS::ALT_pDU__SNS__Size__Ack: return single_value.field_pDU__SNS__Size__Ack->match(other_value.pDU__SNS__Size__Ack(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @NS_Types.PDU_NS."); } } 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 @NS_Types.PDU_NS."); } return FALSE; } boolean PDU__NS_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case PDU__NS::ALT_pDU__NS__Alive: return single_value.field_pDU__NS__Alive->is_value(); case PDU__NS::ALT_pDU__NS__Alive__Ack: return single_value.field_pDU__NS__Alive__Ack->is_value(); case PDU__NS::ALT_pDU__NS__Block: return single_value.field_pDU__NS__Block->is_value(); case PDU__NS::ALT_pDU__NS__Block__Ack: return single_value.field_pDU__NS__Block__Ack->is_value(); case PDU__NS::ALT_pDU__NS__Reset: return single_value.field_pDU__NS__Reset->is_value(); case PDU__NS::ALT_pDU__NS__Reset__Ack: return single_value.field_pDU__NS__Reset__Ack->is_value(); case PDU__NS::ALT_pDU__NS__Status: return single_value.field_pDU__NS__Status->is_value(); case PDU__NS::ALT_pDU__NS__Unblock: return single_value.field_pDU__NS__Unblock->is_value(); case PDU__NS::ALT_pDU__NS__Unblock__Ack: return single_value.field_pDU__NS__Unblock__Ack->is_value(); case PDU__NS::ALT_pDU__NS__Unitdata: return single_value.field_pDU__NS__Unitdata->is_value(); case PDU__NS::ALT_pDU__SNS__Ack: return single_value.field_pDU__SNS__Ack->is_value(); case PDU__NS::ALT_pDU__SNS__Add: return single_value.field_pDU__SNS__Add->is_value(); case PDU__NS::ALT_pDU__SNS__ChangeWeight: return single_value.field_pDU__SNS__ChangeWeight->is_value(); case PDU__NS::ALT_pDU__SNS__Config: return single_value.field_pDU__SNS__Config->is_value(); case PDU__NS::ALT_pDU__SNS__Config__Ack: return single_value.field_pDU__SNS__Config__Ack->is_value(); case PDU__NS::ALT_pDU__SNS__Delete: return single_value.field_pDU__SNS__Delete->is_value(); case PDU__NS::ALT_pDU__SNS__Size: return single_value.field_pDU__SNS__Size->is_value(); case PDU__NS::ALT_pDU__SNS__Size__Ack: return single_value.field_pDU__SNS__Size__Ack->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @NS_Types.PDU_NS."); } } PDU__NS PDU__NS_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 @NS_Types.PDU_NS."); PDU__NS ret_val; switch (single_value.union_selection) { case PDU__NS::ALT_pDU__NS__Alive: ret_val.pDU__NS__Alive() = single_value.field_pDU__NS__Alive->valueof(); break; case PDU__NS::ALT_pDU__NS__Alive__Ack: ret_val.pDU__NS__Alive__Ack() = single_value.field_pDU__NS__Alive__Ack->valueof(); break; case PDU__NS::ALT_pDU__NS__Block: ret_val.pDU__NS__Block() = single_value.field_pDU__NS__Block->valueof(); break; case PDU__NS::ALT_pDU__NS__Block__Ack: ret_val.pDU__NS__Block__Ack() = single_value.field_pDU__NS__Block__Ack->valueof(); break; case PDU__NS::ALT_pDU__NS__Reset: ret_val.pDU__NS__Reset() = single_value.field_pDU__NS__Reset->valueof(); break; case PDU__NS::ALT_pDU__NS__Reset__Ack: ret_val.pDU__NS__Reset__Ack() = single_value.field_pDU__NS__Reset__Ack->valueof(); break; case PDU__NS::ALT_pDU__NS__Status: ret_val.pDU__NS__Status() = single_value.field_pDU__NS__Status->valueof(); break; case PDU__NS::ALT_pDU__NS__Unblock: ret_val.pDU__NS__Unblock() = single_value.field_pDU__NS__Unblock->valueof(); break; case PDU__NS::ALT_pDU__NS__Unblock__Ack: ret_val.pDU__NS__Unblock__Ack() = single_value.field_pDU__NS__Unblock__Ack->valueof(); break; case PDU__NS::ALT_pDU__NS__Unitdata: ret_val.pDU__NS__Unitdata() = single_value.field_pDU__NS__Unitdata->valueof(); break; case PDU__NS::ALT_pDU__SNS__Ack: ret_val.pDU__SNS__Ack() = single_value.field_pDU__SNS__Ack->valueof(); break; case PDU__NS::ALT_pDU__SNS__Add: ret_val.pDU__SNS__Add() = single_value.field_pDU__SNS__Add->valueof(); break; case PDU__NS::ALT_pDU__SNS__ChangeWeight: ret_val.pDU__SNS__ChangeWeight() = single_value.field_pDU__SNS__ChangeWeight->valueof(); break; case PDU__NS::ALT_pDU__SNS__Config: ret_val.pDU__SNS__Config() = single_value.field_pDU__SNS__Config->valueof(); break; case PDU__NS::ALT_pDU__SNS__Config__Ack: ret_val.pDU__SNS__Config__Ack() = single_value.field_pDU__SNS__Config__Ack->valueof(); break; case PDU__NS::ALT_pDU__SNS__Delete: ret_val.pDU__SNS__Delete() = single_value.field_pDU__SNS__Delete->valueof(); break; case PDU__NS::ALT_pDU__SNS__Size: ret_val.pDU__SNS__Size() = single_value.field_pDU__SNS__Size->valueof(); break; case PDU__NS::ALT_pDU__SNS__Size__Ack: ret_val.pDU__SNS__Size__Ack() = single_value.field_pDU__SNS__Size__Ack->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @NS_Types.PDU_NS."); } return ret_val; } PDU__NS_template& PDU__NS_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 @NS_Types.PDU_NS."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @NS_Types.PDU_NS."); return value_list.list_value[list_index]; } void PDU__NS_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 @NS_Types.PDU_NS."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PDU__NS_template[list_length]; } PDU__NS__Alive_template& PDU__NS_template::pDU__NS__Alive() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Alive) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Alive = new PDU__NS__Alive_template(ANY_VALUE); else single_value.field_pDU__NS__Alive = new PDU__NS__Alive_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Alive; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Alive; } const PDU__NS__Alive_template& PDU__NS_template::pDU__NS__Alive() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Alive in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Alive) TTCN_error("Accessing non-selected field pDU_NS_Alive in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Alive; } PDU__NS__Alive__Ack_template& PDU__NS_template::pDU__NS__Alive__Ack() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Alive__Ack) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Alive__Ack = new PDU__NS__Alive__Ack_template(ANY_VALUE); else single_value.field_pDU__NS__Alive__Ack = new PDU__NS__Alive__Ack_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Alive__Ack; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Alive__Ack; } const PDU__NS__Alive__Ack_template& PDU__NS_template::pDU__NS__Alive__Ack() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Alive_Ack in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Alive__Ack) TTCN_error("Accessing non-selected field pDU_NS_Alive_Ack in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Alive__Ack; } PDU__NS__Block_template& PDU__NS_template::pDU__NS__Block() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Block) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Block = new PDU__NS__Block_template(ANY_VALUE); else single_value.field_pDU__NS__Block = new PDU__NS__Block_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Block; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Block; } const PDU__NS__Block_template& PDU__NS_template::pDU__NS__Block() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Block in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Block) TTCN_error("Accessing non-selected field pDU_NS_Block in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Block; } PDU__NS__Block__Ack_template& PDU__NS_template::pDU__NS__Block__Ack() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Block__Ack) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Block__Ack = new PDU__NS__Block__Ack_template(ANY_VALUE); else single_value.field_pDU__NS__Block__Ack = new PDU__NS__Block__Ack_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Block__Ack; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Block__Ack; } const PDU__NS__Block__Ack_template& PDU__NS_template::pDU__NS__Block__Ack() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Block_Ack in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Block__Ack) TTCN_error("Accessing non-selected field pDU_NS_Block_Ack in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Block__Ack; } PDU__NS__Reset_template& PDU__NS_template::pDU__NS__Reset() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Reset) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Reset = new PDU__NS__Reset_template(ANY_VALUE); else single_value.field_pDU__NS__Reset = new PDU__NS__Reset_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Reset; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Reset; } const PDU__NS__Reset_template& PDU__NS_template::pDU__NS__Reset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Reset in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Reset) TTCN_error("Accessing non-selected field pDU_NS_Reset in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Reset; } PDU__NS__Reset__Ack_template& PDU__NS_template::pDU__NS__Reset__Ack() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Reset__Ack) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Reset__Ack = new PDU__NS__Reset__Ack_template(ANY_VALUE); else single_value.field_pDU__NS__Reset__Ack = new PDU__NS__Reset__Ack_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Reset__Ack; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Reset__Ack; } const PDU__NS__Reset__Ack_template& PDU__NS_template::pDU__NS__Reset__Ack() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Reset_Ack in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Reset__Ack) TTCN_error("Accessing non-selected field pDU_NS_Reset_Ack in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Reset__Ack; } PDU__NS__Status_template& PDU__NS_template::pDU__NS__Status() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Status) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Status = new PDU__NS__Status_template(ANY_VALUE); else single_value.field_pDU__NS__Status = new PDU__NS__Status_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Status; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Status; } const PDU__NS__Status_template& PDU__NS_template::pDU__NS__Status() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Status in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Status) TTCN_error("Accessing non-selected field pDU_NS_Status in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Status; } PDU__NS__Unblock_template& PDU__NS_template::pDU__NS__Unblock() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Unblock) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Unblock = new PDU__NS__Unblock_template(ANY_VALUE); else single_value.field_pDU__NS__Unblock = new PDU__NS__Unblock_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Unblock; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Unblock; } const PDU__NS__Unblock_template& PDU__NS_template::pDU__NS__Unblock() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Unblock in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Unblock) TTCN_error("Accessing non-selected field pDU_NS_Unblock in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Unblock; } PDU__NS__Unblock__Ack_template& PDU__NS_template::pDU__NS__Unblock__Ack() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Unblock__Ack) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Unblock__Ack = new PDU__NS__Unblock__Ack_template(ANY_VALUE); else single_value.field_pDU__NS__Unblock__Ack = new PDU__NS__Unblock__Ack_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Unblock__Ack; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Unblock__Ack; } const PDU__NS__Unblock__Ack_template& PDU__NS_template::pDU__NS__Unblock__Ack() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Unblock_Ack in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Unblock__Ack) TTCN_error("Accessing non-selected field pDU_NS_Unblock_Ack in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Unblock__Ack; } PDU__NS__Unitdata_template& PDU__NS_template::pDU__NS__Unitdata() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__NS__Unitdata) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__NS__Unitdata = new PDU__NS__Unitdata_template(ANY_VALUE); else single_value.field_pDU__NS__Unitdata = new PDU__NS__Unitdata_template; single_value.union_selection = PDU__NS::ALT_pDU__NS__Unitdata; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__NS__Unitdata; } const PDU__NS__Unitdata_template& PDU__NS_template::pDU__NS__Unitdata() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_NS_Unitdata in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__NS__Unitdata) TTCN_error("Accessing non-selected field pDU_NS_Unitdata in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__NS__Unitdata; } PDU__SNS__Ack_template& PDU__NS_template::pDU__SNS__Ack() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__SNS__Ack) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__SNS__Ack = new PDU__SNS__Ack_template(ANY_VALUE); else single_value.field_pDU__SNS__Ack = new PDU__SNS__Ack_template; single_value.union_selection = PDU__NS::ALT_pDU__SNS__Ack; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__SNS__Ack; } const PDU__SNS__Ack_template& PDU__NS_template::pDU__SNS__Ack() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_SNS_Ack in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__SNS__Ack) TTCN_error("Accessing non-selected field pDU_SNS_Ack in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__SNS__Ack; } PDU__SNS__Add_template& PDU__NS_template::pDU__SNS__Add() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__SNS__Add) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__SNS__Add = new PDU__SNS__Add_template(ANY_VALUE); else single_value.field_pDU__SNS__Add = new PDU__SNS__Add_template; single_value.union_selection = PDU__NS::ALT_pDU__SNS__Add; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__SNS__Add; } const PDU__SNS__Add_template& PDU__NS_template::pDU__SNS__Add() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_SNS_Add in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__SNS__Add) TTCN_error("Accessing non-selected field pDU_SNS_Add in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__SNS__Add; } PDU__SNS__ChangeWeight_template& PDU__NS_template::pDU__SNS__ChangeWeight() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__SNS__ChangeWeight) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__SNS__ChangeWeight = new PDU__SNS__ChangeWeight_template(ANY_VALUE); else single_value.field_pDU__SNS__ChangeWeight = new PDU__SNS__ChangeWeight_template; single_value.union_selection = PDU__NS::ALT_pDU__SNS__ChangeWeight; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__SNS__ChangeWeight; } const PDU__SNS__ChangeWeight_template& PDU__NS_template::pDU__SNS__ChangeWeight() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_SNS_ChangeWeight in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__SNS__ChangeWeight) TTCN_error("Accessing non-selected field pDU_SNS_ChangeWeight in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__SNS__ChangeWeight; } PDU__SNS__Config_template& PDU__NS_template::pDU__SNS__Config() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__SNS__Config) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__SNS__Config = new PDU__SNS__Config_template(ANY_VALUE); else single_value.field_pDU__SNS__Config = new PDU__SNS__Config_template; single_value.union_selection = PDU__NS::ALT_pDU__SNS__Config; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__SNS__Config; } const PDU__SNS__Config_template& PDU__NS_template::pDU__SNS__Config() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_SNS_Config in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__SNS__Config) TTCN_error("Accessing non-selected field pDU_SNS_Config in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__SNS__Config; } PDU__SNS__Config__Ack_template& PDU__NS_template::pDU__SNS__Config__Ack() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__SNS__Config__Ack) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__SNS__Config__Ack = new PDU__SNS__Config__Ack_template(ANY_VALUE); else single_value.field_pDU__SNS__Config__Ack = new PDU__SNS__Config__Ack_template; single_value.union_selection = PDU__NS::ALT_pDU__SNS__Config__Ack; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__SNS__Config__Ack; } const PDU__SNS__Config__Ack_template& PDU__NS_template::pDU__SNS__Config__Ack() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_SNS_Config_Ack in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__SNS__Config__Ack) TTCN_error("Accessing non-selected field pDU_SNS_Config_Ack in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__SNS__Config__Ack; } PDU__SNS__Delete_template& PDU__NS_template::pDU__SNS__Delete() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__SNS__Delete) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__SNS__Delete = new PDU__SNS__Delete_template(ANY_VALUE); else single_value.field_pDU__SNS__Delete = new PDU__SNS__Delete_template; single_value.union_selection = PDU__NS::ALT_pDU__SNS__Delete; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__SNS__Delete; } const PDU__SNS__Delete_template& PDU__NS_template::pDU__SNS__Delete() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_SNS_Delete in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__SNS__Delete) TTCN_error("Accessing non-selected field pDU_SNS_Delete in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__SNS__Delete; } PDU__SNS__Size_template& PDU__NS_template::pDU__SNS__Size() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__SNS__Size) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__SNS__Size = new PDU__SNS__Size_template(ANY_VALUE); else single_value.field_pDU__SNS__Size = new PDU__SNS__Size_template; single_value.union_selection = PDU__NS::ALT_pDU__SNS__Size; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__SNS__Size; } const PDU__SNS__Size_template& PDU__NS_template::pDU__SNS__Size() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_SNS_Size in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__SNS__Size) TTCN_error("Accessing non-selected field pDU_SNS_Size in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__SNS__Size; } PDU__SNS__Size__Ack_template& PDU__NS_template::pDU__SNS__Size__Ack() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != PDU__NS::ALT_pDU__SNS__Size__Ack) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_pDU__SNS__Size__Ack = new PDU__SNS__Size__Ack_template(ANY_VALUE); else single_value.field_pDU__SNS__Size__Ack = new PDU__SNS__Size__Ack_template; single_value.union_selection = PDU__NS::ALT_pDU__SNS__Size__Ack; set_selection(SPECIFIC_VALUE); } return *single_value.field_pDU__SNS__Size__Ack; } const PDU__SNS__Size__Ack_template& PDU__NS_template::pDU__SNS__Size__Ack() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pDU_SNS_Size_Ack in a non-specific template of union type @NS_Types.PDU_NS."); if (single_value.union_selection != PDU__NS::ALT_pDU__SNS__Size__Ack) TTCN_error("Accessing non-selected field pDU_SNS_Size_Ack in a template of union type @NS_Types.PDU_NS."); return *single_value.field_pDU__SNS__Size__Ack; } boolean PDU__NS_template::ischosen(PDU__NS::union_selection_type checked_selection) const { if (checked_selection == PDU__NS::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @NS_Types.PDU_NS."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == PDU__NS::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @NS_Types.PDU_NS."); 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 @NS_Types.PDU_NS 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 PDU__NS_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case PDU__NS::ALT_pDU__NS__Alive: TTCN_Logger::log_event_str("{ pDU_NS_Alive := "); single_value.field_pDU__NS__Alive->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__NS__Alive__Ack: TTCN_Logger::log_event_str("{ pDU_NS_Alive_Ack := "); single_value.field_pDU__NS__Alive__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__NS__Block: TTCN_Logger::log_event_str("{ pDU_NS_Block := "); single_value.field_pDU__NS__Block->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__NS__Block__Ack: TTCN_Logger::log_event_str("{ pDU_NS_Block_Ack := "); single_value.field_pDU__NS__Block__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__NS__Reset: TTCN_Logger::log_event_str("{ pDU_NS_Reset := "); single_value.field_pDU__NS__Reset->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__NS__Reset__Ack: TTCN_Logger::log_event_str("{ pDU_NS_Reset_Ack := "); single_value.field_pDU__NS__Reset__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__NS__Status: TTCN_Logger::log_event_str("{ pDU_NS_Status := "); single_value.field_pDU__NS__Status->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__NS__Unblock: TTCN_Logger::log_event_str("{ pDU_NS_Unblock := "); single_value.field_pDU__NS__Unblock->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__NS__Unblock__Ack: TTCN_Logger::log_event_str("{ pDU_NS_Unblock_Ack := "); single_value.field_pDU__NS__Unblock__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__NS__Unitdata: TTCN_Logger::log_event_str("{ pDU_NS_Unitdata := "); single_value.field_pDU__NS__Unitdata->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__SNS__Ack: TTCN_Logger::log_event_str("{ pDU_SNS_Ack := "); single_value.field_pDU__SNS__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__SNS__Add: TTCN_Logger::log_event_str("{ pDU_SNS_Add := "); single_value.field_pDU__SNS__Add->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__SNS__ChangeWeight: TTCN_Logger::log_event_str("{ pDU_SNS_ChangeWeight := "); single_value.field_pDU__SNS__ChangeWeight->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__SNS__Config: TTCN_Logger::log_event_str("{ pDU_SNS_Config := "); single_value.field_pDU__SNS__Config->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__SNS__Config__Ack: TTCN_Logger::log_event_str("{ pDU_SNS_Config_Ack := "); single_value.field_pDU__SNS__Config__Ack->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__SNS__Delete: TTCN_Logger::log_event_str("{ pDU_SNS_Delete := "); single_value.field_pDU__SNS__Delete->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__SNS__Size: TTCN_Logger::log_event_str("{ pDU_SNS_Size := "); single_value.field_pDU__SNS__Size->log(); TTCN_Logger::log_event_str(" }"); break; case PDU__NS::ALT_pDU__SNS__Size__Ack: TTCN_Logger::log_event_str("{ pDU_SNS_Size_Ack := "); single_value.field_pDU__SNS__Size__Ack->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 PDU__NS_template::log_match(const PDU__NS& 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 PDU__NS::ALT_pDU__NS__Alive: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Alive"); single_value.field_pDU__NS__Alive->log_match(match_value.pDU__NS__Alive(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Alive := "); single_value.field_pDU__NS__Alive->log_match(match_value.pDU__NS__Alive(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__NS__Alive__Ack: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Alive_Ack"); single_value.field_pDU__NS__Alive__Ack->log_match(match_value.pDU__NS__Alive__Ack(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Alive_Ack := "); single_value.field_pDU__NS__Alive__Ack->log_match(match_value.pDU__NS__Alive__Ack(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__NS__Block: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Block"); single_value.field_pDU__NS__Block->log_match(match_value.pDU__NS__Block(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Block := "); single_value.field_pDU__NS__Block->log_match(match_value.pDU__NS__Block(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__NS__Block__Ack: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Block_Ack"); single_value.field_pDU__NS__Block__Ack->log_match(match_value.pDU__NS__Block__Ack(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Block_Ack := "); single_value.field_pDU__NS__Block__Ack->log_match(match_value.pDU__NS__Block__Ack(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__NS__Reset: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Reset"); single_value.field_pDU__NS__Reset->log_match(match_value.pDU__NS__Reset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Reset := "); single_value.field_pDU__NS__Reset->log_match(match_value.pDU__NS__Reset(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__NS__Reset__Ack: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Reset_Ack"); single_value.field_pDU__NS__Reset__Ack->log_match(match_value.pDU__NS__Reset__Ack(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Reset_Ack := "); single_value.field_pDU__NS__Reset__Ack->log_match(match_value.pDU__NS__Reset__Ack(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__NS__Status: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Status"); single_value.field_pDU__NS__Status->log_match(match_value.pDU__NS__Status(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Status := "); single_value.field_pDU__NS__Status->log_match(match_value.pDU__NS__Status(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__NS__Unblock: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Unblock"); single_value.field_pDU__NS__Unblock->log_match(match_value.pDU__NS__Unblock(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Unblock := "); single_value.field_pDU__NS__Unblock->log_match(match_value.pDU__NS__Unblock(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__NS__Unblock__Ack: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Unblock_Ack"); single_value.field_pDU__NS__Unblock__Ack->log_match(match_value.pDU__NS__Unblock__Ack(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Unblock_Ack := "); single_value.field_pDU__NS__Unblock__Ack->log_match(match_value.pDU__NS__Unblock__Ack(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__NS__Unitdata: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_NS_Unitdata"); single_value.field_pDU__NS__Unitdata->log_match(match_value.pDU__NS__Unitdata(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_NS_Unitdata := "); single_value.field_pDU__NS__Unitdata->log_match(match_value.pDU__NS__Unitdata(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__SNS__Ack: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_SNS_Ack"); single_value.field_pDU__SNS__Ack->log_match(match_value.pDU__SNS__Ack(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_SNS_Ack := "); single_value.field_pDU__SNS__Ack->log_match(match_value.pDU__SNS__Ack(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__SNS__Add: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_SNS_Add"); single_value.field_pDU__SNS__Add->log_match(match_value.pDU__SNS__Add(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_SNS_Add := "); single_value.field_pDU__SNS__Add->log_match(match_value.pDU__SNS__Add(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__SNS__ChangeWeight: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_SNS_ChangeWeight"); single_value.field_pDU__SNS__ChangeWeight->log_match(match_value.pDU__SNS__ChangeWeight(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_SNS_ChangeWeight := "); single_value.field_pDU__SNS__ChangeWeight->log_match(match_value.pDU__SNS__ChangeWeight(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__SNS__Config: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_SNS_Config"); single_value.field_pDU__SNS__Config->log_match(match_value.pDU__SNS__Config(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_SNS_Config := "); single_value.field_pDU__SNS__Config->log_match(match_value.pDU__SNS__Config(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__SNS__Config__Ack: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_SNS_Config_Ack"); single_value.field_pDU__SNS__Config__Ack->log_match(match_value.pDU__SNS__Config__Ack(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_SNS_Config_Ack := "); single_value.field_pDU__SNS__Config__Ack->log_match(match_value.pDU__SNS__Config__Ack(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__SNS__Delete: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_SNS_Delete"); single_value.field_pDU__SNS__Delete->log_match(match_value.pDU__SNS__Delete(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_SNS_Delete := "); single_value.field_pDU__SNS__Delete->log_match(match_value.pDU__SNS__Delete(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__SNS__Size: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_SNS_Size"); single_value.field_pDU__SNS__Size->log_match(match_value.pDU__SNS__Size(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_SNS_Size := "); single_value.field_pDU__SNS__Size->log_match(match_value.pDU__SNS__Size(), legacy); TTCN_Logger::log_event_str(" }"); } break; case PDU__NS::ALT_pDU__SNS__Size__Ack: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".pDU_SNS_Size_Ack"); single_value.field_pDU__SNS__Size__Ack->log_match(match_value.pDU__SNS__Size__Ack(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ pDU_SNS_Size_Ack := "); single_value.field_pDU__SNS__Size__Ack->log_match(match_value.pDU__SNS__Size__Ack(), 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 PDU__NS_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 PDU__NS::ALT_pDU__NS__Alive: single_value.field_pDU__NS__Alive->encode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Alive__Ack: single_value.field_pDU__NS__Alive__Ack->encode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Block: single_value.field_pDU__NS__Block->encode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Block__Ack: single_value.field_pDU__NS__Block__Ack->encode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Reset: single_value.field_pDU__NS__Reset->encode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Reset__Ack: single_value.field_pDU__NS__Reset__Ack->encode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Status: single_value.field_pDU__NS__Status->encode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Unblock: single_value.field_pDU__NS__Unblock->encode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Unblock__Ack: single_value.field_pDU__NS__Unblock__Ack->encode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Unitdata: single_value.field_pDU__NS__Unitdata->encode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Ack: single_value.field_pDU__SNS__Ack->encode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Add: single_value.field_pDU__SNS__Add->encode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__ChangeWeight: single_value.field_pDU__SNS__ChangeWeight->encode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Config: single_value.field_pDU__SNS__Config->encode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Config__Ack: single_value.field_pDU__SNS__Config__Ack->encode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Delete: single_value.field_pDU__SNS__Delete->encode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Size: single_value.field_pDU__SNS__Size->encode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Size__Ack: single_value.field_pDU__SNS__Size__Ack->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @NS_Types.PDU_NS."); } 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 @NS_Types.PDU_NS."); } } void PDU__NS_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = PDU__NS::UNBOUND_VALUE; PDU__NS::union_selection_type new_selection = (PDU__NS::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case PDU__NS::ALT_pDU__NS__Alive: single_value.field_pDU__NS__Alive = new PDU__NS__Alive_template; single_value.field_pDU__NS__Alive->decode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Alive__Ack: single_value.field_pDU__NS__Alive__Ack = new PDU__NS__Alive__Ack_template; single_value.field_pDU__NS__Alive__Ack->decode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Block: single_value.field_pDU__NS__Block = new PDU__NS__Block_template; single_value.field_pDU__NS__Block->decode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Block__Ack: single_value.field_pDU__NS__Block__Ack = new PDU__NS__Block__Ack_template; single_value.field_pDU__NS__Block__Ack->decode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Reset: single_value.field_pDU__NS__Reset = new PDU__NS__Reset_template; single_value.field_pDU__NS__Reset->decode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Reset__Ack: single_value.field_pDU__NS__Reset__Ack = new PDU__NS__Reset__Ack_template; single_value.field_pDU__NS__Reset__Ack->decode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Status: single_value.field_pDU__NS__Status = new PDU__NS__Status_template; single_value.field_pDU__NS__Status->decode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Unblock: single_value.field_pDU__NS__Unblock = new PDU__NS__Unblock_template; single_value.field_pDU__NS__Unblock->decode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Unblock__Ack: single_value.field_pDU__NS__Unblock__Ack = new PDU__NS__Unblock__Ack_template; single_value.field_pDU__NS__Unblock__Ack->decode_text(text_buf); break; case PDU__NS::ALT_pDU__NS__Unitdata: single_value.field_pDU__NS__Unitdata = new PDU__NS__Unitdata_template; single_value.field_pDU__NS__Unitdata->decode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Ack: single_value.field_pDU__SNS__Ack = new PDU__SNS__Ack_template; single_value.field_pDU__SNS__Ack->decode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Add: single_value.field_pDU__SNS__Add = new PDU__SNS__Add_template; single_value.field_pDU__SNS__Add->decode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__ChangeWeight: single_value.field_pDU__SNS__ChangeWeight = new PDU__SNS__ChangeWeight_template; single_value.field_pDU__SNS__ChangeWeight->decode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Config: single_value.field_pDU__SNS__Config = new PDU__SNS__Config_template; single_value.field_pDU__SNS__Config->decode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Config__Ack: single_value.field_pDU__SNS__Config__Ack = new PDU__SNS__Config__Ack_template; single_value.field_pDU__SNS__Config__Ack->decode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Delete: single_value.field_pDU__SNS__Delete = new PDU__SNS__Delete_template; single_value.field_pDU__SNS__Delete->decode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Size: single_value.field_pDU__SNS__Size = new PDU__SNS__Size_template; single_value.field_pDU__SNS__Size->decode_text(text_buf); break; case PDU__NS::ALT_pDU__SNS__Size__Ack: single_value.field_pDU__SNS__Size__Ack = new PDU__SNS__Size__Ack_template; single_value.field_pDU__SNS__Size__Ack->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @NS_Types.PDU_NS."); } 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 PDU__NS_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 @NS_Types.PDU_NS."); } } boolean PDU__NS_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PDU__NS_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 `@NS_Types.PDU_NS'"); } if (strcmp("pDU_NS_Alive", param_field) == 0) { pDU__NS__Alive().set_param(param); return; } else if (strcmp("pDU_NS_Alive_Ack", param_field) == 0) { pDU__NS__Alive__Ack().set_param(param); return; } else if (strcmp("pDU_NS_Block", param_field) == 0) { pDU__NS__Block().set_param(param); return; } else if (strcmp("pDU_NS_Block_Ack", param_field) == 0) { pDU__NS__Block__Ack().set_param(param); return; } else if (strcmp("pDU_NS_Reset", param_field) == 0) { pDU__NS__Reset().set_param(param); return; } else if (strcmp("pDU_NS_Reset_Ack", param_field) == 0) { pDU__NS__Reset__Ack().set_param(param); return; } else if (strcmp("pDU_NS_Status", param_field) == 0) { pDU__NS__Status().set_param(param); return; } else if (strcmp("pDU_NS_Unblock", param_field) == 0) { pDU__NS__Unblock().set_param(param); return; } else if (strcmp("pDU_NS_Unblock_Ack", param_field) == 0) { pDU__NS__Unblock__Ack().set_param(param); return; } else if (strcmp("pDU_NS_Unitdata", param_field) == 0) { pDU__NS__Unitdata().set_param(param); return; } else if (strcmp("pDU_SNS_Ack", param_field) == 0) { pDU__SNS__Ack().set_param(param); return; } else if (strcmp("pDU_SNS_Add", param_field) == 0) { pDU__SNS__Add().set_param(param); return; } else if (strcmp("pDU_SNS_ChangeWeight", param_field) == 0) { pDU__SNS__ChangeWeight().set_param(param); return; } else if (strcmp("pDU_SNS_Config", param_field) == 0) { pDU__SNS__Config().set_param(param); return; } else if (strcmp("pDU_SNS_Config_Ack", param_field) == 0) { pDU__SNS__Config__Ack().set_param(param); return; } else if (strcmp("pDU_SNS_Delete", param_field) == 0) { pDU__SNS__Delete().set_param(param); return; } else if (strcmp("pDU_SNS_Size", param_field) == 0) { pDU__SNS__Size().set_param(param); return; } else if (strcmp("pDU_SNS_Size_Ack", param_field) == 0) { pDU__SNS__Size__Ack().set_param(param); return; } else param.error("Field `%s' not found in union template type `@NS_Types.PDU_NS'", 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: { PDU__NS_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", "@NS_Types.PDU_NS"); 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, "pDU_NS_Alive")) { pDU__NS__Alive().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_NS_Alive_Ack")) { pDU__NS__Alive__Ack().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_NS_Block")) { pDU__NS__Block().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_NS_Block_Ack")) { pDU__NS__Block__Ack().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_NS_Reset")) { pDU__NS__Reset().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_NS_Reset_Ack")) { pDU__NS__Reset__Ack().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_NS_Status")) { pDU__NS__Status().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_NS_Unblock")) { pDU__NS__Unblock().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_NS_Unblock_Ack")) { pDU__NS__Unblock__Ack().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_NS_Unitdata")) { pDU__NS__Unitdata().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_SNS_Ack")) { pDU__SNS__Ack().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_SNS_Add")) { pDU__SNS__Add().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_SNS_ChangeWeight")) { pDU__SNS__ChangeWeight().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_SNS_Config")) { pDU__SNS__Config().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_SNS_Config_Ack")) { pDU__SNS__Config__Ack().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_SNS_Delete")) { pDU__SNS__Delete().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_SNS_Size")) { pDU__SNS__Size().set_param(*mp_last); break; } if (!strcmp(last_name, "pDU_SNS_Size_Ack")) { pDU__SNS__Size__Ack().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @NS_Types.PDU_NS.", last_name); } break; case Module_Param::MP_Implication_Template: { PDU__NS_template* precondition = new PDU__NS_template; precondition->set_param(*m_p->get_elem(0)); PDU__NS_template* implied_template = new PDU__NS_template; implied_template->set_param(*m_p->get_elem(1)); *this = PDU__NS_template(precondition, implied_template); } break; default: param.type_error("union template", "@NS_Types.PDU_NS"); } is_ifpresent = param.get_ifpresent(); } void PDU__NS_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 PDU__NS::ALT_pDU__NS__Alive: single_value.field_pDU__NS__Alive->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__NS__Alive__Ack: single_value.field_pDU__NS__Alive__Ack->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__NS__Block: single_value.field_pDU__NS__Block->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__NS__Block__Ack: single_value.field_pDU__NS__Block__Ack->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__NS__Reset: single_value.field_pDU__NS__Reset->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__NS__Reset__Ack: single_value.field_pDU__NS__Reset__Ack->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__NS__Status: single_value.field_pDU__NS__Status->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__NS__Unblock: single_value.field_pDU__NS__Unblock->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__NS__Unblock__Ack: single_value.field_pDU__NS__Unblock__Ack->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__NS__Unitdata: single_value.field_pDU__NS__Unitdata->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__SNS__Ack: single_value.field_pDU__SNS__Ack->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__SNS__Add: single_value.field_pDU__SNS__Add->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__SNS__ChangeWeight: single_value.field_pDU__SNS__ChangeWeight->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__SNS__Config: single_value.field_pDU__SNS__Config->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__SNS__Config__Ack: single_value.field_pDU__SNS__Config__Ack->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__SNS__Delete: single_value.field_pDU__SNS__Delete->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__SNS__Size: single_value.field_pDU__SNS__Size->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; case PDU__NS::ALT_pDU__SNS__Size__Ack: single_value.field_pDU__SNS__Size__Ack->check_restriction(t_res, t_name ? t_name : "@NS_Types.PDU_NS"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @NS_Types.PDU_NS."); } 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 : "@NS_Types.PDU_NS"); } /* Bodies of functions, altsteps and testcases */ OCTETSTRING enc__PDU__NS(const PDU__NS& pdu) { if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); TTCN_Logger::log_event_str("enc_PDU_NS(): Encoding @NS_Types.PDU_NS: "); pdu.log(); TTCN_Logger::end_event(); } TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); TTCN_Buffer ttcn_buffer; pdu.encode(PDU__NS_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_PDU_NS(): Stream after encoding: "); ret_val.log(); TTCN_Logger::end_event(); } return ret_val; } PDU__NS dec__PDU__NS(const OCTETSTRING& stream) { if (TTCN_Logger::log_this_event(TTCN_Logger::DEBUG_ENCDEC)) { TTCN_Logger::begin_event(TTCN_Logger::DEBUG_ENCDEC); TTCN_Logger::log_event_str("dec_PDU_NS(): Stream before decoding: "); stream.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(stream); PDU__NS ret_val; ret_val.decode(PDU__NS_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_PDU_NS(): Decoded @NS_Types.PDU_NS: "); 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_PDU_NS(): Data remained at the end of the stream after successful decoding: %s", (const char*) remaining_stream); } } return ret_val; } void CauseNS_ext_encoder(const BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(CauseNS_ext_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER CauseNS_ext_decoder(OCTETSTRING& input_stream, BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(CauseNS_ext_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 LIN1__2_length1_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(LIN1__2_length1_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER LIN1__2_length1_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(LIN1__2_length1_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 LIN1__2_length2_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(LIN1__2_length2_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER LIN1__2_length2_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(LIN1__2_length2_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 LIN1__2_encoder(const LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(LIN1__2_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER LIN1__2_decoder(OCTETSTRING& input_stream, LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(LIN1__2_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 CauseNS_lengthIndicator_encoder(const LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(CauseNS_lengthIndicator_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER CauseNS_lengthIndicator_decoder(OCTETSTRING& input_stream, LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(CauseNS_lengthIndicator_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 CauseNS_encoder(const CauseNS& 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 `@NS_Types.CauseNS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(CauseNS_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER CauseNS_decoder(OCTETSTRING& input_stream, CauseNS& 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 `@NS_Types.CauseNS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(CauseNS_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 NS__VCI_ext_encoder(const BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NS__VCI_ext_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NS__VCI_ext_decoder(OCTETSTRING& input_stream, BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NS__VCI_ext_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 NS__VCI_lengthIndicator_encoder(const LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NS__VCI_lengthIndicator_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NS__VCI_lengthIndicator_decoder(OCTETSTRING& input_stream, LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NS__VCI_lengthIndicator_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 NS__VCI_encoder(const NS__VCI& 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 `@NS_Types.NS_VCI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NS__VCI_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NS__VCI_decoder(OCTETSTRING& input_stream, NS__VCI& 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 `@NS_Types.NS_VCI' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NS__VCI_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 NS__PDU_ext_encoder(const BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NS__PDU_ext_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NS__PDU_ext_decoder(OCTETSTRING& input_stream, BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NS__PDU_ext_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 NS__PDU_lengthIndicator_encoder(const LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NS__PDU_lengthIndicator_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NS__PDU_lengthIndicator_decoder(OCTETSTRING& input_stream, LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NS__PDU_lengthIndicator_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 NS__PDU_ns__PDU_encoder(const OCTETSTRING& 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 `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(OCTETSTRING_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NS__PDU_ns__PDU_decoder(OCTETSTRING& input_stream, OCTETSTRING& 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 `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(OCTETSTRING_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 NS__PDU_encoder(const NS__PDU& 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 `@NS_Types.NS_PDU' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NS__PDU_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NS__PDU_decoder(OCTETSTRING& input_stream, NS__PDU& 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 `@NS_Types.NS_PDU' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NS__PDU_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 BVCI__NS_ext_encoder(const BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(BVCI__NS_ext_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER BVCI__NS_ext_decoder(OCTETSTRING& input_stream, BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(BVCI__NS_ext_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 BVCI__NS_lengthIndicator_encoder(const LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(BVCI__NS_lengthIndicator_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER BVCI__NS_lengthIndicator_decoder(OCTETSTRING& input_stream, LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(BVCI__NS_lengthIndicator_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 BVCI__NS_encoder(const BVCI__NS& 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 `@NS_Types.BVCI_NS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(BVCI__NS_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER BVCI__NS_decoder(OCTETSTRING& input_stream, BVCI__NS& 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 `@NS_Types.BVCI_NS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(BVCI__NS_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 ListofIP4Elements_ext_encoder(const BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(ListofIP4Elements_ext_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER ListofIP4Elements_ext_decoder(OCTETSTRING& input_stream, BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(ListofIP4Elements_ext_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 ListofIP4Elements_lengthIndicator_encoder(const LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(ListofIP4Elements_lengthIndicator_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER ListofIP4Elements_lengthIndicator_decoder(OCTETSTRING& input_stream, LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(ListofIP4Elements_lengthIndicator_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; } } boolean operator==(null_type, const IP4__Elements& other_value) { if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @NS_Types.IP4_Elements."); return other_value.val_ptr->n_elements == 0; } void IP4__Element_encoder(const IP4__Element& 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 `@NS_Types.IP4_Element' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(IP4__Element_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER IP4__Element_decoder(OCTETSTRING& input_stream, IP4__Element& 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 `@NS_Types.IP4_Element' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(IP4__Element_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 IP4__Elements_encoder(const IP4__Elements& 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 `@NS_Types.IP4_Elements' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(IP4__Elements_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER IP4__Elements_decoder(OCTETSTRING& input_stream, IP4__Elements& 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 `@NS_Types.IP4_Elements' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(IP4__Elements_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 ListofIP4Elements_encoder(const ListofIP4Elements& 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 `@NS_Types.ListofIP4Elements' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(ListofIP4Elements_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER ListofIP4Elements_decoder(OCTETSTRING& input_stream, ListofIP4Elements& 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 `@NS_Types.ListofIP4Elements' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(ListofIP4Elements_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 ListofIP6Elements_ext_encoder(const BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(ListofIP6Elements_ext_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER ListofIP6Elements_ext_decoder(OCTETSTRING& input_stream, BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(ListofIP6Elements_ext_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 ListofIP6Elements_lengthIndicator_encoder(const LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(ListofIP6Elements_lengthIndicator_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER ListofIP6Elements_lengthIndicator_decoder(OCTETSTRING& input_stream, LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(ListofIP6Elements_lengthIndicator_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; } } boolean operator==(null_type, const IP6__Elements& other_value) { if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @NS_Types.IP6_Elements."); return other_value.val_ptr->n_elements == 0; } void IP6__Element_encoder(const IP6__Element& 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 `@NS_Types.IP6_Element' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(IP6__Element_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER IP6__Element_decoder(OCTETSTRING& input_stream, IP6__Element& 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 `@NS_Types.IP6_Element' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(IP6__Element_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 IP6__Elements_encoder(const IP6__Elements& 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 `@NS_Types.IP6_Elements' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(IP6__Elements_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER IP6__Elements_decoder(OCTETSTRING& input_stream, IP6__Elements& 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 `@NS_Types.IP6_Elements' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(IP6__Elements_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 ListofIP6Elements_encoder(const ListofIP6Elements& 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 `@NS_Types.ListofIP6Elements' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(ListofIP6Elements_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER ListofIP6Elements_decoder(OCTETSTRING& input_stream, ListofIP6Elements& 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 `@NS_Types.ListofIP6Elements' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(ListofIP6Elements_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 IPAddress_encoder(const IPAddress& 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 `@NS_Types.IPAddress' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(IPAddress_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER IPAddress_decoder(OCTETSTRING& input_stream, IPAddress& 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 `@NS_Types.IPAddress' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(IPAddress_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 IP__Address__NS_ipAddress_encoder(const IPAddress& 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 `@NS_Types.IPAddress' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(IP__Address__NS_ipAddress_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER IP__Address__NS_ipAddress_decoder(OCTETSTRING& input_stream, IPAddress& 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 `@NS_Types.IPAddress' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(IP__Address__NS_ipAddress_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 IP__Address__NS_encoder(const IP__Address__NS& 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 `@NS_Types.IP_Address_NS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(IP__Address__NS_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER IP__Address__NS_decoder(OCTETSTRING& input_stream, IP__Address__NS& 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 `@NS_Types.IP_Address_NS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(IP__Address__NS_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 EndFlag_encoder(const EndFlag& 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 `@NS_Types.EndFlag' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(EndFlag_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER EndFlag_decoder(OCTETSTRING& input_stream, EndFlag& 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 `@NS_Types.EndFlag' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(EndFlag_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 ResetFlag_encoder(const ResetFlag& 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 `@NS_Types.ResetFlag' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(ResetFlag_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER ResetFlag_decoder(OCTETSTRING& input_stream, ResetFlag& 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 `@NS_Types.ResetFlag' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(ResetFlag_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 MaxNumberOfNSVCs_encoder(const MaxNumberOfNSVCs& 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 `@NS_Types.MaxNumberOfNSVCs' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(MaxNumberOfNSVCs_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER MaxNumberOfNSVCs_decoder(OCTETSTRING& input_stream, MaxNumberOfNSVCs& 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 `@NS_Types.MaxNumberOfNSVCs' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(MaxNumberOfNSVCs_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 NumberOfIP__Endpoints_encoder(const NumberOfIP__Endpoints& 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 `@NS_Types.NumberOfIP_Endpoints' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NumberOfIP__Endpoints_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NumberOfIP__Endpoints_decoder(OCTETSTRING& input_stream, NumberOfIP__Endpoints& 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 `@NS_Types.NumberOfIP_Endpoints' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NumberOfIP__Endpoints_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 NSEI__NS_ext_encoder(const BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NSEI__NS_ext_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NSEI__NS_ext_decoder(OCTETSTRING& input_stream, BITSTRING& 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 `bitstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NSEI__NS_ext_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 NSEI__NS_lengthIndicator_encoder(const LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NSEI__NS_lengthIndicator_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NSEI__NS_lengthIndicator_decoder(OCTETSTRING& input_stream, LIN1__2& 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 `@NS_Types.LIN1_2' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NSEI__NS_lengthIndicator_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 NSEI__NS_encoder(const NSEI__NS& 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 `@NS_Types.NSEI_NS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NSEI__NS_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NSEI__NS_decoder(OCTETSTRING& input_stream, NSEI__NS& 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 `@NS_Types.NSEI_NS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NSEI__NS_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 NS__SDU__ControlBits_encoder(const NS__SDU__ControlBits& 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 `@NS_Types.NS_SDU_ControlBits' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(NS__SDU__ControlBits_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER NS__SDU__ControlBits_decoder(OCTETSTRING& input_stream, NS__SDU__ControlBits& 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 `@NS_Types.NS_SDU_ControlBits' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(NS__SDU__ControlBits_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 PDU__NS__Alive_encoder(const PDU__NS__Alive& 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 `@NS_Types.PDU_NS_Alive' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Alive_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Alive_decoder(OCTETSTRING& input_stream, PDU__NS__Alive& 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 `@NS_Types.PDU_NS_Alive' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Alive_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 PDU__NS__Alive__Ack_encoder(const PDU__NS__Alive__Ack& 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 `@NS_Types.PDU_NS_Alive_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Alive__Ack_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Alive__Ack_decoder(OCTETSTRING& input_stream, PDU__NS__Alive__Ack& 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 `@NS_Types.PDU_NS_Alive_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Alive__Ack_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 PDU__NS__Block_encoder(const PDU__NS__Block& 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 `@NS_Types.PDU_NS_Block' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Block_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Block_decoder(OCTETSTRING& input_stream, PDU__NS__Block& 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 `@NS_Types.PDU_NS_Block' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Block_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 PDU__NS__Block__Ack_encoder(const PDU__NS__Block__Ack& 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 `@NS_Types.PDU_NS_Block_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Block__Ack_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Block__Ack_decoder(OCTETSTRING& input_stream, PDU__NS__Block__Ack& 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 `@NS_Types.PDU_NS_Block_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Block__Ack_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 PDU__NS__Reset_encoder(const PDU__NS__Reset& 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 `@NS_Types.PDU_NS_Reset' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Reset_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Reset_decoder(OCTETSTRING& input_stream, PDU__NS__Reset& 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 `@NS_Types.PDU_NS_Reset' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Reset_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 PDU__NS__Reset__Ack_encoder(const PDU__NS__Reset__Ack& 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 `@NS_Types.PDU_NS_Reset_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Reset__Ack_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Reset__Ack_decoder(OCTETSTRING& input_stream, PDU__NS__Reset__Ack& 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 `@NS_Types.PDU_NS_Reset_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Reset__Ack_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 PDU__NS__Status_encoder(const PDU__NS__Status& 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 `@NS_Types.PDU_NS_Status' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Status_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Status_decoder(OCTETSTRING& input_stream, PDU__NS__Status& 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 `@NS_Types.PDU_NS_Status' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Status_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 PDU__NS__Unblock_encoder(const PDU__NS__Unblock& 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 `@NS_Types.PDU_NS_Unblock' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Unblock_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Unblock_decoder(OCTETSTRING& input_stream, PDU__NS__Unblock& 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 `@NS_Types.PDU_NS_Unblock' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Unblock_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 PDU__NS__Unblock__Ack_encoder(const PDU__NS__Unblock__Ack& 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 `@NS_Types.PDU_NS_Unblock_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Unblock__Ack_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Unblock__Ack_decoder(OCTETSTRING& input_stream, PDU__NS__Unblock__Ack& 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 `@NS_Types.PDU_NS_Unblock_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Unblock__Ack_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 PDU__NS__Unitdata_nS__SDU_encoder(const OCTETSTRING& 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 `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(OCTETSTRING_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Unitdata_nS__SDU_decoder(OCTETSTRING& input_stream, OCTETSTRING& 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 `octetstring' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(OCTETSTRING_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 PDU__NS__Unitdata_encoder(const PDU__NS__Unitdata& 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 `@NS_Types.PDU_NS_Unitdata' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS__Unitdata_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS__Unitdata_decoder(OCTETSTRING& input_stream, PDU__NS__Unitdata& 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 `@NS_Types.PDU_NS_Unitdata' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS__Unitdata_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 PDU__SNS__Ack_transactionID_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(PDU__SNS__Ack_transactionID_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Ack_transactionID_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(PDU__SNS__Ack_transactionID_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 PDU__SNS__Ack_encoder(const PDU__SNS__Ack& 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 `@NS_Types.PDU_SNS_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__SNS__Ack_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Ack_decoder(OCTETSTRING& input_stream, PDU__SNS__Ack& 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 `@NS_Types.PDU_SNS_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__SNS__Ack_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 PDU__SNS__Add_transactionID_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(PDU__SNS__Add_transactionID_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Add_transactionID_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(PDU__SNS__Add_transactionID_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 PDU__SNS__Add_encoder(const PDU__SNS__Add& 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 `@NS_Types.PDU_SNS_Add' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__SNS__Add_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Add_decoder(OCTETSTRING& input_stream, PDU__SNS__Add& 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 `@NS_Types.PDU_SNS_Add' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__SNS__Add_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 PDU__SNS__ChangeWeight_transactionID_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(PDU__SNS__ChangeWeight_transactionID_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__ChangeWeight_transactionID_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(PDU__SNS__ChangeWeight_transactionID_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 PDU__SNS__ChangeWeight_encoder(const PDU__SNS__ChangeWeight& 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 `@NS_Types.PDU_SNS_ChangeWeight' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__SNS__ChangeWeight_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__ChangeWeight_decoder(OCTETSTRING& input_stream, PDU__SNS__ChangeWeight& 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 `@NS_Types.PDU_SNS_ChangeWeight' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__SNS__ChangeWeight_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 PDU__SNS__Config_encoder(const PDU__SNS__Config& 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 `@NS_Types.PDU_SNS_Config' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__SNS__Config_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Config_decoder(OCTETSTRING& input_stream, PDU__SNS__Config& 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 `@NS_Types.PDU_SNS_Config' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__SNS__Config_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 PDU__SNS__Config__Ack_encoder(const PDU__SNS__Config__Ack& 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 `@NS_Types.PDU_SNS_Config_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__SNS__Config__Ack_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Config__Ack_decoder(OCTETSTRING& input_stream, PDU__SNS__Config__Ack& 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 `@NS_Types.PDU_SNS_Config_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__SNS__Config__Ack_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 PDU__SNS__Delete_transactionID_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(PDU__SNS__Delete_transactionID_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Delete_transactionID_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(PDU__SNS__Delete_transactionID_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 PDU__SNS__Delete_encoder(const PDU__SNS__Delete& 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 `@NS_Types.PDU_SNS_Delete' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__SNS__Delete_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Delete_decoder(OCTETSTRING& input_stream, PDU__SNS__Delete& 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 `@NS_Types.PDU_SNS_Delete' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__SNS__Delete_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 PDU__SNS__Size_encoder(const PDU__SNS__Size& 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 `@NS_Types.PDU_SNS_Size' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__SNS__Size_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Size_decoder(OCTETSTRING& input_stream, PDU__SNS__Size& 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 `@NS_Types.PDU_SNS_Size' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__SNS__Size_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 PDU__SNS__Size__Ack_encoder(const PDU__SNS__Size__Ack& 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 `@NS_Types.PDU_SNS_Size_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__SNS__Size__Ack_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__SNS__Size__Ack_decoder(OCTETSTRING& input_stream, PDU__SNS__Size__Ack& 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 `@NS_Types.PDU_SNS_Size_Ack' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__SNS__Size__Ack_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 PDU__NS_encoder(const PDU__NS& 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 `@NS_Types.PDU_NS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf; input_value.encode(PDU__NS_descr_, ttcn_buf, coding_type, extra_options); ttcn_buf.get_string(output_stream); } INTEGER PDU__NS_decoder(OCTETSTRING& input_stream, PDU__NS& 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 `@NS_Types.PDU_NS' does not support %s encoding", (const char*) TTCN_Logger::end_event_log2str()); } TTCN_Buffer ttcn_buf(input_stream); output_value.decode(PDU__NS_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("NS_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "NS_Types"); General__Types::module_object.pre_init_module(); module_object.add_function("enc_PDU_NS", (genericfunc_t)&enc__PDU__NS, NULL); module_object.add_function("dec_PDU_NS", (genericfunc_t)&dec__PDU__NS, NULL); } void post_init_module() { TTCN_Location current_location("NS_Types.ttcn", 0, TTCN_Location::LOCATION_UNKNOWN, "NS_Types"); General__Types::module_object.post_init_module(); } } /* end of namespace */